Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757153Ab0D1VhL (ORCPT ); Wed, 28 Apr 2010 17:37:11 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:36660 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754307Ab0D1VhJ (ORCPT ); Wed, 28 Apr 2010 17:37:09 -0400 Date: Wed, 28 Apr 2010 14:37:05 -0700 From: "Paul E. McKenney" To: Miles Lane Cc: Vivek Goyal , Eric Paris , Lai Jiangshan , Ingo Molnar , Peter Zijlstra , LKML , nauman@google.com, eric.dumazet@gmail.com, netdev@vger.kernel.org, Jens Axboe , Gui Jianfeng , Li Zefan , Johannes Berg Subject: Re: [PATCH] RCU: don't turn off lockdep when find suspicious rcu_dereference_check() usage Message-ID: <20100428213705.GW2540@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20100420135227.GC2628@linux.vnet.ibm.com> <20100421213543.GO2563@linux.vnet.ibm.com> <20100422145640.GB3228@redhat.com> <20100422160144.GC2524@linux.vnet.ibm.com> <20100423194255.GE2589@linux.vnet.ibm.com> <20100425023455.GM2440@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6463 Lines: 137 On Wed, Apr 28, 2010 at 04:58:54PM -0400, Miles Lane wrote: > On Sat, Apr 24, 2010 at 10:34 PM, Paul E. McKenney < > paulmck@linux.vnet.ibm.com> wrote: > On Fri, Apr 23, 2010 at 06:59:12PM -0400, Miles Lane wrote: [ . . . ] > > commit 0868dd631def762ba00c2f0f397a53c5cdf24ae2 > > Author: Paul E. McKenney > > Date: Sat Apr 24 19:23:30 2010 -0700 > > > > block-cgroup: fix RCU-lockdep splat in blkiocg_add_blkio_group() > > > > It is necessary to be in an RCU read-side critical section when invoking > > css_id(), so this patch adds one to blkiocg_add_blkio_group(). This is > > actually a false positive, because this is called at initialization > > time, > > and hence always refers to the root cgroup, which cannot go away. > > > > Located-by: Miles Lane > > Suggested-by: Vivek Goyal > > Signed-off-by: Paul E. McKenney > > > > diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c > > index 5fe03de..55c8c73 100644 > > --- a/block/blk-cgroup.c > > +++ b/block/blk-cgroup.c > > @@ -71,7 +71,9 @@ void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, > > > > spin_lock_irqsave(&blkcg->lock, flags); > > rcu_assign_pointer(blkg->key, key); > > + rcu_read_lock(); > > blkg->blkcg_id = css_id(&blkcg->css); > > + rcu_read_unlock(); > > hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list); > > spin_unlock_irqrestore(&blkcg->lock, flags); > > #ifdef CONFIG_DEBUG_BLK_CGROUP > > > > Hi Paul, > Did this patch make it into your patch set? Has your patch set gone into > the Linus tree? > I just tested 2.6.34-rc5-git8 and hit one of the issues again. I think this > patch is intended to correct this issue? I replaced the above with an improved patch from Vivek Goyal, which has not yet reached mainline. I will resend my patch stack. Thanx, Paul > [ 2.289598] [ INFO: suspicious rcu_dereference_check() usage. ] > [ 2.289604] --------------------------------------------------- > [ 2.289610] kernel/cgroup.c:4438 invoked rcu_dereference_check() without > protection! > [ 2.289615] > [ 2.289617] other info that might help us debug this: > [ 2.289619] > [ 2.289624] > [ 2.289626] rcu_scheduler_active = 1, debug_locks = 1 > [ 2.289632] 2 locks held by async/1/575: > [ 2.289637] #0: (&shost->scan_mutex){+.+.+.}, at: [] > __scsi_add_device+0x5b/0xab > [ 2.289660] #1: (&(&blkcg->lock)->rlock){......}, at: [] > blkiocg_add_blkio_group+0x1a/0x73 > [ 2.289678] > [ 2.289680] stack backtrace: > [ 2.289688] Pid: 575, comm: async/1 Not tainted 2.6.34-rc5-git8 #17 > [ 2.289693] Call Trace: > [ 2.289704] [] ? printk+0xf/0x14 > [ 2.289715] [] lockdep_rcu_dereference+0x74/0x7d > [ 2.289725] [] css_id+0x37/0x46 > [ 2.289734] [] blkiocg_add_blkio_group+0x2b/0x73 > [ 2.289744] [] cfq_init_queue+0xd6/0x2a3 > [ 2.289755] [] ? scsi_request_fn+0x0/0x3ea > [ 2.289764] [] elevator_init+0xa1/0xd5 > [ 2.289774] [] blk_init_queue_node+0x103/0x109 > [ 2.289783] [] blk_init_queue+0xb/0xd > [ 2.289792] [] __scsi_alloc_queue+0x17/0xef > [ 2.289802] [] scsi_alloc_queue+0x10/0x49 > [ 2.289811] [] scsi_alloc_sdev+0x14f/0x1ef > [ 2.289821] [] scsi_probe_and_add_lun+0xb5/0x7ed > [ 2.289831] [] ? trace_hardirqs_on_caller+0x119/0x141 > [ 2.289843] [] __scsi_add_device+0x87/0xab > [ 2.289854] [] ata_scsi_scan_host+0x64/0x136 > [ 2.289865] [] async_port_probe+0x9e/0xa4 > [ 2.289876] [] async_thread+0xf0/0x1d4 > [ 2.289887] [] ? default_wake_function+0x0/0xd > [ 2.289896] [] ? async_thread+0x0/0x1d4 > [ 2.289906] [] kthread+0x6a/0x6f > [ 2.289916] [] ? kthread+0x0/0x6f > [ 2.289926] [] kernel_thread_helper+0x6/0x1a > [ 2.289934] > [ 2.289935] =================================================== > [ 2.289941] [ INFO: suspicious rcu_dereference_check() usage. ] > [ 2.289946] --------------------------------------------------- > [ 2.289951] kernel/cgroup.c:1651 invoked rcu_dereference_check() without > protection! > [ 2.289957] > [ 2.289958] other info that might help us debug this: > [ 2.289961] > [ 2.289966] > [ 2.289967] rcu_scheduler_active = 1, debug_locks = 1 > [ 2.289973] 1 lock held by async/1/575: > [ 2.289978] #0: (&shost->scan_mutex){+.+.+.}, at: [] > __scsi_add_device+0x5b/0xab > [ 2.289995] > [ 2.289996] stack backtrace: > [ 2.290003] Pid: 575, comm: async/1 Not tainted 2.6.34-rc5-git8 #17 > [ 2.290008] Call Trace: > [ 2.290016] [] ? printk+0xf/0x14 > [ 2.290025] [] lockdep_rcu_dereference+0x74/0x7d > [ 2.290035] [] cgroup_path+0x4a/0x110 > [ 2.290045] [] blkiocg_add_blkio_group+0x61/0x73 > [ 2.290055] [] cfq_init_queue+0xd6/0x2a3 > [ 2.290065] [] ? scsi_request_fn+0x0/0x3ea > [ 2.290074] [] elevator_init+0xa1/0xd5 > [ 2.290083] [] blk_init_queue_node+0x103/0x109 > [ 2.290093] [] blk_init_queue+0xb/0xd > [ 2.290102] [] __scsi_alloc_queue+0x17/0xef > [ 2.290111] [] scsi_alloc_queue+0x10/0x49 > [ 2.290120] [] scsi_alloc_sdev+0x14f/0x1ef > [ 2.290131] [] scsi_probe_and_add_lun+0xb5/0x7ed > [ 2.290140] [] ? trace_hardirqs_on_caller+0x119/0x141 > [ 2.290152] [] __scsi_add_device+0x87/0xab > [ 2.290162] [] ata_scsi_scan_host+0x64/0x136 > [ 2.290172] [] async_port_probe+0x9e/0xa4 > [ 2.290182] [] async_thread+0xf0/0x1d4 > [ 2.290192] [] ? default_wake_function+0x0/0xd > [ 2.290202] [] ? async_thread+0x0/0x1d4 > [ 2.290211] [] kthread+0x6a/0x6f > [ 2.290221] [] ? kthread+0x0/0x6f > [ 2.290230] [] kernel_thread_helper+0x6/0x1a -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/