Re: [RFC][PATCH][EXPERIMENTAL] CPU hotplug with frozen tasks

From: Pavel Machek
Date: Mon Apr 16 2007 - 03:06:25 EST


Hi!

> As I said before, we have a problem with using the CPU hotplug for suspending
> because of the notifiers that are called from within cpu_up()/cpu_down() and
> (sometimes) assume that the system is fully functional.
>
> One obvious solution of this problem would be to make the notifiers behave
> differently if tasks are frozen, but for this purpose we'd need to tell them
> that this is the case. In principle, we could do it in many different ways
> (eg. by using a global variable, with the help of suspend notifiers etc.), but
> IMO one of the cleanest methods woud be to use some special values for the
> notifications occuring while tasks are frozen (eg. CPU_DEAD_FROZEN instead of
> CPU_DEAD etc.). In that case the notifiers could react in some special ways
> to the "FROZEN" notfifications and that would allow us to simplify some code
> paths (eg. in the microcode driver).
>
> The appended patch introduces such "FROZEN" notfifications, modifies the CPU
> hotplug core to use them and updates all of the users of CPU hotplug notifiers
> to recognize them. For now, they are treated in the same way as the
> corresponding "normal" notifications, but I'm going to modify the microcode
> driver to really use them and I believe that some other subsystems can benefit
> from using them as well.
>
> The patch is totally experimental and untested, although it's been successfully
> compiled on x86_64 and it's main purpose is to show what exactly I
> mean. :-)

Looks sane to me.

> Index: linux-2.6.21-rc6/kernel/cpu.c
> ===================================================================
> --- linux-2.6.21-rc6.orig/kernel/cpu.c 2007-04-16 00:24:56.000000000 +0200
> +++ linux-2.6.21-rc6/kernel/cpu.c 2007-04-16 00:25:14.000000000 +0200
> @@ -120,11 +120,12 @@ static int take_cpu_down(void *unused)
> }
>
> /* Requires cpu_add_remove_lock to be held */
> -static int _cpu_down(unsigned int cpu)
> +static int _cpu_down(unsigned int cpu, int tasks_frozen)
> {
> int err;
> struct task_struct *p;
> cpumask_t old_allowed, tmp;
> + unsigned long mod = tasks_frozen ? 0x0008 : 0;
>

Can we get constant instead of 0x0008 here?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
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/