Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: Heng Qi <hengqi@linux.alibaba.com>,
	virtio-comment@lists.oasis-open.org,
	virtio-dev@lists.oasis-open.org, Parav Pandit <parav@nvidia.com>,
	Yuri Benditovich <yuri.benditovich@daynix.com>,
	Jason Wang <jasowang@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [virtio-dev] Re: [PATCH v3] virtio-net: support the virtqueue coalescing moderation
Date: Fri, 17 Feb 2023 06:35:14 -0500	[thread overview]
Message-ID: <20230217062539-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJs=3_B7snyMbjfL3vaKKe3wfx2XomLeVzCiCPNxFpy_ZTbepA@mail.gmail.com>

On Fri, Feb 17, 2023 at 01:17:50PM +0200, Alvaro Karsz wrote:
> > > Yes, max_packets and max_usecs SHOULD be reset to 0.
> > > When the virtqueue is re-enabled, it means that notification conditions are met after each packet is sent/received.
> > >
> > > As described by Alvaro in "[PATCH v5] virtio-net: Fix and update VIRTIO_NET_F_NOTF_COAL feature":
> > > "+When the device has \field{max_usecs} = 0 or \field{max_packets} = 0, the notification conditions are met after every packet received/sent."
> >
> > Oh. Hmm.
> >
> > What Alvaro's patch does not describe is what happens when VQ is reset.
> >
> > Alvaro you said you have hardware implementing this right?
> > How does the command interact with vq reset?
> >
> 
> The device doesn't offer VIRTIO_F_RING_RESET at the moment.
> 
> >
> > > > What about VIRTIO_NET_CTRL_NOTF_COAL?
> > >
> > > I think it should be handled in the same way as the above VQ_SET, that is, reset the corresponding virtqeuue parameters to 0.
> >
> > sounds consistent. but the problem is, I don't think this is
> > how we previously behaved. and RING_RESET is out in 1.2.
> > So we need something compatible. I am sorry.
> >
> > I suspect that instead we can say that existing hardware has a default set of
> > parameters for tx and rx. And global commands change that
> > besides changing all enabled VQs.
> >
> > That is a side effect beyond just changing all VQs.
> >
> > Hmm.
> > Alvaro?
> >
> 
> This is indeed a good point.
> We mention the device reset case, but nothing about VQ reset.
> 
> I feel that no matter how we handle this, we break something.
> 
> Having default coalescing values may collide with "Upon reset, a
> device MUST initialize all coalescing parameters to 0."

No this is after device reset.

> We can say that VQ reset doesn't affect the "global parameters" and a
> device reset does, but this collides with "Device Requirements:
> Virtqueue Reset".
> 
> In fact, resetting coalescing values after vq reset may be derived
> from "Upon reset, a device MUST initialize all coalescing parameters
> to 0".
> This is consistent with "Device Requirements: Virtqueue Reset".
> 
> I can add in my patch some clarifications.
> 
> This will break the linux virtio_net ethtool implementation a little,
> we'll need to fix it.

Not good. I feel we must come up with spec that is backwards compatible.
Hmm, maybe this is why Parav kept talking about modes.
I did not realize at the time, sorry Parav.

I still feel modes are not the best way to describe things so I propose this:
- in addition to per vq parameters, device that supports global TX/RX
  commands and ring reset maintains two sets of default parameters: for RX and TX
- existing commands change default and change all enabled vqs
  of the correct type (RX/TX) to the same value
- vq reset changes a vq to the default
- device reset changes defaults to 0 and changes all vqs to  0

note how defaults are only used for ring reset.  is "vq reset parameter"
a better name? I feel we will repeat "reset" too many times in a
sentence if we call it that though.

So fundamentally the only change is with RING_RESET, then
default is not always 0, it can be set by the global command.

-- 
MST


  reply	other threads:[~2023-02-17 11:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 14:43 [PATCH v3] virtio-net: support the virtqueue coalescing moderation Heng Qi
2023-02-16 14:49 ` [virtio-dev] " Heng Qi
2023-02-16 15:12   ` Parav Pandit
2023-02-16 16:08   ` Michael S. Tsirkin
2023-02-17  6:14     ` [virtio-comment] " Heng Qi
2023-02-16 16:17 ` Michael S. Tsirkin
2023-02-17  5:24   ` Heng Qi
2023-02-17 10:37     ` Michael S. Tsirkin
2023-02-17 11:17       ` [virtio-comment] Re: [virtio-dev] " Alvaro Karsz
2023-02-17 11:35         ` Michael S. Tsirkin [this message]
2023-02-17 12:17           ` Alvaro Karsz
2023-02-17 16:11             ` [virtio-comment] " Parav Pandit
2023-02-17 16:12           ` Parav Pandit
2023-02-17 17:17             ` Heng Qi
2023-02-17 17:22               ` [virtio-comment] " Parav Pandit
2023-02-17 13:50     ` Parav Pandit
2023-02-17 16:43       ` Heng Qi
2023-02-17  2:47 ` Parav Pandit
2023-02-17  4:56   ` [virtio-comment] Re: [virtio-dev] " Heng Qi
2023-02-17  8:42 ` [virtio-comment] " Alvaro Karsz
2023-02-17  9:31   ` [virtio-dev] " Heng Qi
2023-02-17  9:40     ` Alvaro Karsz
2023-02-17 10:06       ` Heng Qi
2023-02-17 10:09         ` Michael S. Tsirkin
2023-02-17 10:07       ` Michael S. Tsirkin
2023-02-17 15:54         ` Parav Pandit
2023-02-17 16:36         ` [virtio-comment] " Heng Qi
2023-02-17 10:04 ` Michael S. Tsirkin
2023-02-17 10:09   ` [virtio-comment] " 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=20230217062539-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alvaro.karsz@solid-run.com \
    --cc=cohuck@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=parav@nvidia.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yuri.benditovich@daynix.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