Skip to contentSkip to conversation

x86/speculation: add cpu_show_gds() prototype

PATCH In review Arnd Bergmann 4 participants 8 messages Aug 9, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86/speculation: add cpu_show_gds() prototype

From: Arnd Bergmann <[email protected]>

The newly added function has two definitions but no prototypes:

drivers/base/cpu.c:605:16: error: no previous prototype for 'cpu_show_gds' [-Werror=missing-prototypes]

Add a declaration next to the other ones for this file to avoid the warning.

Fixes 8974eb588283b ("x86/speculation: Add Gather Data Sampling mitigation")
---
 include/linux/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/cpu.h +2 -0
index 9d43b734170d6..0abd60a7987b6 100644
@@ -73,6 +73,8 @@ extern ssize_t cpu_show_retbleed(struct device *dev,
 				 struct device_attribute *attr, char *buf);
 extern ssize_t cpu_show_spec_rstack_overflow(struct device *dev,
 					     struct device_attribute *attr, char *buf);
+extern ssize_t cpu_show_gds(struct device *dev,
+			    struct device_attribute *attr, char *buf);
 
 extern __printf(4, 5)
 struct device *cpu_device_create(struct device *parent, void *drvdata,
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 x86: move gds_ucode_mitigated() declaration to header

From: Arnd Bergmann <[email protected]>

The declaration got placed in the .c file of the caller, but that causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

Move it to a header where both sides can observe it instead.

Fixes 81ac7e5d74174 ("KVM: Add GDS_NO support to KVM")
---
 arch/x86/include/asm/processor.h | 2 ++
 arch/x86/kvm/x86.c               | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/processor.h +2 -0
index e5b0e23a7a830..01786f3e289cb 100644
@@ -731,4 +731,6 @@ bool arch_is_platform_page(u64 paddr);
 #define arch_is_platform_page arch_is_platform_page
 #endif
 
+extern bool gds_ucode_mitigated(void);
+
 #endif /* _ASM_X86_PROCESSOR_H */
arch/x86/kvm/x86.c +0 -2
index 17b1ee7f839c3..a7d97cde19678 100644
@@ -318,8 +318,6 @@ u64 __read_mostly host_xcr0;
 
 static struct kmem_cache *x86_emulator_cache;
 
-extern bool gds_ucode_mitigated(void);
-
 /*
  * When called, it means the previous get/set msr reached an invalid msr.
  * Return true if we want to ignore/silent this failed msr access.
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header

HI Arnd,

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The declaration got placed in the .c file of the caller, but that causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

Thanks,
Dan

#3 lore raw

Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header

Quoted 5 lines · Daniel Sneddon

HI Arnd,

Quoted 2 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Quoted 7 lines
Quoted 4 lines

The declaration got placed in the .c file of the caller, but that causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

The warning is currently disabled by default, unless you build with 'make W=1'. I'm in the process of getting my last patches out to change this so the warning is enabled by default though, so I was phrasing this based on the future behavior. Sorry if this was confusing.

Arnd

Tested-by
#4 lore raw

Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header

Quoted 14 lines · Arnd Bergmann
Quoted 5 lines · Daniel Sneddon

HI Arnd,

Quoted 2 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Quoted 7 lines
Quoted 4 lines

The declaration got placed in the .c file of the caller, but that causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

Quoted 6 lines

The warning is currently disabled by default, unless you build with 'make W=1'. I'm in the process of getting my last patches out to change this so the warning is enabled by default though, so I was phrasing this based on the future behavior. Sorry if this was confusing.

Arnd

That explains why I wasn't seeing it.

Feel free to add:

Thanks,
Dan

#5 lore raw

Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header

Quoted 22 lines · Daniel Sneddon
Quoted 14 lines · Arnd Bergmann
Quoted 5 lines · Daniel Sneddon

HI Arnd,

Quoted 2 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Quoted 7 lines
Quoted 4 lines

The declaration got placed in the .c file of the caller, but that causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

Quoted 6 lines

The warning is currently disabled by default, unless you build with 'make W=1'. I'm in the process of getting my last patches out to change this so the warning is enabled by default though, so I was phrasing this based on the future behavior. Sorry if this was confusing.

Arnd

Quoted 7 lines

That explains why I wasn't seeing it.

Feel free to add:

Thanks,
Dan

To be clear, that applies to both patches in the series.

BR,
Dan

#6 lore raw
In reply to Arnd Bergmann
Quoted 20 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added function has two definitions but no prototypes:

drivers/base/cpu.c:605:16: error: no previous prototype for 'cpu_show_gds' [-Werror=missing-prototypes]

Add a declaration next to the other ones for this file to avoid the warning.

Fixes 8974eb588283b ("x86/speculation: Add Gather Data Sampling mitigation")
---
 include/linux/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/cpu.h +0 -0
index 9d43b734170d6..0abd60a7987b6 100644

include/linux/cpu.h extern ssize_t cpu_show_retbleed(struct device *dev, · line 80

Quoted 8 lines
include/linux/cpu.h +2 -0
@@ -73,6 +73,8 @@ extern ssize_t cpu_show_retbleed(struct device *dev,
 				 struct device_attribute *attr, char *buf);
 extern ssize_t cpu_show_spec_rstack_overflow(struct device *dev,
 					     struct device_attribute *attr, char *buf);
+extern ssize_t cpu_show_gds(struct device *dev,
+			    struct device_attribute *attr, char *buf);
 
 extern __printf(4, 5)
 struct device *cpu_device_create(struct device *parent, void *drvdata,

Sorry I missed that. Shouldn't stable be CC'd here as well?

Thanks,
Dan

#7 lore raw
In reply to Arnd Bergmann
Quoted 3 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added function has two definitions but no prototypes:

Thanks for these, Arnd. We'll get these up to Linus, probably alongside some of the other fixes for the other hardware issues that got mitigated this week.