WARNING: static_key_slow_dec used before call to jump_label_init
Hello,
I booted kernel with cgroup_disable=cpu and get this warning:
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.3.0-rc2-next-20150923 no_timer_check console=ttyS0,115200n8 root=UUID=01bc7316-b1f4-45c9-a23a-0 [ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:99 static_key_slow_dec+0x44/0x60() [ 0.000000] static_key_slow_dec used before call to jump_label_init [ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.3.0-rc2-next-20150924 #1 [ 0.000000] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 0.000000] 0000000000000000 ebd8af5cfcdffb28 ffffffff81c03da8 ffffffff813b18c2 [ 0.000000] ffffffff81c03df0 ffffffff81c03de0 ffffffff8108dd52 ffffffff81c5bad0 [ 0.000000] ffff88003ffe663a ffffffff81c49a00 0000000000000001 ffff88003ffe662b [ 0.000000] Call Trace: [ 0.000000] [<ffffffff813b18c2>] dump_stack+0x44/0x62 [ 0.000000] [<ffffffff8108dd52>] warn_slowpath_common+0x82/0xc0 [ 0.000000] [<ffffffff8108ddec>] warn_slowpath_fmt+0x5c/0x80 [ 0.000000] [<ffffffff8119c054>] static_key_slow_dec+0x44/0x60 [ 0.000000] [<ffffffff81d826b6>] cgroup_disable+0xaf/0xd6 [ 0.000000] [<ffffffff81d5f9de>] unknown_bootoption+0x8c/0x194 [ 0.000000] [<ffffffff810b0c03>] parse_args+0x273/0x4a0 [ 0.000000] [<ffffffff8119d592>] ? printk+0x57/0x73 [ 0.000000] [<ffffffff81d5fd67>] start_kernel+0x205/0x4b8 [ 0.000000] [<ffffffff81d5f952>] ? set_init_arg+0x55/0x55 [ 0.000000] [<ffffffff81d5f120>] ? early_idt_handler_array+0x120/0x120 [ 0.000000] [<ffffffff81d5f315>] x86_64_start_reservations+0x2a/0x2c [ 0.000000] [<ffffffff81d5f461>] x86_64_start_kernel+0x14a/0x16d [ 0.000000] ---[ end trace 8a774ae3ff020690 ]---
Thanks,
Andrew
2015-09-24 9:57 GMT+03:00 Andrey Wagin <[email protected]>:
Quoted 7 lines
Hello,
I booted kernel with cgroup_disable=cpu and get this warning:
[ 0.000000] Kernel command line:BOOT_IMAGE=/boot/vmlinuz-4.3.0-rc2-next-20150923
no_timer_checkconsole=ttyS0,115200n8 root=UUID=01bc7316-b1f4-45c9-a23a-0
[ 0.000000] Kernel command line:
BOOT_IMAGE=/boot/vmlinuz-4.3.0-rc2-next-20150923 no_timer_check console=ttyS0,115200n8 root=UUID=01bc7316-b1f4-45c9-a23a-00c5a2336ef2 console=tty1 ro rhgb quiet LANG=en_US.UTF-8 initrd=/boot/initramfs-4.3.0-rc2-next-20150923.img debug cgroup_disable=cpu
You have new mail in /var/spool/mail/root
Quoted 33 lines
[ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:99 static_key_slow_dec+0x44/0x60() [ 0.000000] static_key_slow_dec used before call to jump_label_init [ 0.000000] Modules linked in:[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.3.0-rc2-next-20150924 #1 [ 0.000000] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 0.000000] 0000000000000000 ebd8af5cfcdffb28 ffffffff81c03da8 ffffffff813b18c2 [ 0.000000] ffffffff81c03df0 ffffffff81c03de0 ffffffff8108dd52 ffffffff81c5bad0 [ 0.000000] ffff88003ffe663a ffffffff81c49a00 0000000000000001 ffff88003ffe662b [ 0.000000] Call Trace: [ 0.000000] [<ffffffff813b18c2>] dump_stack+0x44/0x62 [ 0.000000] [<ffffffff8108dd52>] warn_slowpath_common+0x82/0xc0 [ 0.000000] [<ffffffff8108ddec>] warn_slowpath_fmt+0x5c/0x80 [ 0.000000] [<ffffffff8119c054>] static_key_slow_dec+0x44/0x60 [ 0.000000] [<ffffffff81d826b6>] cgroup_disable+0xaf/0xd6 [ 0.000000] [<ffffffff81d5f9de>] unknown_bootoption+0x8c/0x194 [ 0.000000] [<ffffffff810b0c03>] parse_args+0x273/0x4a0 [ 0.000000] [<ffffffff8119d592>] ? printk+0x57/0x73 [ 0.000000] [<ffffffff81d5fd67>] start_kernel+0x205/0x4b8 [ 0.000000] [<ffffffff81d5f952>] ? set_init_arg+0x55/0x55 [ 0.000000] [<ffffffff81d5f120>] ? early_idt_handler_array+0x120/0x120 [ 0.000000] [<ffffffff81d5f315>] x86_64_start_reservations+0x2a/0x2c [ 0.000000] [<ffffffff81d5f461>] x86_64_start_kernel+0x14a/0x16d [ 0.000000] ---[ end trace 8a774ae3ff020690 ]---Thanks,
Andrew
Tejun Heo
maintainerPATCH 1/1 cgroup: fix too early usage of static_branch_disable()
In reply to Andrey Wagin49d1dc4b8179 ("cgroup: implement static_key based cgroup_subsys_enabled() and cgroup_subsys_on_dfl()") converted cgroup enabled test to use static_key; however, cgroup_disable() is called before static_key subsystem itself is initialized and thus leads to the following warning when "cgroup_disable=" parameter is specified.
WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:99 static_key_slow_dec+0x44/0x60() static_key_slow_dec used before call to jump_label_init ... Call Trace: [<ffffffff813b18c2>] dump_stack+0x44/0x62 [<ffffffff8108dd52>] warn_slowpath_common+0x82/0xc0 [<ffffffff8108ddec>] warn_slowpath_fmt+0x5c/0x80 [<ffffffff8119c054>] static_key_slow_dec+0x44/0x60 [<ffffffff81d826b6>] cgroup_disable+0xaf/0xd6 [<ffffffff81d5f9de>] unknown_bootoption+0x8c/0x194 [<ffffffff810b0c03>] parse_args+0x273/0x4a0 [<ffffffff81d5fd67>] start_kernel+0x205/0x4b8 ...
Fix it by making cgroup_disable() to record the subsystems to disable in cgroup_disable_mask and moving the actual application to cgroup_init() which is late enough and where the enabled state is first used.
--- kernel/cgroup.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
kernel/cgroup.c +8 -6
@@ -5124,6 +5124,8 @@ int __init cgroup_init_early(void)return 0 ; } +static unsigned long cgroup_disable_mask__initdata ; +/** * cgroup_init - cgroup initialization *
@@ -5170,8 +5172,12 @@ int __init cgroup_init(void)* disabled flag and cftype registration needs kmalloc, * both of which aren't available during early_init. */ -if (!cgroup_ssid_enabled (ssid)) +if (cgroup_disable_mask & (1 << ssid)) { +static_branch_disable (cgroup_subsys_enabled_key[ssid]); +printk (KERN_INFO "Disabling %s control group subsystem\n" , + ss->name);continue ; + } cgrp_dfl_root.subsys_mask |=1 << ss->id;
@@ -5595,11 +5601,7 @@ static int __init cgroup_disable(char *str)if (strcmp (token, ss->name) &&strcmp (token, ss->legacy_name))continue ; - -static_branch_disable (cgroup_subsys_enabled_key[i]); -printk (KERN_INFO "Disabling %s control group subsystem\n" , - ss->name); -break ; + cgroup_disable_mask |=1 << i; } }return 1 ;