Re: [PATCH] cpu hoptlug: avoid usage of smp_processor_id() in preemptible code

From: Heiko Carstens
Date: Wed Nov 02 2005 - 02:07:59 EST


> > From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> >
> > Replace smp_processor_id() with any_online_cpu(cpu_online_map) in
> > order to avoid lots of "BUG: using smp_processor_id() in preemptible
> > [00000001] code:..." messages in case taking a cpu online fails.
>
> could you post the full message, including the stacktrace? I think this
> patch just works around the debugging message, and there might be some
> real bug to fix.
>
> Ingo

Sure, all traces start actually at the last notifier_call_chain(...) in
kernel/cpu.c. Since we hold the cpu_control semaphore it shouldn't be
any problem to access cpu_online_map.
The reason why cpu_up failed is simply that the cpu that was supposed to be
taken online wasn't even there. That is because on s390 we never know when
a new cpu comes and therefore cpu_possible_map consists of only ones and
doesn't reflect reality.

Heiko

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is migration_call+0x1c8/0x920
000000000d377928 07d9fe4c616704cc 0000000000357d22 0000000000357d22
0000000000015dc8 00000000004e3838 000000000dc6a500 000000000d9c5180
00000000004072e0 0000000000000000 000000000d377888 000000000d3778d8
000000000000000c 000000000032e040 0000000000015dc8 000000000d377888
0000000000000004 0000000000000000 000000000d3779c8 000000000d377928
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<000000000002ac48>] migration_call+0x1c8/0x920
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is cpu_callback+0x156/0x360
000000000d377980 000000000d377870 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000020000020000
00000000004072e0 0000000000000000 000000000d3778e0 000000000d377930
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778e0
0000000000000004 0000000000000000 000000000d377a20 000000000d377980
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<0000000000038a4a>] cpu_callback+0x156/0x360
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is cpu_callback+0x138/0x1c0
000000000d377988 0000000000a2f1b0 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000020000020000
00000000004072e0 0000000000000000 000000000d3778e8 000000000d377938
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778e8
0000000000000004 0000000000000000 000000000d377a28 000000000d377988
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<000000000005c00c>] cpu_callback+0x138/0x1c0
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is workqueue_cpu_callback+0x17c/0x358
000000000d377978 000000000ebb1280 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000000000000009
00000000004072e0 0000000000000000 000000000d3778d8 000000000d377928
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778d8
0000000000000004 0000000000000000 000000000d377a18 000000000d377978
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<00000000000472ac>] workqueue_cpu_callback+0x17c/0x358
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is workqueue_cpu_callback+0x17c/0x358
000000000d377978 000000000d377888 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000000000000009
00000000004072e0 0000000000000000 000000000d3778d8 000000000d377928
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778d8
0000000000000004 0000000000000000 000000000d377a18 000000000d377978
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<00000000000472ac>] workqueue_cpu_callback+0x17c/0x358
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is workqueue_cpu_callback+0x17c/0x358
000000000d377978 000000000d377888 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000000000000009
00000000004072e0 0000000000000000 000000000d3778d8 000000000d377928
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778d8
0000000000000004 0000000000000000 000000000d377a18 000000000d377978
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<00000000000472ac>] workqueue_cpu_callback+0x17c/0x358
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is workqueue_cpu_callback+0x17c/0x358
000000000d377978 000000000d377888 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000000000000009
00000000004072e0 0000000000000000 000000000d3778d8 000000000d377928
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778d8
0000000000000004 0000000000000000 000000000d377a18 000000000d377978
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<00000000000472ac>] workqueue_cpu_callback+0x17c/0x358
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24

BUG: using smp_processor_id() in preemptible [00000001] code: bash/1398
caller is workqueue_cpu_callback+0x17c/0x358
000000000d377978 000000000d377888 0000000000357d22 0000000000357d22
0000000000015dc8 000000000d374000 000000000dc6a500 0000000000000009
00000000004072e0 0000000000000000 000000000d3778d8 000000000d377928
000000000000000c 000000000032e040 0000000000015dc8 000000000d3778d8
0000000000000004 0000000000000000 000000000d377a18 000000000d377978
Call Trace:
([<0000000000015d5c>] show_trace+0xbc/0xd0)
[<0000000000149fb6>] debug_smp_processor_id+0xee/0xf4
[<00000000000472ac>] workqueue_cpu_callback+0x17c/0x358
[<0000000000043292>] notifier_call_chain+0x46/0x84
[<0000000000052c06>] cpu_up+0x16a/0x1c0
[<000000000015bc92>] store_online+0xae/0xe0
[<00000000000d3af0>] sysfs_write_file+0x150/0x1c4
[<000000000008963a>] vfs_write+0xae/0x184
[<000000000008a186>] sys_write+0x52/0x84
[<00000000000211e6>] sysc_do_restart+0x16/0x1c
[<0000020000107e24>] 0x20000107e24
-
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/