public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Parav Pandit <parav@nvidia.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	Si-Wei Liu <si-wei.liu@oracle.com>,
	Heng Qi <hengqi@linux.alibaba.com>,
	Cornelia Huck <cohuck@redhat.com>,
	"virtio-comment@lists.linux.dev" <virtio-comment@lists.linux.dev>,
	Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH v5] virtio-net: clarify coalescing parameters settings
Date: Thu, 27 Jun 2024 10:59:01 -0400	[thread overview]
Message-ID: <20240627105707-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <PH0PR12MB5481AC5003763A6C07947DA5DCD72@PH0PR12MB5481.namprd12.prod.outlook.com>

On Thu, Jun 27, 2024 at 01:03:51PM +0000, Parav Pandit wrote:
> 
> > From: Michael S. Tsirkin <mst@redhat.com>
> > Sent: Thursday, June 27, 2024 6:23 PM
> > 
> > On Thu, Jun 27, 2024 at 12:45:49PM +0000, Parav Pandit wrote:
> > > Hi Michael,
> > >
> > > > From: Michael S. Tsirkin <mst@redhat.com>
> > > > Sent: Thursday, June 27, 2024 6:05 PM
> > > >
> > > > On Thu, Jun 27, 2024 at 12:37:32PM +0200, Halil Pasic wrote:
> > > > > On Tue, 25 Jun 2024 18:14:15 -0700 Si-Wei Liu
> > > > > <si-wei.liu@oracle.com> wrote:
> > > > >
> > > > > > On 6/24/2024 10:56 PM, Parav Pandit wrote:
> > > > > [..]
> > > > > > > I saw the need of this proposal slightly differently in the
> > > > > > > discussion with
> > > > Heng in v4.
> > > > > > > The way I understood is, proposed relaxation enables below
> > > > > > > Linux driver
> > > > flow to work as equally as without device offering
> > > > VIRTIO_NET_F_VQ_NOTF_COAL.
> > > > > > >
> > > > > > > Flow is:
> > > > > > > 1. The device offered feature VIRTIO_NET_F_VQ_NOTF_COAL 2. The
> > > > > > > virtio-net driver negotiated VIRTNET_FEATURES that has
> > > > > > > VIRTIO_NET_F_VQ_NOTF_COAL
> > > > > > >
> > > > > > > 3. Because VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, device is
> > > > > > > not
> > > > applying any coalescing on the VQ, in a good hope that driver will
> > > > perform VQ notification coalescing.
> > > > >
> > > > > I have certainly understood this differently. When
> > > > > VIRTIO_NET_F_VQ_NOTF_COAL is not negotiated then the device is not
> > > > supposed/allowed to do any interrupt coalescing (notification
> > > > suppression may still apply).
> > > > >
> > > > > If VIRTIO_NET_F_VQ_NOTF_COAL is negotiated the device is supposed
> > > > > to/MUST do the coalescing according to the parameters as described
> > > > > by the virtio spec.
> > > > >
> > > > > Michael, Jason: Can you guys weigh in on this?
> > > >
> > > > I still don't understand why this change is needed.
> > > > We have this text:
> > > >
> > > > 	The device may generate notifications more or less frequently than
> > > > 	specified by set commands of the VIRTIO_NET_CTRL_NOTF_COAL
> > class.
> > > >
> > > > and
> > > >
> > > > 	The behavior of the device in response to set commands of the
> > > > VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
> > > > 	the device MAY generate notifications more or less frequently than
> > > > specified.
> > > >
> > > > So with no spec changes, devices already can do what this patch says
> > > > they can do - send notifications less frequently.
> > > >
> > > > Re-reading this spec text, maybe the confusion is that it mentions
> > > > set commands specifically? And it's also stuck in the middle where
> > > > it's easy to miss.
> > > >
> > > > So it would seem that the following should be sufficient, and it
> > > > looks like a small clarification we could just apply and include in
> > > > the vote for the csd. What do you guys think?
> > > >
> > > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > >
> > > > ----
> > > >
> > > >
> > > > diff --git a/device-types/net/description.tex b/device-
> > > > types/net/description.tex index 76585b0..d6788df 100644
> > > > --- a/device-types/net/description.tex
> > > > +++ b/device-types/net/description.tex
> > > > @@ -1711,8 +1711,6 @@ \subsubsection{Control
> > > > Virtqueue}\label{sec:Device Types / Network Device / Devi
> > > >                                          for an enabled
> > > > transmit/receive virtqueue whose index is \field{vq_index}.
> > > >  \end{enumerate}
> > > >
> > > > -The device may generate notifications more or less frequently than
> > > > specified by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class.
> > > > -
> > > >  If coalescing parameters are being set, the device applies the last
> > > > coalescing parameters set for a  virtqueue, regardless of the
> > > > command used to set the parameters. Use the following command
> > > > sequence  with two pairs of virtqueues as an example:
> > > > @@ -1726,6 +1724,9 @@ \subsubsection{Control
> > > > Virtqueue}\label{sec:Device Types / Network Device / Devi  \item
> > Command6:
> > > > VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET with \field{vq_index} = 1, the
> > > > device responds with coalescing parameters of index 1 set by command5.
> > > >  \end{itemize}
> > > >
> > > > +The device can generate notifications more or less frequently than
> > > > +specified by the coalescing parameters.
> > > > +
> > > >  \subparagraph{Operation}\label{sec:Device Types / Network Device /
> > > > Device Operation / Control Virtqueue / Notifications Coalescing /
> > > > Operation}
> > > >
> > > >  The device sends a used buffer notification once the notification
> > > > conditions are met and if the notifications are not suppressed as
> > > > explained in \ref{sec:Basic Facilities of a Virtio Device /
> > > > Virtqueues / Used Buffer Notification Suppression}.
> > > > @@ -1798,7 +1799,7 @@ \subsubsection{Control
> > > > Virtqueue}\label{sec:Device Types / Network Device / Devi  Upon
> > > > disabling and re-enabling a receive virtqueue, the device MUST set
> > > > the coalescing parameters of the virtqueue  to those configured
> > > > through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the
> > > > driver did not set any RX coalescing parameters, to 0.
> > > >
> > > > -The behavior of the device in response to set commands of the
> > > > VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
> > > > +The behavior of the device in response to specific coalescing
> > > > +parameters is
> > > > best-effort:
> > > >  the device MAY generate notifications more or less frequently than
> > specified.
> > > >
> > > >  A device SHOULD NOT send used buffer notifications to the driver if
> > > > the notifications are suppressed, even if the notification conditions are
> > met.
> > > >
> > >
> > > Your changes above are good and they are applicable when the specific
> > coalescing parameters are set by the driver.
> > 
> > What makes you say this?
> Because I was reading this in the CVQ section of the spec where CVQ commands are setting it.


So? Reset also sets it.

> > No they apply universally whenever parameters are specified by the spec:
> > whether parameters are set by driver or by device.
> I see. Upon reset they are set to 0 in the below text, means no coalescing, means quick interrupts, right?

But device can make them as slow as it likes, spec says so.


> > Is that unclear somehow?
> > I suspect you are just reading the wrong part of the patch ...
> > 
> > 
> > > The issue that is being resolved is, when these parameters are NOT set by the
> > driver, when feature is negotiated.
> > > What should device do?
> > > The parameters are not specified...
> > 
> > They are specified - set to 0.
> > 
> > > The spec says " Upon reset, a device MUST initialize all coalescing parameters
> > to 0.".
> > 
> > yes. and device can then coalesce if it wants to.
> > 
> You mean 0 means coalescing is disabled (and not quick notifications) ?
> And hence, it is device chosen value?
> If so, that interpretation would work too.

No 0 means send notification after any # of packets.


> > > And Heng attempt is to clarify that by adding a changing above line
> > > something like,
> > >
> > > "when driver does not set coalescing params, but have negotiated the
> > feature, device may generate notifications more or less frequently than
> > specified".
> > 
> > 
> > Maybe that is the intention, but the proposed text is instead saying the
> > parameters themselves are !0. 
> A clarification like above would be better or 0 means device chosen parameters would also work fine.


> > Which is what triggered the whole mess with a
> > misvote: commit log says it's a clarification when it is actually a behaviour
> > change.
> > 
> It is a behavior change to fix/restore.
> But if you suggest: 0 means device chosen value, that will work too to restore current regression.


  reply	other threads:[~2024-06-27 14:59 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  4:47 [PATCH v5] virtio-net: clarify coalescing parameters settings Heng Qi
2024-05-28  4:50 ` Heng Qi
2024-05-31  6:36   ` Heng Qi
2024-05-31  9:39     ` Cornelia Huck
2024-06-07 20:02 ` Halil Pasic
2024-06-08  2:34   ` Heng Qi
2024-06-10 12:46     ` Halil Pasic
2024-06-10 13:35       ` Heng Qi
2024-06-10 14:50         ` Michael S. Tsirkin
2024-06-10 15:12           ` Parav Pandit
2024-06-11 14:04           ` Cornelia Huck
2024-06-10 20:19         ` Halil Pasic
2024-06-11 10:40           ` Heng Qi
2024-06-11 16:29             ` Michael S. Tsirkin
2024-06-11 17:43               ` Parav Pandit
2024-06-13  6:13                 ` Michael S. Tsirkin
2024-06-17  2:27                   ` Heng Qi
2024-06-17 23:31                     ` Si-Wei Liu
2024-06-20  7:40                       ` Heng Qi
2024-06-21  1:21                         ` Si-Wei Liu
2024-06-21  3:24                           ` Heng Qi
2024-06-21 23:46                             ` Si-Wei Liu
2024-06-22  1:34                               ` Heng Qi
2024-06-25  4:51                                 ` Si-Wei Liu
2024-06-25  5:56                                   ` Parav Pandit
2024-06-26  1:14                                     ` Si-Wei Liu
2024-06-27 10:37                                       ` Halil Pasic
2024-06-27 11:27                                         ` Parav Pandit
2024-06-27 12:35                                         ` Michael S. Tsirkin
2024-06-27 12:45                                           ` Parav Pandit
2024-06-27 12:52                                             ` Michael S. Tsirkin
2024-06-27 13:03                                               ` Parav Pandit
2024-06-27 14:59                                                 ` Michael S. Tsirkin [this message]
2024-06-27 17:27                                               ` Si-Wei Liu
2024-06-27 17:14                                           ` Si-Wei Liu
2024-06-27 22:18                                             ` Michael S. Tsirkin
2024-06-28  6:56                                               ` Si-Wei Liu
2024-06-28  8:23                                                 ` Jason Wang
2024-06-28 19:31                                                   ` Si-Wei Liu
2024-06-30 17:04                                                     ` Michael S. Tsirkin
2024-07-03  6:09                                                     ` Jason Wang
2024-07-02 20:37                                                   ` Halil Pasic
2024-07-02 21:04                                                     ` Michael S. Tsirkin
2024-07-03  5:01                                                     ` Jason Wang
2024-06-29  6:47                                           ` Halil Pasic
2024-06-30 16:55                                             ` Michael S. Tsirkin
2024-07-02 21:43                                               ` Halil Pasic
2024-06-27 12:13                                       ` Parav Pandit
2024-06-27 12:42                                         ` Michael S. Tsirkin
2024-06-25  7:53                               ` Jason Wang
2024-06-25  8:06                                 ` Michael S. Tsirkin
2024-06-25  8:13                                   ` Jason Wang
2024-06-25  8:21                                     ` Michael S. Tsirkin
2024-06-11 23:03 ` Michael S. Tsirkin
2024-06-17  2:35   ` Heng Qi
2024-06-25  7:26     ` 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=20240627105707-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=parav@nvidia.com \
    --cc=pasic@linux.ibm.com \
    --cc=si-wei.liu@oracle.com \
    --cc=virtio-comment@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