From patchwork Tue Oct 30 02:25:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junichi Nomura X-Patchwork-Id: 1668231 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id B40223FDDA for ; Tue, 30 Oct 2012 02:32:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9U2SlTO025391; Mon, 29 Oct 2012 22:28:50 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9U2SiR2022841 for ; Mon, 29 Oct 2012 22:28:44 -0400 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9U2SbcV027845; Mon, 29 Oct 2012 22:28:38 -0400 Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [210.143.35.51]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9U2SZpo017238; Mon, 29 Oct 2012 22:28:36 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id q9U2QGn4011558; Tue, 30 Oct 2012 11:26:16 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id q9U2QGt12637; Tue, 30 Oct 2012 11:26:16 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id q9U2QFID021882; Tue, 30 Oct 2012 11:26:15 +0900 (JST) Received: from kogoro.jp.nec.com ([10.26.220.12] [10.26.220.12]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-2257456; Tue, 30 Oct 2012 11:25:48 +0900 Received: from xzibit.linux.bs1.fc.nec.co.jp ([10.34.125.175] [10.34.125.175]) by mail.jp.nec.com with ESMTPA id BT-MMP-24347; Tue, 30 Oct 2012 11:25:47 +0900 Message-ID: <508F3AAB.6060204@ce.jp.nec.com> Date: Tue, 30 Oct 2012 11:25:47 +0900 From: "Jun'ichi Nomura" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Vivek Goyal References: <50890937.7010809@ce.jp.nec.com> <20121026202105.GF24687@redhat.com> <508E572C.6000707@ce.jp.nec.com> <20121029163845.GB7709@redhat.com> <1351529115.24721.40.camel@twins> <20121029171346.GC3308@redhat.com> In-Reply-To: <20121029171346.GC3308@redhat.com> X-RedHat-Spam-Score: -4.202 (BAYES_00, RCVD_IN_DNSWL_MED, SPF_HELO_PASS, SPF_PASS) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Peter Zijlstra , "linux-kernel@vger.kernel.org" , device-mapper development , Tejun Heo , "Paul E. McKenney" , Alasdair G Kergon Subject: [dm-devel] [PATCH] blkcg: fix "scheduling while atomic" in blk_queue_bypass_start X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com On 10/30/12 02:13, Vivek Goyal wrote: > On Mon, Oct 29, 2012 at 05:45:15PM +0100, Peter Zijlstra wrote: >> int radix_tree_preload(gfp_t gfp_mask) >> { >> struct radix_tree_preload *rtp; >> struct radix_tree_node *node; >> int ret = -ENOMEM; >> >> preempt_disable(); >> >> >> Seems obvious why it explodes.. > > Oh right. Thanks Peter. So just calling blk_queue_bypass_start() before > radix_tree_preload() should fix it. Junichi, can you please give it > a try. Thank you! It just works. This is a revised patch. With 749fefe677 ("block: lift the initial queue bypass mode on blk_register_queue() instead of blk_init_allocated_queue()"), the following warning appears when multipath is used with CONFIG_PREEMPT=y. This patch moves blk_queue_bypass_start() before radix_tree_preload() to avoid the sleeping call while preemption is disabled. BUG: scheduling while atomic: multipath/2460/0x00000002 1 lock held by multipath/2460: #0: (&md->type_lock){......}, at: [] dm_lock_md_type+0x17/0x19 [dm_mod] Modules linked in: ... Pid: 2460, comm: multipath Tainted: G W 3.7.0-rc2 #1 Call Trace: [] __schedule_bug+0x6a/0x78 [] __schedule+0xb4/0x5e0 [] schedule+0x64/0x66 [] schedule_timeout+0x39/0xf8 [] ? put_lock_stats+0xe/0x29 [] ? lock_release_holdtime+0xb6/0xbb [] wait_for_common+0x9d/0xee [] ? try_to_wake_up+0x206/0x206 [] ? kfree_call_rcu+0x1c/0x1c [] wait_for_completion+0x1d/0x1f [] wait_rcu_gp+0x5d/0x7a [] ? wait_rcu_gp+0x7a/0x7a [] ? complete+0x21/0x53 [] synchronize_rcu+0x1e/0x20 [] blk_queue_bypass_start+0x5d/0x62 [] blkcg_activate_policy+0x73/0x270 [] ? kmem_cache_alloc_node_trace+0xc7/0x108 [] cfq_init_queue+0x80/0x28e [] ? dm_blk_ioctl+0xa7/0xa7 [dm_mod] [] elevator_init+0xe1/0x115 [] ? blk_queue_make_request+0x54/0x59 [] blk_init_allocated_queue+0x8c/0x9e [] dm_setup_md_queue+0x36/0xaa [dm_mod] [] table_load+0x1bd/0x2c8 [dm_mod] [] ctl_ioctl+0x1d6/0x236 [dm_mod] [] ? table_clear+0xaa/0xaa [dm_mod] [] dm_ctl_ioctl+0x13/0x17 [dm_mod] [] do_vfs_ioctl+0x3fb/0x441 [] ? file_has_perm+0x8a/0x99 [] sys_ioctl+0x5e/0x82 [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] system_call_fastpath+0x16/0x1b Signed-off-by: Jun'ichi Nomura Cc: Vivek Goyal Cc: Tejun Heo Cc: Jens Axboe Cc: Alasdair G Kergon Acked-by: Vivek Goyal --- block/blk-cgroup.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index d0b7703..954f4be 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -791,10 +791,10 @@ int blkcg_activate_policy(struct request_queue *q, if (!blkg) return -ENOMEM; - preloaded = !radix_tree_preload(GFP_KERNEL); - blk_queue_bypass_start(q); + preloaded = !radix_tree_preload(GFP_KERNEL); + /* make sure the root blkg exists and count the existing blkgs */ spin_lock_irq(q->queue_lock);