RE: [PATCH v2 13/13] x86/msr: Simplify some rdmsrq() use cases

Michael Kelley <[email protected]>
Newsgroups org.kernel.vger.linux-hyperv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-perf-users
Message-ID <SN6PR02MB41573E35611668E830B82A7BD4A32@SN6PR02MB4157.namprd02.prod.outlook.com>
From: Juergen Gross <[email protected]> Sent: Wednesday, August 19, 2026 3:23 AM
> 
> After the conversion of rdmsrq() to an inline function some use cases
> can be simplified by dropping an intermediate variable.
> 
> Signed-off-by: Juergen Gross <[email protected]>
> ---
>  arch/x86/events/amd/core.c      |  6 +-----
>  arch/x86/events/amd/lbr.c       | 12 ++----------
>  arch/x86/events/intel/core.c    |  6 +-----
>  arch/x86/events/intel/cstate.c  |  5 +----
>  arch/x86/events/intel/knc.c     |  6 +-----
>  arch/x86/events/intel/lbr.c     | 17 +++--------------
>  arch/x86/events/intel/uncore.c  |  6 +-----
>  arch/x86/events/rapl.c          |  4 +---
>  arch/x86/events/zhaoxin/core.c  |  6 +-----
>  arch/x86/hyperv/hv_apic.c       |  5 +----
>  arch/x86/include/asm/apic.h     |  5 +----
>  arch/x86/include/asm/debugreg.h |  6 +-----
>  arch/x86/include/asm/kvm_host.h |  5 +----
>  13 files changed, 16 insertions(+), 73 deletions(-)
>

[snip]
 
> diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
> index 4e30f9a11bc4..52ee8c237c2c 100644
> --- a/arch/x86/hyperv/hv_apic.c
> +++ b/arch/x86/hyperv/hv_apic.c
> @@ -36,10 +36,7 @@ static struct apic orig_apic;
> 
>  static u64 hv_apic_icr_read(void)
>  {
> -	u64 reg_val;
> -
> -	reg_val = rdmsrq(HV_X64_MSR_ICR);
> -	return reg_val;
> +	return rdmsrq(HV_X64_MSR_ICR);
>  }
> 

For this Hyper-V specific code,

Reviewed-by: Michael Kelley <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.