freebsd-dev/sys/powerpc/aim
Kyle Evans 589aed00e3 sched: separate out schedinit_ap()
schedinit_ap() sets up an AP for a later call to sched_throw(NULL).

Currently, ULE sets up some pcpu bits and fixes the idlethread lock with
a call to sched_throw(NULL); this results in a window where curthread is
setup in platforms' init_secondary(), but it has the wrong td_lock.
Typical platform AP startup procedure looks something like:

- Setup curthread
- ... other stuff, including cpu_initclocks_ap()
- Signal smp_started
- sched_throw(NULL) to enter the scheduler

cpu_initclocks_ap() may have callouts to process (e.g., nvme) and
attempt to sched_add() for this AP, but this attempt fails because
of the noted violated assumption leading to locking heartburn in
sched_setpreempt().

Interrupts are still disabled until cpu_throw() so we're not really at
risk of being preempted -- just let the scheduler in on it a little
earlier as part of setting up curthread.

Reviewed by:	alfredo, kib, markj
Triage help from:	andrew, markj
Smoke-tested by:	alfredo (ppc), kevans (arm64, x86), mhorne (arm)
Differential Revision:	https://reviews.freebsd.org/D32797
2021-11-03 15:54:59 -05:00
..
aim_machdep.c powerpc64: make radix with superpages default 2021-10-14 13:13:27 -03:00
locore32.S powerpc64: Add a trap stack area 2019-02-04 16:02:03 +00:00
locore64.S powerpc64: Fix boot on virtual-mode OF (PowerMac G5) 2021-02-07 16:13:55 -06:00
locore.S Add CFI start/end proc directives to arm64, i386, and ppc 2020-12-05 00:33:28 +00:00
mmu_oea64.c Convert vm_page_alloc() callers to use vm_page_alloc_noobj(). 2021-10-19 21:22:56 -04:00
mmu_oea64.h powerpc64: Split out DMAP and non-DMAP implementations of some methods 2021-05-05 20:57:33 -05:00
mmu_oea.c Clean up a couple of MD warts in vm_fault_populate(): 2021-03-30 18:15:55 -07:00
mmu_radix.c Use the vm_radix_init() helper when initializing pmaps 2021-10-19 21:22:56 -04:00
moea64_native.c powerpc64: Split out DMAP and non-DMAP implementations of some methods 2021-05-05 20:57:33 -05:00
mp_cpudep.c sched: separate out schedinit_ap() 2021-11-03 15:54:59 -05:00
slb.c Convert consumers to vm_page_alloc_noobj_contig() 2021-10-19 21:22:56 -04:00
trap_subr32.S [PowerPC] Fix AP bringup on 32-bit AIM SMP 2021-03-06 15:46:28 -06:00
trap_subr64.S powerpc64: Optimize radix trap handling a little more 2021-04-30 19:58:11 -05:00