From: David Hildenbrand <david@redhat.com>
To: Gao Shiyuan <gaoshiyuan@baidu.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Jason Wang <jasowang@redhat.com>,
zuoboqun@baidu.com
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/1] virtio-pci: Add lookup subregion of VirtIOPCIRegion MR
Date: Wed, 18 Sep 2024 09:57:59 +0200 [thread overview]
Message-ID: <b7f9dad2-29d9-42e6-97b0-32be6c077391@redhat.com> (raw)
In-Reply-To: <20240903120304.97833-1-gaoshiyuan@baidu.com>
On 03.09.24 14:03, Gao Shiyuan via wrote:
> Now virtio_address_space_lookup only lookup common/isr/device/notify
> MR and exclude their subregions.
>
> When VHOST_USER_PROTOCOL_F_HOST_NOTIFIER enable, the notify MR has
> host-notifier subregions and we need use host-notifier MR to
> notify the hardware accelerator directly instead of eventfd notify.
>
> Further more, maybe common/isr/device MR also has subregions in
> the future, so need memory_region_find for each MR incluing
> their subregions.
>
> Add lookup subregion of VirtIOPCIRegion MR instead of only lookup container MR.
>
> Fixes: a93c8d8 ("virtio-pci: Replace modern_as with direct access to modern_bar")
>
> Co-developed-by: Zuo Boqun <zuoboqun@baidu.com>
> Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
> Signed-off-by: Zuo Boqun <zuoboqun@baidu.com>
> ---
> hw/virtio/virtio-pci.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> ---
> v2 -> v3:
> * modify commit message
> * remove unused variable and move mrs to the inner block
> * replace error_report with assert
>
> v1 -> v2:
> * modify commit message
> * replace direct iteration over subregions with memory_region_find.
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 524b63e5c7..4d832fe845 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -615,8 +615,12 @@ static MemoryRegion *virtio_address_space_lookup(VirtIOPCIProxy *proxy,
> reg = &proxy->regs[i];
> if (*off >= reg->offset &&
> *off + len <= reg->offset + reg->size) {
> - *off -= reg->offset;
> - return ®->mr;
> + MemoryRegionSection mrs = memory_region_find(®->mr,
> + *off - reg->offset, len);
> + assert(mrs.mr);
We are able to trigger that assert:
https://gitlab.com/qemu-project/qemu/-/issues/2576
Can you take a look and send a fix?
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-09-18 7:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 12:03 [PATCH v3 1/1] virtio-pci: Add lookup subregion of VirtIOPCIRegion MR Gao Shiyuan via
2024-09-18 7:57 ` David Hildenbrand [this message]
2024-09-18 12:30 ` Gao,Shiyuan via
2024-09-19 13:49 ` Gao,Shiyuan via
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=b7f9dad2-29d9-42e6-97b0-32be6c077391@redhat.com \
--to=david@redhat.com \
--cc=gaoshiyuan@baidu.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=zuoboqun@baidu.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;
as well as URLs for NNTP newsgroup(s).