[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] a6f577: vfio: simplify the conditional statem
From: |
Richard Henderson |
Subject: |
[Qemu-commits] [qemu/qemu] a6f577: vfio: simplify the conditional statements in vfio_... |
Date: |
Fri, 06 May 2022 19:36:57 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: a6f5770fb2b22cb219a684469c8224ebec74ca2e
https://github.com/qemu/qemu/commit/a6f5770fb2b22cb219a684469c8224ebec74ca2e
Author: Longpeng(Mike) <longpeng2@huawei.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
vfio: simplify the conditional statements in vfio_msi_enable
It's unnecessary to test against the specific return value of
VFIO_DEVICE_SET_IRQS, since any positive return is an error
indicating the number of vectors we should retry with.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-2-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: be4a46eccfe97069fd62f967f6660407c9aa2a03
https://github.com/qemu/qemu/commit/be4a46eccfe97069fd62f967f6660407c9aa2a03
Author: Longpeng(Mike) <longpeng2@huawei.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
vfio: move re-enabling INTX out of the common helper
Move re-enabling INTX out, and the callers should decide to
re-enable it or not.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-3-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 8ab217d5d34275ee471a3b085ec90728b8f06d80
https://github.com/qemu/qemu/commit/8ab217d5d34275ee471a3b085ec90728b8f06d80
Author: Longpeng(Mike) <longpeng2@huawei.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
vfio: simplify the failure path in vfio_msi_enable
Use vfio_msi_disable_common to simplify the error handling
in vfio_msi_enable.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-4-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 75d546fc18023d36779c687b948128c1a4666a96
https://github.com/qemu/qemu/commit/75d546fc18023d36779c687b948128c1a4666a96
Author: Longpeng(Mike) <longpeng2@huawei.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO
migration"
Commit ecebe53fe993 ("vfio: Avoid disabling and enabling vectors
repeatedly in VFIO migration") avoids inefficiently disabling and
enabling vectors repeatedly and lets the unmasked vectors be enabled
one by one.
But we want to batch multiple routes and defer the commit, and only
commit once outside the loop of setting vector notifiers, so we
cannot enable the vectors one by one in the loop now.
Revert that commit and we will take another way in the next patch,
it can not only avoid disabling/enabling vectors repeatedly, but
also satisfy our requirement of defer to commit.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-5-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: dc580d51f7dd3e02134957be2b771636ac59e868
https://github.com/qemu/qemu/commit/dc580d51f7dd3e02134957be2b771636ac59e868
Author: Longpeng(Mike) <longpeng2@huawei.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
M hw/vfio/pci.h
Log Message:
-----------
vfio: defer to commit kvm irq routing when enable msi/msix
In migration resume phase, all unmasked msix vectors need to be
setup when loading the VF state. However, the setup operation would
take longer if the VM has more VFs and each VF has more unmasked
vectors.
The hot spot is kvm_irqchip_commit_routes, it'll scan and update
all irqfds that are already assigned each invocation, so more
vectors means need more time to process them.
vfio_pci_load_config
vfio_msix_enable
msix_set_vector_notifiers
for (vector = 0; vector < dev->msix_entries_nr; vector++) {
vfio_msix_vector_do_use
vfio_add_kvm_msi_virq
kvm_irqchip_commit_routes <-- expensive
}
We can reduce the cost by only committing once outside the loop.
The routes are cached in kvm_state, we commit them first and then
bind irqfd for each vector.
The test VM has 128 vcpus and 8 VF (each one has 65 vectors),
we measure the cost of the vfio_msix_enable for each VF, and
we can see 90+% costs can be reduce.
VF Count of irqfds[*] Original With this patch
1st 65 8 2
2nd 130 15 2
3rd 195 22 2
4th 260 24 3
5th 325 36 2
6th 390 44 3
7th 455 51 3
8th 520 58 4
Total 258ms 21ms
[*] Count of irqfds
How many irqfds that already assigned and need to process in this
round.
The optimization can be applied to msi type too.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-6-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 99510d271b173f21a7a1e8a238b5f35d9e88a147
https://github.com/qemu/qemu/commit/99510d271b173f21a7a1e8a238b5f35d9e88a147
Author: Xiang Chen <chenxiang66@hisilicon.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/common.c
Log Message:
-----------
vfio/common: Fix a small boundary issue of a trace
It uses [offset, offset + size - 1] to indicate that the length of range is
size in most places in vfio trace code (such as
trace_vfio_region_region_mmap()) execpt trace_vfio_region_sparse_mmap_entry().
So change it for trace_vfio_region_sparse_mmap_entry(), but if size is zero,
the trace will be weird with an underflow, so move the trace and trace it
only if size is not zero.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link:
https://lore.kernel.org/r/1650100104-130737-1-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 4168cdad398843ed53d650a27651868b4d3e21c9
https://github.com/qemu/qemu/commit/4168cdad398843ed53d650a27651868b4d3e21c9
Author: Eric Auger <eric.auger@redhat.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M include/sysemu/tpm.h
Log Message:
-----------
sysemu: tpm: Add a stub function for TPM_IS_CRB
In a subsequent patch, VFIO will need to recognize if
a memory region owner is a TPM CRB device. Hence VFIO
needs to use TPM_IS_CRB() even if CONFIG_TPM is unset. So
let's add a stub function.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Suggested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linnux.ibm.com>
Link: https://lore.kernel.org/r/20220506132510.1847942-2-eric.auger@redhat.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 851d6d1a0ff29a87ec588205842edf6b86d99b5c
https://github.com/qemu/qemu/commit/851d6d1a0ff29a87ec588205842edf6b86d99b5c
Author: Eric Auger <eric.auger@redhat.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/common.c
M hw/vfio/trace-events
Log Message:
-----------
vfio/common: remove spurious tpm-crb-cmd misalignment warning
The CRB command buffer currently is a RAM MemoryRegion and given
its base address alignment, it causes an error report on
vfio_listener_region_add(). This region could have been a RAM device
region, easing the detection of such safe situation but this option
was not well received. So let's add a helper function that uses the
memory region owner type to detect the situation is safe wrt
the assignment. Other device types can be checked here if such kind
of problem occurs again.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/20220506132510.1847942-3-eric.auger@redhat.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 9d38ffc5d82839cdc9effb2e9ee84a6941a25e1a
https://github.com/qemu/qemu/commit/9d38ffc5d82839cdc9effb2e9ee84a6941a25e1a
Author: Eric Auger <eric.auger@redhat.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
hw/vfio/pci: fix vfio_pci_hot_reset_result trace point
"%m" format specifier is not interpreted by the trace infrastructure
and thus "%m" is output instead of the actual errno string. Fix it by
outputting strerror(errno).
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20220502094223.36384-2-yi.l.liu@intel.com
[aw: replace commit log as provided by Eric]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 0d570a2572395cca79b83002e589aeb24fcd1732
https://github.com/qemu/qemu/commit/0d570a2572395cca79b83002e589aeb24fcd1732
Author: Eric Auger <eric.auger@redhat.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/pci.c
Log Message:
-----------
vfio/pci: Use vbasedev local variable in vfio_realize()
Using a VFIODevice handle local variable to improve the code readability.
no functional change intended
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20220502094223.36384-3-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 44ee6aaae0c937abb631e57a9853c2cdef2bc9bb
https://github.com/qemu/qemu/commit/44ee6aaae0c937abb631e57a9853c2cdef2bc9bb
Author: Yi Liu <yi.l.liu@intel.com>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/common.c
M include/hw/vfio/vfio-common.h
Log Message:
-----------
vfio/common: Rename VFIOGuestIOMMU::iommu into ::iommu_mr
Rename VFIOGuestIOMMU iommu field into iommu_mr. Then it becomes clearer
it is an IOMMU memory region.
no functional change intended
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20220502094223.36384-4-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Commit: 13220a46e27ef95159651acd5e408b6aac9dbf3e
https://github.com/qemu/qemu/commit/13220a46e27ef95159651acd5e408b6aac9dbf3e
Author: Richard Henderson <richard.henderson@linaro.org>
Date: 2022-05-06 (Fri, 06 May 2022)
Changed paths:
M hw/vfio/common.c
M hw/vfio/pci.c
M hw/vfio/pci.h
M hw/vfio/trace-events
M include/hw/vfio/vfio-common.h
M include/sysemu/tpm.h
Log Message:
-----------
Merge tag 'vfio-updates-20220506.1' of
https://gitlab.com/alex.williamson/qemu into staging
VFIO updates 2022-05-06
* Defer IRQ routing commits to improve setup and resume latency (Longpeng)
* Fix trace sparse mmap boundary condition (Xiang Chen)
* Quiet misalignment warning from TPM device mapping (Eric Auger)
* Misc cleanups (Yi Liu, Eric Auger)
# -----BEGIN PGP SIGNATURE-----
#
# iQJPBAABCAA5FiEEQvbATlQL0amee4qQI5ubbjuwiyIFAmJ1hm8bHGFsZXgud2ls
# bGlhbXNvbkByZWRoYXQuY29tAAoJECObm247sIsi8cIP+wfOMh9YLAm6NC70Gd9q
# 7Z6Z3ql/5SYUF8AmsLZf3UPa1+bVQ4TcsjqN5tiaCx36iDXF39jkHM/w9Cd4sPuB
# 7ETmWndj6FwOI9PNpFmVoUrpONyLI3VuCNZqwhV1mlmTEnmCsE1PAvjjjPz51HDd
# +dnkIJsjoKqpzja9zotQnpWtx7O4iKGGAUx3oi4BbF47sG2az2GQnI/5L/Zj8dBO
# G3h+FCavSO6ODmIxX865ndZifN3BV1asazNDjFp7beUNFVrNCpzZkIkFGzhtx8yS
# npxw/27m2s/O+dJZIlWPMCH0H0ItIHpqntBziMopxCG3ELsnhJjAccg5aWi2okXM
# M0rmNu+BH9WKPJoqy8u89gZvebyhvtTuMQ1gDzZWkEe80LLfoB9Re/qvMuw2LBnv
# BSu8hUHCoX3Whnc7PoP11Y97uBW/uaH/LTagrqzIJIBWSniUCZaZUep6Ihg1wFFQ
# oTNKKiaer/jtzmCTFtGKC7dj/gGuKNvAO8l/yqWj3k7ssstllaOLOzjDmoD5bmZD
# jVaaAedOhFme5sGtgqcmFmNXA+r01PoKmopkHku74meCk+RCxV4i8xkVZGlREHpS
# YB7CsA8B8jcLQS9QfguFWreImhstaC0fOKRDXDGMGm9ikPThdtIE5oWt2c4fKz5Y
# Hi6FjfEsDoZNLs64lc4cyMEq
# =ShHn
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 06 May 2022 03:34:55 PM CDT
# gpg: using RSA key 42F6C04E540BD1A99E7B8A90239B9B6E3BB08B22
# gpg: issuer "alex.williamson@redhat.com"
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
[undefined]
# gpg: aka "Alex Williamson <alex@shazbot.org>" [undefined]
# gpg: aka "Alex Williamson <alwillia@redhat.com>" [undefined]
# gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>"
[undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22
* tag 'vfio-updates-20220506.1' of https://gitlab.com/alex.williamson/qemu:
vfio/common: Rename VFIOGuestIOMMU::iommu into ::iommu_mr
vfio/pci: Use vbasedev local variable in vfio_realize()
hw/vfio/pci: fix vfio_pci_hot_reset_result trace point
vfio/common: remove spurious tpm-crb-cmd misalignment warning
sysemu: tpm: Add a stub function for TPM_IS_CRB
vfio/common: Fix a small boundary issue of a trace
vfio: defer to commit kvm irq routing when enable msi/msix
Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO
migration"
vfio: simplify the failure path in vfio_msi_enable
vfio: move re-enabling INTX out of the common helper
vfio: simplify the conditional statements in vfio_msi_enable
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Compare: https://github.com/qemu/qemu/compare/31abf61c4929...13220a46e27e