-----Original Message----- From: yezengruan Sent: Tuesday, August 4, 2020 3:42 PM To: Xiexiuqi xiexiuqi@huawei.com; Guohanjun (Hanjun Guo) guohanjun@huawei.com Cc: Wanghaibin (D) wanghaibin.wang@huawei.com; Fanhenglong fanhenglong@huawei.com; yezengruan yezengruan@huawei.com; Zhanghailiang zhang.zhanghailiang@huawei.com; kernel.openeuler kernel.openeuler@huawei.com; Chenzhendong (alex) alex.chen@huawei.com; virt@openeuler.org; Xiexiangyou xiexiangyou@huawei.com; yuzenghui yuzenghui@huawei.com Subject: [PATCH hulk-4.19-next v3 13/17] KVM: arm64: Add SMCCC PV-sched to kick cpu
euleros inclusion category: feature bugzilla: NA DTS: NA CVE: NA
A new hypercall interface function is provided for the guest to kick WFI state vCPU.
Signed-off-by: Zengruan Ye yezengruan@huawei.com
Documentation/virtual/kvm/arm/pvsched.txt | 18 +++++++++++++++++- include/linux/arm-smccc.h | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/virtual/kvm/arm/pvsched.txt b/Documentation/virtual/kvm/arm/pvsched.txt index 9091dea7e..f8b746a7f 100644 --- a/Documentation/virtual/kvm/arm/pvsched.txt +++ b/Documentation/virtual/kvm/arm/pvsched.txt @@ -4,10 +4,11 @@ Paravirtualized sched support for arm64 KVM/arm64 provides some hypervisor service calls to support a paravirtualized sched.
-Two new SMCCC compatible hypercalls are defined: +Three new SMCCC compatible hypercalls are defined:
- PV_SCHED_FEATURES: 0xC5000040
- PV_SCHED_IPA: 0xC5000041
+* PV_SCHED_KICK_CPU: 0xC5000042
The existence of the PV_SCHED hypercall should be probed using the SMCCC 1.1 ARCH_FEATURES mechanism before calling it. @@ -28,6 +29,13 @@ PV_SCHED_IPA hypervisor. ============= ======== ==========
+PV_SCHED_KICK_CPU
- ============= ======== ==========
- Function ID: (uint32) 0xC5000042
- Return value: (int64) NOT_SUPPORTED (-1) or SUCCESS (0) if the
vCPU is
kicked by the hypervisor.
- ============= ======== ==========
PV sched state
@@ -46,3 +54,11 @@ The structure pointed to by the PV_SCHED_IPA hypercall is as follows: The preempted field will be updated to 0 by the hypervisor prior to scheduling a vCPU. When the vCPU is scheduled out, the preempted field will be updated to 1 by the hypervisor.
+A vCPU of a paravirtualized guest that is busywaiting in guest kernel +mode for an event to occur (ex: a spinlock to become available) can +execute WFI instruction once it has busy-waited for more than a threshold time-interval. +Execution of WFI instruction would cause the hypervisor to put the vCPU +to sleep until occurrence of an appropriate event. Another vCPU of the +same guest can wakeup the sleeping vCPU by issuing PV_SCHED_KICK_CPU +hypercall, specifying CPU id (reg1) of the vCPU to be woken up. diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index 159189b3a..950d29492 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -370,5 +370,11 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, ARM_SMCCC_OWNER_STANDARD_HYP, \ 0x41)
+#define ARM_SMCCC_HV_PV_SCHED_KICK_CPU \
- ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_STANDARD_HYP, \
0x42)
建议从后边选用值,防止这些补丁无法进入内核,导致后续主干内核使用了此值进而导致兼容性问题!!
#endif /*__ASSEMBLY__*/
#endif /*__LINUX_ARM_SMCCC_H*/
2.19.1