[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH 0/6] x86/msr: let paravirt inline rdmsr/wrmsr instructions
- To: Juergen Gross <jgross@xxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, "linux-coco@xxxxxxxxxxxxxxx" <linux-coco@xxxxxxxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" <kvm@xxxxxxxxxxxxxxx>, "linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>, "virtualization@xxxxxxxxxxxxxxx" <virtualization@xxxxxxxxxxxxxxx>
- From: Michael Kelley <mhklinux@xxxxxxxxxxx>
- Date: Sat, 10 May 2025 16:03:54 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Tjs5AmFLgTWYdxmohOlPee4q0M1+ZDvdtNJL9cCkKtM=; b=lWwOxaiqOZURx41hKG8Q14Q1iyJ8Mj5gaKWPtK18m4JzlBe0N99f/GIgG8AvbskqrpHfnQSTx4eXFEEVzA9S5OW3Oh8B4qNtzVfLav7WFUllH6SyOlDVfUaAdWSV+AoxDRnDMOdkA32WuYlSUWG70jL+Fvp3h8hYUdnFuBdPmM0ZVnkID8v1uFg4j6zViXuJH2NydJDPQwuWoHYsIf6ZLVSI+ERcAU3niCNang3rS4D9DZuAt7vV/iM5IuAq10kJ8sc0JoPExfm7edSCUaXXsxMAOyOrm0ea1XiIVn6CI0zYYTToO+uvBCQSWwgKGUkvxgDX7wHJyvD5OH0+d3+XpA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P5JHj/EfutujMkhdbOHhj+B1g+qkZhYOOYCQjO9oPaBdlGBPNikBzvG8JXS66T/UoCHVrcuf+7aSkFKIXnaumV2wnnESVVUxmsqfU3aMBfu1peVuf4dsvt4bnoqRurME2v5+szEGNdok39cbk7grE7TnaF9Xya8dB+cddIPSaYO5DHYtRCs25lp+e4qTJMcg8hCoKbBQ2WU/wKVbgAy0o0r95jOdbvNmPf/Pw+72AZ/JJUXkZe1hlhIScFNkYdmgGt7VLQB+Ttcdh/bT6hcZxSaR/Hhpj0Ur7JmLwWFu+X5Cblq610m8+tf2xcqDGMmOmuGbo+nZcWIp4iOIeqDLFw==
- Cc: "xin@xxxxxxxxx" <xin@xxxxxxxxx>, "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ajay Kaher <ajay.kaher@xxxxxxxxxxxx>, Alexey Makhalov <alexey.amakhalov@xxxxxxxxxxxx>, Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>
- Delivery-date: Sat, 10 May 2025 16:04:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbvmhEFeeiouIdcUmtZAu/e2cRwrPMDIRg
- Thread-topic: [PATCH 0/6] x86/msr: let paravirt inline rdmsr/wrmsr instructions
From: Juergen Gross <jgross@xxxxxxxx> Sent: Tuesday, May 6, 2025 2:20 AM
>
> 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.
I've tested in SEV-SNP and TDX guests with paravisor on Hyper-V. Basic
smoke test showed no issues.
Tested-by: Michael Kelley <mhklinux@xxxxxxxxxxx>
>
> 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
>
|