[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250506092015.1849-1-jgross@suse.com>
Date: Tue, 6 May 2025 11:20:09 +0200
From: Juergen Gross <jgross@...e.com>
To: linux-kernel@...r.kernel.org,
x86@...nel.org,
linux-coco@...ts.linux.dev,
kvm@...r.kernel.org,
linux-hyperv@...r.kernel.org,
virtualization@...ts.linux.dev
Cc: xin@...or.com,
Juergen Gross <jgross@...e.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>,
Dexuan Cui <decui@...rosoft.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
xen-devel@...ts.xenproject.org,
Ajay Kaher <ajay.kaher@...adcom.com>,
Alexey Makhalov <alexey.amakhalov@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>
Subject: [PATCH 0/6] x86/msr: let paravirt inline rdmsr/wrmsr instructions
When building a kernel with CONFIG_PARAVIRT_XXL the paravirt
infrastructure will always use functions for reading or writing MSRs,
even when running on bare metal.
Switch to inline RDMSR/WRMSR instructions in this case, reducing the
paravirt overhead.
In order to make this less intrusive, some further reorganization of
the MSR access helpers is done in the first 4 patches.
This series has been tested to work with Xen PV and on bare metal.
There has been another approach by Xin Li, which used dedicated #ifdef
and removing the MSR related paravirt hooks instead of just modifying
the paravirt code generation.
Please note that I haven't included the use of WRMSRNS or the
immediate forms of WRMSR and RDMSR, because I wanted to get some
feedback on my approach first. Enhancing paravirt for those cases
is not very complicated, as the main base is already prepared for
that enhancement.
This series is based on the x86/msr branch of the tip tree.
Juergen Gross (6):
coco/tdx: Rename MSR access helpers
x86/kvm: Rename the KVM private read_msr() function
x86/msr: minimize usage of native_*() msr access functions
x86/msr: Move MSR trace calls one function level up
x86/paravirt: Switch MSR access pv_ops functions to instruction
interfaces
x86/msr: reduce number of low level MSR access helpers
arch/x86/coco/tdx/tdx.c | 8 +-
arch/x86/hyperv/ivm.c | 2 +-
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/include/asm/msr.h | 116 ++++++++++-------
arch/x86/include/asm/paravirt.h | 152 ++++++++++++++--------
arch/x86/include/asm/paravirt_types.h | 13 +-
arch/x86/include/asm/qspinlock_paravirt.h | 5 +-
arch/x86/kernel/kvmclock.c | 2 +-
arch/x86/kernel/paravirt.c | 26 +++-
arch/x86/kvm/svm/svm.c | 16 +--
arch/x86/kvm/vmx/vmx.c | 4 +-
arch/x86/xen/enlighten_pv.c | 60 ++++++---
arch/x86/xen/pmu.c | 4 +-
13 files changed, 262 insertions(+), 148 deletions(-)
--
2.43.0
Powered by blists - more mailing lists