From: bryan.wu@canonical.com (Bryan Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] led-triggers: use atomic kzalloc during led trigger registering
Date: Thu, 8 Mar 2012 17:11:02 +0800 [thread overview]
Message-ID: <1331197863-25564-2-git-send-email-bryan.wu@canonical.com> (raw)
In-Reply-To: <1331197863-25564-1-git-send-email-bryan.wu@canonical.com>
kzalloc might cause sleep and will generate some warning detected by lockdep,
when call led_trigger_register_simple on each cpu cores in SMP. This patch fix
this.
[ 1.999938] ------------[ cut here ]------------
[ 2.004791] WARNING: at kernel/lockdep.c:2664 lockdep_trace_alloc+0xd8/0xf0()
[ 2.012298] Modules linked in:
[ 2.015563] [<c001b0cc>] (unwind_backtrace+0x0/0xf0) from [<c0052408>] (warn_slowpath_common+0x4c/0x64)
[ 2.025451] [<c0052408>] (warn_slowpath_common+0x4c/0x64) from [<c005243c>] (warn_slowpath_null+0x1c/0x24)
[ 2.035583] [<c005243c>] (warn_slowpath_null+0x1c/0x24) from [<c008be28>] (lockdep_trace_alloc+0xd8/0xf0)
[ 2.045684] [<c008be28>] (lockdep_trace_alloc+0xd8/0xf0) from [<c00feeb4>] (kmem_cache_alloc_trace+0x2c/0x148)
[ 2.056213] [<c00feeb4>] (kmem_cache_alloc_trace+0x2c/0x148) from [<c03770a0>] (led_trigger_register_simple+0x20/0x74)
[ 2.067474] [<c03770a0>] (led_trigger_register_simple+0x20/0x74) from [<c0627a30>] (ledtrig_cpu_register+0x4c/0x8c)
[ 2.078460] [<c0627a30>] (ledtrig_cpu_register+0x4c/0x8c) from [<c0094ca4>] (generic_smp_call_function_single_interrupt+0xcc/0x138)
[ 2.090911] [<c0094ca4>] (generic_smp_call_function_single_interrupt+0xcc/0x138) from [<c0008408>] (do_IPI+0xb0/0x128)
[ 2.102172] [<c0008408>] (do_IPI+0xb0/0x128) from [<c045921c>] (__irq_svc+0x3c/0x100)
[ 2.110412] Exception stack(0xc07adf70 to 0xc07adfb8)
[ 2.115722] df60: c07c80f8 0000fb45 00000000 c07c80f8
[ 2.124328] df80: c07ac000 c0837be4 c0464b64 c07c9d8c 00000000 411fc092 00000000 00000000
[ 2.132934] dfa0: c0649760 c07adfb8 c07c5c58 c0014d50 20000013 ffffffff
[ 2.139892] [<c045921c>] (__irq_svc+0x3c/0x100) from [<c0014d50>] (default_idle+0x30/0x38)
[ 2.148590] [<c0014d50>] (default_idle+0x30/0x38) from [<c0014f74>] (cpu_idle+0xb4/0xf4)
[ 2.157135] [<c0014f74>] (cpu_idle+0xb4/0xf4) from [<c0602778>] (start_kernel+0x2a8/0x2fc)
[ 2.165832] [<c0602778>] (start_kernel+0x2a8/0x2fc) from [<80008040>] (0x80008040)
[ 2.173797] ---[ end trace 97549d21d8dad3f5 ]---
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/leds/led-triggers.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 46b4c76..74d0ba7 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -255,7 +255,7 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp)
struct led_trigger *trigger;
int err;
- trigger = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+ trigger = kzalloc(sizeof(struct led_trigger), GFP_ATOMIC);
if (trigger) {
trigger->name = name;
--
1.7.9
next prev parent reply other threads:[~2012-03-08 9:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 9:11 [PATCH 1/3] led-class: change back LEDS_CLASS to tristate instead of bool Bryan Wu
2012-03-08 9:11 ` Bryan Wu [this message]
2012-03-08 9:29 ` [PATCH 2/3] led-triggers: use atomic kzalloc during led trigger registering Uwe Kleine-König
2012-03-10 11:15 ` Bryan Wu
2012-03-12 19:37 ` Linus Walleij
2012-03-13 8:50 ` Bryan Wu
2012-03-08 9:11 ` [PATCH 3/3] led-triggers: create a trigger for CPU activity Bryan Wu
2012-03-13 23:11 ` Andrew Morton
2012-03-14 9:01 ` Linus Walleij
2012-03-15 5:08 ` Bryan Wu
2012-03-11 7:45 ` [PATCH 1/3] led-class: change back LEDS_CLASS to tristate instead of bool Bryan Wu
2012-03-11 13:13 ` Richard Purdie
2012-03-12 2:32 ` Bryan Wu
2012-03-12 19:35 ` Linus Walleij
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=1331197863-25564-2-git-send-email-bryan.wu@canonical.com \
--to=bryan.wu@canonical.com \
--cc=linux-arm-kernel@lists.infradead.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).