From: Alex Williamson <alex.williamson@redhat.com>
To: Kunkun Jiang <jiangkunkun@huawei.com>
Cc: "open list:All patches CC here" <qemu-devel@nongnu.org>,
Eric Auger <eric.auger@redhat.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
tangnianyao@huawei.com, ganqixin@huawei.com,
wanghaibin.wang@huawei.com
Subject: Re: [PATCH 1/2] vfio/pci: Fix vfio-pci sub-page MMIO BAR mmaping in live migration
Date: Wed, 8 Sep 2021 14:45:35 -0600 [thread overview]
Message-ID: <20210908144535.66463b6c.alex.williamson@redhat.com> (raw)
In-Reply-To: <20210903093611.1159-2-jiangkunkun@huawei.com>
On Fri, 3 Sep 2021 17:36:10 +0800
Kunkun Jiang <jiangkunkun@huawei.com> wrote:
> We expand MemoryRegions of vfio-pci sub-page MMIO BARs to
> vfio_pci_write_config to improve IO performance.
> The MemoryRegions of destination VM will not be expanded
> successful in live migration, because their addresses have
> been updated in vmstate_load_state (vfio_pci_load_config).
What's the call path through vfio_pci_write_config() that you're
relying on to get triggered to enable this and why wouldn't we just
walk all sub-page BARs in vfio_pci_load_config() to resolve the issue
then? It's my understanding that we do this update in write-config
because it's required that the VM sizes the BAR before using it, which
is not the case when we resume from migration. Thanks,
Alex
> Remove the restriction on base address change in
> vfio_pci_write_config for correct mmapping sub-page MMIO
> BARs. Accroding to my analysis, the remaining parameter
> verification is enough.
>
> Fixes: c5e2fb3ce4d (vfio: Add save and load functions for VFIO PCI devices)
> Reported-by: Nianyao Tang <tangnianyao@huawei.com>
> Reported-by: Qixin Gan <ganqixin@huawei.com>
> Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
> ---
> hw/vfio/pci.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index e1ea1d8a23..891b211ddf 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -1189,18 +1189,12 @@ void vfio_pci_write_config(PCIDevice *pdev,
> }
> } else if (ranges_overlap(addr, len, PCI_BASE_ADDRESS_0, 24) ||
> range_covers_byte(addr, len, PCI_COMMAND)) {
> - pcibus_t old_addr[PCI_NUM_REGIONS - 1];
> int bar;
>
> - for (bar = 0; bar < PCI_ROM_SLOT; bar++) {
> - old_addr[bar] = pdev->io_regions[bar].addr;
> - }
> -
> pci_default_write_config(pdev, addr, val, len);
>
> for (bar = 0; bar < PCI_ROM_SLOT; bar++) {
> - if (old_addr[bar] != pdev->io_regions[bar].addr &&
> - vdev->bars[bar].region.size > 0 &&
> + if (vdev->bars[bar].region.size > 0 &&
> vdev->bars[bar].region.size < qemu_real_host_page_size) {
> vfio_sub_page_bar_update_mapping(pdev, bar);
> }
next prev parent reply other threads:[~2021-09-08 20:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 9:36 [PATCH 0/2] vfio: Some fixes about vfio-pci MMIO RAM mapping Kunkun Jiang
2021-09-03 9:36 ` [PATCH 1/2] vfio/pci: Fix vfio-pci sub-page MMIO BAR mmaping in live migration Kunkun Jiang
2021-09-08 20:45 ` Alex Williamson [this message]
2021-09-10 8:33 ` Kunkun Jiang
2021-09-10 22:24 ` Alex Williamson
2021-09-13 2:44 ` Kunkun Jiang
2021-09-03 9:36 ` [PATCH 2/2] vfio/common: Add trace point when a MMIO RAM section less than PAGE_SIZE Kunkun Jiang
2021-09-08 20:45 ` Alex Williamson
2021-09-10 8:38 ` Kunkun Jiang
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=20210908144535.66463b6c.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=eric.auger@redhat.com \
--cc=ganqixin@huawei.com \
--cc=jiangkunkun@huawei.com \
--cc=kwankhede@nvidia.com \
--cc=qemu-devel@nongnu.org \
--cc=tangnianyao@huawei.com \
--cc=wanghaibin.wang@huawei.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).