From: Pranith Kumar <bobby.prani@gmail.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com
Subject: Re: [PATCH tip/core/rcu 3/9] drivers/md: Use rcu_dereference() for accessing rcu pointer
Date: Fri, 21 Nov 2014 09:30:36 -0500 [thread overview]
Message-ID: <546F4C8C.4040904@gmail.com> (raw)
In-Reply-To: <20141121133145.GA17245@node.dhcp.inet.fi>
On 11/21/2014 08:31 AM, Kirill A. Shutemov wrote:
> On Tue, Oct 28, 2014 at 03:09:56PM -0700, Paul E. McKenney wrote:
>> From: Pranith Kumar <bobby.prani@gmail.com>
>>
>> Got Paul's email wrong the first time.
>>
>> The map field in 'struct mapped_device' is an rcu pointer. Use rcu_dereference()
>> while accessing it.
>>
>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> On current -next I see this:
>
> [ 6.388264] ===============================
> [ 6.389571] [ INFO: suspicious RCU usage. ]
> [ 6.390869] 3.18.0-rc5-next-20141121-08303-g44cae4530372 #2 Not tainted
> [ 6.392185] -------------------------------
> [ 6.393479] /home/kas/git/public/linux/drivers/md/dm.c:2853 suspicious rcu_dereference_check() usage!
> [ 6.394801]
> other info that might help us debug this:
>
Hi Kirill,
We are dereferencing an RCU pointer with the suspend_lock held which is causing this warning.
Can you please check if the following patch helps? Thanks!
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index a0ece87..e584e66 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2830,7 +2830,7 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map,
*/
int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
{
- struct dm_table *map = NULL;
+ struct dm_table *map = rcu_dereference(md->map);
int r = 0;
retry:
@@ -2850,8 +2850,6 @@ retry:
goto retry;
}
- map = rcu_dereference(md->map);
-
r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE);
if (r)
goto out_unlock;
> [ 6.398714]
> rcu_scheduler_active = 1, debug_locks = 0
> [ 6.401247] 1 lock held by cryptsetup/159:
> [ 6.402522] #0: (&md->suspend_lock/1){+.+...}, at: [<ffffffff8179dd1d>] dm_suspend+0x3d/0x140
> [ 6.403848]
> stack backtrace:
> [ 6.406448] CPU: 3 PID: 159 Comm: cryptsetup Not tainted 3.18.0-rc5-next-20141121-08303-g44cae4530372 #2
> [ 6.407726] Hardware name: LENOVO 3460CC6/3460CC6, BIOS G6ET93WW (2.53 ) 02/04/2013
> [ 6.408982] 0000000000000001 ffff8800d3ac7c38 ffffffff81b00bbd 0000000000000011
> [ 6.410249] ffff8800d301a560 ffff8800d3ac7c68 ffffffff81153be7 ffff8800d3928800
> [ 6.411548] ffff8800d3928970 ffff8800d3928aa0 0000000000000001 ffff8800d3ac7ca8
> [ 6.412780] Call Trace:
> [ 6.413980] [<ffffffff81b00bbd>] dump_stack+0x4c/0x6e
> [ 6.415178] [<ffffffff81153be7>] lockdep_rcu_suspicious+0xe7/0x120
> [ 6.416364] [<ffffffff8179de1d>] dm_suspend+0x13d/0x140
> [ 6.417535] [<ffffffff817a2d80>] ? table_load+0x340/0x340
> [ 6.418749] [<ffffffff817a2f2b>] dev_suspend+0x1ab/0x260
> [ 6.419901] [<ffffffff817a2d80>] ? table_load+0x340/0x340
> [ 6.421038] [<ffffffff817a3781>] ctl_ioctl+0x251/0x540
> [ 6.422164] [<ffffffff812b6415>] ? mntput_no_expire+0x5/0x360
> [ 6.423280] [<ffffffff817a3a83>] dm_ctl_ioctl+0x13/0x20
> [ 6.424389] [<ffffffff812a6f98>] do_vfs_ioctl+0x308/0x540
> [ 6.425515] [<ffffffff81175d2d>] ? rcu_read_lock_held+0x6d/0x70
> [ 6.426601] [<ffffffff812b324e>] ? __fget_light+0xbe/0xd0
> [ 6.427686] [<ffffffff812a7251>] SyS_ioctl+0x81/0xa0
> [ 6.428760] [<ffffffff81b0d6ad>] system_call_fastpath+0x16/0x1b
>
next prev parent reply other threads:[~2014-11-21 14:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 22:09 [PATCH tip/core/rcu 0/9] Miscellaneous fixes for 3.19 Paul E. McKenney
2014-10-28 22:09 ` [PATCH tip/core/rcu 1/9] rcu: Remove CONFIG_RCU_CPU_STALL_VERBOSE Paul E. McKenney
2014-10-28 22:09 ` [PATCH tip/core/rcu 2/9] compiler: Allow 1- and 2-byte smp_load_acquire() and smp_store_release() Paul E. McKenney
2014-10-28 22:09 ` [PATCH tip/core/rcu 3/9] drivers/md: Use rcu_dereference() for accessing rcu pointer Paul E. McKenney
2014-11-21 13:31 ` Kirill A. Shutemov
2014-11-21 14:30 ` Pranith Kumar [this message]
2014-11-21 14:58 ` Kirill A. Shutemov
2014-11-23 12:21 ` Pranith Kumar
2014-11-23 16:39 ` Eric Dumazet
2014-11-23 16:40 ` [PATCH ] drivers/md: use proper rcu accessor Eric Dumazet
2014-11-23 16:53 ` Mike Snitzer
2014-11-23 17:31 ` Eric Dumazet
2014-11-23 19:12 ` Mike Snitzer
2014-11-23 17:34 ` [PATCH v2] " Eric Dumazet
2014-11-24 4:09 ` Mike Snitzer
2014-10-28 22:09 ` [PATCH tip/core/rcu 4/9] dm: sparse: Annotate field with __rcu for checking Paul E. McKenney
2014-10-28 22:09 ` [PATCH tip/core/rcu 5/9] rcu: Add sparse check for RCU_INIT_POINTER() Paul E. McKenney
2014-10-28 22:09 ` [PATCH tip/core/rcu 6/9] rcu: Optimize cond_resched_rcu_qs() Paul E. McKenney
2014-10-28 22:10 ` [PATCH tip/core/rcu 7/9] rcu: More info about potential deadlocks with rcu_read_unlock() Paul E. McKenney
2014-10-28 22:10 ` [PATCH tip/core/rcu 8/9] rcu: Fix FIXME in rcu_tasks_kthread() Paul E. McKenney
2014-10-28 22:10 ` [PATCH tip/core/rcu 9/9] rcu: Provide counterpart to rcu_dereference() for non-RCU situations Paul E. McKenney
2014-10-29 10:57 ` Peter Zijlstra
2014-10-29 12:42 ` Paul E. McKenney
2014-10-29 19:15 ` Oleg Nesterov
2014-10-29 18:43 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546F4C8C.4040904@gmail.com \
--to=bobby.prani@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhart@linux.intel.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=kirill@shutemov.name \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox