svn commit: r357171 - stable/12/sys/x86/x86

Konstantin Belousov kib at FreeBSD.org
Mon Jan 27 13:12:41 UTC 2020


Author: kib
Date: Mon Jan 27 13:12:40 2020
New Revision: 357171
URL: https://svnweb.freebsd.org/changeset/base/357171

Log:
  MFC r356919,r357054:
  x86: Wait for curpcb to be set up as an indicator that the boot stack
  is no longer used.

Modified:
  stable/12/sys/x86/x86/mp_x86.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/x86/x86/mp_x86.c
==============================================================================
--- stable/12/sys/x86/x86/mp_x86.c	Mon Jan 27 12:02:47 2020	(r357170)
+++ stable/12/sys/x86/x86/mp_x86.c	Mon Jan 27 13:12:40 2020	(r357171)
@@ -1074,6 +1074,11 @@ init_secondary_tail(void)
 	cpu_initclocks_ap();
 #endif
 
+	/*
+	 * Assert that smp_after_idle_runnable condition is reasonable.
+	 */
+	MPASS(PCPU_GET(curpcb) == NULL);
+
 	sched_throw(NULL);
 
 	panic("scheduler returned us to %s", __func__);
@@ -1083,13 +1088,12 @@ init_secondary_tail(void)
 static void
 smp_after_idle_runnable(void *arg __unused)
 {
-	struct thread *idle_td;
+	struct pcpu *pc;
 	int cpu;
 
 	for (cpu = 1; cpu < mp_ncpus; cpu++) {
-		idle_td = pcpu_find(cpu)->pc_idlethread;
-		while (idle_td->td_lastcpu == NOCPU &&
-		    idle_td->td_oncpu == NOCPU)
+		pc = pcpu_find(cpu);
+		while (atomic_load_ptr(&pc->pc_curpcb) == (uintptr_t)NULL)
 			cpu_spinwait();
 		kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages *
 		    PAGE_SIZE);


More information about the svn-src-all mailing list