qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gao Shiyuan <gaoshiyuan@baidu.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	zuoboqun@baidu.com, thuth@redhat.com, alxndr@bu.edu,
	peterx@redhat.com, qemu-devel@nongnu.org, imammedo@redhat.com
Subject: Re: [PATCH 1/1] virtio-pci: fix memory_region_find for VirtIOPCIRegion's MR
Date: Tue, 8 Oct 2024 12:27:01 +0200	[thread overview]
Message-ID: <9db8c23d-aac4-45bc-b771-8ba62e75dfe7@redhat.com> (raw)
In-Reply-To: <20240930100043-mutt-send-email-mst@kernel.org>

On 30.09.24 16:00, Michael S. Tsirkin wrote:
> On Tue, Sep 24, 2024 at 02:31:20PM +0200, David Hildenbrand wrote:
>> On 24.09.24 03:11, Gao Shiyuan wrote:
>>
>> Make sure to version your patch series. For example, via
>> 	$ git format-patch -v1 ...
>>
>>> As shown below, if a virtio PCI device is attached under a pci-bridge, the MR
>>> of VirtIOPCIRegion does not belong to any address space. So memory_region_find
>>> cannot be used to search for this MR.
>>
>> I'm starting to wonder if memory_region_find() is really the right fun
>>
>>>
>>> Introduce the virtio-pci and pci_bridge_pci address spaces to solve this problem.
>>>
>>> Before:
>>> memory-region: pci_bridge_pci
>>>     0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
>>>       00000000fe200000-00000000fe200fff (prio 1, i/o): virtio-blk-pci-msix
>>>         00000000fe200000-00000000fe20016f (prio 0, i/o): msix-table
>>>         00000000fe200800-00000000fe200807 (prio 0, i/o): msix-pba
>>>       000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
>>>         000000a000400000-000000a000400fff (prio 0, i/o): virtio-pci-common-virtio-blk
>>>         000000a000401000-000000a000401fff (prio 0, i/o): virtio-pci-isr-virtio-blk
>>>         000000a000402000-000000a000402fff (prio 0, i/o): virtio-pci-device-virtio-blk
>>>         000000a000403000-000000a000403fff (prio 0, i/o): virtio-pci-notify-virtio-blk
>>>
>>> After:
>>> address-space: pci_bridge_pci
>>>     0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
>>>       00000000fe200000-00000000fe200fff (prio 1, i/o): virtio-blk-pci-msix
>>>         00000000fe200000-00000000fe20016f (prio 0, i/o): msix-table
>>>         00000000fe200800-00000000fe200807 (prio 0, i/o): msix-pba
>>>       000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
>>>         000000a000400000-000000a000400fff (prio 0, i/o): virtio-pci-common-virtio-blk
>>>         000000a000401000-000000a000401fff (prio 0, i/o): virtio-pci-isr-virtio-blk
>>>         000000a000402000-000000a000402fff (prio 0, i/o): virtio-pci-device-virtio-blk
>>>         000000a000403000-000000a000403fff (prio 0, i/o): virtio-pci-notify-virtio-blk
>>>
>>> address-space: virtio-pci
>>>     000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
>>>       000000a000400000-000000a000400fff (prio 0, i/o): virtio-pci-common-virtio-blk
>>>       000000a000401000-000000a000401fff (prio 0, i/o): virtio-pci-isr-virtio-blk
>>>       000000a000402000-000000a000402fff (prio 0, i/o): virtio-pci-device-virtio-blk
>>>       000000a000403000-000000a000403fff (prio 0, i/o): virtio-pci-notify-virtio-blk
>>>
>>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2576
>>> Fixes: ffa8a3e ("virtio-pci: Add lookup subregion of VirtIOPCIRegion MR")
>>
>> Commit id is not unique. Use 12 digits please.
>>
>> I'm still not quite sure if memory_region_find() is really the right thing
>> to use here, but I'm no expert on that so I'm hoping virtio/PCI people can
>> review.
> 
> I donnu, what would you use?

I assume there is currently not better alternative. Scanning all address 
spaces to find+walk a flatview sounds quite wasteful during each 
virtio_address_space_lookup ...

So this change here looks ok to me for the time being.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-10-08 10:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24  1:11 [PATCH 1/1] virtio-pci: fix memory_region_find for VirtIOPCIRegion's MR Gao Shiyuan via
2024-09-24 12:31 ` David Hildenbrand
2024-09-24 13:10   ` Gao,Shiyuan via
2024-09-25 12:07     ` Junjie Mao
2024-09-30 14:00   ` Michael S. Tsirkin
2024-10-08 10:27     ` David Hildenbrand [this message]
2024-09-25 12:58 ` Junjie Mao
  -- strict thread matches above, loose matches on Subject: below --
2024-10-08  3:19 Zuo,Boqun via
2024-10-09  3:01 ` Junjie Mao
2024-10-09  3:15 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=9db8c23d-aac4-45bc-b771-8ba62e75dfe7@redhat.com \
    --to=david@redhat.com \
    --cc=alxndr@bu.edu \
    --cc=gaoshiyuan@baidu.com \
    --cc=imammedo@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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).