From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: David Hildenbrand <david@redhat.com>
Cc: virtualization@lists.linux.dev,
"Richard Weinberger" <richard@nod.at>,
"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Vadim Pasternak" <vadimp@nvidia.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Mathieu Poirier" <mathieu.poirier@linaro.org>,
"Cornelia Huck" <cohuck@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
linux-um@lists.infradead.org,
platform-driver-x86@vger.kernel.org,
linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org,
kvm@vger.kernel.org, "Daniel Verkamp" <dverkamp@chromium.org>
Subject: Re: [PATCH vhost v4 1/6] virtio_balloon: remove the dependence where names[] is null
Date: Mon, 25 Mar 2024 14:08:21 +0800 [thread overview]
Message-ID: <1711346901.0977402-2-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <b420a545-0a7a-431c-aa48-c5db3d221420@redhat.com>
On Fri, 22 Mar 2024 22:02:27 +0100, David Hildenbrand <david@redhat.com> wrote:
> On 22.03.24 20:16, Daniel Verkamp wrote:
> > On Thu, Mar 21, 2024 at 3:16 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> >>
> >> Currently, the init_vqs function within the virtio_balloon driver relies
> >> on the condition that certain names array entries are null in order to
> >> skip the initialization of some virtual queues (vqs). This behavior is
> >> unique to this part of the codebase. In an upcoming commit, we plan to
> >> eliminate this dependency by removing the function entirely. Therefore,
> >> with this change, we are ensuring that the virtio_balloon no longer
> >> depends on the aforementioned function.
> >
> > This is a behavior change, and I believe means that the driver no
> > longer follows the spec [1].
> >
> > For example, the spec says that virtqueue 4 is reporting_vq, and
> > reporting_vq only exists if VIRTIO_BALLOON_F_PAGE_REPORTING is set,
> > but there is no mention of its virtqueue number changing if other
> > features are not set. If a device/driver combination negotiates
> > VIRTIO_BALLOON_F_PAGE_REPORTING but not VIRTIO_BALLOON_F_STATS_VQ or
> > VIRTIO_BALLOON_F_FREE_PAGE_HINT, my reading of the specification is
> > that reporting_vq should still be vq number 4, and vq 2 and 3 should
> > be unused. This patch would make the reporting_vq use vq 2 instead in
> > this case.
> >
> > If the new behavior is truly intended, then the spec does not match
> > reality, and it would need to be changed first (IMO); however,
> > changing the spec would mean that any devices implemented correctly
> > per the previous spec would now be wrong, so some kind of mechanism
> > for detecting the new behavior would be warranted, e.g. a new
> > non-device-specific virtio feature flag.
> >
> > I have brought this up previously on the virtio-comment list [2], but
> > it did not receive any satisfying answers at that time.
>
> Rings a bell, but staring at this patch, I thought that there would be
> no behavioral change. Maybe I missed it :/
>
> I stared at virtio_ccw_find_vqs(), and it contains:
>
> for (i = 0; i < nvqs; ++i) {
> if (!names[i]) {
> vqs[i] = NULL;
> continue;
> }
>
> vqs[i] = virtio_ccw_setup_vq(vdev, queue_idx++, callbacks[i],
> names[i], ctx ? ctx[i] : false,
> ccw);
> if (IS_ERR(vqs[i])) {
> ret = PTR_ERR(vqs[i]);
> vqs[i] = NULL;
> goto out;
> }
> }
>
> We increment queue_idx only if an entry was not NULL. SO I thought no
> behavioral change? (at least on s390x :) )
>
> It's late here in Germany, so maybe I'm missing something.
I think we've encountered a tricky issue. Currently, all transports handle queue
id by incrementing them in order, without skipping any queue id. So, I'm quite
surprised that my changes would affect the spec. The fact that the
'names' value is null is just a small trick in the Linux kernel implementation
and should not have an impact on the queue id.
I believe that my recent modification will not affect the spec. So, let's
consider the issues with this patch set separately for now. Regarding the Memory
Balloon Device, it has been operational for many years, and perhaps we should
add to the spec that if a certain vq does not exist, then subsequent vqs will
take over its id.
Thanks.
>
> --
> Cheers,
>
> David / dhildenb
>
next prev parent reply other threads:[~2024-03-25 6:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 10:15 [PATCH vhost v4 0/6] refactor the params of find_vqs() Xuan Zhuo
2024-03-21 10:15 ` [PATCH vhost v4 1/6] virtio_balloon: remove the dependence where names[] is null Xuan Zhuo
2024-03-22 11:56 ` David Hildenbrand
2024-03-25 6:03 ` Xuan Zhuo
2024-03-22 19:16 ` Daniel Verkamp
2024-03-22 21:02 ` David Hildenbrand
2024-03-25 6:08 ` Xuan Zhuo [this message]
2024-03-25 9:11 ` David Hildenbrand
2024-03-26 20:23 ` Daniel Verkamp
2024-03-25 9:44 ` Cornelia Huck
2024-03-26 4:11 ` Jason Wang
2024-03-26 4:25 ` Jason Wang
2024-03-21 10:15 ` [PATCH vhost v4 2/6] virtio: remove support for names array entries being null Xuan Zhuo
2024-03-21 10:15 ` [PATCH vhost v4 3/6] virtio: find_vqs: pass struct instead of multi parameters Xuan Zhuo
2024-03-21 10:15 ` [PATCH vhost v4 4/6] virtio: vring_create_virtqueue: " Xuan Zhuo
2024-03-21 10:15 ` [PATCH vhost v4 5/6] virtio: vring_new_virtqueue(): " Xuan Zhuo
2024-03-21 10:15 ` [PATCH vhost v4 6/6] virtio_ring: simplify the parameters of the funcs related to vring_create/new_virtqueue() Xuan Zhuo
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=1711346901.0977402-2-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=agordeev@linux.ibm.com \
--cc=andersson@kernel.org \
--cc=anton.ivanov@cambridgegreys.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dverkamp@chromium.org \
--cc=farman@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=kvm@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=mathieu.poirier@linaro.org \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=richard@nod.at \
--cc=svens@linux.ibm.com \
--cc=vadimp@nvidia.com \
--cc=virtualization@lists.linux.dev \
/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