From: Cornelia Huck <cohuck@redhat.com>
To: "Carlos López" <clopez@suse.de>, qemu-devel@nongnu.org
Cc: Halil Pasic <pasic@linux.ibm.com>,
Eric Farman <farman@linux.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>,
Ilya Leoshkevich <iii@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Thomas Huth <thuth@redhat.com>,
"open list:virtio-ccw" <qemu-s390x@nongnu.org>
Subject: Re: [PATCH] virtio: refresh vring region cache after updating a virtqueue size
Date: Wed, 15 Mar 2023 14:11:47 +0100 [thread overview]
Message-ID: <87jzzitazw.fsf@redhat.com> (raw)
In-Reply-To: <5eb8bbd4-2d02-002d-6e68-a123b2da2a70@suse.de>
On Mon, Mar 13 2023, Carlos López <clopez@suse.de> wrote:
> On 9/3/23 11:43, Cornelia Huck wrote:
>> On Thu, Mar 02 2023, Carlos López <clopez@suse.de> wrote:
>>> Fix this by calling virtio_queue_update_rings() after
>>> virtio_queue_set_num() if we are not already calling
>>> virtio_queue_set_rings().
>>
>> Don't we instead need to call virtio_init_region_cache() to update the
>> caches? virtio_queue_set_rings() will calculate avail and used from
>> desc, which looks wrong for modern devices.
>
> I take it you meant virtio_queue_update_rings() instead of
> virtio_queue_set_rings()? Otherwise I'm not sure what you mean.
I think I had been looking at the code for too long :(
>
> If this is the case sure - there is this same kind of logic in
> virtio_load():
>
> /*
> * VIRTIO-1 devices migrate desc, used, and avail ring
> addresses so
> * only the region cache needs to be set up. Legacy
> devices need
> * to calculate used and avail ring addresses based on the desc
> * address.
> */
> if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
> virtio_init_region_cache(vdev, i);
> } else {
> virtio_queue_update_rings(vdev, i);
> }
Yes, I think we need to follow the same logic.
> This will require making virtio_init_region_cache() non static of course.
>
>>> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
>>> index e33e5207ab..89891ac58a 100644
>>> --- a/hw/s390x/virtio-ccw.c
>>> +++ b/hw/s390x/virtio-ccw.c
>>> @@ -237,6 +237,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info,
>>> return -EINVAL;
>>> }
>>> virtio_queue_set_num(vdev, index, num);
>>> + virtio_queue_update_rings(vdev, index);
>>
>> Note that this is the non-legacy path.
>>
> So if I understand correctly, in virtio_mmio_write() we check via
> proxy->legacy, and in virtio_ccw_set_vqs() we are in the non-legacy
> path. What about virtio_pci_common_write()?
IIUC, only modern drivers will write to the modern bar.
prev parent reply other threads:[~2023-03-15 13:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 10:14 [PATCH] virtio: refresh vring region cache after updating a virtqueue size Carlos López
2023-03-06 11:36 ` Thomas Huth
2023-03-09 10:43 ` Cornelia Huck
2023-03-10 11:29 ` Michael S. Tsirkin
2023-03-13 10:19 ` Carlos López
2023-03-15 13:11 ` Cornelia Huck [this message]
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=87jzzitazw.fsf@redhat.com \
--to=cohuck@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=clopez@suse.de \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.