Page MenuHomeFreeBSD

Implement get_pcpu() for i386
ClosedPublic

Authored by jah on Jan 29 2017, 3:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 29 2023, 5:15 PM
Unknown Object (File)
Dec 20 2023, 12:32 AM
Unknown Object (File)
Nov 25 2023, 6:34 AM
Unknown Object (File)
Nov 24 2023, 8:46 AM
Unknown Object (File)
Nov 21 2023, 8:40 AM
Unknown Object (File)
Nov 12 2023, 2:02 PM
Unknown Object (File)
Nov 12 2023, 9:25 AM
Unknown Object (File)
Nov 12 2023, 6:02 AM
Subscribers

Details

Summary

get_pcpu() already exists for arm/arm64/risc-v
as a more direct alternative to pcpu_find(curcpu).
The curcpu macro already loads the per-cpu data
pointer as its first step, so the following steps
of loading the cpuid field and using that to index
the per-cpu data array via pcpu_find() are circular.

Replace pcpu_find(curcpu) with get_pcpu() in i386
pmap. My plan is to implement get_pcpu() for the
remaining architectures and use it to replace
instances of pcpu_find(curcpu) in MI code.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7074
Build 7253: arc lint + arc unit

Event Timeline

jah retitled this revision from to Implement get_pcpu() for i386.
jah updated this object.
jah edited the test plan for this revision. (Show Details)

Overall, it looks good.

sys/i386/i386/pmap.c
4209

There seems to be a stray space after the ';' in each such line.

sys/i386/include/pcpu.h
79

Use <tab> after #define.

200

Why is this not

static inline struct pcpu *
get_pcpu(void)
{}

?

sys/i386/include/pcpu.h
200

struct pcpu isn't a complete type at the point the MD pcpu.h is included, so offsetof(pc_prvspace) doesn't work in an inline function. That's why the subsequent inline functions curthread and curpcb use hardcoded offsets OFFSETOF_CURTHREAD and OFFSETOF_CURPCB. I'd rather not do that in case the struct layout changes.

jah edited edge metadata.

Whitespace fixes

kib edited edge metadata.
This revision is now accepted and ready to land.Jan 29 2017, 4:31 PM
This revision was automatically updated to reflect the committed changes.