Bug 2011 - Backport IPI virtualization support from Linux kernel
Summary: Backport IPI virtualization support from Linux kernel
Status: RESOLVED FIXED
Alias: None
Product: ANCK 5.10 Dev
Classification: ANCK
Component: virt (show other bugs) virt
Version: unspecified
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: maqiao
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-30 13:45 UTC by wenqian
Modified: 2023-01-17 15:03 UTC (History)
0 users

See Also:


Attachments
test files (1.32 KB, application/x-gzip)
2022-08-30 13:45 UTC, wenqian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wenqian intel_group 2022-08-30 13:45:36 UTC
Created attachment 378 [details]
test files

Description of problem:
IPI virtualization is a new VT-x feature, targeting to eliminate VM-exits on source vCPUs when issuing unicast, physical-addressing IPIs. Once it is enabled, the processor virtualizes the following kinds of operations that send IPIs without causing VM-exits:
- Memory-mapped ICR writes
- MSR-mapped ICR writes
- SENDUIPI execution

Version-Release number of selected component (if applicable):
N/A

How reproducible:
Measure the average time sending IPI from the source vCPU to the target vCPU completing the IPI handling by kvm-unit-tests w/ and w/o IPI virtualization.

Steps to Reproduce:
Experiment 1:
Apply patch "0001-modify-smptest.c.patch" on kvm-unit-tests and build it to get test image "x86/smptest.flat". Configure your QEMU and perf path in the file "perf-ipiv-test.sh", and run the script with and without IPIv respectively.
Experiment 2: 
Apply patch "0001-modify-smp.c.patch" kvm-unit-tests that AP was modified to run in the idle loop instead of the halt to ensure no VM exit impact on target vCPU. Build it to get test "image x86/vmexit.flat". The test script is ipi-test.sh, configure and run it with/without IPIv.

Actual results:
N/A

Expected results:
Experiment 1: 
Check the value after "APIC_WRITE"/"MSR_WRITE" in the printed log. Compared with disabling IPIv, enabling IPIv reduces the APIC_WRITE/MSR_WRITE VM-exit by 1000000 times in xapic/x2apic mode.
Experiment 2: 
Check the value after "ipi ipi" in the printed log. Compared with disabling IPIv, enabling IPIv reduces the overhead by at least 22.21% in the xapic mode and 15.98% in the x2apic mode.

Additional info:
enable IPIv:  modprobe -r kvm-intel && modprobe kvm-intel enable_ipiv=1
disable IPIv: modprobe -r kvm-intel && modprobe kvm-intel enable_ipiv=0
files in attachment:
0001-modify-smp.c.patch
0001-modify-smptest.c.patch
ipi-test.sh
perf-ipiv-test.sh
Comment 1 maqiao alibaba_cloud_group 2023-01-17 15:03:29 UTC
merged: https://gitee.com/anolis/cloud-kernel/pulls/703