public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	Parav Pandit <parav@nvidia.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 23:56:42 -0700	[thread overview]
Message-ID: <3297e270-e9a5-404e-92eb-55fbe6c3f78c@oracle.com> (raw)
In-Reply-To: <20240627181635-mutt-send-email-mst@kernel.org>



On 6/27/2024 3:18 PM, Michael S. Tsirkin wrote:
> On Thu, Jun 27, 2024 at 10:14:49AM -0700, Si-Wei Liu wrote:
>>
>> On 6/27/2024 5:35 AM, Michael S. Tsirkin wrote:
>>> 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.
>> Right. If I still recall it correctly, the above text was to accommodate the
>> interaction with existing used buffer notification mechanism, F_EVENT_IDX or
>> whatnot.
>> When coalescing is in place and effective, interrupt delivery is a
>> collaborative consideration based on the coalescing parameters specified
>> *AND * event index / NO_INTERRUPT flag as well.
> No, not really.
>
> For that we have the next sentence:
>
> A device SHOULD NOT send used buffer notifications to the driver if the notifications are suppressed, even if the notification conditions are met.
>
>
> And of course event index never makes you send interrupts
> more frequently.
Hmmm, this next sentence you reference above was indeed for the 
interaction between coalescing and used buffer suppression. Then what's 
the best-effort part was about, really? Round-up or round down the set 
value to the power of 2 to save space? How is it relevant to our 
discussion? I think even with rounding it shouldn't be too off? (as 
said, by best-effort v.s. give up)

-Siwei

>
>>> 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?
>> The revised text below looks good to me.
>>
>> Thanks,
>> -Siwei
>>>
>>> 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.
>>>


  reply	other threads:[~2024-06-28  6:57 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
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 [this message]
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=3297e270-e9a5-404e-92eb-55fbe6c3f78c@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=cohuck@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=pasic@linux.ibm.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