Re: [PATCH] kernel/watchdog.c : fix smp_processor_id() warning
From: Don Zickus
Date: Thu Jul 26 2012 - 15:43:24 EST
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] [<c001558c>] (unwind_backtrace+0x0/0x11c) from [<c0296874>] (debug_smp_processor_id+0xbc/0xf0)
> [ 168.259521] [<c0296874>] (debug_smp_processor_id+0xbc/0xf0) from [<c0090114>] (lockup_detector_bootcpu_res
> ume+0x8/0x48)
> [ 168.259552] [<c0090114>] (lockup_detector_bootcpu_resume+0x8/0x48) from [<c006facc>] (suspend_devices_and_
> enter+0x1f8/0x358)
> [ 168.259552] [<c006facc>] (suspend_devices_and_enter+0x1f8/0x358) from [<c006fd68>] (pm_suspend+0x13c/0x204
> )
> [ 168.259582] [<c006fd68>] (pm_suspend+0x13c/0x204) from [<c006f0d0>] (state_store+0xb0/0xd4)
> [ 168.259582] [<c006f0d0>] (state_store+0xb0/0xd4) from [<c028a3d8>] (kobj_attr_store+0x14/0x20)
> [ 168.259613] [<c028a3d8>] (kobj_attr_store+0x14/0x20) from [<c014d344>] (sysfs_write_file+0x10c/0x140)
> [ 168.259643] [<c014d344>] (sysfs_write_file+0x10c/0x140) from [<c00f5a88>] (vfs_write+0xb0/0x138)
> [ 168.259643] [<c00f5a88>] (vfs_write+0xb0/0x138) from [<c00f5ce8>] (sys_write+0x3c/0x68)
> [ 168.259674] [<c00f5ce8>] (sys_write+0x3c/0x68) from [<c000e020>] (ret_fast_syscall+0x0/0x48)
> [ 168.260375] Enabling non-boot CPUs ...
>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxxxxx>
> ---
> 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/