From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Len Brown <lenb@kernel.org>,
Francois Valenduc <francois.valenduc@tvcablenet.be>,
Lin Ming <ming.m.lin@intel.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH][RFC] acpi: Prevent scheduling while atomic warning in early boot
Date: Wed, 12 Oct 2011 14:49:02 -0400 [thread overview]
Message-ID: <1318445342.13262.54.camel@gandalf.stny.rr.com> (raw)
I hit the following bug:
[ 0.109053] ACPI: Core revision 20110623
[ 0.116130] BUG: scheduling while atomic: swapper/0/0x10000002
[ 0.120017] no locks held by swapper/0.
[ 0.124016] Modules linked in:
[ 0.128199] Pid: 0, comm: swapper Not tainted 3.1.0-rc1-test-00020-gd696b58 #5
[ 0.132016] Call Trace:
[ 0.134455] [<ffffffff83ec3be1>] __schedule_bug+0xb4/0xc0
[ 0.140038] [<ffffffff83fdc782>] schedule+0xaf/0x772
[ 0.144022] [<ffffffff810d3d63>] __cond_resched+0x2f/0x41
[ 0.148020] [<ffffffff83fdd197>] _cond_resched+0x2e/0x3e
[ 0.152022] [<ffffffff81b82bff>] acpi_ps_complete_op+0x5b5/0x5f8^M
[ 0.156021] [<ffffffff81b83a41>] acpi_ps_parse_loop+0x5e4/0x69f
[ 0.160021] [<ffffffff81b8b28c>] ? acpi_ut_exit+0x3a/0x49
[ 0.164021] [<ffffffff81b81a88>] acpi_ps_parse_aml+0x1db/0x5fb^M
[ 0.168021] [<ffffffff81b7e1a4>] acpi_ns_one_complete_parse+0x2a8/0x2fa
[ 0.172021] [<ffffffff81b7e279>] acpi_ns_parse_table+0x83/0x17a^M
[ 0.176023] [<ffffffff81b76ed8>] acpi_ns_load_table+0x104/0x234
[ 0.180022] [<ffffffff81b881b8>] acpi_tb_load_namespace+0x110/0x2a0
[ 0.184022] [<ffffffff81b88384>] acpi_load_tables+0x3c/0xa1
[ 0.188024] [<ffffffff8653c21e>] acpi_early_init+0xca/0x1a7
[ 0.192023] [<ffffffff864de1c7>] start_kernel+0x6b2/0x6ea
[ 0.196023] [<ffffffff864dd3dd>] x86_64_start_reservations+0xf5/0x100^M
[ 0.200023] [<ffffffff864dd140>] ? early_idt_handlers+0x140/0x140
[ 0.204023] [<ffffffff864dd521>] x86_64_start_kernel+0x139/0x14f
The commit 0a7992c90828a65 acpi: fix bogus preemption logic
tried again to fix the preempt logic by encapsulating the
ACPI_PREEMPTION_POINT() with a #ifndef CONFIG_PREEMPT and only testing
irqsoff. But when CONFIG_PREEMPT=n and CONFIG_DEBUG_ATOMIC_SLEEP=y, the
preempt count is still active. This code is called at boot up when
preemption is still disabled triggering the above dump.
Ideally, in_atomic() should not be used in general code, but I'm not
sure what should be used. This does silent the warning, and it should
not be an issue while it is still encapsulated in #ifndef CONFIG_PREEMPT
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f72403c..1730ff8 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -59,6 +59,7 @@
#include <linux/ctype.h>
#include <linux/sched.h>
#include <asm/system.h>
+#include <linux/hardirq.h>
#include <linux/atomic.h>
#include <asm/div64.h>
#include <asm/acpi.h>
@@ -151,10 +152,14 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
/*
* Used within ACPICA to show where it is safe to preempt execution
* when CONFIG_PREEMPT=n
+ *
+ * Note we still test for !in_atomic() in case CONFIG_DEBUG_ATOMIC_SLEEP
+ * is set. In that case, preempt_count is still updated and scheduling
+ * here will cause a warning in early boot.
*/
#define ACPI_PREEMPTION_POINT() \
do { \
- if (!irqs_disabled()) \
+ if (!irqs_disabled() && !in_atomic()) \
cond_resched(); \
} while (0)
#endif
next reply other threads:[~2011-10-12 18:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 18:49 Steven Rostedt [this message]
2011-10-12 20:07 ` Andrew Morton
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=1318445342.13262.54.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=francois.valenduc@tvcablenet.be \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®