> Date: Tue, 3 May 2016 15:39:51 +0200 > From: Martin Pieuchot <[email protected]> > > On 03/05/16(Tue) 13:41, Mark Kettenis wrote: > > > Date: Tue, 3 May 2016 12:17:03 +0200 (CEST) > > > From: Mark Kettenis <[email protected]> > > > > > > > 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. > > > > Oh, I only tested this on sparc64. Probably should get tested on some > > i386/amd64 laptops as well to see if they still suspend/resume. > > This doesn't boot on amd64 because sched_init_cpu() is called before > cpu_configure() could run, which means that the CPUF_PRIMARY flag is > not set. > > What about calling sched_init_cpu() inside sched_start_secondary_cpus() > so that MD code does not need to call it?
Then you have the exact same problem back as your initial diff since sched_start_secondary_cpus() gets called in the resume path as well ;). I think the answer is that we should set CPUF_PRIMARY earlier. In fact we can set it in the initializer of cpu_info_primary. I'll need to check i386 as well.
