From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753204Ab2GZTnb (ORCPT ); Thu, 26 Jul 2012 15:43:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639Ab2GZTna (ORCPT ); Thu, 26 Jul 2012 15:43:30 -0400 Date: Thu, 26 Jul 2012 15:43:24 -0400 From: Don Zickus To: Ming Lei Cc: Sameer Nanda , Andrew Morton , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel/watchdog.c : fix smp_processor_id() warning Message-ID: <20120726194324.GG5637@redhat.com> References: <1343191185-7746-1-git-send-email-ming.lei@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1343191185-7746-1-git-send-email-ming.lei@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 25, 2012 at 12:39:45PM +0800, Ming Lei wrote: > Use raw_smp_processor_id in lockup_detector_bootcpu_resume() > because it is enough when non-boot CPUs are offline. > > This patch fixes the following warning when DEBUG_PREEMPT > is enabled. Is this patched on top of linux-next? It seems right based on the code usage. Though it makes me sad the resume code has to hack into the cpu notifiers like that. Cheers, Don > > [ 168.259429] BUG: using smp_processor_id() in preemptible [00000000] code: pm/1577 > [ 168.259460] caller is lockup_detector_bootcpu_resume+0x8/0x48 > [ 168.259490] [] (unwind_backtrace+0x0/0x11c) from [] (debug_smp_processor_id+0xbc/0xf0) > [ 168.259521] [] (debug_smp_processor_id+0xbc/0xf0) from [] (lockup_detector_bootcpu_res > ume+0x8/0x48) > [ 168.259552] [] (lockup_detector_bootcpu_resume+0x8/0x48) from [] (suspend_devices_and_ > enter+0x1f8/0x358) > [ 168.259552] [] (suspend_devices_and_enter+0x1f8/0x358) from [] (pm_suspend+0x13c/0x204 > ) > [ 168.259582] [] (pm_suspend+0x13c/0x204) from [] (state_store+0xb0/0xd4) > [ 168.259582] [] (state_store+0xb0/0xd4) from [] (kobj_attr_store+0x14/0x20) > [ 168.259613] [] (kobj_attr_store+0x14/0x20) from [] (sysfs_write_file+0x10c/0x140) > [ 168.259643] [] (sysfs_write_file+0x10c/0x140) from [] (vfs_write+0xb0/0x138) > [ 168.259643] [] (vfs_write+0xb0/0x138) from [] (sys_write+0x3c/0x68) > [ 168.259674] [] (sys_write+0x3c/0x68) from [] (ret_fast_syscall+0x0/0x48) > [ 168.260375] Enabling non-boot CPUs ... > > Signed-off-by: Ming Lei > --- > kernel/watchdog.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index 69add8a..7ddb11b 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -623,7 +623,7 @@ static struct notifier_block cpu_nfb = { > */ > void lockup_detector_bootcpu_resume(void) > { > - void *cpu = (void *)(long)smp_processor_id(); > + void *cpu = (void *)(long)raw_smp_processor_id(); > > cpu_callback(&cpu_nfb, CPU_DEAD_FROZEN, cpu); > cpu_callback(&cpu_nfb, CPU_UP_PREPARE_FROZEN, cpu); > -- > 1.7.9.5 >