From: "Michael S. Tsirkin" <mst@redhat.com>
To: Heng Qi <hengqi@linux.alibaba.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
virtio-comment@lists.linux.dev, Jason Wang <jasowang@redhat.com>,
Parav Pandit <parav@nvidia.com>,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH v5] virtio-net: clarify coalescing parameters settings
Date: Tue, 11 Jun 2024 12:29:33 -0400 [thread overview]
Message-ID: <20240611122756-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1718102433.0456574-3-hengqi@linux.alibaba.com>
On Tue, Jun 11, 2024 at 06:40:33PM +0800, Heng Qi wrote:
> On Mon, 10 Jun 2024 22:19:00 +0200, Halil Pasic <pasic@linux.ibm.com> wrote:
> > On Mon, 10 Jun 2024 21:35:45 +0800
> > Heng Qi <hengqi@linux.alibaba.com> wrote:
> >
> > > On Mon, 10 Jun 2024 14:46:02 +0200, Halil Pasic <pasic@linux.ibm.com> wrote:
> > [..]
> >
> > > > > If the device chooses a stupid
> > > > > maximum value, it is his choice (spec should give more devices choices instead of
> > > > > forcing them to choose "0" which is not the best practice). We can't talk about
> > > > > performance for drivers when the devices tend to choose any "stupid" designs.
> > > > >
> > > > > We need relaxe the restrictions and makes the spec more reasonable.
> > > > >
> > > >
> > > > Hm, I see Linux virtio-net changes have landed with v6.0 and if I read
> > > > those correctly the driver -- contrary to my initial expectation --
> > > > negotiates the feature, but does not set the parameters explicitly and
> > >
> > > How does the driver know what parameters to set?
> >
> > Disclaimer: I'm not very knowledgeable when it comes to networking and
> > NICs. Please be patient with me.
> >
> > If I understood that properly have previously stated that it is basically
> > a trade-off between "latency friendly" (downside: overhead and not so
> > throughput friendly) and "throughput friendly" (downside: not so latency
> > friendly). And that makes sense to me.
> >
>
> Yes, I am correcting the description about the trade-off thing.
It does not look like this thing is ready yet.
How we can we make progress with
the realease but sure we don't make backwards compat a pain?
Ideas?
> > So I would think, the answer to the question what is the best trade-off
> > should also depend on the workload.
>
> device-side dim or driver-side dim to solve this problem. But, when the device
> is reset, the driver may not enable dim, the device or driver needs to have a
> static coalescing parameters (0 or non-zero) for the trade-off.
>
> (don't trust dim too much now, I'm doing some updates to optimize dim.)
>
>
> >
> > Now as far as I understand although we call the parameters max_usecs and
> > max_packets the notification condition is dictated by those two values. I.e.
> > there won't be a notification unless the compound condition is met.
>
> Right, just one of the conditions needs to be met.
>
> >
> > When there is no traffic 0 and 0 looks like reasonable values to me: I
> > want the first of possibly many packets ASAP. Depending on the actual
> > load, maybe one could employ some sort of a heuristics to keep good
> > balance -- maybe based on a frequency of interrupts. Maybe DIM is
> > actually exactly what I have in mind.
>
> This patch is not to solve the scenario where dim exists, but what the
> static value of the coalescing parameter is when the device is reset.
> (please check some hhistorical discussion of this topic)
>
> >
> > You seem more knowledgeable on the topic. How is this usually done? How
> > are the optimal values correlated with device characteristics?
>
>
> NICs such as mlx, ena, ice, and HiSilicon all have a non-zero static
> coalescing value. Although they all support netdim, the static value is
> still useful when dim is disabled.
>
> As for the specific value, I think it is best to notify the driver through the
> device itself, such as adding capability fileds or this:
> https://lore.kernel.org/all/20240426065441.120710-3-hengqi@linux.alibaba.com/
>
> >
> > > The parameters should be
> > > exposed by each device.
> >
> > I would like to better understand why. My intention is not to question
> > the correctness of this statement, but to gain a better understanding.
> >
> > >
> > > > thus keeps the defaults (until userspace decides to set the parameters).
> > > > So it does matter whether the defaults are guaranteed to be 0 or not,
> > > > and if not it does matter what defaults are chosen by the device.
> > >
> > > Didn't follow this. More below.
> > >
> >
> > Maybe my statement was wrong. So let me make a question out of it. What
> > entity or entities do we expect to change the parameter values, and when
> > or under which conditions do we expect them to change the parameter
> > values?
>
> Changed by the driver when the load changes or user..
>
> >
> > > >
> > > > One could even argue that those patches have been reviewed under the
> > > > assumption that the device needs to use 0 as the default parameter value.
> > >
> > > The default value should not be explicitly specified in the spec, because one
> > > size does not fit multiple devices.
> >
> > This ties in to my previous question about the relationship between
> > device characteristics and the optimal values for max_usecs and
> > max_packets.
>
> Device characteristics and optimal max_usecs/frames are preferably communicated
> via device capability, but at least should not be forced to a specific value by
> the driver.
>
> >
> > > The source of this problem is that we are
> > > missing fields like default_{rx, tx}_coalesicng_params that indicate the device
> > > capabilities. No?
> >
> > I don't think so! In my understanding is that with your proposal
> > after a reset, the OS/driver has no problem obtaining the defaults that
> > indicate the device capabilities. But I would really like to better
> > understand that device capabilities part.
> >
> > And yes another way around this would have been say:
> > * let us introduce those defaults fields, e.g. to the config space
>
> Do you want to solve it by adding another new feature?
> Otherwise, how do you solve the compatibility problem?
>
> > * make the driver read those values as a part of the initialization
>
> The spec is in conflict with this, because the driver can only read 0 from
> devices that conform to the spec. I submitted this patch to achieve this goal:
> https://lore.kernel.org/all/20240426065441.120710-3-hengqi@linux.alibaba.com/
>
> > * and set those values as the initial parameters.
>
> I don't support this, the device doesn't want to accept any initial
> unreasonable settings.
>
> Thanks.
>
> > But frankly I see no benefit of that over what you propose here.
> >
> > Regards,
> > Halil
next prev parent reply other threads:[~2024-06-11 16:29 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 [this message]
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
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=20240611122756-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=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