[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBR8EoYkxaFHwZN2@gmail.com>
Date: Fri, 2 May 2025 10:02:26 +0200
From: Ingo Molnar <mingo@...nel.org>
To: "Xin Li (Intel)" <xin@...or.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-perf-users@...r.kernel.org, linux-hyperv@...r.kernel.org,
virtualization@...ts.linux.dev, linux-pm@...r.kernel.org,
linux-edac@...r.kernel.org, xen-devel@...ts.xenproject.org,
linux-acpi@...r.kernel.org, linux-hwmon@...r.kernel.org,
netdev@...r.kernel.org, platform-driver-x86@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
acme@...nel.org, jgross@...e.com, andrew.cooper3@...rix.com,
peterz@...radead.org, namhyung@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
irogers@...gle.com, adrian.hunter@...el.com,
kan.liang@...ux.intel.com, wei.liu@...nel.org,
ajay.kaher@...adcom.com, bcm-kernel-feedback-list@...adcom.com,
tony.luck@...el.com, pbonzini@...hat.com, vkuznets@...hat.com,
seanjc@...gle.com, luto@...nel.org, boris.ostrovsky@...cle.com,
kys@...rosoft.com, haiyangz@...rosoft.com, decui@...rosoft.com,
dapeng1.mi@...ux.intel.com, ilpo.jarvinen@...ux.intel.com
Subject: Re: [PATCH v4 02/15] x86/msr: Move rdtsc{,_ordered}() to <asm/tsc.h>
* Xin Li (Intel) <xin@...or.com> wrote:
> index 94408a784c8e..13335a130edf 100644
> --- a/arch/x86/include/asm/tsc.h
> +++ b/arch/x86/include/asm/tsc.h
> @@ -7,7 +7,81 @@
>
> #include <asm/cpufeature.h>
> #include <asm/processor.h>
> -#include <asm/msr.h>
> +
> +/*
> + * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A"
> + * constraint has different meanings. For i386, "A" means exactly
> + * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead,
> + * it means rax *or* rdx.
> + */
> +#ifdef CONFIG_X86_64
> +/* Using 64-bit values saves one instruction clearing the high half of low */
> +#define DECLARE_ARGS(val, low, high) unsigned long low, high
> +#define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
> +#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
> +#else
> +#define DECLARE_ARGS(val, low, high) u64 val
> +#define EAX_EDX_VAL(val, low, high) (val)
> +#define EAX_EDX_RET(val, low, high) "=A" (val)
> +#endif
Meh, this patch creates a duplicate copy of DECLARE_ARGS() et al in
<asm/tsc.h> now:
arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high
arch/x86/include/asm/msr.h:#define DECLARE_ARGS(val, low, high) u64 val
arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/msr.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) unsigned long low, high
arch/x86/include/asm/tsc.h:#define DECLARE_ARGS(val, low, high) u64 val
arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h: DECLARE_ARGS(val, low, high);
arch/x86/include/asm/tsc.h:#undef DECLARE_ARGS
Which was both an undeclared change, bloats the code, causes various
problems, and is totally unnecessary to boot.
Please don't do that ...
Thanks,
Ingo
Powered by blists - more mailing lists