linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: George Amanakis <gamanakis@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: sdf@google.com, George Amanakis <gamanakis@gmail.com>
Subject: BUG: vnet0 selects TX queue 11, but real number of TX queues is 11
Date: Tue, 29 Jan 2019 21:16:21 -0500	[thread overview]
Message-ID: <20190130021621.17250-1-gamanakis@gmail.com> (raw)

Since 4.20.4 when running a KVM with vhost_net I am seeing in dmesg:
vnet0 selects TX queue 11, but real number of TX queues is 11

The corresponding part in the xml definition of the virtual machine is:
-------8<-------
<interface type='bridge'>
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <driver name='vhost' queues='12'>
  </driver>
  <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
-------8<-------

Doing a git-bisect with 4.20.3 last known good, and 4.20.4 as bad, this
commit turned up:
-------8<-------
commit 9ff0436e2c3575ffe64d359fb3b67aee237dc519
Author: Stanislav Fomichev <sdf@google.com>
Date:   Mon Jan 7 13:38:38 2019 -0800

    tun: publish tfile after it's fully initialized

    [ Upstream commit 0b7959b6257322f7693b08a459c505d4938646f2 ]

    BUG: unable to handle kernel NULL pointer dereference at
00000000000000d1
-------8<-------


Applying the following patch corrects it in 4.20.5. Would this be the
correct thing to do?
---
 drivers/net/tun.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6658658246d2..e0dc004c6483 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -862,8 +862,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
 	if (rtnl_dereference(tun->xdp_prog))
 		sock_set_flag(&tfile->sk, SOCK_XDP);
 
-	tun_set_real_num_queues(tun);
-
 	/* device is allowed to go away first, so no need to hold extra
 	 * refcnt.
 	 */
@@ -875,6 +873,9 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
 	rcu_assign_pointer(tfile->tun, tun);
 	rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile);
 	tun->numqueues++;
+
+	tun_set_real_num_queues(tun);
+
 out:
 	return err;
 }
-- 
2.20.1


             reply	other threads:[~2019-01-30  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30  2:16 George Amanakis [this message]
2019-01-30  2:52 ` BUG: vnet0 selects TX queue 11, but real number of TX queues is 11 Stanislav Fomichev
2019-01-30  3:53   ` [PATCH] tun: move the call to tun_set_real_num_queues George Amanakis

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=20190130021621.17250-1-gamanakis@gmail.com \
    --to=gamanakis@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdf@google.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;
as well as URLs for NNTP newsgroup(s).