* [PATCH v3 1/7] x86: Fix amd_check_microcode() declaration
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 2/7] x86: apic: hide unused safe_smp_processor_id on UP Arnd Bergmann
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The newly added amd_check_microcode() function has two conflicting definitions
if CONFIG_CPU_SUP_AMD is enabled and CONFIG_MICROCODE_AMD is disabled. Since
the header with the stub definition is not included in cpu/amd.c, this only
causes a -Wmissing-prototype warning with W=1
arch/x86/kernel/cpu/amd.c:1289:6: error: no previous prototype for 'amd_check_microcode' [-Werror=missing-prototypes]
Adding the missing #include shows the other problem:
arch/x86/kernel/cpu/amd.c:1290:6: error: redefinition of 'amd_check_microcode'
arch/x86/include/asm/microcode_amd.h:58:20: note: previous definition of 'amd_check_microcode' with type 'void(void)'
Move the declaration into a more appropriate header that is already included,
with the #ifdef check changed to match the definition's.
Fixes: 522b1d69219d8 ("x86/cpu/amd: Add a Zenbleed fix")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/include/asm/microcode_amd.h | 3 +--
arch/x86/include/asm/processor.h | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index a9b3f9635727e..81d3294b2b5e2 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -47,12 +47,11 @@ struct microcode_amd {
extern void load_ucode_amd_early(unsigned int cpuid_1_eax);
extern int __init save_microcode_in_initrd_amd(unsigned int family);
void reload_ucode_amd(unsigned int cpu);
-extern void amd_check_microcode(void);
#else
static inline void load_ucode_amd_early(unsigned int cpuid_1_eax) {}
static inline int __init
save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
static inline void reload_ucode_amd(unsigned int cpu) {}
-static inline void amd_check_microcode(void) {}
#endif
+
#endif /* _ASM_X86_MICROCODE_AMD_H */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index d46300e94f853..36d52075fdade 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -682,9 +682,11 @@ extern u16 get_llc_id(unsigned int cpu);
#ifdef CONFIG_CPU_SUP_AMD
extern u32 amd_get_nodes_per_socket(void);
extern u32 amd_get_highest_perf(void);
+extern void amd_check_microcode(void);
#else
static inline u32 amd_get_nodes_per_socket(void) { return 0; }
static inline u32 amd_get_highest_perf(void) { return 0; }
+static inline void amd_check_microcode(void) { }
#endif
extern unsigned long arch_align_stack(unsigned long sp);
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v3 2/7] x86: apic: hide unused safe_smp_processor_id on UP
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 1/7] x86: Fix amd_check_microcode() declaration Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 3/7] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
When CONFIG_SMP is disabled, the prototype for safe_smp_processor_id()
is hidden, which causes a W=1 warning:
/home/arnd/arm-soc/arch/x86/kernel/apic/ipi.c:316:5: error: no previous prototype for 'safe_smp_processor_id' [-Werror=missing-prototypes]
Since there are no callers in this configuration, just hide the definition
as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/apic/ipi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 2a6509e8c840d..9bfd6e3973845 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -301,6 +301,7 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
local_irq_restore(flags);
}
+#ifdef CONFIG_SMP
/* must come after the send_IPI functions above for inlining */
static int convert_apicid_to_cpu(int apic_id)
{
@@ -329,3 +330,4 @@ int safe_smp_processor_id(void)
return cpuid >= 0 ? cpuid : 0;
}
#endif
+#endif
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v3 3/7] x86: avoid unneeded __div64_32 function definition
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 1/7] x86: Fix amd_check_microcode() declaration Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 2/7] x86: apic: hide unused safe_smp_processor_id on UP Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 15:59 ` [tip: x86/cleanups] x86/asm: Avoid " tip-bot2 for Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 4/7] x86: purgatory: include header for warn() declaration Arnd Bergmann
` (4 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The __div64_32() function is provided for 32-bit architectures that
don't have a custom do_div() implementation. x86_32 has one, and
does not use the header file that declares the function prototype,
so the definition causes a W=1 warning:
lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Werror=missing-prototypes]
Define an empty macro to prevent the function definition from getting
built, which avoids the warning and saves a little .text space.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: improve code comment
---
arch/x86/include/asm/div64.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
index b8f1dc0761e4b..9931e4c7d73f3 100644
--- a/arch/x86/include/asm/div64.h
+++ b/arch/x86/include/asm/div64.h
@@ -71,6 +71,12 @@ static inline u64 mul_u32_u32(u32 a, u32 b)
}
#define mul_u32_u32 mul_u32_u32
+/*
+ * __div64_32() is never called on x86, so prevent the
+ * generic definition from getting built.
+ */
+#define __div64_32
+
#else
# include <asm-generic/div64.h>
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [tip: x86/cleanups] x86/asm: Avoid unneeded __div64_32 function definition
2023-08-03 8:26 ` [PATCH v3 3/7] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
@ 2023-08-03 15:59 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-08-03 15:59 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 65412c8d72741cc6e6b082b478b8957d7e7c0480
Gitweb: https://git.kernel.org/tip/65412c8d72741cc6e6b082b478b8957d7e7c0480
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 03 Aug 2023 10:26:15 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 03 Aug 2023 12:08:35 +02:00
x86/asm: Avoid unneeded __div64_32 function definition
The __div64_32() function is provided for 32-bit architectures that
don't have a custom do_div() implementation. x86_32 has one, and
does not use the header file that declares the function prototype,
so the definition causes a W=1 warning:
lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Werror=missing-prototypes]
Define an empty macro to prevent the function definition from getting
built, which avoids the warning and saves a little .text space.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230803082619.1369127-4-arnd@kernel.org
---
arch/x86/include/asm/div64.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
index b8f1dc0..9931e4c 100644
--- a/arch/x86/include/asm/div64.h
+++ b/arch/x86/include/asm/div64.h
@@ -71,6 +71,12 @@ static inline u64 mul_u32_u32(u32 a, u32 b)
}
#define mul_u32_u32 mul_u32_u32
+/*
+ * __div64_32() is never called on x86, so prevent the
+ * generic definition from getting built.
+ */
+#define __div64_32
+
#else
# include <asm-generic/div64.h>
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 4/7] x86: purgatory: include header for warn() declaration
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
` (2 preceding siblings ...)
2023-08-03 8:26 ` [PATCH v3 3/7] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 15:59 ` [tip: x86/cleanups] x86/purgatory: Include " tip-bot2 for Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 5/7] x86: alternative: add __alt_reloc_selftest prototype Arnd Bergmann
` (3 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The purgatory code has uses parts of the decompressor and provides
its own warn() function, but has to include the corresponding
header file to avoid a -Wmissing-prototypes warning.
It turns out that this the function prototype actually differs
from the declaration, so change it to get a constant pointer
in the declaration and the other definition as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/boot/compressed/error.c | 2 +-
arch/x86/boot/compressed/error.h | 2 +-
arch/x86/purgatory/purgatory.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/error.c b/arch/x86/boot/compressed/error.c
index 5313c5cb2b802..19a8251de506a 100644
--- a/arch/x86/boot/compressed/error.c
+++ b/arch/x86/boot/compressed/error.c
@@ -7,7 +7,7 @@
#include "misc.h"
#include "error.h"
-void warn(char *m)
+void warn(const char *m)
{
error_putstr("\n\n");
error_putstr(m);
diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 86fe33b937154..31f9e080d61a8 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -4,7 +4,7 @@
#include <linux/compiler.h>
-void warn(char *m);
+void warn(const char *m);
void error(char *m) __noreturn;
void panic(const char *fmt, ...) __noreturn __cold;
diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 7558139920f8c..aea47e7939637 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -14,6 +14,7 @@
#include <crypto/sha2.h>
#include <asm/purgatory.h>
+#include "../boot/compressed/error.h"
#include "../boot/string.h"
u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory");
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [tip: x86/cleanups] x86/purgatory: Include header for warn() declaration
2023-08-03 8:26 ` [PATCH v3 4/7] x86: purgatory: include header for warn() declaration Arnd Bergmann
@ 2023-08-03 15:59 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-08-03 15:59 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 6d33531bc0234332572ae612232d947f353a4450
Gitweb: https://git.kernel.org/tip/6d33531bc0234332572ae612232d947f353a4450
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 03 Aug 2023 10:26:16 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 03 Aug 2023 16:37:18 +02:00
x86/purgatory: Include header for warn() declaration
The purgatory code uses parts of the decompressor and provides its own
warn() function, but has to include the corresponding header file to
avoid a -Wmissing-prototypes warning.
It turns out that this function prototype actually differs from the
declaration, so change it to get a constant pointer in the declaration
and the other definition as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230803082619.1369127-5-arnd@kernel.org
---
arch/x86/boot/compressed/error.c | 2 +-
arch/x86/boot/compressed/error.h | 2 +-
arch/x86/purgatory/purgatory.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/error.c b/arch/x86/boot/compressed/error.c
index 5313c5c..19a8251 100644
--- a/arch/x86/boot/compressed/error.c
+++ b/arch/x86/boot/compressed/error.c
@@ -7,7 +7,7 @@
#include "misc.h"
#include "error.h"
-void warn(char *m)
+void warn(const char *m)
{
error_putstr("\n\n");
error_putstr(m);
diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 86fe33b..31f9e08 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -4,7 +4,7 @@
#include <linux/compiler.h>
-void warn(char *m);
+void warn(const char *m);
void error(char *m) __noreturn;
void panic(const char *fmt, ...) __noreturn __cold;
diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 7558139..aea47e7 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -14,6 +14,7 @@
#include <crypto/sha2.h>
#include <asm/purgatory.h>
+#include "../boot/compressed/error.h"
#include "../boot/string.h"
u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory");
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/7] x86: alternative: add __alt_reloc_selftest prototype
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
` (3 preceding siblings ...)
2023-08-03 8:26 ` [PATCH v3 4/7] x86: purgatory: include header for warn() declaration Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 15:59 ` [tip: x86/cleanups] x86/alternative: Add a __alt_reloc_selftest() prototype tip-bot2 for Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning Arnd Bergmann
` (2 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The newly introduced selftest function causes a warning when -Wmissing-prototypes
is enabled:
arch/x86/kernel/alternative.c:1461:32: error: no previous prototype for '__alt_reloc_selftest' [-Werror=missing-prototypes]
Since it's only used locally, add the prototype directly in front of it.
Fixes: 270a69c4485d ("x86/alternative: Support relocations in alternatives")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/alternative.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 2dcf3a06af090..934c23f24a3f8 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1531,6 +1531,7 @@ static noinline void __init int3_selftest(void)
static __initdata int __alt_reloc_selftest_addr;
+extern void __init __alt_reloc_selftest(void *arg);
__visible noinline void __init __alt_reloc_selftest(void *arg)
{
WARN_ON(arg != &__alt_reloc_selftest_addr);
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [tip: x86/cleanups] x86/alternative: Add a __alt_reloc_selftest() prototype
2023-08-03 8:26 ` [PATCH v3 5/7] x86: alternative: add __alt_reloc_selftest prototype Arnd Bergmann
@ 2023-08-03 15:59 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-08-03 15:59 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 1a3e4b4da39bbf540a379e21869faa74bb19d16f
Gitweb: https://git.kernel.org/tip/1a3e4b4da39bbf540a379e21869faa74bb19d16f
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 03 Aug 2023 10:26:17 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 03 Aug 2023 16:40:50 +02:00
x86/alternative: Add a __alt_reloc_selftest() prototype
The newly introduced selftest function causes a warning when -Wmissing-prototypes
is enabled:
arch/x86/kernel/alternative.c:1461:32: error: no previous prototype for '__alt_reloc_selftest' [-Werror=missing-prototypes]
Since it's only used locally, add the prototype directly in front of it.
Fixes: 270a69c4485d ("x86/alternative: Support relocations in alternatives")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230803082619.1369127-6-arnd@kernel.org
---
arch/x86/kernel/alternative.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 2dcf3a0..934c23f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1531,6 +1531,7 @@ static noinline void __init int3_selftest(void)
static __initdata int __alt_reloc_selftest_addr;
+extern void __init __alt_reloc_selftest(void *arg);
__visible noinline void __init __alt_reloc_selftest(void *arg)
{
WARN_ON(arg != &__alt_reloc_selftest_addr);
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
` (4 preceding siblings ...)
2023-08-03 8:26 ` [PATCH v3 5/7] x86: alternative: add __alt_reloc_selftest prototype Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 15:59 ` [tip: x86/cleanups] x86/paravirt: Silence " tip-bot2 for Arnd Bergmann
2023-08-03 8:26 ` [PATCH v3 7/7] x86: qspinlock-paravirt: fix mising-prototype warning Arnd Bergmann
2023-08-03 10:04 ` [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Borislav Petkov
7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The native_pv_lock_init function is only used in SMP configurations
and declared in asm/qspinlock.h, which is not used in UP kernels,
but the function is still defined for both, which causes a warning:
arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'native_pv_lock_init' [-Werror=missing-prototypes]
Move the declaration to asm/paravirt.h so it is visible even
with CONFIG_SMP but short-circuit the definition to turn it
into an empty function.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: new patch to avoid adding another #ifdef to paravirt.c
---
arch/x86/include/asm/paravirt.h | 7 +++++++
arch/x86/include/asm/qspinlock.h | 7 +------
arch/x86/kernel/paravirt.c | 3 ++-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index b49778664d2be..6c8ff12140aea 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -739,6 +739,7 @@ static __always_inline unsigned long arch_local_irq_save(void)
".popsection")
extern void default_banner(void);
+void native_pv_lock_init(void) __init;
#else /* __ASSEMBLY__ */
@@ -778,6 +779,12 @@ extern void default_banner(void);
#endif /* __ASSEMBLY__ */
#else /* CONFIG_PARAVIRT */
# define default_banner x86_init_noop
+
+#ifndef __ASSEMBLY__
+static inline void native_pv_lock_init(void)
+{
+}
+#endif
#endif /* !CONFIG_PARAVIRT */
#ifndef __ASSEMBLY__
diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index d87451df480bd..cde8357bb226d 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -74,8 +74,6 @@ static inline bool vcpu_is_preempted(long cpu)
*/
DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
-void native_pv_lock_init(void) __init;
-
/*
* Shortcut for the queued_spin_lock_slowpath() function that allows
* virt to hijack it.
@@ -103,10 +101,7 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
return true;
}
-#else
-static inline void native_pv_lock_init(void)
-{
-}
+
#endif /* CONFIG_PARAVIRT */
#include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 89842bb7ec9cc..066fc19d2568e 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -75,7 +75,8 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
void __init native_pv_lock_init(void)
{
- if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
+ if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) &&
+ !boot_cpu_has(X86_FEATURE_HYPERVISOR))
static_branch_disable(&virt_spin_lock_key);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [tip: x86/cleanups] x86/paravirt: Silence unused native_pv_lock_init() function warning
2023-08-03 8:26 ` [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning Arnd Bergmann
@ 2023-08-03 15:59 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-08-03 15:59 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: ce0a1b608bfc709cf366f020b520310a3b3272c3
Gitweb: https://git.kernel.org/tip/ce0a1b608bfc709cf366f020b520310a3b3272c3
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 03 Aug 2023 10:26:18 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 03 Aug 2023 16:50:19 +02:00
x86/paravirt: Silence unused native_pv_lock_init() function warning
The native_pv_lock_init() function is only used in SMP configurations
and declared in asm/qspinlock.h which is not used in UP kernels, but
the function is still defined for both, which causes a warning:
arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'native_pv_lock_init' [-Werror=missing-prototypes]
Move the declaration to asm/paravirt.h so it is visible even
with CONFIG_SMP but short-circuit the definition to turn it
into an empty function.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230803082619.1369127-7-arnd@kernel.org
---
arch/x86/include/asm/paravirt.h | 7 +++++++
arch/x86/include/asm/qspinlock.h | 7 +------
arch/x86/kernel/paravirt.c | 3 ++-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index b497786..6c8ff12 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -739,6 +739,7 @@ static __always_inline unsigned long arch_local_irq_save(void)
".popsection")
extern void default_banner(void);
+void native_pv_lock_init(void) __init;
#else /* __ASSEMBLY__ */
@@ -778,6 +779,12 @@ extern void default_banner(void);
#endif /* __ASSEMBLY__ */
#else /* CONFIG_PARAVIRT */
# define default_banner x86_init_noop
+
+#ifndef __ASSEMBLY__
+static inline void native_pv_lock_init(void)
+{
+}
+#endif
#endif /* !CONFIG_PARAVIRT */
#ifndef __ASSEMBLY__
diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index d87451d..cde8357 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -74,8 +74,6 @@ static inline bool vcpu_is_preempted(long cpu)
*/
DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key);
-void native_pv_lock_init(void) __init;
-
/*
* Shortcut for the queued_spin_lock_slowpath() function that allows
* virt to hijack it.
@@ -103,10 +101,7 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
return true;
}
-#else
-static inline void native_pv_lock_init(void)
-{
-}
+
#endif /* CONFIG_PARAVIRT */
#include <asm-generic/qspinlock.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index ac10b46..32e94a3 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -75,7 +75,8 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
void __init native_pv_lock_init(void)
{
- if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
+ if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) &&
+ !boot_cpu_has(X86_FEATURE_HYPERVISOR))
static_branch_disable(&virt_spin_lock_key);
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 7/7] x86: qspinlock-paravirt: fix mising-prototype warning
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
` (5 preceding siblings ...)
2023-08-03 8:26 ` [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning Arnd Bergmann
@ 2023-08-03 8:26 ` Arnd Bergmann
2023-08-03 15:59 ` [tip: x86/cleanups] x86/qspinlock-paravirt: Fix missing-prototype warning tip-bot2 for Arnd Bergmann
2023-08-03 10:04 ` [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Borislav Petkov
7 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2023-08-03 8:26 UTC (permalink / raw)
To: Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
__pv_queued_spin_unlock_slowpath is defined in a header file as a global
function, and designed to be called from an inline asm, but there is
no prototype visible in the definition:
kernel/locking/qspinlock_paravirt.h:493:1: error: no previous prototype for '__pv_queued_spin_unlock_slowpath' [-Werror=missing-prototypes]
Add this to the x86 header that contains the inline asm calling it,
and ensure this gets included before the definition, rather than
after it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: split out native_pv_lock_init() changes into a separate patch,
keeping only __pv_queued_spin_unlock_slowpath here
---
arch/x86/include/asm/qspinlock_paravirt.h | 2 ++
kernel/locking/qspinlock_paravirt.h | 20 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h
index 42b17cf10b10e..85b6e3609cb92 100644
--- a/arch/x86/include/asm/qspinlock_paravirt.h
+++ b/arch/x86/include/asm/qspinlock_paravirt.h
@@ -4,6 +4,8 @@
#include <asm/ibt.h>
+void __lockfunc __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked);
+
/*
* For x86-64, PV_CALLEE_SAVE_REGS_THUNK() saves and restores 8 64-bit
* registers. For i386, however, only 1 32-bit register needs to be saved
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index 6afc249ce697d..6a0184e9c2348 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -485,6 +485,16 @@ pv_wait_head_or_lock(struct qspinlock *lock, struct mcs_spinlock *node)
return (u32)(atomic_read(&lock->val) | _Q_LOCKED_VAL);
}
+/*
+ * Include the architecture specific callee-save thunk of the
+ * __pv_queued_spin_unlock(). This thunk is put together with
+ * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
+ * function close to each other sharing consecutive instruction cachelines.
+ * Alternatively, architecture specific version of __pv_queued_spin_unlock()
+ * can be defined.
+ */
+#include <asm/qspinlock_paravirt.h>
+
/*
* PV versions of the unlock fastpath and slowpath functions to be used
* instead of queued_spin_unlock().
@@ -533,16 +543,6 @@ __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked)
pv_kick(node->cpu);
}
-/*
- * Include the architecture specific callee-save thunk of the
- * __pv_queued_spin_unlock(). This thunk is put together with
- * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
- * function close to each other sharing consecutive instruction cachelines.
- * Alternatively, architecture specific version of __pv_queued_spin_unlock()
- * can be defined.
- */
-#include <asm/qspinlock_paravirt.h>
-
#ifndef __pv_queued_spin_unlock
__visible __lockfunc void __pv_queued_spin_unlock(struct qspinlock *lock)
{
--
2.39.2
^ permalink raw reply related [flat|nested] 14+ messages in thread* [tip: x86/cleanups] x86/qspinlock-paravirt: Fix missing-prototype warning
2023-08-03 8:26 ` [PATCH v3 7/7] x86: qspinlock-paravirt: fix mising-prototype warning Arnd Bergmann
@ 2023-08-03 15:59 ` tip-bot2 for Arnd Bergmann
0 siblings, 0 replies; 14+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-08-03 15:59 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Arnd Bergmann, Borislav Petkov (AMD), x86, linux-kernel
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 8874a414f8f706daf1de467cbf2550988ebec09d
Gitweb: https://git.kernel.org/tip/8874a414f8f706daf1de467cbf2550988ebec09d
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 03 Aug 2023 10:26:19 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 03 Aug 2023 17:15:05 +02:00
x86/qspinlock-paravirt: Fix missing-prototype warning
__pv_queued_spin_unlock_slowpath() is defined in a header file as
a global function, and designed to be called from inline asm, but
there is no prototype visible in the definition:
kernel/locking/qspinlock_paravirt.h:493:1: error: no previous \
prototype for '__pv_queued_spin_unlock_slowpath' [-Werror=missing-prototypes]
Add this to the x86 header that contains the inline asm calling it,
and ensure this gets included before the definition, rather than
after it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230803082619.1369127-8-arnd@kernel.org
---
arch/x86/include/asm/qspinlock_paravirt.h | 2 ++
kernel/locking/qspinlock_paravirt.h | 20 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h
index 42b17cf..85b6e36 100644
--- a/arch/x86/include/asm/qspinlock_paravirt.h
+++ b/arch/x86/include/asm/qspinlock_paravirt.h
@@ -4,6 +4,8 @@
#include <asm/ibt.h>
+void __lockfunc __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked);
+
/*
* For x86-64, PV_CALLEE_SAVE_REGS_THUNK() saves and restores 8 64-bit
* registers. For i386, however, only 1 32-bit register needs to be saved
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index 6afc249..6a0184e 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -486,6 +486,16 @@ gotlock:
}
/*
+ * Include the architecture specific callee-save thunk of the
+ * __pv_queued_spin_unlock(). This thunk is put together with
+ * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
+ * function close to each other sharing consecutive instruction cachelines.
+ * Alternatively, architecture specific version of __pv_queued_spin_unlock()
+ * can be defined.
+ */
+#include <asm/qspinlock_paravirt.h>
+
+/*
* PV versions of the unlock fastpath and slowpath functions to be used
* instead of queued_spin_unlock().
*/
@@ -533,16 +543,6 @@ __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked)
pv_kick(node->cpu);
}
-/*
- * Include the architecture specific callee-save thunk of the
- * __pv_queued_spin_unlock(). This thunk is put together with
- * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
- * function close to each other sharing consecutive instruction cachelines.
- * Alternatively, architecture specific version of __pv_queued_spin_unlock()
- * can be defined.
- */
-#include <asm/qspinlock_paravirt.h>
-
#ifndef __pv_queued_spin_unlock
__visible __lockfunc void __pv_queued_spin_unlock(struct qspinlock *lock)
{
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes
2023-08-03 8:26 [PATCH v3 0/7] x86: remaining -Wmissing-prototype warning fixes Arnd Bergmann
` (6 preceding siblings ...)
2023-08-03 8:26 ` [PATCH v3 7/7] x86: qspinlock-paravirt: fix mising-prototype warning Arnd Bergmann
@ 2023-08-03 10:04 ` Borislav Petkov
7 siblings, 0 replies; 14+ messages in thread
From: Borislav Petkov @ 2023-08-03 10:04 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, linux-kernel, x86,
Arnd Bergmann
On Thu, Aug 03, 2023 at 10:26:12AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> This is almost the same as before, and should let us turn
> on -Wmissing-prototypes by default. I'm still unsure whether
> we need to do this per architecture as some other ones still
> produce a lot of warnings, or we just enabled it for everyone
> and let arch maintainers deal with it now that the major
Yeah, might wanna ask them first.
I definitely want this finally enabled so that we can finally put this
one to rest.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 14+ messages in thread