cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* WARNING: static_key_slow_dec used before call to jump_label_init
@ 2015-09-24  6:57 Andrey Wagin
       [not found] ` <CANaxB-yFuS4SA2znSvcKrO9L_CbHciHYW+o9bN8sZJ8eR9FxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Wagin @ 2015-09-24  6:57 UTC (permalink / raw)
  To: LKML, cgroups-u79uwXL29TY76Z2rM5mHXA; +Cc: Tejun Heo, Li Zefan

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: WARNING: static_key_slow_dec used before call to jump_label_init
       [not found] ` <CANaxB-yFuS4SA2znSvcKrO9L_CbHciHYW+o9bN8sZJ8eR9FxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-09-24  7:10   ` Andrey Wagin
  2015-09-25 20:24   ` [PATCH cgroup/for-4.4] cgroup: fix too early usage of static_branch_disable() Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Wagin @ 2015-09-24  7:10 UTC (permalink / raw)
  To: LKML, cgroups-u79uwXL29TY76Z2rM5mHXA; +Cc: Tejun Heo, Li Zefan

2015-09-24 9:57 GMT+03:00 Andrey Wagin <avagin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> 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] 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

> [    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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH cgroup/for-4.4] cgroup: fix too early usage of static_branch_disable()
       [not found] ` <CANaxB-yFuS4SA2znSvcKrO9L_CbHciHYW+o9bN8sZJ8eR9FxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-09-24  7:10   ` Andrey Wagin
@ 2015-09-25 20:24   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2015-09-25 20:24 UTC (permalink / raw)
  To: Andrey Wagin
  Cc: LKML, cgroups-u79uwXL29TY76Z2rM5mHXA, Li Zefan,
	kernel-team-b10kYP2dOMg

49d1dc4b8179 ("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.

Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Reported-by: Andrey Wagin <avagin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Link: http://lkml.kernel.org/g/CANaxB-yFuS4SA2znSvcKrO9L_CbHciHYW+o9bN8sZJ8eR9FxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Fixes: 49d1dc4b81797f88270832b11e9f73809e7e7209
---
 kernel/cgroup.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f924158..ae23814 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-25 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24  6:57 WARNING: static_key_slow_dec used before call to jump_label_init Andrey Wagin
     [not found] ` <CANaxB-yFuS4SA2znSvcKrO9L_CbHciHYW+o9bN8sZJ8eR9FxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-24  7:10   ` Andrey Wagin
2015-09-25 20:24   ` [PATCH cgroup/for-4.4] cgroup: fix too early usage of static_branch_disable() Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).