linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net: rcu warnings in ip6fl_get_first
@ 2013-02-07 19:32 Sasha Levin
  2013-02-08  1:37 ` Cong Wang
  2013-02-08  1:38 ` Cong Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Sasha Levin @ 2013-02-07 19:32 UTC (permalink / raw)
  To: David S. Miller, yoshfuji; +Cc: Dave Jones, netdev, linux-kernel

Hi guys,

I got the following while fuzzing with trinity inside a KVM tools guest:

[   51.680236] ===============================
[   51.681914] [ INFO: suspicious RCU usage. ]
[   51.683610] 3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276 Tainted: G        W
[   51.686703] -------------------------------
[   51.688281] net/ipv6/ip6_flowlabel.c:671 suspicious rcu_dereference_check() usage!
[   51.691345]
[   51.691345] other info that might help us debug this:
[   51.691345]
[   51.694479]
[   51.694479] rcu_scheduler_active = 1, debug_locks = 1
[   51.697650] 2 locks held by trinity/7421:
[   51.701271]  #0:  (&p->lock){+.+.+.}, at: [<ffffffff812b049a>] seq_read+0x3a/0x3d0
[   51.704292]  #1:  (rcu_read_lock_bh){.+....}, at: [<ffffffff8397cde0>] ip6fl_seq_start+0x0/0xe0
[   51.707845]
[   51.707845] stack backtrace:
[   51.709678] Pid: 7421, comm: trinity Tainted: G        W    3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276
[   51.713495] Call Trace:
[   51.714370]  [<ffffffff81181fdb>] lockdep_rcu_suspicious+0x10b/0x120
[   51.716560]  [<ffffffff8397caca>] ip6fl_get_first+0x8a/0x140
[   51.718755]  [<ffffffff8397cdb7>] ip6fl_seq_next+0x17/0x40
[   51.720963]  [<ffffffff812b0711>] seq_read+0x2b1/0x3d0
[   51.723056]  [<ffffffff812b0460>] ? seq_lseek+0x110/0x110
[   51.725238]  [<ffffffff812f9c0c>] proc_reg_read+0x9c/0xd0
[   51.727266]  [<ffffffff812f9b70>] ? proc_reg_write+0xd0/0xd0
[   51.729337]  [<ffffffff8128b2eb>] do_loop_readv_writev+0x4b/0x90
[   51.731846]  [<ffffffff8128b566>] do_readv_writev+0xf6/0x1d0
[   51.734092]  [<ffffffff8128b6de>] vfs_readv+0x3e/0x60
[   51.736015]  [<ffffffff8128b750>] sys_readv+0x50/0xd0
[   51.737930]  [<ffffffff83d73d98>] tracesys+0xe1/0xe6

This is the result of commit "ipv6 flowlabel: Convert hash list to RCU." which
mixes between regular and _bh() locking.


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: net: rcu warnings in ip6fl_get_first
  2013-02-07 19:32 net: rcu warnings in ip6fl_get_first Sasha Levin
@ 2013-02-08  1:37 ` Cong Wang
  2013-02-08  1:38 ` Cong Wang
  1 sibling, 0 replies; 5+ messages in thread
From: Cong Wang @ 2013-02-08  1:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

["Followup-To:" header set to gmane.linux.network.]
On Thu, 07 Feb 2013 at 19:32 GMT, Sasha Levin <sasha.levin@oracle.com> wrote:
> Hi guys,
>
> I got the following while fuzzing with trinity inside a KVM tools guest:
>
> [   51.680236] ===============================
> [   51.681914] [ INFO: suspicious RCU usage. ]
> [   51.683610] 3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276 Tainted: G        W
> [   51.686703] -------------------------------
> [   51.688281] net/ipv6/ip6_flowlabel.c:671 suspicious rcu_dereference_check() usage!
> [   51.691345]
> [   51.691345] other info that might help us debug this:
> [   51.691345]
> [   51.694479]
> [   51.694479] rcu_scheduler_active = 1, debug_locks = 1
> [   51.697650] 2 locks held by trinity/7421:
> [   51.701271]  #0:  (&p->lock){+.+.+.}, at: [<ffffffff812b049a>] seq_read+0x3a/0x3d0
> [   51.704292]  #1:  (rcu_read_lock_bh){.+....}, at: [<ffffffff8397cde0>] ip6fl_seq_start+0x0/0xe0
> [   51.707845]
> [   51.707845] stack backtrace:
> [   51.709678] Pid: 7421, comm: trinity Tainted: G        W    3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276
> [   51.713495] Call Trace:
> [   51.714370]  [<ffffffff81181fdb>] lockdep_rcu_suspicious+0x10b/0x120
> [   51.716560]  [<ffffffff8397caca>] ip6fl_get_first+0x8a/0x140
> [   51.718755]  [<ffffffff8397cdb7>] ip6fl_seq_next+0x17/0x40
> [   51.720963]  [<ffffffff812b0711>] seq_read+0x2b1/0x3d0
> [   51.723056]  [<ffffffff812b0460>] ? seq_lseek+0x110/0x110
> [   51.725238]  [<ffffffff812f9c0c>] proc_reg_read+0x9c/0xd0
> [   51.727266]  [<ffffffff812f9b70>] ? proc_reg_write+0xd0/0xd0
> [   51.729337]  [<ffffffff8128b2eb>] do_loop_readv_writev+0x4b/0x90
> [   51.731846]  [<ffffffff8128b566>] do_readv_writev+0xf6/0x1d0
> [   51.734092]  [<ffffffff8128b6de>] vfs_readv+0x3e/0x60
> [   51.736015]  [<ffffffff8128b750>] sys_readv+0x50/0xd0
> [   51.737930]  [<ffffffff83d73d98>] tracesys+0xe1/0xe6
>
> This is the result of commit "ipv6 flowlabel: Convert hash list to RCU." which
> mixes between regular and _bh() locking.
>
>
> Thanks,
> Sasha


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: net: rcu warnings in ip6fl_get_first
  2013-02-07 19:32 net: rcu warnings in ip6fl_get_first Sasha Levin
  2013-02-08  1:37 ` Cong Wang
@ 2013-02-08  1:38 ` Cong Wang
  2013-02-08  3:54   ` Sasha Levin
  2013-02-08 19:19   ` Paul E. McKenney
  1 sibling, 2 replies; 5+ messages in thread
From: Cong Wang @ 2013-02-08  1:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev

On Thu, 07 Feb 2013 at 19:32 GMT, Sasha Levin <sasha.levin@oracle.com> wrote:
> Hi guys,
>
> I got the following while fuzzing with trinity inside a KVM tools guest:
>
> [   51.680236] ===============================
> [   51.681914] [ INFO: suspicious RCU usage. ]
> [   51.683610] 3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276 Tainted: G        W
> [   51.686703] -------------------------------
> [   51.688281] net/ipv6/ip6_flowlabel.c:671 suspicious rcu_dereference_check() usage!
> [   51.691345]

It should use rcu_dereference_bh()...

diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index ea42bf4..c50080f 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -65,13 +65,13 @@ static DEFINE_SPINLOCK(ip6_fl_lock);
 static DEFINE_SPINLOCK(ip6_sk_fl_lock);
 
 #define for_each_fl_rcu(hash, fl)				\
-	for (fl = rcu_dereference(fl_ht[(hash)]);		\
+	for (fl = rcu_dereference_bh(fl_ht[(hash)]);		\
 	     fl != NULL;					\
-	     fl = rcu_dereference(fl->next))
+	     fl = rcu_dereference_hb(fl->next))
 #define for_each_fl_continue_rcu(fl)				\
-	for (fl = rcu_dereference(fl->next);			\
+	for (fl = rcu_dereference_bh(fl->next);			\
 	     fl != NULL;					\
-	     fl = rcu_dereference(fl->next))
+	     fl = rcu_dereference_bh(fl->next))
 
 #define for_each_sk_fl_rcu(np, sfl)				\
 	for (sfl = rcu_dereference_bh(np->ipv6_fl_list);	\


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: net: rcu warnings in ip6fl_get_first
  2013-02-08  1:38 ` Cong Wang
@ 2013-02-08  3:54   ` Sasha Levin
  2013-02-08 19:19   ` Paul E. McKenney
  1 sibling, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2013-02-08  3:54 UTC (permalink / raw)
  To: Cong Wang; +Cc: linux-kernel, netdev, davem, yoshfuji

On Thu, Feb 7, 2013 at 8:38 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Thu, 07 Feb 2013 at 19:32 GMT, Sasha Levin <sasha.levin@oracle.com> wrote:
>> Hi guys,
>>
>> I got the following while fuzzing with trinity inside a KVM tools guest:
>>
>> [   51.680236] ===============================
>> [   51.681914] [ INFO: suspicious RCU usage. ]
>> [   51.683610] 3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276 Tainted: G        W
>> [   51.686703] -------------------------------
>> [   51.688281] net/ipv6/ip6_flowlabel.c:671 suspicious rcu_dereference_check() usage!
>> [   51.691345]
>
> It should use rcu_dereference_bh()...
>
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index ea42bf4..c50080f 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -65,13 +65,13 @@ static DEFINE_SPINLOCK(ip6_fl_lock);
>  static DEFINE_SPINLOCK(ip6_sk_fl_lock);
>
>  #define for_each_fl_rcu(hash, fl)                              \
> -       for (fl = rcu_dereference(fl_ht[(hash)]);               \
> +       for (fl = rcu_dereference_bh(fl_ht[(hash)]);            \
>              fl != NULL;                                        \
> -            fl = rcu_dereference(fl->next))
> +            fl = rcu_dereference_hb(fl->next))
>  #define for_each_fl_continue_rcu(fl)                           \
> -       for (fl = rcu_dereference(fl->next);                    \
> +       for (fl = rcu_dereference_bh(fl->next);                 \
>              fl != NULL;                                        \
> -            fl = rcu_dereference(fl->next))
> +            fl = rcu_dereference_bh(fl->next))
>
>  #define for_each_sk_fl_rcu(np, sfl)                            \
>         for (sfl = rcu_dereference_bh(np->ipv6_fl_list);        \

Yup, that's how I fixed it locally and it was running without warnings
for couple of hours now.


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: net: rcu warnings in ip6fl_get_first
  2013-02-08  1:38 ` Cong Wang
  2013-02-08  3:54   ` Sasha Levin
@ 2013-02-08 19:19   ` Paul E. McKenney
  1 sibling, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2013-02-08 19:19 UTC (permalink / raw)
  To: Cong Wang; +Cc: linux-kernel, netdev

On Fri, Feb 08, 2013 at 01:38:29AM +0000, Cong Wang wrote:
> On Thu, 07 Feb 2013 at 19:32 GMT, Sasha Levin <sasha.levin@oracle.com> wrote:
> > Hi guys,
> >
> > I got the following while fuzzing with trinity inside a KVM tools guest:
> >
> > [   51.680236] ===============================
> > [   51.681914] [ INFO: suspicious RCU usage. ]
> > [   51.683610] 3.8.0-rc6-next-20130206-sasha-00028-g83214f7-dirty #276 Tainted: G        W
> > [   51.686703] -------------------------------
> > [   51.688281] net/ipv6/ip6_flowlabel.c:671 suspicious rcu_dereference_check() usage!
> > [   51.691345]
> 
> It should use rcu_dereference_bh()...
> 
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index ea42bf4..c50080f 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -65,13 +65,13 @@ static DEFINE_SPINLOCK(ip6_fl_lock);
>  static DEFINE_SPINLOCK(ip6_sk_fl_lock);
> 
>  #define for_each_fl_rcu(hash, fl)				\
> -	for (fl = rcu_dereference(fl_ht[(hash)]);		\
> +	for (fl = rcu_dereference_bh(fl_ht[(hash)]);		\
>  	     fl != NULL;					\
> -	     fl = rcu_dereference(fl->next))
> +	     fl = rcu_dereference_hb(fl->next))

Small but important typo in the preceding line, should be:

 +	     fl = rcu_dereference_bh(fl->next))

 							Thanx, Paul

>  #define for_each_fl_continue_rcu(fl)				\
> -	for (fl = rcu_dereference(fl->next);			\
> +	for (fl = rcu_dereference_bh(fl->next);			\
>  	     fl != NULL;					\
> -	     fl = rcu_dereference(fl->next))
> +	     fl = rcu_dereference_bh(fl->next))
> 
>  #define for_each_sk_fl_rcu(np, sfl)				\
>  	for (sfl = rcu_dereference_bh(np->ipv6_fl_list);	\
> 
> --
> 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/
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-08 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 19:32 net: rcu warnings in ip6fl_get_first Sasha Levin
2013-02-08  1:37 ` Cong Wang
2013-02-08  1:38 ` Cong Wang
2013-02-08  3:54   ` Sasha Levin
2013-02-08 19:19   ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).