From: "Michael S. Tsirkin" <mst@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
"Eugenio Pérez" <eperezma@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Heng Qi" <hengqi@linux.alibaba.com>
Subject: Re: [PATCH net-next v4 2/5] virtio_net: enable irq for the control vq
Date: Fri, 21 Jun 2024 07:46:15 -0400 [thread overview]
Message-ID: <20240621074023-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1718955706.2555537-1-xuanzhuo@linux.alibaba.com>
On Fri, Jun 21, 2024 at 03:41:46PM +0800, Xuan Zhuo wrote:
> On Thu, 20 Jun 2024 06:11:40 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > On Thu, Jun 20, 2024 at 06:10:51AM -0400, Michael S. Tsirkin wrote:
> > > On Thu, Jun 20, 2024 at 05:53:15PM +0800, Heng Qi wrote:
> > > > On Thu, 20 Jun 2024 16:26:05 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > > > > On Thu, Jun 20, 2024 at 4:21 PM Jason Wang <jasowang@redhat.com> wrote:
> > > > > >
> > > > > > On Thu, Jun 20, 2024 at 3:35 PM Heng Qi <hengqi@linux.alibaba.com> wrote:
> > > > > > >
> > > > > > > On Wed, 19 Jun 2024 17:19:12 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > > > > > > On Thu, Jun 20, 2024 at 12:19:05AM +0800, Heng Qi wrote:
> > > > > > > > > @@ -5312,7 +5315,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
> > > > > > > > >
> > > > > > > > > /* Parameters for control virtqueue, if any */
> > > > > > > > > if (vi->has_cvq) {
> > > > > > > > > - callbacks[total_vqs - 1] = NULL;
> > > > > > > > > + callbacks[total_vqs - 1] = virtnet_cvq_done;
> > > > > > > > > names[total_vqs - 1] = "control";
> > > > > > > > > }
> > > > > > > > >
> > > > > > > >
> > > > > > > > If the # of MSIX vectors is exactly for data path VQs,
> > > > > > > > this will cause irq sharing between VQs which will degrade
> > > > > > > > performance significantly.
> > > > > > > >
> > > > > >
> > > > > > Why do we need to care about buggy management? I think libvirt has
> > > > > > been teached to use 2N+2 since the introduction of the multiqueue[1].
> > > > >
> > > > > And Qemu can calculate it correctly automatically since:
> > > > >
> > > > > commit 51a81a2118df0c70988f00d61647da9e298483a4
> > > > > Author: Jason Wang <jasowang@redhat.com>
> > > > > Date: Mon Mar 8 12:49:19 2021 +0800
> > > > >
> > > > > virtio-net: calculating proper msix vectors on init
> > > > >
> > > > > Currently, the default msix vectors for virtio-net-pci is 3 which is
> > > > > obvious not suitable for multiqueue guest, so we depends on the user
> > > > > or management tools to pass a correct vectors parameter. In fact, we
> > > > > can simplifying this by calculating the number of vectors on realize.
> > > > >
> > > > > Consider we have N queues, the number of vectors needed is 2*N + 2
> > > > > (#queue pairs + plus one config interrupt and control vq). We didn't
> > > > > check whether or not host support control vq because it was added
> > > > > unconditionally by qemu to avoid breaking legacy guests such as Minix.
> > > > >
> > > > > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com
> > > > > Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> > > > > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> > > > > Signed-off-by: Jason Wang <jasowang@redhat.com>
> > > >
> > > > Yes, devices designed according to the spec need to reserve an interrupt
> > > > vector for ctrlq. So, Michael, do we want to be compatible with buggy devices?
> > > >
> > > > Thanks.
> > >
> > > These aren't buggy, the spec allows this. So don't fail, but
> > > I'm fine with using polling if not enough vectors.
> >
> > sharing with config interrupt is easier code-wise though, FWIW -
> > we don't need to maintain two code-paths.
>
>
> If we do that, we should introduce a new helper, not to add new function to
> find_vqs().
>
> if ->share_irq_with_config:
> ->share_irq_with_config(..., vq_idx)
>
> Thanks.
Generally, I'd like to avoid something very narrow and single-use
in the API. Just telling virtio core that a vq is slow-path
sounds generic enough, and we should be able to extend that
later to support sharing between VQs.
>
> >
> > > > >
> > > > > Thanks
> > > > >
> > > > > >
> > > > > > > > So no, you can not just do it unconditionally.
> > > > > > > >
> > > > > > > > The correct fix probably requires virtio core/API extensions.
> > > > > > >
> > > > > > > If the introduction of cvq irq causes interrupts to become shared, then
> > > > > > > ctrlq need to fall back to polling mode and keep the status quo.
> > > > > >
> > > > > > Having to path sounds a burden.
> > > > > >
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > >
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > [1] https://www.linux-kvm.org/page/Multiqueue
> > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > MST
> > > > > > > >
> > > > > > >
> > > > >
> >
next prev parent reply other threads:[~2024-06-21 11:46 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 16:19 [PATCH net-next v4 0/5] virtio_net: enable the irq for ctrlq Heng Qi
2024-06-19 16:19 ` [PATCH net-next v4 1/5] virtio_net: passing control_buf explicitly Heng Qi
2024-06-19 16:19 ` [PATCH net-next v4 2/5] virtio_net: enable irq for the control vq Heng Qi
2024-06-19 21:19 ` Michael S. Tsirkin
2024-06-20 7:29 ` Heng Qi
2024-06-20 8:21 ` Jason Wang
2024-06-20 8:26 ` Jason Wang
2024-06-20 9:53 ` Heng Qi
2024-06-20 10:10 ` Michael S. Tsirkin
2024-06-20 10:11 ` Michael S. Tsirkin
2024-06-20 10:31 ` Heng Qi
2024-06-26 7:52 ` Jiri Pirko
2024-06-26 8:08 ` Michael S. Tsirkin
2024-06-26 8:43 ` Jiri Pirko
2024-06-26 9:58 ` Michael S. Tsirkin
2024-06-26 11:51 ` Jiri Pirko
2024-07-08 11:40 ` Jiri Pirko
2024-07-08 12:19 ` Heng Qi
2024-06-21 7:41 ` Xuan Zhuo
2024-06-21 11:46 ` Michael S. Tsirkin [this message]
2024-06-25 1:27 ` Jason Wang
2024-06-25 7:14 ` Michael S. Tsirkin
2024-06-20 8:32 ` Michael S. Tsirkin
2024-06-20 8:37 ` Jason Wang
2024-06-20 9:38 ` Heng Qi
2024-06-20 10:07 ` Michael S. Tsirkin
2024-06-24 11:30 ` Michael S. Tsirkin
2024-06-19 16:19 ` [PATCH net-next v4 3/5] virtio_net: change the command token to completion Heng Qi
2024-06-19 16:19 ` [PATCH net-next v4 4/5] virtio_net: refactor command sending and response handling Heng Qi
2024-06-19 16:19 ` [PATCH net-next v4 5/5] virtio_net: improve dim command request efficiency Heng Qi
2024-06-20 6:40 ` kernel test robot
2024-06-19 21:16 ` [PATCH net-next v4 0/5] virtio_net: enable the irq for ctrlq Michael S. Tsirkin
2024-06-20 7:16 ` Heng Qi
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=20240621074023-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=hengqi@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.