Re: [PATCH -mm][resend] Disable CPU hotplug during suspend

From: Nathan Lynch
Date: Sat Jul 29 2006 - 17:39:29 EST


Rafael J. Wysocki wrote:
> On Saturday 29 July 2006 00:40, Nathan Lynch wrote:
>
> > But maybe I'm misunderstanding the motivation for using cpu 0 here. I
> > had assumed it was because on i386 (and others?) the BSP can't be
> > offlined. Is there some other reason?
>
> Yes.
>
> First, the arch-dependent suspend code assumes implicitly that it will be
> running on the BSP, so some strange things may happen if it doesn't.
>
> Second, we have to make sure that this function will always leaves the
> same CPU online. It's a bit difficult to explain, but I'll do my best.
> Suppose that disable_nonboot_cpus() exits running on CPU1, assuming it's
> possible. Then the system memory state saved in the suspend image will
> reflect this situation. Now the resume code will almost certainly run on the
> BSP (say it's CPU0), but when the system memory is restored from the suspend
> image the kernel will think it's running on CPU1.
>
> In the last patch I send yesterday I made disable_nonboot_cpus() check if the
> first present CPU, first_cpu(cpu_present_map), is online, try to bring it up
> if not and migrate itself to it before the loop over all online CPUs is run.
>
> I think that's general enough.

I see, thanks for the explanation.

It doesn't look like SMP swsusp would work reliably on platforms where
there's a possibility of the cpu maps in the resume and saved images
not matching (e.g. ppc64 logical partitions, where cpu 0 could be
removed before suspending). But I guess that's largely a theoretical
concern at this time. ;)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/