Page MenuHomeFreeBSD

powerpc: add a best-effort SMP time base sync for G5's that need it
Needs ReviewPublic

Authored by adrian on Thu, Jan 22, 5:27 AM.
Referenced Files
F142945461: D54821.diff
Sat, Jan 24, 9:15 PM
F142941931: D54821.id170321.diff
Sat, Jan 24, 8:41 PM
Unknown Object (File)
Sat, Jan 24, 1:51 PM
Unknown Object (File)
Thu, Jan 22, 8:01 PM
Unknown Object (File)
Thu, Jan 22, 7:05 PM
Unknown Object (File)
Thu, Jan 22, 5:27 PM
Unknown Object (File)
Thu, Jan 22, 3:58 PM
Unknown Object (File)
Thu, Jan 22, 3:12 PM

Details

Reviewers
jhibbits
Group Reviewers
PowerPC
Summary

There's no timebase freeze platform routine registered on my dual 2.3GHz
G5 PPC970FX Apple PowerMac.

For platforms without an explicit timebase freeze/unfreeze, we'll have to
make do with what we have - which for now is an explicit hand-crafted
spinlock/rendezvous method.

  • For existing platforms, they'll still continue to clock freeze / rendezvous; albeit with some stronger atomic bits now (from jhibbits@.)
  • Instead of the fallback being "no timesync", implement a best-effort one which does a similar rendezvous barrier between BSP and APs, but instead of freeze/unfreeze the first instruction after the CPUs all register they're ready is to set the timebase.

This has resulted in many reboots of my Powermac G5 dual-socket device
correctly starting and running in SMP mode.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70052
Build 66935: arc lint + arc unit

Event Timeline

sys/powerpc/powermac/platform_powermac.c
415

Instead of cloning the powerpc_smp_timebase_sync() function into an identical fallback, why not just get rid of the dummy_timebase() check, and let it go as-is? The code looks otherwise identical.

sys/powerpc/powermac/platform_powermac.c
415

They're almost but not quite the same:

  • the freeze version starts timebase sync between CPUs, freezes the timebase clock, sets the timebase on all APs, rendezvous them all, then unpauses
  • the best effort version starts timebase sync between CPUs, rendezvous them all, then sets the timebases on all APs immediately after the rendezvous finishes

I didn't want to make the one timebase sync function more complicated in case it broke /other/ platforms in doing so. I'd be much happier to combine them together if I had example SMP G4/G5 hardware to test the various code paths but unfortunately I don't, and the QEMU emulation for the old/new era powermacs doesn't currently implement SMP.

sys/powerpc/powermac/platform_powermac.c
481

Do something about these printfs, I don't think users want to see them every boot. A few options I can think of:

  • Get rid of them
  • bootverbose them
  • KTR them