Skip to content

KVM: deliver IOAPIC scan request only to the target vCPUs

Nitesh Narayan Lal kvm lkml 2 versions – Applied

Status from this message: Queued, thanks. I just took the liberty of renaming the function to

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesApplied
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

https://lkml.org/lkml/2019/11/6/535
- Renamed vcpus_idx to vcpu_idx.
- Fixed a bug in kvm_get_dest_vcpus_mask(), which would have triggered when kvm_apic_map_get_dest_lapic() returned false.
- Removed kvm_make_cpus_request_mask() from kvm_main.c. Now, I am directly calling kvm_make_vcpus_request_mask() from kvm_make_scan_ioapic_request_mask().

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: remember position in kvm->vcpus arrayinclude/linux/kvm_host.h virt/kvm/kvm_main.c+6 -100 replies
2/2KVM: x86: deliver KVM IOAPIC scan request to target vCPUsarch/x86/include/asm/kvm_host.h arch/x86/kvm/ioapic.c arch/x86/kvm/lapic.c +3 more+96 -22 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: deliver IOAPIC scan request only to the target vCPUs

IOAPIC scan requests with fixed delivery mode should only be delivered to the vCPUs specified by the destination ID.
The second patch in this patch-set introduces an additional kvm_get_dest_vcpus_mask() API which retrieves a bitmap with bits set for each target vCPUs. This bitmap is later passed on to the kvm_make_vcpus_request_mask().

I have re-used the patch sent by Radim Krčmář, which adds the support to remember the position of each vCPUs in kvm->vcpus array.
As I needed to find out the vCPUs index in kvm->vcpus array for setting the bits in the bitmap corresponding to the target vCPUs.

This support will enable us to reduce the latency overhead on isolated vCPUs caused by the IPI to process due to KVM_REQ_IOAPIC_SCAN. With the current implementation, the KVM_REQ_IOAPIC_SCAN is flushed on to all the vCPUs even if it is meant for just one of them.

Testing:
I have added the support for testing IOAPIC logical and physical destination mode under Fixed Delivery mode to kvm-unit-test and used it to test this patch.
https://patchwork.kernel.org/cover/11230215/
Tested the scenario where kvm_apic_map_get_dest_lapic() returns false in kvm_get_dest_vcpus_mask() using the same patch-set mentioned above.

Changes from v1:
https://lkml.org/lkml/2019/11/6/535
- Renamed vcpus_idx to vcpu_idx.
- Fixed a bug in kvm_get_dest_vcpus_mask(), which would have triggered when kvm_apic_map_get_dest_lapic() returned false.
- Removed kvm_make_cpus_request_mask() from kvm_main.c. Now, I am directly calling kvm_make_vcpus_request_mask() from kvm_make_scan_ioapic_request_mask().

Nitesh Narayan Lal (1):
KVM: x86: deliver KVM IOAPIC scan request to target vCPUs

Radim Krčmář (1):
KVM: remember position in kvm->vcpus array

 arch/x86/include/asm/kvm_host.h |  2 ++
 arch/x86/kvm/ioapic.c           | 33 +++++++++++++++++++++++++++++--
 arch/x86/kvm/lapic.c            | 44 +++++++++++++++++++++++++++++++++++++++++
 arch/x86/kvm/lapic.h            |  3 +++
 arch/x86/kvm/x86.c              | 14 +++++++++++++
 include/linux/kvm_host.h        | 13 +++++-------
 virt/kvm/kvm_main.c             |  5 +++--
 7 files changed, 102 insertions(+), 12 deletions(-)