From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932468AbaLJQD2 (ORCPT ); Wed, 10 Dec 2014 11:03:28 -0500 Received: from cantor2.suse.de ([195.135.220.15]:44935 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932072AbaLJQD1 (ORCPT ); Wed, 10 Dec 2014 11:03:27 -0500 Date: Wed, 10 Dec 2014 17:03:25 +0100 Message-ID: From: Takashi Iwai To: Jens Axboe Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] blk-mq: Fix uninitialized kobject at CPU hotplugging In-Reply-To: <54886E41.4000407@kernel.dk> References: <1418225910-22108-1-git-send-email-tiwai@suse.de> <54886E41.4000407@kernel.dk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Wed, 10 Dec 2014 09:01:05 -0700, Jens Axboe wrote: > > On 12/10/2014 08:38 AM, Takashi Iwai wrote: > > When a CPU is hotplugged, the current blk-mq spews a warning like: > > > > kobject '(null)' (ffffe8ffffc8b5d8): tried to add an uninitialized object, something is seriously wrong. > > CPU: 1 PID: 1386 Comm: systemd-udevd Not tainted 3.18.0-rc7-2.g088d59b-default #1 > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_171129-lamiak 04/01/2014 > > 0000000000000000 0000000000000002 ffffffff81605f07 ffffe8ffffc8b5d8 > > ffffffff8132c7a0 ffff88023341d370 0000000000000020 ffff8800bb05bd58 > > ffff8800bb05bd08 000000000000a0a0 000000003f441940 0000000000000007 > > Call Trace: > > [] dump_trace+0x86/0x330 > > [] show_stack_log_lvl+0x94/0x170 > > [] show_stack+0x21/0x50 > > [] dump_stack+0x41/0x51 > > [] kobject_add+0xa0/0xb0 > > [] blk_mq_register_hctx+0x91/0xb0 > > [] blk_mq_sysfs_register+0x3e/0x60 > > [] blk_mq_queue_reinit_notify+0xf8/0x190 > > [] notifier_call_chain+0x4c/0x70 > > [] cpu_notify+0x23/0x50 > > [] _cpu_up+0x157/0x170 > > [] cpu_up+0x89/0xb0 > > [] cpu_subsys_online+0x35/0x80 > > [] device_online+0x5d/0xa0 > > [] online_store+0x75/0x80 > > [] kernfs_fop_write+0xda/0x150 > > [] vfs_write+0xb2/0x1f0 > > [] SyS_write+0x42/0xb0 > > [] system_call_fastpath+0x16/0x1b > > [<00007f0132fb24e0>] 0x7f0132fb24e0 > > > > This is indeed because of an uninitialized kobject for blk_mq_ctx. > > The blk_mq_ctx kobjects are initialized in blk_mq_sysfs_init(), but it > > goes loop over hctx_for_each_ctx(), i.e. it initializes only for > > online CPUs. Thus, when a CPU is hotplugged, the ctx for the newly > > onlined CPU is registered without initialization. > > > > This patch fixes the issue by initializing the all ctx kobjects > > belonging to each queue. > > Thanks, this looks good. I wonder why I haven't hit this yet. Maybe you did test CPU hot removal before adding? Takashi