Re: [PATCH 1/2] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable

From: Vitaly Kuznetsov
Date: Tue May 19 2015 - 11:59:34 EST


Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> On Tue, May 19, 2015 at 02:15:41PM +0200, Vitaly Kuznetsov wrote:
>> Loaded Hyper-V module will use these functions to disable CPU hotplug
>> under certain circumstances.
>
> What's wrong with get_online_cpus() ?

We need to disable cpu offlining permanently (till the module is
unloaded but this is highly unlikely). If we do get_online_cpus()
instead we get

# echo 0 > /sys/devices/system/cpu/cpu1/online
<nothing happens, pemanent hang followed by the following:>

[ 240.247109] INFO: task bash:972 blocked for more than 120 seconds.
[ 240.248937] Not tainted 4.1.0-rc3_bug1167380_test_rkr+ #602
[ 240.250515] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
disables this message.
[ 240.252379] bash D ffff880021b83c18 0 972 939
0x00000004
[ 240.255068] ffff880021b83c18 0000000000000001 0000000000000046
ffff880021b83be8
[ 240.258140] ffffffff81fdcdb0 ffff880037dbcfc0 ffff880037203bd0
ffffffff81fdcdb8
[ 240.261275] ffff880021b84000 0000000000000001 0000000000000000
0000000000000001
[ 240.264402] Call Trace:
[ 240.265423] [<ffffffff81aecf77>] schedule+0x37/0x90
[ 240.266748] [<ffffffff81081872>] cpu_hotplug_begin+0xd2/0xe0
[ 240.268210] [<ffffffff810817a5>] ? cpu_hotplug_begin+0x5/0xe0
[ 240.269675] [<ffffffff810cb860>] ? prepare_to_wait_event+0xf0/0xf0
[ 240.271285] [<ffffffff81ad561a>] _cpu_down+0x8a/0x300
[ 240.275294] [<ffffffff81ad58c6>] cpu_down+0x36/0x50
[ 240.276680] [<ffffffff8160f954>] cpu_subsys_offline+0x14/0x20
[ 240.278145] [<ffffffff8160a505>] device_offline+0xa5/0xd0
[ 240.279618] [<ffffffff8160a620>] online_store+0x50/0xa0
[ 240.280991] [<ffffffff81607678>] dev_attr_store+0x18/0x30
...

And if we do the cpu_hotplug_disable() call we get:
# echo 0 > /sys/devices/system/cpu/cpu1/online
-bash: echo: write error: Device or resource busy

This behavior is preferable.

--
Vitaly
--
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/