Page MenuHomeFreeBSD

powerpc: Add a (CPU/runtime features) flags set to pcpu struct
ClosedPublic

Authored by jhibbits on May 19 2020, 12:48 AM.

Details

Summary

The point of this addition is to cache CPU behavior 'features', to avoid
having to recompute based on CPU, etc.

The first such use case is to avoid the unnecessary manipulation of the
SLBs (Segment Lookaside Buffers) when using the Radix pmap on POWER9.
Since we already get the PCPU pointer wherever we swap the SLB entries,
we can use a cached flag to check if it's necessary to perform the
operation anyway, and skip it when not.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhibbits created this revision.

Copy the pc_flags before unleashing the CPUs, instead of recomputing on each CPU.

sys/powerpc/include/pcpu.h
58 ↗(On Diff #72009)

There's a 4-byte hole after pc_ipimask, thoughts on it going there instead to save space?

sys/powerpc/include/pcpu.h
58 ↗(On Diff #72009)

Consider it done.

sys/powerpc/include/pcpu.h
58 ↗(On Diff #72009)

FWIW there's also a hole after pc_inside_intr.

There appears to be a slight bit of slop at the end currently, the __pad bits below are meant to make it exactly fit on a page but it's +24b (or +16b with pc_flags in a suboptimal place)

Move pc_flags to a better spot.

PPC64 ok (radix on superglue)
RB800 ok
X5000 ok
PPC32 ok

I am not convinced it will kick in on Radix though, I think the bit flag is wrong.

sys/powerpc/include/pcpu.h
58 ↗(On Diff #72350)

Should take this \ back out.

82 ↗(On Diff #72350)

Err, shouldn't this be 0x80000000 in BE? Or am I completely misunderstanding how mtcr works? Additionally, this should probably be specifically mentioning that it's targeting a specific CR bit.

jhibbits added inline comments.
sys/powerpc/include/pcpu.h
82 ↗(On Diff #72350)

You're absolutely right. Don't know how I didn't notice it

jhibbits marked an inline comment as done.

Fix the flag value for PC_FLAG_NOSRS.

AIM64 Radix boots ok
AIM64 HPT boots ok
RB800 boots ok
X5000 boots ok
PPC32 boots ok

Code seems fine to me.

This revision is now accepted and ready to land.Jun 5 2020, 6:15 PM