* [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
@ 2025-06-30 18:43 kernel test robot
2025-06-30 19:27 ` Borislav Petkov
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2025-06-30 18:43 UTC (permalink / raw)
To: Nikunj A Dadhania
Cc: llvm, oe-kbuild-all, linux-kernel, x86, Borislav Petkov (AMD)
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)
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@intel.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;
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
2025-06-30 18:43 [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used kernel test robot
@ 2025-06-30 19:27 ` Borislav Petkov
2025-07-01 15:06 ` Nathan Chancellor
0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2025-06-30 19:27 UTC (permalink / raw)
To: kernel test robot
Cc: Nikunj A Dadhania, llvm, oe-kbuild-all, linux-kernel, x86
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@intel.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
2025-06-30 19:27 ` Borislav Petkov
@ 2025-07-01 15:06 ` Nathan Chancellor
2025-07-01 15:29 ` Borislav Petkov
0 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2025-07-01 15:06 UTC (permalink / raw)
To: Borislav Petkov
Cc: kernel test robot, Nikunj A Dadhania, llvm, oe-kbuild-all,
linux-kernel, x86
On Mon, Jun 30, 2025 at 09:27:26PM +0200, Borislav Petkov wrote:
> 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.
Citation needed. This reproduces with Clang 15 (earliest supported on
x86 now), Clang 19, and GCC 15 for me. Were you missing W=1?
$ x86_64-linux-gcc --version | head -1
x86_64-linux-gcc (GCC) 15.1.0
$ curl -LSso .config https://download.01.org/0day-ci/archive/20250701/202507010218.3O5Ge0Xt-lkp@intel.com/config
$ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- W=1 olddefconfig arch/x86/coco/sev/core.o
arch/x86/coco/sev/core.c: In function 'snp_secure_tsc_init':
arch/x86/coco/sev/core.c:2170:37: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
2170 | unsigned long tsc_freq_mhz, dummy;
| ^~~~~
Cheers,
Nathan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
2025-07-01 15:06 ` Nathan Chancellor
@ 2025-07-01 15:29 ` Borislav Petkov
2025-07-02 21:02 ` Nathan Chancellor
0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2025-07-01 15:29 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, Nikunj A Dadhania, llvm, oe-kbuild-all,
linux-kernel, x86
On Tue, Jul 01, 2025 at 08:06:44AM -0700, Nathan Chancellor wrote:
> Citation needed. This reproduces with Clang 15 (earliest supported on
> x86 now), Clang 19, and GCC 15 for me. Were you missing W=1?
Nope.
$ git checkout -b test 4a35d2b5254af89595fd90dae9ee0c8f990a148d
Switched to a new branch 'test'
$ make CC=clang-19 HOSTCC=clang-19 W=1 arch/x86/coco/sev/core.o
...
LINK /mnt/kernel/kernel/linux/tools/objtool/objtool
CC arch/x86/coco/sev/core.o
$ clang-19 --version
Debian clang version 19.1.7 (1+b1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
2025-07-01 15:29 ` Borislav Petkov
@ 2025-07-02 21:02 ` Nathan Chancellor
0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-07-02 21:02 UTC (permalink / raw)
To: Borislav Petkov
Cc: kernel test robot, Nikunj A Dadhania, llvm, oe-kbuild-all,
linux-kernel, x86
On Tue, Jul 01, 2025 at 05:29:53PM +0200, Borislav Petkov wrote:
> On Tue, Jul 01, 2025 at 08:06:44AM -0700, Nathan Chancellor wrote:
> > Citation needed. This reproduces with Clang 15 (earliest supported on
> > x86 now), Clang 19, and GCC 15 for me. Were you missing W=1?
>
> Nope.
>
> $ git checkout -b test 4a35d2b5254af89595fd90dae9ee0c8f990a148d
> Switched to a new branch 'test'
> $ make CC=clang-19 HOSTCC=clang-19 W=1 arch/x86/coco/sev/core.o
> ...
> LINK /mnt/kernel/kernel/linux/tools/objtool/objtool
> CC arch/x86/coco/sev/core.o
> $ clang-19 --version
> Debian clang version 19.1.7 (1+b1)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/lib/llvm-19/bin
Spooky, same SHA, build command, and configuration from this thread with
Debian clang version 19.1.7 (3+b1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
from unstable Debian (since it is what I base on for my Debian
development container) shows it for me... Can't imagine the two Debian
patch levels would have caused anything here but it is probably not
worth thinking too much more about since it is already resolved.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-07-02 21:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 18:43 [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used kernel test robot
2025-06-30 19:27 ` Borislav Petkov
2025-07-01 15:06 ` Nathan Chancellor
2025-07-01 15:29 ` Borislav Petkov
2025-07-02 21:02 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox