]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.3/blk-mq-fix-uninitialized-kobject-at-cpu-hotplugging.patch
drop drm patch
[thirdparty/kernel/stable-queue.git] / releases / 3.18.3 / blk-mq-fix-uninitialized-kobject-at-cpu-hotplugging.patch
1 From 06a41a99d13d8e919e9a00a4849e6b85ae492592 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Wed, 10 Dec 2014 16:38:30 +0100
4 Subject: blk-mq: Fix uninitialized kobject at CPU hotplugging
5
6 From: Takashi Iwai <tiwai@suse.de>
7
8 commit 06a41a99d13d8e919e9a00a4849e6b85ae492592 upstream.
9
10 When a CPU is hotplugged, the current blk-mq spews a warning like:
11
12 kobject '(null)' (ffffe8ffffc8b5d8): tried to add an uninitialized object, something is seriously wrong.
13 CPU: 1 PID: 1386 Comm: systemd-udevd Not tainted 3.18.0-rc7-2.g088d59b-default #1
14 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_171129-lamiak 04/01/2014
15 0000000000000000 0000000000000002 ffffffff81605f07 ffffe8ffffc8b5d8
16 ffffffff8132c7a0 ffff88023341d370 0000000000000020 ffff8800bb05bd58
17 ffff8800bb05bd08 000000000000a0a0 000000003f441940 0000000000000007
18 Call Trace:
19 [<ffffffff81005306>] dump_trace+0x86/0x330
20 [<ffffffff81005644>] show_stack_log_lvl+0x94/0x170
21 [<ffffffff81006d21>] show_stack+0x21/0x50
22 [<ffffffff81605f07>] dump_stack+0x41/0x51
23 [<ffffffff8132c7a0>] kobject_add+0xa0/0xb0
24 [<ffffffff8130aee1>] blk_mq_register_hctx+0x91/0xb0
25 [<ffffffff8130b82e>] blk_mq_sysfs_register+0x3e/0x60
26 [<ffffffff81309298>] blk_mq_queue_reinit_notify+0xf8/0x190
27 [<ffffffff8107cfdc>] notifier_call_chain+0x4c/0x70
28 [<ffffffff8105fd23>] cpu_notify+0x23/0x50
29 [<ffffffff81060037>] _cpu_up+0x157/0x170
30 [<ffffffff810600d9>] cpu_up+0x89/0xb0
31 [<ffffffff815fa5b5>] cpu_subsys_online+0x35/0x80
32 [<ffffffff814323cd>] device_online+0x5d/0xa0
33 [<ffffffff81432485>] online_store+0x75/0x80
34 [<ffffffff81236a5a>] kernfs_fop_write+0xda/0x150
35 [<ffffffff811c5532>] vfs_write+0xb2/0x1f0
36 [<ffffffff811c5f42>] SyS_write+0x42/0xb0
37 [<ffffffff8160c4ed>] system_call_fastpath+0x16/0x1b
38 [<00007f0132fb24e0>] 0x7f0132fb24e0
39
40 This is indeed because of an uninitialized kobject for blk_mq_ctx.
41 The blk_mq_ctx kobjects are initialized in blk_mq_sysfs_init(), but it
42 goes loop over hctx_for_each_ctx(), i.e. it initializes only for
43 online CPUs. Thus, when a CPU is hotplugged, the ctx for the newly
44 onlined CPU is registered without initialization.
45
46 This patch fixes the issue by initializing the all ctx kobjects
47 belonging to each queue.
48
49 Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=908794
50 Signed-off-by: Takashi Iwai <tiwai@suse.de>
51 Signed-off-by: Jens Axboe <axboe@fb.com>
52 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
53
54 ---
55 block/blk-mq-sysfs.c | 9 ++++-----
56 1 file changed, 4 insertions(+), 5 deletions(-)
57
58 --- a/block/blk-mq-sysfs.c
59 +++ b/block/blk-mq-sysfs.c
60 @@ -390,16 +390,15 @@ static void blk_mq_sysfs_init(struct req
61 {
62 struct blk_mq_hw_ctx *hctx;
63 struct blk_mq_ctx *ctx;
64 - int i, j;
65 + int i;
66
67 kobject_init(&q->mq_kobj, &blk_mq_ktype);
68
69 - queue_for_each_hw_ctx(q, hctx, i) {
70 + queue_for_each_hw_ctx(q, hctx, i)
71 kobject_init(&hctx->kobj, &blk_mq_hw_ktype);
72
73 - hctx_for_each_ctx(hctx, ctx, j)
74 - kobject_init(&ctx->kobj, &blk_mq_ctx_ktype);
75 - }
76 + queue_for_each_ctx(q, ctx, i)
77 + kobject_init(&ctx->kobj, &blk_mq_ctx_ktype);
78 }
79
80 /* see blk_register_queue() */