public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Dave Jones <davej@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>, LKML <linux-kernel@vger.kernel.org>
Subject: [BUGFIX] cpufreq: dont BUG_ON uninitialized policy cpu
Date: Wed, 13 Jan 2010 13:14:38 +0800	[thread overview]
Message-ID: <20100113051438.GA32519@localhost> (raw)

Remove a BUG_ON which is always triggered here after commit 0b19a310eebb93:

[    6.879063] kernel BUG at drivers/cpufreq/cpufreq.c:88!
[    6.879381] invalid opcode: 0000 [#1] SMP
[    6.879711] last sysfs file:
[    6.879918] CPU 3
[    6.880114] Pid: 1, comm: swapper Not tainted 2.6.33-rc3-next-20100112 #51 DX58SO/
[    6.880611] RIP: 0010:[<ffffffff81577729>]  [<ffffffff81577729>] lock_policy_rwsem_write+0x69/0x90
...
[    6.885630] Process swapper (pid: 1, threadinfo ffff8800bbbdc000, task ffff8800bbbe0000)
...
[    6.888135] Call Trace:
[    6.888318]  [<ffffffff8157851a>] cpufreq_update_policy+0x2a/0x110
...
[    6.892586]  [<ffffffff81c981e6>] cpufreq_stats_init+0x83/0xb5

CC: Thomas Renninger <trenn@suse.de>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 drivers/cpufreq/cpufreq.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-mm.orig/drivers/cpufreq/cpufreq.c	2010-01-13 13:06:03.000000000 +0800
+++ linux-mm/drivers/cpufreq/cpufreq.c	2010-01-13 13:06:57.000000000 +0800
@@ -72,7 +72,8 @@ int lock_policy_rwsem_##mode						\
 (int cpu)								\
 {									\
 	int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);		\
-	BUG_ON(policy_cpu == -1);					\
+	if (policy_cpu == -1)						\
+		return -1;						\
 	down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu));		\
 	if (unlikely(!cpu_online(cpu))) {				\
 		up_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu));	\

             reply	other threads:[~2010-01-13  5:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13  5:14 Wu Fengguang [this message]
2010-01-13  6:32 ` [BUGFIX] cpufreq: dont BUG_ON uninitialized policy cpu Dave Jones
2010-01-13 12:42 ` Thomas Renninger
2010-01-13 12:48   ` Wu Fengguang
2010-01-13 15:59   ` Dave Jones
2010-01-14  2:42     ` Wu Fengguang

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=20100113051438.GA32519@localhost \
    --to=fengguang.wu@intel.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trenn@suse.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