From: Hannes Reinecke <Hannes.Reinecke@suse.de>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Dumb question: BKL on reboot ?
Date: Wed, 20 Aug 2003 13:51:47 +0200 [thread overview]
Message-ID: <3F4360D3.8070004@suse.de> (raw)
In-Reply-To: <p73wud861tg.fsf@oldwotan.suse.de>
Andi Kleen wrote:
> Hannes Reinecke <Hannes.Reinecke@suse.de> writes:
>
>
>>I've got a dumb question: Why is the BKL held on entering sys_reboot()
>>in kernel/sys.c:405 ?
>
>
> Interesting. I have a few SMP deadlocks on x86-64 in reboot too
> and it's possible that it is the same problem.
>
> I would hold it during exection of the notifiers, but drop
> it before calling into machine_*
>
Indeed. Works on s390 and survived several reboots (test still
continuing). I moved lock_kernel() into the sections that actually _do_
something; looks much cleaner IMHO.
THX for your help.
Is it worth to try to push it into mainstream kernel?
Cheers,
Hannes
--
--- linux-2.4.21/kernel/sys.c.orig 2003-08-20 10:52:39.000000000 +0200
+++ linux-2.4.21/kernel/sys.c 2003-08-20 10:52:39.000000000 +0200
@@ -340,11 +340,12 @@
magic2 != LINUX_REBOOT_MAGIC2B))
return -EINVAL;
- lock_kernel();
switch (cmd) {
case LINUX_REBOOT_CMD_RESTART:
+ lock_kernel();
notifier_call_chain(&reboot_notifier_list, SYS_RESTART,
NULL);
printk(KERN_EMERG "Restarting system.\n");
+ unlock_kernel();
machine_restart(NULL);
break;
@@ -357,20 +358,25 @@
break;
case LINUX_REBOOT_CMD_HALT:
+ lock_kernel();
notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
printk(KERN_EMERG "System halted.\n");
+ unlock_kernel();
machine_halt();
do_exit(0);
break;
case LINUX_REBOOT_CMD_POWER_OFF:
+ lock_kernel();
notifier_call_chain(&reboot_notifier_list,
SYS_POWER_OFF, NULL);
printk(KERN_EMERG "Power down.\n");
+ unlock_kernel();
machine_power_off();
do_exit(0);
break;
case LINUX_REBOOT_CMD_RESTART2:
+ lock_kernel();
if (strncpy_from_user(&buffer[0], (char *)arg,
sizeof(buffer) -
1) < 0) {
unlock_kernel();
return -EFAULT;
@@ -379,14 +385,13 @@
notifier_call_chain(&reboot_notifier_list, SYS_RESTART,
buffer);
printk(KERN_EMERG "Restarting system with command
'%s'.\n", buff
er);
+ unlock_kernel();
machine_restart(buffer);
break;
default:
- unlock_kernel();
return -EINVAL;
}
- unlock_kernel();
return 0;
}
next prev parent reply other threads:[~2003-08-20 11:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3F434BD1.9050704@suse.de.suse.lists.linux.kernel>
2003-08-20 10:49 ` Dumb question: BKL on reboot ? Andi Kleen
2003-08-20 11:51 ` Hannes Reinecke [this message]
2003-08-20 12:03 ` Andi Kleen
2003-08-20 10:22 Hannes Reinecke
2003-08-20 18:29 ` Andrew Morton
2003-08-20 18:35 ` David S. Miller
2003-08-20 20:23 ` Dave Hansen
2003-08-21 8:05 ` Hannes Reinecke
2003-08-21 15:41 ` Andrea Arcangeli
2003-08-21 15:55 ` Hannes Reinecke
2003-08-21 16:39 ` Andrea Arcangeli
2003-08-21 16:58 ` Andrea Arcangeli
2003-08-22 6:39 ` Hannes Reinecke
2003-08-22 13:57 ` Andrea Arcangeli
2003-08-24 21:43 ` Andrea Arcangeli
2003-08-21 15:33 ` Andrea Arcangeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F4360D3.8070004@suse.de \
--to=hannes.reinecke@suse.de \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).