public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org, Vlad Yasevich <vyasevic@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: macvtap bug: using smp_processor_id() in preemptible code
Date: Wed, 07 Aug 2013 08:26:51 -0700	[thread overview]
Message-ID: <1375889211.4004.28.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130807164319.20aa2333@thhw500>

On Wed, 2013-08-07 at 16:43 +0200, Thomas Huth wrote:
> Hi,
> 
> I am using macvtap (via KVM/virsh) on a s390 box. With the latest
> kernel source from linux-next master branch, I suddenly get the
> following error messages in the dmesg output:
> 
> BUG: using smp_processor_id() in preemptible [00000000] code: vhost-45891/45892
> caller is macvtap_do_read+0x45c/0x600 [macvtap]
> CPU: 1 PID: 45892 Comm: vhost-45891 Not tainted 3.11.0-bisecttest #13
>        000000010cab3a00 000000010cab3a10 0000000000000002 0000000000000000 
>        000000010cab3aa0 000000010cab3a18 000000010cab3a18 00000000001127b4 
>        0000000000000000 0000000000000001 0000000000000000 000000010000000b 
>        0000000000000060 000003fe00000008 0000000000000000 000000010cab3a70 
>        00000000006ea2f0 00000000001127b4 000000010cab3a00 000000010cab3a50 
> Call Trace:
> ([<00000000001126ee>] show_trace+0x126/0x144)
>  [<00000000001127d2>] show_stack+0xc6/0xd4
>  [<000000000068bcec>] dump_stack+0x74/0xd8
>  [<0000000000481066>] debug_smp_processor_id+0xf6/0x114
>  [<000003ff802e9a18>] macvtap_do_read+0x45c/0x600 [macvtap]
>  [<000003ff802e9c1c>] macvtap_recvmsg+0x60/0x88 [macvtap]
>  [<000003ff80318c5e>] handle_rx+0x5b2/0x800 [vhost_net]
>  [<000003ff8028f77c>] vhost_worker+0x15c/0x1c4 [vhost]
>  [<000000000015f3ac>] kthread+0xd8/0xe4
>  [<00000000006934a6>] kernel_thread_starter+0x6/0xc
>  [<00000000006934a0>] kernel_thread_starter+0x0/0xc
> 2 locks held by vhost-45891/45892:
>  #0:  (&vq->mutex){+.+...}, at: [<000003ff80318718>] handle_rx+0x6c/0x800 [vhost_net]
>  #1:  (rcu_read_lock){.+.+..}, at: [<000003ff802e98fe>] macvtap_do_read+0x342/0x600 [macvtap]
> 
> Apart from these "annoying" error messages (they are repeated
> continually while the KVM guest is running / macvtap is in use),
> everything still seems to work fine, though.
> 
> Since everything was still working fine in v3.10, I did some bisecting
> and it seems like this commit introduced this problem:
> 
>   commit: ac4e4af1e59e16a018527ffa58d9d3f30bb96ca9
>   Subject: macvtap: Consistently use rcu functions
> 
> I am not sure how to proceed here, this is my first bug report in this
> area, so advice is welcome...

Please try following fix :

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index a98fb0e..1c7aab4 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -912,8 +912,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
 done:
 	rcu_read_lock();
 	vlan = rcu_dereference(q->vlan);
-	if (vlan)
+	if (vlan) {
+		preempt_disable();
 		macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
+		preempt_enable();
+	}
 	rcu_read_unlock();
 
 	return ret ? ret : copied;

  reply	other threads:[~2013-08-07 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 14:43 macvtap bug: using smp_processor_id() in preemptible code Thomas Huth
2013-08-07 15:26 ` Eric Dumazet [this message]
2013-08-08  8:25   ` Thomas Huth
2013-08-08 13:21     ` Eric Dumazet
2013-08-08 13:56       ` Thomas Huth
2013-08-08 14:04         ` Eric Dumazet
2013-08-08 15:06         ` [PATCH] macvtap: fix two races Eric Dumazet
2013-08-09 17:16           ` Vlad Yasevich
2013-08-09 17:41             ` Eric Dumazet
2013-08-09 18:01               ` Vlad Yasevich
2013-08-12  4:50           ` David Miller

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=1375889211.4004.28.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=vyasevic@redhat.com \
    /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