public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype
@ 2023-08-09 13:04 Arnd Bergmann
  2023-08-09 13:05 ` [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2023-08-09 13:04 UTC (permalink / raw)
  To: x86, Thomas Gleixner, Peter Zijlstra, Josh Poimboeuf, Dave Hansen,
	Daniel Sneddon
  Cc: Borislav Petkov, Ingo Molnar, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/cpu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 9d43b734170d6..0abd60a7987b6 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header
  2023-08-09 13:04 [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Arnd Bergmann
@ 2023-08-09 13:05 ` Arnd Bergmann
  2023-08-09 16:54   ` Daniel Sneddon
  2023-08-09 15:46 ` [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Daniel Sneddon
  2023-08-09 22:13 ` Dave Hansen
  2 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2023-08-09 13:05 UTC (permalink / raw)
  To: x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Sean Christopherson, Paolo Bonzini, Josh Poimboeuf,
	Daniel Sneddon
  Cc: Arnd Bergmann, H. Peter Anvin, Peter Zijlstra (Intel),
	Maxim Levitsky, Michal Luczaj, linux-kernel, kvm

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/processor.h | 2 ++
 arch/x86/kvm/x86.c               | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index e5b0e23a7a830..01786f3e289cb 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -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 */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 17b1ee7f839c3..a7d97cde19678 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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.
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype
  2023-08-09 13:04 [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Arnd Bergmann
  2023-08-09 13:05 ` [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header Arnd Bergmann
@ 2023-08-09 15:46 ` Daniel Sneddon
  2023-08-09 22:13 ` Dave Hansen
  2 siblings, 0 replies; 8+ messages in thread
From: Daniel Sneddon @ 2023-08-09 15:46 UTC (permalink / raw)
  To: Arnd Bergmann, x86, Thomas Gleixner, Peter Zijlstra,
	Josh Poimboeuf, Dave Hansen
  Cc: Borislav Petkov, Ingo Molnar, Arnd Bergmann, linux-kernel

On 8/9/23 06:04, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 9d43b734170d6..0abd60a7987b6 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header
  2023-08-09 13:05 ` [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header Arnd Bergmann
@ 2023-08-09 16:54   ` Daniel Sneddon
  2023-08-09 18:26     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Sneddon @ 2023-08-09 16:54 UTC (permalink / raw)
  To: Arnd Bergmann, x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, Sean Christopherson, Paolo Bonzini, Josh Poimboeuf
  Cc: Arnd Bergmann, H. Peter Anvin, Peter Zijlstra (Intel),
	Maxim Levitsky, Michal Luczaj, linux-kernel, kvm

HI Arnd,

On 8/9/23 06:05, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header
  2023-08-09 16:54   ` Daniel Sneddon
@ 2023-08-09 18:26     ` Arnd Bergmann
  2023-08-09 19:16       ` Daniel Sneddon
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2023-08-09 18:26 UTC (permalink / raw)
  To: Daniel Sneddon, Arnd Bergmann, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Sean Christopherson, Paolo Bonzini,
	Josh Poimboeuf
  Cc: H. Peter Anvin, Peter Zijlstra, Maxim Levitsky, Michal Luczaj,
	linux-kernel, kvm

On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
> HI Arnd,
>
> On 8/9/23 06:05, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header
  2023-08-09 18:26     ` Arnd Bergmann
@ 2023-08-09 19:16       ` Daniel Sneddon
  2023-08-09 19:20         ` Daniel Sneddon
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Sneddon @ 2023-08-09 19:16 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Sean Christopherson, Paolo Bonzini,
	Josh Poimboeuf
  Cc: H. Peter Anvin, Peter Zijlstra, Maxim Levitsky, Michal Luczaj,
	linux-kernel, kvm

On 8/9/23 11:26, Arnd Bergmann wrote:
> On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
>> HI Arnd,
>>
>> On 8/9/23 06:05, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> 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

That explains why I wasn't seeing it.

Feel free to add:
Tested-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>

Thanks,
Dan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header
  2023-08-09 19:16       ` Daniel Sneddon
@ 2023-08-09 19:20         ` Daniel Sneddon
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Sneddon @ 2023-08-09 19:20 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Sean Christopherson, Paolo Bonzini,
	Josh Poimboeuf
  Cc: H. Peter Anvin, Peter Zijlstra, Maxim Levitsky, Michal Luczaj,
	linux-kernel, kvm

On 8/9/23 12:16, Daniel Sneddon wrote:
> On 8/9/23 11:26, Arnd Bergmann wrote:
>> On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
>>> HI Arnd,
>>>
>>> On 8/9/23 06:05, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> 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
> 
> That explains why I wasn't seeing it.
> 
> Feel free to add:
> Tested-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
> 
> Thanks,
> Dan

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

BR,
Dan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype
  2023-08-09 13:04 [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Arnd Bergmann
  2023-08-09 13:05 ` [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header Arnd Bergmann
  2023-08-09 15:46 ` [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Daniel Sneddon
@ 2023-08-09 22:13 ` Dave Hansen
  2 siblings, 0 replies; 8+ messages in thread
From: Dave Hansen @ 2023-08-09 22:13 UTC (permalink / raw)
  To: Arnd Bergmann, x86, Thomas Gleixner, Peter Zijlstra,
	Josh Poimboeuf, Dave Hansen, Daniel Sneddon
  Cc: Borislav Petkov, Ingo Molnar, Arnd Bergmann, linux-kernel

On 8/9/23 06:04, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-09 22:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 13:04 [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Arnd Bergmann
2023-08-09 13:05 ` [PATCH 2/2] x86: move gds_ucode_mitigated() declaration to header Arnd Bergmann
2023-08-09 16:54   ` Daniel Sneddon
2023-08-09 18:26     ` Arnd Bergmann
2023-08-09 19:16       ` Daniel Sneddon
2023-08-09 19:20         ` Daniel Sneddon
2023-08-09 15:46 ` [PATCH 1/2] x86/speculation: add cpu_show_gds() prototype Daniel Sneddon
2023-08-09 22:13 ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox