Avoid a name clash with a new general MSR access helper after a future
MSR infrastructure rework by renaming the KVM specific read_msr() to
kvm_read_msr().
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/kvm/vmx/vmx.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 9c971f846108..308f7020dc9d 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -2275,7 +2275,7 @@ static inline void kvm_load_ldt(u16 sel)
}
#ifdef CONFIG_X86_64
-static inline unsigned long read_msr(unsigned long msr)
+static inline unsigned long kvm_read_msr(unsigned long msr)
{
u64 value;
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 63de5f6051e5..5a5f3c57363c 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1335,8 +1335,8 @@ void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu)
} else {
savesegment(fs, fs_sel);
savesegment(gs, gs_sel);
- fs_base = read_msr(MSR_FS_BASE);
- vmx->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
+ fs_base = kvm_read_msr(MSR_FS_BASE);
+ vmx->msr_host_kernel_gs_base = kvm_read_msr(MSR_KERNEL_GS_BASE);
}
wrmsrq(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
--
2.43.0
On Tue, May 06, 2025, Juergen Gross wrote: > Avoid a name clash with a new general MSR access helper after a future > MSR infrastructure rework by renaming the KVM specific read_msr() to > kvm_read_msr(). > > Signed-off-by: Juergen Gross <jgross@suse.com> > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 9c971f846108..308f7020dc9d 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -2275,7 +2275,7 @@ static inline void kvm_load_ldt(u16 sel) > } > > #ifdef CONFIG_X86_64 > -static inline unsigned long read_msr(unsigned long msr) Ewwww. Eww, eww, eww. I forgot this thing existed. Please just delete this and use rdmsrq() directly (or is it still rdmsrl()? at this point?).
* Sean Christopherson <seanjc@google.com> wrote: > On Tue, May 06, 2025, Juergen Gross wrote: > > Avoid a name clash with a new general MSR access helper after a future > > MSR infrastructure rework by renaming the KVM specific read_msr() to > > kvm_read_msr(). > > > > Signed-off-by: Juergen Gross <jgross@suse.com> > > --- > > arch/x86/include/asm/kvm_host.h | 2 +- > > arch/x86/kvm/vmx/vmx.c | 4 ++-- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index 9c971f846108..308f7020dc9d 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -2275,7 +2275,7 @@ static inline void kvm_load_ldt(u16 sel) > > } > > > > #ifdef CONFIG_X86_64 > > -static inline unsigned long read_msr(unsigned long msr) > > Ewwww. Eww, eww, eww. I forgot this thing existed. > > Please just delete this and use rdmsrq() directly (or is it still rdmsrl()? at > this point?). Both will work, so code-in-transition isn't build-broken unnecessarily: arch/x86/include/asm/msr.h:#define rdmsrl(msr, val) rdmsrq(msr, val) :-) Thanks, Ingo
On May 6, 2025 9:16:03 AM PDT, Ingo Molnar <mingo@kernel.org> wrote: > >* Sean Christopherson <seanjc@google.com> wrote: > >> On Tue, May 06, 2025, Juergen Gross wrote: >> > Avoid a name clash with a new general MSR access helper after a future >> > MSR infrastructure rework by renaming the KVM specific read_msr() to >> > kvm_read_msr(). >> > >> > Signed-off-by: Juergen Gross <jgross@suse.com> >> > --- >> > arch/x86/include/asm/kvm_host.h | 2 +- >> > arch/x86/kvm/vmx/vmx.c | 4 ++-- >> > 2 files changed, 3 insertions(+), 3 deletions(-) >> > >> > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h >> > index 9c971f846108..308f7020dc9d 100644 >> > --- a/arch/x86/include/asm/kvm_host.h >> > +++ b/arch/x86/include/asm/kvm_host.h >> > @@ -2275,7 +2275,7 @@ static inline void kvm_load_ldt(u16 sel) >> > } >> > >> > #ifdef CONFIG_X86_64 >> > -static inline unsigned long read_msr(unsigned long msr) >> >> Ewwww. Eww, eww, eww. I forgot this thing existed. >> >> Please just delete this and use rdmsrq() directly (or is it still rdmsrl()? at >> this point?). > >Both will work, so code-in-transition isn't build-broken unnecessarily: > > arch/x86/include/asm/msr.h:#define rdmsrl(msr, val) rdmsrq(msr, val) > >:-) > >Thanks, > > Ingo But for forward-looking code, rdmsrq().
On 06.05.25 15:53, Sean Christopherson wrote: > On Tue, May 06, 2025, Juergen Gross wrote: >> Avoid a name clash with a new general MSR access helper after a future >> MSR infrastructure rework by renaming the KVM specific read_msr() to >> kvm_read_msr(). >> >> Signed-off-by: Juergen Gross <jgross@suse.com> >> --- >> arch/x86/include/asm/kvm_host.h | 2 +- >> arch/x86/kvm/vmx/vmx.c | 4 ++-- >> 2 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h >> index 9c971f846108..308f7020dc9d 100644 >> --- a/arch/x86/include/asm/kvm_host.h >> +++ b/arch/x86/include/asm/kvm_host.h >> @@ -2275,7 +2275,7 @@ static inline void kvm_load_ldt(u16 sel) >> } >> >> #ifdef CONFIG_X86_64 >> -static inline unsigned long read_msr(unsigned long msr) > > Ewwww. Eww, eww, eww. I forgot this thing existed. > > Please just delete this and use rdmsrq() directly (or is it still rdmsrl()? at > this point?). rdmsrq() it is. Fine with me. Juergen
© 2016 - 2025 Red Hat, Inc.