[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250630192726.GBaGLlHl84xIopx4Pt@fat_crate.local>
Date: Mon, 30 Jun 2025 21:27:26 +0200
From: Borislav Petkov <bp@...en8.de>
To: kernel test robot <lkp@...el.com>
Cc: Nikunj A Dadhania <nikunj@....com>, llvm@...ts.linux.dev,
oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
x86@...nel.org
Subject: Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning:
variable 'dummy' set but not used
On Tue, Jul 01, 2025 at 02:43:31AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> head: 4a35d2b5254af89595fd90dae9ee0c8f990a148d
> commit: 4a35d2b5254af89595fd90dae9ee0c8f990a148d [1/1] x86/sev: Use TSC_FACTOR for Secure TSC frequency calculation
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250701/202507010218.3O5Ge0Xt-lkp@intel.com/config)
> compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
Pff, doesn't fire with clang-19.
That damn compiler.
gcc used to complain about those but they fixed their interprocedural analysis
or whatnot.
clang is simply complaining more.
/facepalm 1
And the 0day bot - because it doesn't have anything better to do - is doing
W=1 builds. I did complain about that waste of resources in the past but
nothing happened.
/facepalm 2
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250701/202507010218.3O5Ge0Xt-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507010218.3O5Ge0Xt-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
> 2170 | unsigned long tsc_freq_mhz, dummy;
> | ^
> 1 warning generated.
>
>
> vim +/dummy +2170 arch/x86/coco/sev/core.c
>
> 2167
> 2168 void __init snp_secure_tsc_init(void)
> 2169 {
> > 2170 unsigned long tsc_freq_mhz, dummy;
And it is actually my damn fault because even if that dummy crap variable was
bugging me, I thought we want to "harmonize".
/facepalm 3
Which is a total nonsense because that code doesn't build in 32-bit.
So this should've stayed like this:
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 47d10d9a28e9..36c167333d04 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -2167,8 +2167,8 @@ static unsigned long securetsc_get_tsc_khz(void)
void __init snp_secure_tsc_init(void)
{
- unsigned long tsc_freq_mhz, dummy;
struct snp_secrets_page *secrets;
+ unsigned long tsc_freq_mhz;
void *mem;
if (!cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC))
@@ -2183,7 +2183,7 @@ void __init snp_secure_tsc_init(void)
secrets = (__force struct snp_secrets_page *)mem;
setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
- rdmsr(MSR_AMD64_GUEST_TSC_FREQ, tsc_freq_mhz, dummy);
+ rdmsrq(MSR_AMD64_GUEST_TSC_FREQ, tsc_freq_mhz);
/* Extract the GUEST TSC MHZ from BIT[17:0], rest is reserved space */
tsc_freq_mhz = tsc_freq_mhz & GENMASK_ULL(17, 0);
snp_tsc_freq_khz = SNP_SCALE_TSC_FREQ(tsc_freq_mhz * 1000, secrets->tsc_factor);
What a f*cking mess. I don't have enough room on my face anymore from
facepalms.
Oh boy.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists