netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jason Wang <jasowang@redhat.com>
Cc: "Bui Quang Minh" <minhquangbui99@gmail.com>,
	virtualization@lists.linux.dev,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"David S . Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v3 3/3] selftests: net: add a virtio_net deadlock selftest
Date: Wed, 16 Apr 2025 17:08:57 -0700	[thread overview]
Message-ID: <20250416170857.2e46a3be@kernel.org> (raw)
In-Reply-To: <CACGkMEvceXT+=HJRRe6D3Zk3k40E2ADJiXNb4qqAYm=PZnxNpQ@mail.gmail.com>

On Wed, 16 Apr 2025 15:46:42 +0800 Jason Wang wrote:
> On Wed, Apr 16, 2025 at 2:54 PM Bui Quang Minh <minhquangbui99@gmail.com> wrote:
> > On 4/16/25 11:27, Jakub Kicinski wrote:  
> > > Unfortunately this doesn't work on a basic QEMU setup:
> > >
> > > # ethtool -G eth0 rx 128
> > > [   15.680655][  T287] virtio_net virtio2 eth0: resize rx fail: rx queue index: 0 err: -2
> > > netlink error: No such file or directory
> > >
> > > Is there a way to enable more capable virtio_net with QEMU?  
> 
> What's the qemu command line and version?
> 
> Resize depends on queue_reset which should be supported from Qemu 7.2

I'm using virtme-ng with --net loop and:

QEMU emulator version 9.1.3 (qemu-9.1.3-2.fc41)

--net loop resolves to:

	-device virtio-net-device,netdev=n0 \
	-netdev hubport,id=n0,hubid=0 \
	-device virtio-net-device,netdev=n1 \
	-netdev hubport,id=n1,hubid=0

> > I guess that virtio-pci-legacy is used in your setup.  
> 
> Note that modern devices are used by default.
> 
> >
> > Here is how I setup virtio-net with Qemu
> >
> >      -netdev tap,id=hostnet1,vhost=on,script=$NETWORK_SCRIPT,downscript=no \
> >      -device
> > virtio-net-pci,netdev=hostnet1,iommu_platform=on,disable-legacy=on \

That works! I rejigged the CI, for posterity I used two times:

	-device	virtio-net-pci,netdev=n0,iommu_platform=on,disable-legacy=on,mq=on,vectors=18
	-netdev tap,id=n0,ifname=tap4,vhost=on,script=no,downscript=no,queues=8 

and then manually bridged the taps together on the hypervisor side.

> > The iommu_platform=on is necessary to make vring use dma API which is a
> > requirement to enable xsk_pool in virtio-net (XDP socket will be in
> > zerocopy mode for this case). Otherwise, the XDP socket will fallback to
> > copy mode, xsk_pool is not enabled in virtio-net that makes the
> > probability to reproduce bug to be very small. Currently, when you don't
> > have iommu_platform=on, you can pass the test even before the fix, so I
> > think I will try to harden the selftest to make it return skip in this case.  
> 
> I would like to keep the resize test as it doesn't require iommu_platform.

Sounds good but lets just add them to the drivers/net/hw directory.
I don't think there's anything virtio specific in the test itself?

Right now drivers/net/virtio_net has a test which expects to see
both netdevs in the VM, while drivers / Python based tests expect
to have the env prepared where only one end is on the local machine, 
and the other is accessible over SSH or in another netns. So it's a bit
painful to marry the two kinds of tests in the CI. At least our netdev
CI does not know how to figure this out :( It preps the env and then
runs the whole kselftest TARGET in the same setup.

  parent reply	other threads:[~2025-04-17  0:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  7:43 [PATCH v3 0/3] virtio-net: disable delayed refill when pausing rx Bui Quang Minh
2025-04-15  7:43 ` [PATCH v3 1/3] " Bui Quang Minh
2025-04-15 13:19   ` Michael S. Tsirkin
2025-04-15  7:43 ` [PATCH v3 2/3] selftests: net: move xdp_helper to net/lib Bui Quang Minh
2025-04-15  7:43 ` [PATCH v3 3/3] selftests: net: add a virtio_net deadlock selftest Bui Quang Minh
2025-04-16  4:27   ` Jakub Kicinski
2025-04-16  6:54     ` Bui Quang Minh
2025-04-16  7:46       ` Jason Wang
2025-04-16  9:00         ` Bui Quang Minh
2025-04-17  0:08         ` Jakub Kicinski [this message]
2025-04-15 14:04 ` [PATCH v3 0/3] virtio-net: disable delayed refill when pausing rx Michael S. Tsirkin

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=20250416170857.2e46a3be@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=hawk@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minhquangbui99@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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).