> Date: Tue, 3 May 2016 01:57:53 -0700
> From: Mike Larkin <[email protected]>
>
> On Tue, May 03, 2016 at 03:59:33PM +0800, Ray Lai wrote:
> > This commit broke resume on my x200:
> >
> > https://marc.info/?l=openbsd-cvs&m=146194866402207&w=2
> >
> > > CVSROOT: /cvs
> > > Module name: src
> > > Changes by: [email protected] 2016/04/29 10:49:53
> > >
> > > Modified files:
> > > sys/arch/amd64/amd64: cpu.c
> > > sys/arch/i386/i386: cpu.c
> > > sys/arch/sparc64/sparc64: cpu.c
> > >
> > > Log message:
> > > Call sched_init_cpu() just before booting secondary CPUs.
> > >
> > > This prevent the scheduler from scheduling tasks to CPUs not beeing able
> > > to execute them during the boot process.
> > >
> > > ok visa@, kettenis@
> >
>
> Thank you for identifying the commit. As subsequently reported,
> kettenis has temporarily reverted this until we can find a better way.
I think this is a better way to fix things.
Index: sys/kern/kern_sched.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_sched.c,v
retrieving revision 1.42
diff -u -p -r1.42 kern_sched.c
--- sys/kern/kern_sched.c 17 Mar 2016 13:18:47 -0000 1.42
+++ sys/kern/kern_sched.c 3 May 2016 10:14:52 -0000
@@ -97,7 +97,13 @@ sched_init_cpu(struct cpu_info *ci)
* structures.
*/
cpuset_init_cpu(ci);
- cpuset_add(&sched_all_cpus, ci);
+
+ /*
+ * Delay scheduling processes onto the secondary CPUs until
+ * they're actually running.
+ */
+ if (CPU_IS_PRIMARY(ci))
+ cpuset_add(&sched_all_cpus, ci);
}
void
Index: sys/kern/init_main.c
===================================================================
RCS file: /cvs/src/sys/kern/init_main.c,v
retrieving revision 1.249
diff -u -p -r1.249 init_main.c
--- sys/kern/init_main.c 19 Mar 2016 12:04:15 -0000 1.249
+++ sys/kern/init_main.c 3 May 2016 10:14:52 -0000
@@ -534,6 +534,7 @@ main(void *framep)
#if defined(MULTIPROCESSOR)
/* Boot the secondary processors. */
cpu_boot_secondary_processors();
+ sched_start_secondary_cpus();
#endif
config_process_deferred_mountroot();