[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen stable-4.19] arm64: Restore trapless ptimer access



commit 53a4e7ef420a2e272907b98fd8ffc199bcdc0e06
Author:     Colton Lewis <coltonlewis@xxxxxxxxxx>
AuthorDate: Thu Aug 31 19:00:52 2023 +0000
Commit:     Michael Tokarev <mjt@xxxxxxxxxx>
CommitDate: Mon Sep 11 22:33:58 2023 +0300

    arm64: Restore trapless ptimer access
    
    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    
https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Andrew Jones <andrew.jones@xxxxxxxxx>
    Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
    Reviewed-by: Richard Henderson <richard.henderson@xxxxxxxxxx>
    Tested-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
    Message-id: 20230831190052.129045-1-coltonlewis@xxxxxxxxxx
    Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    (cherry picked from commit 682814e2a3c883b27f24b9e7cab47313c49acbd4)
    Signed-off-by: Michael Tokarev <mjt@xxxxxxxxxx>
---
 target/arm/kvm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 810db33ccb..ed85bcfb5c 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -950,6 +950,7 @@ typedef struct CPRegStateLevel {
  */
 static const CPRegStateLevel non_runtime_cpregs[] = {
     { KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
+    { KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
 };
 
 int kvm_arm_cpreg_level(uint64_t regidx)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.