x86: address -Wmissing-prototype warnings
Subsystems (17)
cover x86: address -Wmissing-prototype warnings
From: Arnd Bergmann <[email protected]>
This addresses all x86 specific prototype warnings. The majority of the patches should be straightforward, either adding an #include statement to get the right header, or ensuring that an unused global function is left out of the build when the prototype is hidden.
The ones that are a bit awkward are those that just add a prototype to shut up the warning, but the prototypes are never used for calling the function because the only caller is in assembler code. I tried to come up with other ways to shut up the compiler using the asmlinkage annotation, but with no success.
All of the warnings have to be addressed in some form before the warning can be enabled by default.
Arnd
Arnd Bergmann (20):
x86: move prepare_ftrace_return prototype to header
x86: ce4100: Mark local functions as 'static'
x86: apic: hide unused safe_smp_processor_id on UP
x86: avoid unneeded __div64_32 function definition
x86: head: add dummy prototype for mk_early_pgtbl_32
x86: math-emu: include asm/fpu/regset.h
x86: doublefault: avoid missing-prototype warnings
x86: highmem: include asm/numa.h for set_highmem_pages_init
x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled
x86: xen: add missing prototypes
x86: entry: add do_SYSENTER_32() prototype
x86: qspinlock-paravirt: fix mising-prototype warnings
x86: hibernate: declare global functions in suspend.h
x86: fbdev: include asm/fb.h as needed
x86: mce: add copy_mc_fragile_handle_tail prototype
x86: vdso: include vdso/processor.h
x86: usercopy: include arch_wb_cache_pmem declaration
x86: ioremap: add early_memremap_pgprot_adjust prototype
x86: purgatory: include header for warn() declaration
x86: olpc: avoid missing-prototype warnings
arch/x86/boot/compressed/error.c | 2 +- arch/x86/boot/compressed/error.h | 2 +- arch/x86/entry/vdso/vgetcpu.c | 1 + arch/x86/include/asm/div64.h | 2 ++ arch/x86/include/asm/doublefault.h | 4 ++++ arch/x86/include/asm/ftrace.h | 3 +++ arch/x86/include/asm/mce.h | 3 +++ arch/x86/include/asm/qspinlock_paravirt.h | 2 ++ arch/x86/include/asm/syscall.h | 6 ++++-- arch/x86/kernel/apic/ipi.c | 2 ++ arch/x86/kernel/doublefault_32.c | 1 + arch/x86/kernel/ftrace.c | 3 --- arch/x86/kernel/head32.c | 1 + arch/x86/kernel/paravirt.c | 2 ++ arch/x86/kernel/platform-quirks.c | 1 + arch/x86/lib/usercopy_64.c | 1 + arch/x86/math-emu/fpu_entry.c | 1 + arch/x86/mm/highmem_32.c | 1 + arch/x86/pci/ce4100.c | 4 ++-- arch/x86/platform/olpc/olpc_dt.c | 2 +- arch/x86/purgatory/purgatory.c | 1 + arch/x86/video/fbdev.c | 1 + arch/x86/xen/efi.c | 2 ++ arch/x86/xen/smp.h | 3 +++ arch/x86/xen/xen-ops.h | 14 ++++++++++++++ include/linux/io.h | 5 +++++ include/linux/olpc-ec.h | 2 ++ include/linux/suspend.h | 4 ++++ include/xen/xen.h | 3 +++ kernel/locking/qspinlock_paravirt.h | 20 ++++++++++---------- kernel/power/power.h | 5 ----- mm/internal.h | 6 ------ 32 files changed, 79 insertions(+), 31 deletions(-)
Signature · 29 lines
2.39.2 Cc: Thomas Gleixner <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/5=20%,authored:1/5=20%) Cc: Ingo Molnar <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: Borislav Petkov <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/3=33%,commit_signer:1/5=20%,authored:1/5=20%,removed_lines:40/51=78%) Cc: Dave Hansen <[email protected]> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/5=20%) Cc: [email protected] (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: "H. Peter Anvin" <[email protected]> (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: Andy Lutomirski <[email protected]> (maintainer:X86 VDSO) Cc: Steven Rostedt <[email protected]> (maintainer:FUNCTION HOOKS (FTRACE)) Cc: Masami Hiramatsu <[email protected]> (maintainer:FUNCTION HOOKS (FTRACE)) Cc: Mark Rutland <[email protected]> (reviewer:FUNCTION HOOKS (FTRACE)) Cc: Juergen Gross <[email protected]> (supporter:PARAVIRT_OPS INTERFACE,commit_signer:2/5=40%,authored:1/5=20%,added_lines:20/31=65%,removed_lines:27/35=77%) Cc: "Srivatsa S. Bhat (VMware)" <[email protected]> (supporter:PARAVIRT_OPS INTERFACE) Cc: Alexey Makhalov <[email protected]> (reviewer:PARAVIRT_OPS INTERFACE) Cc: VMware PV-Drivers Reviewers <[email protected]> (reviewer:PARAVIRT_OPS INTERFACE) Cc: Peter Zijlstra <[email protected]> (maintainer:X86 MM,commit_signer:4/5=80%,commit_signer:1/2=50%) Cc: Darren Hart <[email protected]> (reviewer:X86 PLATFORM DRIVERS - ARCH) Cc: Andy Shevchenko <[email protected]> (reviewer:X86 PLATFORM DRIVERS - ARCH) Cc: Boris Ostrovsky <[email protected]> (reviewer:XEN HYPERVISOR X86) Cc: "Rafael J. Wysocki" <[email protected]> (supporter:HIBERNATION (aka Software Suspend, aka swsusp)) Cc: [email protected] (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Cc: [email protected] (open list:FUNCTION HOOKS (FTRACE)) Cc: [email protected] (open list:PARAVIRT_OPS INTERFACE) Cc: [email protected] (open list:PCI SUBSYSTEM) Cc: [email protected] (open list:X86 PLATFORM DRIVERS - ARCH) Cc: [email protected] (moderated list:XEN HYPERVISOR X86) Cc: [email protected] (open list:HIBERNATION (aka Software Suspend, aka swsusp)) Cc: [email protected] (open list:MEMORY MANAGEMENT)
PATCH 1/20 x86: move prepare_ftrace_return prototype to header
From: Arnd Bergmann <[email protected]>
On 32-bit builds, the prepare_ftrace_return() function only has a global definition, but no prototype before it, which causes a warning:
arch/x86/kernel/ftrace.c:625:6: warning: no previous prototype for ‘prepare_ftrace_return’ [-Wmissing-prototypes]
625 | void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
Move the prototype that is already needed for some configurations into a header file where it can be seen unconditionally.
--- arch/x86/include/asm/ftrace.h | 3 +++ arch/x86/kernel/ftrace.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/ftrace.h +3 -0
@@ -106,6 +106,9 @@ struct dyn_arch_ftrace {#ifndef __ASSEMBLY__ +void prepare_ftrace_return (unsigned long ip,unsigned long *parent, +unsigned long frame_pointer); +#if defined(CONFIG_FUNCTION_TRACER ) && defined(CONFIG_DYNAMIC_FTRACE )extern void set_ftrace_ops_ro (void );#else
arch/x86/kernel/ftrace.c +0 -3
@@ -525,9 +525,6 @@ static void *addr_from_call(void *ptr)return ptr +CALL_INSN_SIZE + call.disp; } -void prepare_ftrace_return (unsigned long ip,unsigned long *parent, -unsigned long frame_pointer); -/* * If the ops->trampoline was not allocated, then it probably * has a static trampoline func, or is the ftrace caller itself.
Signature · 1 line
2.39.2
Re: [PATCH 01/20] x86: move prepare_ftrace_return prototype to header
arch/x86/include/asm/ftrace.h
Quoted 21 lines · On Tue, 16 May 2023 21:35:30 +0200 Arnd Bergmann <[email protected]> wrote:
From: Arnd Bergmann <[email protected]>
On 32-bit builds, the
prepare_ftrace_return()function only has a global definition, but no prototype before it, which causes a warning:
arch/x86/kernel/ftrace.c:625:6: warning: no previous prototype for ‘prepare_ftrace_return’ [-Wmissing-prototypes]
625 | void prepare_ftrace_return(unsigned long ip, unsigned long *parent,Move the prototype that is already needed for some configurations into a header file where it can be seen unconditionally.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/x86/include/asm/ftrace.h | 3 +++ arch/x86/kernel/ftrace.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)arch/x86/include/asm/ftrace.h +0
-0
-- Steve
PATCH 2/20 x86: ce4100: Mark local functions as 'static'
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Two functions in this file are global but have no prototype in a header and are not called from elsewhere, so they should be static:
arch/x86/pci/ce4100.c:86:6: error: no previous prototype for 'sata_revid_init' [-Werror=missing-prototypes] arch/x86/pci/ce4100.c:175:5: error: no previous prototype for 'bridge_read' [-Werror=missing-prototypes]
--- arch/x86/pci/ce4100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/pci/ce4100.c +2 -2
@@ -83,7 +83,7 @@ static void ehci_reg_read(struct sim_dev_reg *reg, u32 *value) *value |=0x100 ; } -void sata_revid_init (struct sim_dev_reg *reg) +static void sata_revid_init (struct sim_dev_reg *reg) { reg->sim_reg.value =0x01060100 ; reg->sim_reg.mask =0 ;
@@ -172,7 +172,7 @@ static inline void extract_bytes(u32 *value, int reg, int len) *value &= mask; } -int bridge_read (unsigned int devfn,int reg,int len,u32 *value) +static int bridge_read (unsigned int devfn,int reg,int len,u32 *value) {u32 av_bridge_base, av_bridge_limit;int retval =0 ;
Signature · 1 line
2.39.2
PATCH 3/20 x86: apic: hide unused safe_smp_processor_id on UP
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
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.
--- arch/x86/kernel/apic/ipi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/apic/ipi.c +2 -0
@@ -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
Signature · 1 line
2.39.2
PATCH 4/20 x86: avoid unneeded __div64_32 function definition
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
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.
--- arch/x86/include/asm/div64.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/div64.h +2 -0
@@ -71,6 +71,8 @@ static inline u64 mul_u32_u32(u32 a, u32 b) }#define mul_u32_u32 mul_u32_u32 +#define __div64_32/* not needed */ +#else # include <asm-generic/div64.h>
Signature · 1 line
2.39.2
PATCH 5/20 x86: head: add dummy prototype for mk_early_pgtbl_32
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
'make W=1' warns about a function without a prototype in the x86-32 head code:
arch/x86/kernel/head32.c:72:13: error: no previous prototype for 'mk_early_pgtbl_32' [-Werror=missing-prototypes]
This is called from assembler code, so it does not actually need a prototype. I could not find an appropriate header for it, so just declare it in front of the definition to shut up th warning.
--- arch/x86/kernel/head32.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/head32.c +1 -0
@@ -69,6 +69,7 @@ asmlinkage __visible void __init __noreturn i386_start_kernel(void)* to the first kernel PMD. Note the upper half of each PMD or PTE are * always zero at this stage. */ +void __init mk_early_pgtbl_32 (void );void __init mk_early_pgtbl_32 (void ) {#ifdef __pa
Signature · 1 line
2.39.2
Re: [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32
From: Arnd Bergmann <[email protected]>
Date: Tue, 16 May 2023 21:35:34 +0200
Quoted 9 lines
From: Arnd Bergmann <[email protected]>
'make W=1' warns about a function without a prototype in the x86-32 head code:
arch/x86/kernel/head32.c:72:13: error: no previous prototype for 'mk_early_pgtbl_32' [-Werror=missing-prototypes]This is called from assembler code, so it does not actually need a prototype. I could not find an appropriate header for it, so just declare it in front of the definition to shut up th warning.
^^
the :pQuoted 2 lines
Signed-off-by Arnd Bergmann <[email protected]>
I'd say, for the whole series:
BUT apart from the Xen part, it's all black magic rituals to me :D
Thanks,
Olek
PATCH 6/20 x86: math-emu: include asm/fpu/regset.h
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The fpregs_soft_set/fpregs_soft_get functions are declared in a header that is not included in the file that defines them, causing a W=1 warning:
/home/arnd/arm-soc/arch/x86/math-emu/fpu_entry.c:638:5: error: no previous prototype for 'fpregs_soft_set' [-Werror=missing-prototypes]
638 | int fpregs_soft_set(struct task_struct *target,
| ^~~~~~~~~~~~~~~
/home/arnd/arm-soc/arch/x86/math-emu/fpu_entry.c:690:5: error: no previous prototype for 'fpregs_soft_get' [-Werror=missing-prototypes]
690 | int fpregs_soft_get(struct task_struct *target,
Include the file here to avoid the warning.
--- arch/x86/math-emu/fpu_entry.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/math-emu/fpu_entry.c +1 -0
@@ -32,6 +32,7 @@#include <asm/traps.h> #include <asm/user.h> #include <asm/fpu/api.h> +#include <asm/fpu/regset.h> #include "fpu_system.h" #include "fpu_emu.h"
Signature · 1 line
2.39.2
PATCH 7/20 x86: doublefault: avoid missing-prototype warnings
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Two functions in the 32-bit doublefault code are lacking a prototype:
arch/x86/kernel/doublefault_32.c:23:36: error: no previous prototype for 'doublefault_shim' [-Werror=missing-prototypes]
23 | asmlinkage noinstr void __noreturn doublefault_shim(void)
| ^~~~~~~~~~~~~~~~
arch/x86/kernel/doublefault_32.c:114:6: error: no previous prototype for 'doublefault_init_cpu_tss' [-Werror=missing-prototypes]
114 | void doublefault_init_cpu_tss(void)
The first one is only called from assembler, while the second one is declared in doublefault.h, but this file is not included.
Include the header file and add the other declaration there as well.
--- arch/x86/include/asm/doublefault.h | 4 ++++ arch/x86/kernel/doublefault_32.c | 1 + 2 files changed, 5 insertions(+)
arch/x86/include/asm/doublefault.h +4 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_DOUBLEFAULT_H#define _ASM_X86_DOUBLEFAULT_H +#include <linux/linkage.h> +#ifdef CONFIG_X86_32 extern void doublefault_init_cpu_tss (void );#else
@@ -10,4 +12,6 @@ static inline void doublefault_init_cpu_tss(void) }#endif +asmlinkage void __noreturn doublefault_shim(void); +#endif /* _ASM_X86_DOUBLEFAULT_H */
arch/x86/kernel/doublefault_32.c +1 -0
@@ -9,6 +9,7 @@#include <asm/processor.h> #include <asm/desc.h> #include <asm/traps.h> +#include <asm/doublefault.h> #define ptr_ok (x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
Signature · 1 line
2.39.2
PATCH 8/20 x86: highmem: include asm/numa.h for set_highmem_pages_init
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The set_highmem_pages_init() function is declared in asm/numa.h, which must be included in the file that defines it to avoid a W=1 warning:
arch/x86/mm/highmem_32.c:7:13: error: no previous prototype for 'set_highmem_pages_init' [-Werror=missing-prototypes]
--- arch/x86/mm/highmem_32.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/mm/highmem_32.c +1 -0
@@ -3,6 +3,7 @@#include <linux/export.h> #include <linux/swap.h> /* for totalram_pages */ #include <linux/memblock.h> +#include <asm/numa.h> void __init set_highmem_pages_init (void ) {
Signature · 1 line
2.39.2
PATCH 9/20 x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
arch_pnpbios_disabled() is defined in architecture code on x86, but this does not include the appropriate header, causing a warning:
arch/x86/kernel/platform-quirks.c:42:13: error: no previous prototype for 'arch_pnpbios_disabled' [-Werror=missing-prototypes]
--- arch/x86/kernel/platform-quirks.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/platform-quirks.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/init.h> +#include <linux/pnp.h> #include <asm/setup.h> #include <asm/bios_ebda.h>
Signature · 1 line
2.39.2
PATCH 10/20 x86: xen: add missing prototypes
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes] arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]
--- arch/x86/xen/efi.c | 2 ++ arch/x86/xen/smp.h | 3 +++ arch/x86/xen/xen-ops.h | 14 ++++++++++++++ include/xen/xen.h | 3 +++ 4 files changed, 22 insertions(+)
arch/x86/xen/efi.c +2 -0
@@ -16,6 +16,8 @@#include <asm/setup.h> #include <asm/xen/hypercall.h> +#include "xen-ops.h" +static efi_char16_t vendor[100 ]__initdata ;static efi_system_table_t efi_systab_xen__initdata = {
arch/x86/xen/smp.h +3 -0
@@ -2,6 +2,9 @@#ifndef _XEN_SMP_H#ifdef CONFIG_SMP + +asmlinkage void cpu_bringup_and_idle(void); +extern void xen_send_IPI_mask (const struct cpumask *mask,int vector); extern void xen_send_IPI_mask_allbutself(const struct cpumask *mask,
arch/x86/xen/xen-ops.h +14 -0
@@ -160,4 +160,18 @@ void xen_hvm_post_suspend(int suspend_cancelled);static inline void xen_hvm_post_suspend (int suspend_cancelled) {}#endif +void xen_force_evtchn_callback (void ); +pteval_t xen_pte_val (pte_t pte); +pgdval_t xen_pgd_val (pgd_t pgd); +pte_t xen_make_pte (pteval_t pte); +pgd_t xen_make_pgd (pgdval_t pgd); +pmdval_t xen_pmd_val (pmd_t pmd); +pmd_t xen_make_pmd (pmdval_t pmd); +pudval_t xen_pud_val (pud_t pud); +pud_t xen_make_pud (pudval_t pud); +p4dval_t xen_p4d_val (p4d_t p4d); +p4d_t xen_make_p4d (p4dval_t p4d); +pte_t xen_make_pte_init (pteval_t pte); +void xen_start_kernel (struct start_info *si); +#endif /* XEN_OPS_H */
include/xen/xen.h +3 -0
@@ -31,6 +31,9 @@ extern uint32_t xen_start_flags;#include <xen/interface/hvm/start_info.h> extern struct hvm_start_info pvh_start_info; +void xen_prepare_pvh (void ); +struct pt_regs ; +void xen_pv_evtchn_do_upcall (struct pt_regs *regs);#ifdef CONFIG_XEN_DOM0 #include <xen/interface/xen.h>
Signature · 1 line
2.39.2
Re: [PATCH 10/20] x86: xen: add missing prototypes
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes]arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]
What's the deal with this one?
The patch is doing a bunch functions on top of the ones from the commit message. Were you just showing a snippet of what the actual set of warnings is?
Also, fwiw, it would be nice to have actual words in the changelog, even for these maddeningly repetitive series. Even something like:
Xen has a bunch of these because of how the paravirt code uses inline assembly.
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 10/20] x86: xen: add missing prototypes
Quoted 7 lines · Dave Hansen
Quoted 5 lines · Arnd Bergmann
arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes]arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]
Quoted 5 lines
What's the deal with this one?
The patch is doing a bunch functions on top of the ones from the commit message. Were you just showing a snippet of what the actual set of warnings is?
I missed this one going through the changelogs before sending them out, I thought I had added a proper text to each one, but it fell through the cracks. I've followed up with a v2 patch that has a proper changelog now.
Arnd
PATCH 11/20 x86: entry: add do_SYSENTER_32() prototype
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The 32-bit system call entry points can be called on both 32-bit and 64-bit kernels, but on the former the declarations are hidden:
arch/x86/entry/common.c:238:24: error: no previous prototype for 'do_SYSENTER_32' [-Werror=missing-prototypes]
Move them all out of the #ifdef block to avoid the warnings.
--- arch/x86/include/asm/syscall.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/include/asm/syscall.h +4 -2
@@ -127,9 +127,11 @@ static inline int syscall_get_arch(struct task_struct *task) }void do_syscall_64 (struct pt_regs *regs,int nr); -void do_int80_syscall_32 (struct pt_regs *regs); -long do_fast_syscall_32 (struct pt_regs *regs);#endif /* CONFIG_X86_32 */ +void do_int80_syscall_32 (struct pt_regs *regs); +long do_fast_syscall_32 (struct pt_regs *regs); +long do_SYSENTER_32 (struct pt_regs *regs); +#endif /* _ASM_X86_SYSCALL_H */
Signature · 1 line
2.39.2
PATCH 12/20 x86: qspinlock-paravirt: fix mising-prototype warnings
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
__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.
The native_pv_lock_init function in turn is only declared in SMP builds but can be left out in UP to avoid another warning:
arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'native_pv_lock_init' [-Werror=missing-prototypes]
--- arch/x86/include/asm/qspinlock_paravirt.h | 2 ++ arch/x86/kernel/paravirt.c | 2 ++ kernel/locking/qspinlock_paravirt.h | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-)
arch/x86/include/asm/qspinlock_paravirt.h +2 -0
@@ -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
arch/x86/kernel/paravirt.c +2 -0
@@ -73,11 +73,13 @@ DEFINE_PARAVIRT_ASM(pv_native_read_cr2, "mov %cr2, %rax", .noinstr.text);DEFINE_STATIC_KEY_TRUE (virt_spin_lock_key); +#ifdef CONFIG_SMP void __init native_pv_lock_init (void ) {if (!boot_cpu_has (X86_FEATURE_HYPERVISOR ))static_branch_disable (&virt_spin_lock_key); } +#endif unsigned int paravirt_patch (u8 type,void *insn_buff,unsigned long addr,unsigned int len)
kernel/locking/qspinlock_paravirt.h +10 -10
@@ -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) {
Signature · 1 line
2.39.2
PATCH 13/20 x86: hibernate: declare global functions in suspend.h
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Three functions that are defined in x86 specific code to override generic __weak implementations cause a warning because of a missing prototype:
arch/x86/power/cpu.c:298:5: error: no previous prototype for 'hibernate_resume_nonboot_cpu_disable' [-Werror=missing-prototypes] arch/x86/power/hibernate.c:129:5: error: no previous prototype for 'arch_hibernation_header_restore' [-Werror=missing-prototypes] arch/x86/power/hibernate.c:91:5: error: no previous prototype for 'arch_hibernation_header_save' [-Werror=missing-prototypes]
Move the declarations into a global header so it can be included by any file defining one of these.
--- include/linux/suspend.h | 4 ++++ kernel/power/power.h | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-)
include/linux/suspend.h +4 -0
@@ -452,6 +452,10 @@ extern struct pbe *restore_pblist;int pfn_is_nosave (unsigned long pfn);int hibernate_quiet_exec (int (*func)(void *data),void *data); +int hibernate_resume_nonboot_cpu_disable (void ); +int arch_hibernation_header_save (void *addr,unsigned int max_size); +int arch_hibernation_header_restore (void *addr); +#else /* CONFIG_HIBERNATION */ static inline void register_nosave_region (unsigned long b,unsigned long e) {}static inline int swsusp_page_is_forbidden (struct page *p) {return 0 ; }
kernel/power/power.h +0 -5
@@ -26,9 +26,6 @@ extern void __init hibernate_image_size_init(void);/* Maximum size of architecture specific data in a hibernation header */ #define MAX_ARCH_HEADER_SIZE (sizeof(struct new_utsname) + 4) -extern int arch_hibernation_header_save (void *addr,unsigned int max_size); -extern int arch_hibernation_header_restore (void *addr); -static inline int init_header_complete (struct swsusp_info *info) {return arch_hibernation_header_save (info,MAX_ARCH_HEADER_SIZE );
@@ -41,8 +38,6 @@ static inline const char *check_image_kernel(struct swsusp_info *info) }#endif /* CONFIG_ARCH_HIBERNATION_HEADER */ -extern int hibernate_resume_nonboot_cpu_disable (void ); -/* * Keep some memory free so that I/O operations can succeed without paging * [Might this be more than 4 MB?]
Signature · 1 line
2.39.2
PATCH 14/20 x86: fbdev: include asm/fb.h as needed
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
fb_is_primary_device() is defined as a global function on x86, unlike the others that have an inline version. The file that defines is however needs to include the declaration to avoid a warning:
arch/x86/video/fbdev.c:14:5: error: no previous prototype for 'fb_is_primary_device' [-Werror=missing-prototypes]
--- arch/x86/video/fbdev.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/video/fbdev.c +1 -0
@@ -10,6 +10,7 @@#include <linux/pci.h> #include <linux/module.h> #include <linux/vgaarb.h> +#include <asm/fb.h> int fb_is_primary_device (struct fb_info *info) {
Signature · 1 line
2.39.2
PATCH 15/20 x86: mce: add copy_mc_fragile_handle_tail prototype
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
copy_mc_fragile_handle_tail() is only called from assembler, but 'make W=1' complains about a missing prototype:
arch/x86/lib/copy_mc.c:26:1: warning: no previous prototype for ‘copy_mc_fragile_handle_tail’ [-Wmissing-prototypes]
26 | copy_mc_fragile_handle_tail(char *to, char *from, unsigned len)
Add the prototype to avoid the warning.
--- arch/x86/include/asm/mce.h | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/include/asm/mce.h +3 -0
@@ -350,4 +350,7 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { }#endif static inline void mce_hygon_feature_init (struct cpuinfo_x86 *c) {return mce_amd_feature_init (c); } + +unsigned long copy_mc_fragile_handle_tail (char *to,char *from,unsigned len); +#endif /* _ASM_X86_MCE_H */
Signature · 1 line
2.39.2
PATCH 16/20 x86: vdso: include vdso/processor.h
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
__vdso_getcpu is declared in a header but this is not included before the definition, causing a W=1 warning:
arch/x86/entry/vdso/vgetcpu.c:13:1: error: no previous prototype for '__vdso_getcpu' [-Werror=missing-prototypes] arch/x86/entry/vdso/vdso32/../vgetcpu.c:13:1: error: no previous prototype for '__vdso_getcpu' [-Werror=missing-prototypes]
--- arch/x86/entry/vdso/vgetcpu.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/entry/vdso/vgetcpu.c +1 -0
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/getcpu.h> #include <asm/segment.h> +#include <vdso/processor.h> notrace long __vdso_getcpu (unsigned *cpu,unsigned *node,struct getcpu_cache *unused)
Signature · 1 line
2.39.2
PATCH 17/20 x86: usercopy: include arch_wb_cache_pmem declaration
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
arch_wb_cache_pmem() is declared in a global header but defined by the architecture. On x86, the implementation needs to include the header to avoid this warning:
arch/x86/lib/usercopy_64.c:39:6: error: no previous prototype for 'arch_wb_cache_pmem' [-Werror=missing-prototypes]
--- arch/x86/lib/usercopy_64.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/lib/usercopy_64.c +1 -0
@@ -9,6 +9,7 @@#include <linux/export.h> #include <linux/uaccess.h> #include <linux/highmem.h> +#include <linux/libnvdimm.h> /* * Zero Userspace
Signature · 1 line
2.39.2
PATCH 18/20 x86: ioremap: add early_memremap_pgprot_adjust prototype
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
early_memremap_pgprot_adjust() is a __weak function with a local prototype, but x86 has a custom implementation that does not see the prototype, causing a W=1 warning:
arch/x86/mm/ioremap.c:785:17: error: no previous prototype for 'early_memremap_pgprot_adjust' [-Werror=missing-prototypes]
Move the declaration into the global linux/io.h header to avoid this.
--- include/linux/io.h | 5 +++++ mm/internal.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-)
include/linux/io.h +5 -0
@@ -68,6 +68,11 @@ void *devm_memremap(struct device *dev, resource_size_t offset, size_t size, unsigned long flags);void devm_memunmap (struct device *dev,void *addr); +/* architectures can override this */ +pgprot_t __init early_memremap_pgprot_adjust (resource_size_t phys_addr, +unsigned long size,pgprot_t prot); + +#ifdef CONFIG_PCI /* * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and
mm/internal.h +0 -6
@@ -178,12 +178,6 @@ extern unsigned long highest_memmap_pfn;*/ #define MAX_RECLAIM_RETRIES 16 -/* -* in mm/early_ioremap.c -*/ -pgprot_t __init early_memremap_pgprot_adjust (resource_size_t phys_addr, -unsigned long size,pgprot_t prot); -/* * in mm/vmscan.c: */
Signature · 1 line
2.39.2
PATCH 19/20 x86: purgatory: include header for warn() declaration
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
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.
--- 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(-)
arch/x86/boot/compressed/error.c +1 -1
@@ -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);
arch/x86/boot/compressed/error.h +1 -1
@@ -4,7 +4,7 @@#include <linux/compiler.h> -void warn (char *m); +void warn (const char *m);void error (char *m)__noreturn ;#endif /* BOOT_COMPRESSED_ERROR_H */
arch/x86/purgatory/purgatory.c +1 -0
@@ -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");
Signature · 1 line
2.39.2
PATCH 20/20 x86: olpc: avoid missing-prototype warnings
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are two functions in the olpc platform that have no prototype:
arch/x86/platform/olpc/olpc_dt.c:237:13: error: no previous prototype for 'olpc_dt_fixup' [-Werror=missing-prototypes] arch/x86/platform/olpc/olpc-xo1-pm.c:73:26: error: no previous prototype for 'xo1_do_sleep' [-Werror=missing-prototypes]
The first one should just be marked 'static' as there are no other callers, while the second one is called from assembler and is just a false-positive warning that can be silenced by adding a prototype.
--- arch/x86/platform/olpc/olpc_dt.c | 2 +- include/linux/olpc-ec.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/platform/olpc/olpc_dt.c +1 -1
@@ -234,7 +234,7 @@ static int __init olpc_dt_compatible_match(phandle node, const char *compat)return 0 ; } -void __init olpc_dt_fixup (void ) +static void __init olpc_dt_fixup (void ) {phandle node;u32 board_rev;
include/linux/olpc-ec.h +2 -0
@@ -56,6 +56,8 @@ extern int olpc_ec_sci_query(u16 *sci_value);extern bool olpc_ec_wakeup_available (void ); +asmlinkage int xo1_do_sleep(u8 sleep_state); +#else static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
Signature · 1 line
2.39.2
Quoted 5 lines · Arnd Bergmann
The ones that are a bit awkward are those that just add a prototype to shut up the warning, but the prototypes are never used for calling the function because the only caller is in assembler code. I tried to come up with other ways to shut up the compiler using the asmlinkage annotation, but with no success.
I went looking for the same thing. It's too bad gcc doesn't have an __attribute__ for it.
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 7 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
This addresses all x86 specific prototype warnings. The majority of the patches should be straightforward, either adding an #include statement to get the right header, or ensuring that an unused global function is left out of the build when the prototype is hidden.
Quoted 8 lines
The ones that are a bit awkward are those that just add a prototype to shut up the warning, but the prototypes are never used for calling the function because the only caller is in assembler code. I tried to come up with other ways to shut up the compiler using the asmlinkage annotation, but with no success.
All of the warnings have to be addressed in some form before the warning can be enabled by default.
I picked up the ones that were blatantly obvious, but left out 03, 04, 10, 12 and 19 for the moment.
BTW, I think the i386 allyesconfig is getting pretty lightly tested these days. I think you and I hit the same mlx4 __bad_copy_from() compile issue.
Quoted 4 lines · Dave Hansen
On 5/16/23 12:35, Arnd Bergmann wrote:
I picked up the ones that were blatantly obvious, but left out 03, 04, 10, 12 and 19 for the moment.
Btw, there is series that went unnoticed
https://lore.kernel.org/all/[email protected]/
I dunno why.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Dave Hansen
Quoted 3 lines · Arnd Bergmann
All of the warnings have to be addressed in some form before the warning can be enabled by default.
I picked up the ones that were blatantly obvious, but left out 03, 04, 10, 12 and 19 for the moment.
Ok, thanks!
I've already sent a fixed version of patch 10, let me know if you need anything else for the other ones.
Quoted 3 lines
BTW, I think the i386 allyesconfig is getting pretty lightly tested these days. I think you and I hit the same mlx4
__bad_copy_from()compile issue.
I did all my testing on randconfig builds, so I probably caught a lot of the more obscure corner cases, but it doesn't always hit everything that is in allyesconfig/allmodconfig.
Arnd