Re: Dumb question: BKL on reboot ?

From: Andrea Arcangeli
Date: Thu Aug 21 2003 - 12:03:35 EST


On Thu, Aug 21, 2003 at 06:39:38PM +0200, Andrea Arcangeli wrote:
> static void do_machine_restart(void * __unused)
> {
> clear_bit(smp_processor_id(), &cpu_restart_map);
> if (smp_processor_id() == 0) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> if the `reboot` program doesn't run by luck on cpu 0, it will be the one
> that will hang instead of the others. the above check must be changed to:
>
> smp_processor_id() == reboot_cpu
>
> and you should snapshot reboot_cpu in machine_restart_smp. then it won't
> hang anymore.

this untested patch should do the trick:

--- 2.4.22pre7aa1/arch/s390x/kernel/smp.c.~1~ 2003-07-19 02:34:04.000000000 +0200
+++ 2.4.22pre7aa1/arch/s390x/kernel/smp.c 2003-08-21 18:48:05.000000000 +0200
@@ -240,11 +240,12 @@ void smp_send_stop(void)
* Reboot, halt and power_off routines for SMP.
*/
static volatile unsigned long cpu_restart_map;
+static unsigned long restart_cpu;

static void do_machine_restart(void * __unused)
{
clear_bit(smp_processor_id(), &cpu_restart_map);
- if (smp_processor_id() == 0) {
+ if (smp_processor_id() == restart_cpu) {
/* Wait for all other cpus to enter do_machine_restart. */
while (cpu_restart_map != 0);
/* Store status of other cpus. */
@@ -263,6 +264,7 @@ static void do_machine_restart(void * __

void machine_restart_smp(char * __unused)
{
+ restart_cpu = smp_processor_id();
cpu_restart_map = cpu_online_map;
smp_call_function(do_machine_restart, NULL, 0, 0);
do_machine_restart(NULL);

Andrea
-
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/