* [PATCH v2] x86/cpu: fix prototype warning @ 2018-11-08 1:12 Yi Wang 2018-11-08 15:03 ` Borislav Petkov 0 siblings, 1 reply; 21+ messages in thread From: Yi Wang @ 2018-11-08 1:12 UTC (permalink / raw) To: tglx, mingo Cc: bp, hpa, x86, suravee.suthikulpanit, puwen, davidwang, wang.yi59, linux-kernel, zhong.weidong This patch fix the following build warnings which because of missing include file: arch/x86/kernel/cpu/cacheinfo.c:647:6: warning: no previous prototype for ‘cacheinfo_amd_init_llc_id’ [-Wmissing-prototypes] arch/x86/kernel/cpu/cacheinfo.c:686:6: warning: no previous prototype for ‘cacheinfo_hygon_init_llc_id’ [-Wmissing-prototypes] arch/x86/kernel/cpu/scattered.c:37:6: warning: no previous prototype for ‘init_scattered_cpuid_features’ [-Wmissing-prototypes] arch/x86/kernel/cpu/scattered.c:60:5: warning: no previous prototype for ‘get_scattered_cpuid_leaf’ [-Wmissing-prototypes] arch/x86/kernel/cpu/topology.c:25:5: warning: no previous prototype for ‘detect_extended_topology_early’ [-Wmissing-prototypes] arch/x86/kernel/cpu/topology.c:57:5: warning: no previous prototype for ‘detect_extended_topology’ [-Wmissing-prototypes] Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> --- v2: merge the series into a single patch --- arch/x86/kernel/cpu/cacheinfo.c | 1 + arch/x86/kernel/cpu/scattered.c | 2 ++ arch/x86/kernel/cpu/topology.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c index dc1b934..5bafd93 100644 --- a/arch/x86/kernel/cpu/cacheinfo.c +++ b/arch/x86/kernel/cpu/cacheinfo.c @@ -19,6 +19,7 @@ #include <asm/cpufeature.h> #include <asm/amd_nb.h> #include <asm/smp.h> +#include <asm/cacheinfo.h> #include "cpu.h" diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 772c219..5b6866f 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -9,6 +9,8 @@ #include <asm/apic.h> +#include "cpu.h" + struct cpuid_bit { u16 feature; u8 reg; diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index 71ca064..8f6c784 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -10,6 +10,8 @@ #include <asm/pat.h> #include <asm/processor.h> +#include "cpu.h" + /* leaf 0xb SMT level */ #define SMT_LEVEL 0 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 1:12 [PATCH v2] x86/cpu: fix prototype warning Yi Wang @ 2018-11-08 15:03 ` Borislav Petkov 2018-11-08 15:32 ` Borislav Petkov 0 siblings, 1 reply; 21+ messages in thread From: Borislav Petkov @ 2018-11-08 15:03 UTC (permalink / raw) To: Yi Wang Cc: tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Thu, Nov 08, 2018 at 09:12:28AM +0800, Yi Wang wrote: > This patch fix the following build warnings which because of missing > include file: > > arch/x86/kernel/cpu/cacheinfo.c:647:6: warning: no previous prototype for ‘cacheinfo_amd_init_llc_id’ [-Wmissing-prototypes] > arch/x86/kernel/cpu/cacheinfo.c:686:6: warning: no previous prototype for ‘cacheinfo_hygon_init_llc_id’ [-Wmissing-prototypes] > arch/x86/kernel/cpu/scattered.c:37:6: warning: no previous prototype for ‘init_scattered_cpuid_features’ [-Wmissing-prototypes] > arch/x86/kernel/cpu/scattered.c:60:5: warning: no previous prototype for ‘get_scattered_cpuid_leaf’ [-Wmissing-prototypes] That function is gone in: https://git.kernel.org/tip/43500e6f294d175602606c77bfb0d8cd4ea88b4f You probably should run your test against tip/master. Also, you should say in your commit message that this is an extra warning - -Wmissing-prototypes - which is not enabled by default but a W=1 one. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:03 ` Borislav Petkov @ 2018-11-08 15:32 ` Borislav Petkov 2018-11-08 15:35 ` Thomas Gleixner 2018-11-08 15:47 ` [PATCH v2] x86/cpu: fix prototype warning Michael Matz 0 siblings, 2 replies; 21+ messages in thread From: Borislav Petkov @ 2018-11-08 15:32 UTC (permalink / raw) To: Yi Wang, Michael Matz Cc: tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Thu, Nov 08, 2018 at 04:03:18PM +0100, Borislav Petkov wrote: > On Thu, Nov 08, 2018 at 09:12:28AM +0800, Yi Wang wrote: > > This patch fix the following build warnings which because of missing > > include file: > > > > arch/x86/kernel/cpu/cacheinfo.c:647:6: warning: no previous prototype for ‘cacheinfo_amd_init_llc_id’ [-Wmissing-prototypes] > > arch/x86/kernel/cpu/cacheinfo.c:686:6: warning: no previous prototype for ‘cacheinfo_hygon_init_llc_id’ [-Wmissing-prototypes] > > arch/x86/kernel/cpu/scattered.c:37:6: warning: no previous prototype for ‘init_scattered_cpuid_features’ [-Wmissing-prototypes] > > arch/x86/kernel/cpu/scattered.c:60:5: warning: no previous prototype for ‘get_scattered_cpuid_leaf’ [-Wmissing-prototypes] > > That function is gone in: > > https://git.kernel.org/tip/43500e6f294d175602606c77bfb0d8cd4ea88b4f > > You probably should run your test against tip/master. > > Also, you should say in your commit message that this is an extra > warning - -Wmissing-prototypes - which is not enabled by default but a > W=1 one. And frankly, I don't see why we should be fixing all those. So what if a global function does't have a previous prototype declaration?! Micha, is there anything "useful" that warning bitches about or should we disable it? Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:32 ` Borislav Petkov @ 2018-11-08 15:35 ` Thomas Gleixner 2018-11-08 15:41 ` Borislav Petkov ` (4 more replies) 2018-11-08 15:47 ` [PATCH v2] x86/cpu: fix prototype warning Michael Matz 1 sibling, 5 replies; 21+ messages in thread From: Thomas Gleixner @ 2018-11-08 15:35 UTC (permalink / raw) To: Borislav Petkov Cc: Yi Wang, Michael Matz, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong Borislav, On Thu, 8 Nov 2018, Borislav Petkov wrote: > And frankly, I don't see why we should be fixing all those. So what if a > global function does't have a previous prototype declaration?! Global function declarations must have a prototype definition, really. Otherwise you can change the function signature and all callers which use the old unchanged prototype are hosed. Thanks, tglx ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:35 ` Thomas Gleixner @ 2018-11-08 15:41 ` Borislav Petkov 2018-11-09 16:07 ` David Laight ` (3 subsequent siblings) 4 siblings, 0 replies; 21+ messages in thread From: Borislav Petkov @ 2018-11-08 15:41 UTC (permalink / raw) To: Thomas Gleixner Cc: Yi Wang, Michael Matz, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Thu, Nov 08, 2018 at 04:35:45PM +0100, Thomas Gleixner wrote: > Global function declarations must have a prototype definition, really. > > Otherwise you can change the function signature and all callers which use > the old unchanged prototype are hosed. Ok, should we then enable this warning by default? It is an extra warning now, behind W=1. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:35 ` Thomas Gleixner 2018-11-08 15:41 ` Borislav Petkov @ 2018-11-09 16:07 ` David Laight 2018-11-10 10:51 ` [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov ` (2 subsequent siblings) 4 siblings, 0 replies; 21+ messages in thread From: David Laight @ 2018-11-09 16:07 UTC (permalink / raw) To: 'Thomas Gleixner', Borislav Petkov Cc: Yi Wang, Michael Matz, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong From: Thomas Gleixner > Sent: 08 November 2018 15:36 > On Thu, 8 Nov 2018, Borislav Petkov wrote: > > And frankly, I don't see why we should be fixing all those. So what if a > > global function does't have a previous prototype declaration?! > > Global function declarations must have a prototype definition, really. > > Otherwise you can change the function signature and all callers which use > the old unchanged prototype are hosed. I bet there are at least double-figures of real bugs out there. The next on the list should be -Wwriteable-strings. Usually just needs a few 'const' sprinkled. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) ^ permalink raw reply [flat|nested] 21+ messages in thread
* [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-08 15:35 ` Thomas Gleixner 2018-11-08 15:41 ` Borislav Petkov 2018-11-09 16:07 ` David Laight @ 2018-11-10 10:51 ` tip-bot for Borislav Petkov 2018-11-10 14:16 ` Borislav Petkov 2018-11-13 14:21 ` [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov 2018-11-14 13:18 ` tip-bot for Borislav Petkov 4 siblings, 1 reply; 21+ messages in thread From: tip-bot for Borislav Petkov @ 2018-11-10 10:51 UTC (permalink / raw) To: linux-tip-commits; +Cc: wang.yi59, bp, hpa, mingo, tglx, matz, linux-kernel Commit-ID: d813dfb28641306f66cf1e2c3586f39ab4f84b27 Gitweb: https://git.kernel.org/tip/d813dfb28641306f66cf1e2c3586f39ab4f84b27 Author: Borislav Petkov <bp@suse.de> AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100 Committer: Borislav Petkov <bp@suse.de> CommitDate: Sat, 10 Nov 2018 11:19:16 +0100 x86/mce: Fix -Wmissing-prototypes warnings Add the proper includes and make smca_get_name() static. Fix an actual bug too which the warning triggered: arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ types for ‘smp_thermal_interrupt’ asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) ^~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ ‘smp_thermal_interrupt’ was here asmlinkage void smp_thermal_interrupt(void); Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Yi Wang <wang.yi59@zte.com.cn> Cc: Michael Matz <matz@suse.de> Cc: x86@kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1811081633160.1549@nanos.tec.linutronix.de --- arch/x86/kernel/cpu/mcheck/mce_amd.c | 3 ++- arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++- arch/x86/kernel/cpu/mcheck/threshold.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index dd33c357548f..87499b997039 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -23,6 +23,7 @@ #include <linux/string.h> #include <asm/amd_nb.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } }; -const char *smca_get_name(enum smca_bank_types t) +static const char *smca_get_name(enum smca_bank_types t) { if (t >= N_SMCA_BANK_TYPES) return NULL; diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 2da67b70ba98..8a2a842d1a72 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -25,6 +25,7 @@ #include <linux/cpu.h> #include <asm/processor.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -390,7 +391,7 @@ static void unexpected_thermal_interrupt(void) static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; -asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) +asmlinkage __visible void __irq_entry smp_thermal_interrupt(void) { entering_irq(); trace_thermal_apic_entry(THERMAL_APIC_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 2b584b319eff..b0c60beb6312 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -6,6 +6,7 @@ #include <linux/kernel.h> #include <asm/irq_vectors.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/trace/irq_vectors.h> ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-10 10:51 ` [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov @ 2018-11-10 14:16 ` Borislav Petkov 2018-11-12 5:24 ` Ingo Molnar ` (2 more replies) 0 siblings, 3 replies; 21+ messages in thread From: Borislav Petkov @ 2018-11-10 14:16 UTC (permalink / raw) To: hpa, tglx, mingo, wang.yi59, linux-kernel, matz; +Cc: linux-tip-commits On Sat, Nov 10, 2018 at 02:51:56AM -0800, tip-bot for Borislav Petkov wrote: ... > diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c > index 2da67b70ba98..8a2a842d1a72 100644 > --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c > +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c > @@ -25,6 +25,7 @@ > #include <linux/cpu.h> > > #include <asm/processor.h> > +#include <asm/traps.h> > #include <asm/apic.h> > #include <asm/mce.h> > #include <asm/msr.h> > @@ -390,7 +391,7 @@ static void unexpected_thermal_interrupt(void) > > static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; > > -asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) > +asmlinkage __visible void __irq_entry smp_thermal_interrupt(void) And looking at this more, *this* is actually the wrong fix. Goes to show how important that warning is... Anyway, all those interrupt handlers run with struct pt_regs * in %rdi, see the apic interrupt asm glue: .macro apicinterrupt3 num sym do_sym ENTRY(\sym) UNWIND_HINT_IRET_REGS pushq $~(\num) .Lcommon_\sym: call interrupt_entry UNWIND_HINT_REGS indirect=1 call \do_sym /* rdi points to pt_regs */ ^^^^^^^^^^ so the real fix should be this. Even if the argument doesn't get used, its prototype should specify it as interrupt_entry() does all that preparation and puts a pt_regs ptr on stack. --- From: Borislav Petkov <bp@suse.de> Date: Fri, 9 Nov 2018 23:13:13 +0100 Subject: [PATCH] x86/mce: Fix -Wmissing-prototypes warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the proper includes and make smca_get_name() static. Fix an actual bug too which the warning triggered: arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ types for ‘smp_thermal_interrupt’ asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) ^~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ ‘smp_thermal_interrupt’ was here asmlinkage void smp_thermal_interrupt(void); Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Yi Wang <wang.yi59@zte.com.cn> Cc: Michael Matz <matz@suse.de> Cc: x86@kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1811081633160.1549@nanos.tec.linutronix.de --- arch/x86/include/asm/traps.h | 6 +++--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 5 +++-- arch/x86/kernel/cpu/mcheck/therm_throt.c | 1 + arch/x86/kernel/cpu/mcheck/threshold.c | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index 3de69330e6c5..9ea54a764a8e 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -104,9 +104,9 @@ extern int panic_on_unrecovered_nmi; void math_emulate(struct math_emu_info *); #ifndef CONFIG_X86_32 -asmlinkage void smp_thermal_interrupt(void); -asmlinkage void smp_threshold_interrupt(void); -asmlinkage void smp_deferred_error_interrupt(void); +asmlinkage void smp_thermal_interrupt(struct pt_regs *); +asmlinkage void smp_threshold_interrupt(struct pt_regs *); +asmlinkage void smp_deferred_error_interrupt(struct pt_regs *); #endif extern void ist_enter(struct pt_regs *regs); diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index dd33c357548f..f6b8e62b286b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -23,6 +23,7 @@ #include <linux/string.h> #include <asm/amd_nb.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } }; -const char *smca_get_name(enum smca_bank_types t) +static const char *smca_get_name(enum smca_bank_types t) { if (t >= N_SMCA_BANK_TYPES) return NULL; @@ -825,7 +826,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc) mce_log(&m); } -asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(void) +asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(struct pt_regs *r) { entering_irq(); trace_deferred_error_apic_entry(DEFERRED_ERROR_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 2da67b70ba98..95a7cfa6de15 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -25,6 +25,7 @@ #include <linux/cpu.h> #include <asm/processor.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 2b584b319eff..13bccbc8e9e6 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -6,6 +6,7 @@ #include <linux/kernel.h> #include <asm/irq_vectors.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/trace/irq_vectors.h> @@ -18,7 +19,7 @@ static void default_threshold_interrupt(void) void (*mce_threshold_vector)(void) = default_threshold_interrupt; -asmlinkage __visible void __irq_entry smp_threshold_interrupt(void) +asmlinkage __visible void __irq_entry smp_threshold_interrupt(struct pt_regs *r) { entering_irq(); trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR); -- 2.19.1 -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-10 14:16 ` Borislav Petkov @ 2018-11-12 5:24 ` Ingo Molnar 2018-11-12 12:19 ` Borislav Petkov 2018-11-13 14:22 ` [tip:x86/cleanups] x86/traps: Complete prototype declarations tip-bot for Borislav Petkov 2018-11-14 13:19 ` tip-bot for Borislav Petkov 2 siblings, 1 reply; 21+ messages in thread From: Ingo Molnar @ 2018-11-12 5:24 UTC (permalink / raw) To: Borislav Petkov Cc: hpa, tglx, wang.yi59, linux-kernel, matz, linux-tip-commits * Borislav Petkov <bp@suse.de> wrote: > Fix an actual bug too which the warning triggered: > > arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ > types for ‘smp_thermal_interrupt’ > asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) > ^~~~~~~~~~~~~~~~~~~~~ > In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: > ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ > ‘smp_thermal_interrupt’ was here > asmlinkage void smp_thermal_interrupt(void); > > Signed-off-by: Borislav Petkov <bp@suse.de> > Cc: Yi Wang <wang.yi59@zte.com.cn> > Cc: Michael Matz <matz@suse.de> > Cc: x86@kernel.org > Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1811081633160.1549@nanos.tec.linutronix.de > --- > arch/x86/include/asm/traps.h | 6 +++--- > arch/x86/kernel/cpu/mcheck/mce_amd.c | 5 +++-- > arch/x86/kernel/cpu/mcheck/therm_throt.c | 1 + > arch/x86/kernel/cpu/mcheck/threshold.c | 3 ++- > 4 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h > index 3de69330e6c5..9ea54a764a8e 100644 > --- a/arch/x86/include/asm/traps.h > +++ b/arch/x86/include/asm/traps.h > @@ -104,9 +104,9 @@ extern int panic_on_unrecovered_nmi; > > void math_emulate(struct math_emu_info *); > #ifndef CONFIG_X86_32 > -asmlinkage void smp_thermal_interrupt(void); > -asmlinkage void smp_threshold_interrupt(void); > -asmlinkage void smp_deferred_error_interrupt(void); > +asmlinkage void smp_thermal_interrupt(struct pt_regs *); > +asmlinkage void smp_threshold_interrupt(struct pt_regs *); > +asmlinkage void smp_deferred_error_interrupt(struct pt_regs *); Nit: please use full declarations in prototypes, i.e. 'struct pt_regs *regs' or so. Much of traps.h does this wrong so I guess this should be a separate cleanup patch. > +asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(struct pt_regs *r) > +asmlinkage __visible void __irq_entry smp_threshold_interrupt(struct pt_regs *r) Please use the canonical name, i.e. 'regs'. Thanks, Ingo ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-12 5:24 ` Ingo Molnar @ 2018-11-12 12:19 ` Borislav Petkov 0 siblings, 0 replies; 21+ messages in thread From: Borislav Petkov @ 2018-11-12 12:19 UTC (permalink / raw) To: Ingo Molnar; +Cc: hpa, tglx, wang.yi59, linux-kernel, matz, linux-tip-commits On Mon, Nov 12, 2018 at 06:24:53AM +0100, Ingo Molnar wrote: > Nit: please use full declarations in prototypes, i.e. 'struct pt_regs > *regs' or so. Done. I'll test them some more and add them to tip:ras/core. > Much of traps.h does this wrong so I guess this should be a separate > cleanup patch. See below. Btw, do you remember why do_page_fault()'s error_code is "unsigned long" vs all the others which are only "long" type? Because the error code pushed by the hardware is only a couple of (least significant) bits. 5 to be exact + there's bit 15 which is new for SGX. But all that should still fit in a long. Hmmm? --- diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index afbc87206886..877afdedbbc5 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -61,34 +61,34 @@ asmlinkage void xen_machine_check(void); asmlinkage void xen_simd_coprocessor_error(void); #endif -dotraplinkage void do_divide_error(struct pt_regs *, long); -dotraplinkage void do_debug(struct pt_regs *, long); -dotraplinkage void do_nmi(struct pt_regs *, long); -dotraplinkage void do_int3(struct pt_regs *, long); -dotraplinkage void do_overflow(struct pt_regs *, long); -dotraplinkage void do_bounds(struct pt_regs *, long); -dotraplinkage void do_invalid_op(struct pt_regs *, long); -dotraplinkage void do_device_not_available(struct pt_regs *, long); -dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); -dotraplinkage void do_invalid_TSS(struct pt_regs *, long); -dotraplinkage void do_segment_not_present(struct pt_regs *, long); -dotraplinkage void do_stack_segment(struct pt_regs *, long); +dotraplinkage void do_divide_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_debug(struct pt_regs *regs, long error_code); +dotraplinkage void do_nmi(struct pt_regs *regs, long error_code); +dotraplinkage void do_int3(struct pt_regs *regs, long error_code); +dotraplinkage void do_overflow(struct pt_regs *regs, long error_code); +dotraplinkage void do_bounds(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_op(struct pt_regs *regs, long error_code); +dotraplinkage void do_device_not_available(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_TSS(struct pt_regs *regs, long error_code); +dotraplinkage void do_segment_not_present(struct pt_regs *regs, long error_code); +dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_64 -dotraplinkage void do_double_fault(struct pt_regs *, long); +dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_general_protection(struct pt_regs *, long); -dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); -dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); -dotraplinkage void do_coprocessor_error(struct pt_regs *, long); -dotraplinkage void do_alignment_check(struct pt_regs *, long); +dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code); +dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code); +dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_MCE -dotraplinkage void do_machine_check(struct pt_regs *, long); +dotraplinkage void do_machine_check(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long); +dotraplinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_32 -dotraplinkage void do_iret_error(struct pt_regs *, long); +dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_mce(struct pt_regs *, long); +dotraplinkage void do_mce(struct pt_regs *regs, long error_code); static inline int get_si_code(unsigned long condition) { -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip:x86/cleanups] x86/traps: Complete prototype declarations 2018-11-10 14:16 ` Borislav Petkov 2018-11-12 5:24 ` Ingo Molnar @ 2018-11-13 14:22 ` tip-bot for Borislav Petkov 2018-11-14 13:19 ` tip-bot for Borislav Petkov 2 siblings, 0 replies; 21+ messages in thread From: tip-bot for Borislav Petkov @ 2018-11-13 14:22 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, bp, x86, mingo, tglx, hpa Commit-ID: 95715a3f0e4f0abc4749c6a4fdf2c08c3ff18450 Gitweb: https://git.kernel.org/tip/95715a3f0e4f0abc4749c6a4fdf2c08c3ff18450 Author: Borislav Petkov <bp@suse.de> AuthorDate: Mon, 12 Nov 2018 13:20:36 +0100 Committer: Borislav Petkov <bp@suse.de> CommitDate: Tue, 13 Nov 2018 15:16:50 +0100 x86/traps: Complete prototype declarations ... with proper variable names. No functional changes. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: <x86@kernel.org> Link: https://lkml.kernel.org/r/20181110141647.GA20073@zn.tnic --- arch/x86/include/asm/traps.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index afbc87206886..877afdedbbc5 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -61,34 +61,34 @@ asmlinkage void xen_machine_check(void); asmlinkage void xen_simd_coprocessor_error(void); #endif -dotraplinkage void do_divide_error(struct pt_regs *, long); -dotraplinkage void do_debug(struct pt_regs *, long); -dotraplinkage void do_nmi(struct pt_regs *, long); -dotraplinkage void do_int3(struct pt_regs *, long); -dotraplinkage void do_overflow(struct pt_regs *, long); -dotraplinkage void do_bounds(struct pt_regs *, long); -dotraplinkage void do_invalid_op(struct pt_regs *, long); -dotraplinkage void do_device_not_available(struct pt_regs *, long); -dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); -dotraplinkage void do_invalid_TSS(struct pt_regs *, long); -dotraplinkage void do_segment_not_present(struct pt_regs *, long); -dotraplinkage void do_stack_segment(struct pt_regs *, long); +dotraplinkage void do_divide_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_debug(struct pt_regs *regs, long error_code); +dotraplinkage void do_nmi(struct pt_regs *regs, long error_code); +dotraplinkage void do_int3(struct pt_regs *regs, long error_code); +dotraplinkage void do_overflow(struct pt_regs *regs, long error_code); +dotraplinkage void do_bounds(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_op(struct pt_regs *regs, long error_code); +dotraplinkage void do_device_not_available(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_TSS(struct pt_regs *regs, long error_code); +dotraplinkage void do_segment_not_present(struct pt_regs *regs, long error_code); +dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_64 -dotraplinkage void do_double_fault(struct pt_regs *, long); +dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_general_protection(struct pt_regs *, long); -dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); -dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); -dotraplinkage void do_coprocessor_error(struct pt_regs *, long); -dotraplinkage void do_alignment_check(struct pt_regs *, long); +dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code); +dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code); +dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_MCE -dotraplinkage void do_machine_check(struct pt_regs *, long); +dotraplinkage void do_machine_check(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long); +dotraplinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_32 -dotraplinkage void do_iret_error(struct pt_regs *, long); +dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_mce(struct pt_regs *, long); +dotraplinkage void do_mce(struct pt_regs *regs, long error_code); static inline int get_si_code(unsigned long condition) { ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip:x86/cleanups] x86/traps: Complete prototype declarations 2018-11-10 14:16 ` Borislav Petkov 2018-11-12 5:24 ` Ingo Molnar 2018-11-13 14:22 ` [tip:x86/cleanups] x86/traps: Complete prototype declarations tip-bot for Borislav Petkov @ 2018-11-14 13:19 ` tip-bot for Borislav Petkov 2 siblings, 0 replies; 21+ messages in thread From: tip-bot for Borislav Petkov @ 2018-11-14 13:19 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, mingo, tglx, bp, x86, hpa Commit-ID: 8e1599fcac2efda8b7d433ef69d2492f0b351e3f Gitweb: https://git.kernel.org/tip/8e1599fcac2efda8b7d433ef69d2492f0b351e3f Author: Borislav Petkov <bp@suse.de> AuthorDate: Mon, 12 Nov 2018 13:20:36 +0100 Committer: Borislav Petkov <bp@suse.de> CommitDate: Wed, 14 Nov 2018 13:46:29 +0100 x86/traps: Complete prototype declarations ... with proper variable names. No functional changes. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: <x86@kernel.org> Link: https://lkml.kernel.org/r/20181110141647.GA20073@zn.tnic --- arch/x86/include/asm/traps.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index afbc87206886..877afdedbbc5 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -61,34 +61,34 @@ asmlinkage void xen_machine_check(void); asmlinkage void xen_simd_coprocessor_error(void); #endif -dotraplinkage void do_divide_error(struct pt_regs *, long); -dotraplinkage void do_debug(struct pt_regs *, long); -dotraplinkage void do_nmi(struct pt_regs *, long); -dotraplinkage void do_int3(struct pt_regs *, long); -dotraplinkage void do_overflow(struct pt_regs *, long); -dotraplinkage void do_bounds(struct pt_regs *, long); -dotraplinkage void do_invalid_op(struct pt_regs *, long); -dotraplinkage void do_device_not_available(struct pt_regs *, long); -dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long); -dotraplinkage void do_invalid_TSS(struct pt_regs *, long); -dotraplinkage void do_segment_not_present(struct pt_regs *, long); -dotraplinkage void do_stack_segment(struct pt_regs *, long); +dotraplinkage void do_divide_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_debug(struct pt_regs *regs, long error_code); +dotraplinkage void do_nmi(struct pt_regs *regs, long error_code); +dotraplinkage void do_int3(struct pt_regs *regs, long error_code); +dotraplinkage void do_overflow(struct pt_regs *regs, long error_code); +dotraplinkage void do_bounds(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_op(struct pt_regs *regs, long error_code); +dotraplinkage void do_device_not_available(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *regs, long error_code); +dotraplinkage void do_invalid_TSS(struct pt_regs *regs, long error_code); +dotraplinkage void do_segment_not_present(struct pt_regs *regs, long error_code); +dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_64 -dotraplinkage void do_double_fault(struct pt_regs *, long); +dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_general_protection(struct pt_regs *, long); -dotraplinkage void do_page_fault(struct pt_regs *, unsigned long); -dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *, long); -dotraplinkage void do_coprocessor_error(struct pt_regs *, long); -dotraplinkage void do_alignment_check(struct pt_regs *, long); +dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code); +dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code); +dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code); +dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code); +dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_MCE -dotraplinkage void do_machine_check(struct pt_regs *, long); +dotraplinkage void do_machine_check(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long); +dotraplinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code); #ifdef CONFIG_X86_32 -dotraplinkage void do_iret_error(struct pt_regs *, long); +dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code); #endif -dotraplinkage void do_mce(struct pt_regs *, long); +dotraplinkage void do_mce(struct pt_regs *regs, long error_code); static inline int get_si_code(unsigned long condition) { ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-08 15:35 ` Thomas Gleixner ` (2 preceding siblings ...) 2018-11-10 10:51 ` [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov @ 2018-11-13 14:21 ` tip-bot for Borislav Petkov 2018-11-14 13:18 ` tip-bot for Borislav Petkov 4 siblings, 0 replies; 21+ messages in thread From: tip-bot for Borislav Petkov @ 2018-11-13 14:21 UTC (permalink / raw) To: linux-tip-commits; +Cc: hpa, wang.yi59, bp, mingo, matz, linux-kernel, tglx Commit-ID: 83a204daa40315a38204493f60768910c8604e9c Gitweb: https://git.kernel.org/tip/83a204daa40315a38204493f60768910c8604e9c Author: Borislav Petkov <bp@suse.de> AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100 Committer: Borislav Petkov <bp@suse.de> CommitDate: Tue, 13 Nov 2018 14:55:08 +0100 x86/mce: Fix -Wmissing-prototypes warnings Add the proper includes and make smca_get_name() static. Fix an actual bug too which the warning triggered: arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ types for ‘smp_thermal_interrupt’ asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) ^~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ ‘smp_thermal_interrupt’ was here asmlinkage void smp_thermal_interrupt(void); Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Yi Wang <wang.yi59@zte.com.cn> Cc: Michael Matz <matz@suse.de> Cc: x86@kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1811081633160.1549@nanos.tec.linutronix.de --- arch/x86/include/asm/traps.h | 6 +++--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 5 +++-- arch/x86/kernel/cpu/mcheck/therm_throt.c | 1 + arch/x86/kernel/cpu/mcheck/threshold.c | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index 3de69330e6c5..afbc87206886 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -104,9 +104,9 @@ extern int panic_on_unrecovered_nmi; void math_emulate(struct math_emu_info *); #ifndef CONFIG_X86_32 -asmlinkage void smp_thermal_interrupt(void); -asmlinkage void smp_threshold_interrupt(void); -asmlinkage void smp_deferred_error_interrupt(void); +asmlinkage void smp_thermal_interrupt(struct pt_regs *regs); +asmlinkage void smp_threshold_interrupt(struct pt_regs *regs); +asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs); #endif extern void ist_enter(struct pt_regs *regs); diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index dd33c357548f..9c8e2daa48cd 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -23,6 +23,7 @@ #include <linux/string.h> #include <asm/amd_nb.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } }; -const char *smca_get_name(enum smca_bank_types t) +static const char *smca_get_name(enum smca_bank_types t) { if (t >= N_SMCA_BANK_TYPES) return NULL; @@ -825,7 +826,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc) mce_log(&m); } -asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(void) +asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(struct pt_regs *regs) { entering_irq(); trace_deferred_error_apic_entry(DEFERRED_ERROR_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 2da67b70ba98..95a7cfa6de15 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -25,6 +25,7 @@ #include <linux/cpu.h> #include <asm/processor.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 2b584b319eff..c21e0a1efd0f 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -6,6 +6,7 @@ #include <linux/kernel.h> #include <asm/irq_vectors.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/trace/irq_vectors.h> @@ -18,7 +19,7 @@ static void default_threshold_interrupt(void) void (*mce_threshold_vector)(void) = default_threshold_interrupt; -asmlinkage __visible void __irq_entry smp_threshold_interrupt(void) +asmlinkage __visible void __irq_entry smp_threshold_interrupt(struct pt_regs *regs) { entering_irq(); trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR); ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings 2018-11-08 15:35 ` Thomas Gleixner ` (3 preceding siblings ...) 2018-11-13 14:21 ` [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov @ 2018-11-14 13:18 ` tip-bot for Borislav Petkov 4 siblings, 0 replies; 21+ messages in thread From: tip-bot for Borislav Petkov @ 2018-11-14 13:18 UTC (permalink / raw) To: linux-tip-commits; +Cc: wang.yi59, linux-kernel, mingo, bp, matz, hpa, tglx Commit-ID: 68b5e4326e4b8ac9080835005d8254fed0fb3c56 Gitweb: https://git.kernel.org/tip/68b5e4326e4b8ac9080835005d8254fed0fb3c56 Author: Borislav Petkov <bp@suse.de> AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100 Committer: Borislav Petkov <bp@suse.de> CommitDate: Wed, 14 Nov 2018 13:46:26 +0100 x86/mce: Fix -Wmissing-prototypes warnings Add the proper includes and make smca_get_name() static. Fix an actual bug too which the warning triggered: arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ types for ‘smp_thermal_interrupt’ asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) ^~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ ‘smp_thermal_interrupt’ was here asmlinkage void smp_thermal_interrupt(void); Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Yi Wang <wang.yi59@zte.com.cn> Cc: Michael Matz <matz@suse.de> Cc: x86@kernel.org Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1811081633160.1549@nanos.tec.linutronix.de --- arch/x86/include/asm/traps.h | 6 +++--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 5 +++-- arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++- arch/x86/kernel/cpu/mcheck/threshold.c | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index 3de69330e6c5..afbc87206886 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -104,9 +104,9 @@ extern int panic_on_unrecovered_nmi; void math_emulate(struct math_emu_info *); #ifndef CONFIG_X86_32 -asmlinkage void smp_thermal_interrupt(void); -asmlinkage void smp_threshold_interrupt(void); -asmlinkage void smp_deferred_error_interrupt(void); +asmlinkage void smp_thermal_interrupt(struct pt_regs *regs); +asmlinkage void smp_threshold_interrupt(struct pt_regs *regs); +asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs); #endif extern void ist_enter(struct pt_regs *regs); diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index dd33c357548f..9c8e2daa48cd 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -23,6 +23,7 @@ #include <linux/string.h> #include <asm/amd_nb.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } }; -const char *smca_get_name(enum smca_bank_types t) +static const char *smca_get_name(enum smca_bank_types t) { if (t >= N_SMCA_BANK_TYPES) return NULL; @@ -825,7 +826,7 @@ static void __log_error(unsigned int bank, u64 status, u64 addr, u64 misc) mce_log(&m); } -asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(void) +asmlinkage __visible void __irq_entry smp_deferred_error_interrupt(struct pt_regs *regs) { entering_irq(); trace_deferred_error_apic_entry(DEFERRED_ERROR_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 2da67b70ba98..ee229ceee745 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -25,6 +25,7 @@ #include <linux/cpu.h> #include <asm/processor.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -390,7 +391,7 @@ static void unexpected_thermal_interrupt(void) static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; -asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) +asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *regs) { entering_irq(); trace_thermal_apic_entry(THERMAL_APIC_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 2b584b319eff..c21e0a1efd0f 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -6,6 +6,7 @@ #include <linux/kernel.h> #include <asm/irq_vectors.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/trace/irq_vectors.h> @@ -18,7 +19,7 @@ static void default_threshold_interrupt(void) void (*mce_threshold_vector)(void) = default_threshold_interrupt; -asmlinkage __visible void __irq_entry smp_threshold_interrupt(void) +asmlinkage __visible void __irq_entry smp_threshold_interrupt(struct pt_regs *regs) { entering_irq(); trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR); ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:32 ` Borislav Petkov 2018-11-08 15:35 ` Thomas Gleixner @ 2018-11-08 15:47 ` Michael Matz 2018-11-08 17:22 ` Borislav Petkov 2018-11-09 22:17 ` Borislav Petkov 1 sibling, 2 replies; 21+ messages in thread From: Michael Matz @ 2018-11-08 15:47 UTC (permalink / raw) To: Borislav Petkov Cc: Yi Wang, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong Hi, On Thu, 8 Nov 2018, Borislav Petkov wrote: > And frankly, I don't see why we should be fixing all those. So what if a > global function does't have a previous prototype declaration?! > > Micha, is there anything "useful" that warning bitches about or should > we disable it? What tglx said. If you don't intend such functions to be called from other units make them static, if you do intend them to be callable declare the properly. [There's also one subtle issue with argument promotions. prototypeless functions are called as if they are declared "int name()" that is default argument promotions take place (float->double, {char,short}->int), which won't happen with prototypes, and argument type conversions won't take place (as no parameter types are known). This might lead to different values between calling a prototyped and a prototype-less function arriving at the function even though the call expression looked the same] Ciao, Michael. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:47 ` [PATCH v2] x86/cpu: fix prototype warning Michael Matz @ 2018-11-08 17:22 ` Borislav Petkov [not found] ` <201811090843126464658@zte.com.cn> 2018-11-09 22:17 ` Borislav Petkov 1 sibling, 1 reply; 21+ messages in thread From: Borislav Petkov @ 2018-11-08 17:22 UTC (permalink / raw) To: Michael Matz Cc: Yi Wang, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Thu, Nov 08, 2018 at 03:47:32PM +0000, Michael Matz wrote: > What tglx said. If you don't intend such functions to be called > from other units make them static, if you do intend them to be callable > declare the properly. > > [There's also one subtle issue with argument promotions. prototypeless > functions are called as if they are declared "int name()" that is > default argument promotions take place (float->double, {char,short}->int), > which won't happen with prototypes, and argument type conversions won't > take place (as no parameter types are known). This might lead to > different values between calling a prototyped and a prototype-less > function arriving at the function even though the call expression looked > the same] Eww, that's yucky. Ok, so we should enalbe this warning by default then. And doing that in the main Makefile gives ~1400 warnings on an allmodconfig build. Yi Wang, I guess you have a long road in front of you. :-) Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <201811090843126464658@zte.com.cn>]
* Re: [PATCH v2] x86/cpu: fix prototype warning [not found] ` <201811090843126464658@zte.com.cn> @ 2018-11-09 10:55 ` Borislav Petkov 2018-11-09 11:12 ` Greg KH 0 siblings, 1 reply; 21+ messages in thread From: Borislav Petkov @ 2018-11-09 10:55 UTC (permalink / raw) To: wang.yi59, Greg KH Cc: matz, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Fri, Nov 09, 2018 at 08:43:12AM +0800, wang.yi59@zte.com.cn wrote: > Yeah, so that is. However, I suppose we should not enable this by default > before we fix ALL of these warning, Yeah, the build is really noisy now. > which is really a hard work. :) Yeah, I wonder if adding this to a kernel janitors TODO list or somesuch would help speeding up the process. Maybe Greg knows. Greg, the question is whether we can get people to help out with -Wmissing-prototypes fixes around the tree. Currently, there are ~1400 warnings and we want to have 0 and then add that option to the main Makefile. It is very easy to do: you simply build the kernel with W=1, choose one -Wmissing-prototypes warning and fix it by adding a function prototype or declaring the function static. It should be a pretty easy for newbies to get involved... > Aha, I will try my best to to work on this, and as you said, that's a long > road to go, so maybe I would only work on modules which I am familiar with. ;-) Sounds good. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-09 10:55 ` Borislav Petkov @ 2018-11-09 11:12 ` Greg KH 2018-11-09 11:41 ` Borislav Petkov 0 siblings, 1 reply; 21+ messages in thread From: Greg KH @ 2018-11-09 11:12 UTC (permalink / raw) To: Borislav Petkov Cc: wang.yi59, matz, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Fri, Nov 09, 2018 at 11:55:38AM +0100, Borislav Petkov wrote: > On Fri, Nov 09, 2018 at 08:43:12AM +0800, wang.yi59@zte.com.cn wrote: > > Yeah, so that is. However, I suppose we should not enable this by default > > before we fix ALL of these warning, > > Yeah, the build is really noisy now. > > > which is really a hard work. :) > > Yeah, I wonder if adding this to a kernel janitors TODO list or somesuch > would help speeding up the process. > > Maybe Greg knows. > > Greg, the question is whether we can get people to help out with > > -Wmissing-prototypes > > fixes around the tree. Currently, there are ~1400 warnings and we want > to have 0 and then add that option to the main Makefile. > > It is very easy to do: you simply build the kernel with W=1, choose one > -Wmissing-prototypes warning and fix it by adding a function prototype > or declaring the function static. > > It should be a pretty easy for newbies to get involved... Sure, sounds like a good task. Post it to the driverdevel mailing list and see if people are interested. thanks, greg k-h ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-09 11:12 ` Greg KH @ 2018-11-09 11:41 ` Borislav Petkov 2018-11-09 12:25 ` Greg KH 0 siblings, 1 reply; 21+ messages in thread From: Borislav Petkov @ 2018-11-09 11:41 UTC (permalink / raw) To: Greg KH Cc: wang.yi59, matz, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Fri, Nov 09, 2018 at 03:12:25AM -0800, Greg KH wrote: > Sure, sounds like a good task. Post it to the driverdevel mailing list > and see if people are interested. By "driverdevel" do you mean this guy, per chance: http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ? Also, I guess I should send to kernel-janitors@vger.kernel.org too, no? Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-09 11:41 ` Borislav Petkov @ 2018-11-09 12:25 ` Greg KH 0 siblings, 0 replies; 21+ messages in thread From: Greg KH @ 2018-11-09 12:25 UTC (permalink / raw) To: Borislav Petkov Cc: wang.yi59, matz, tglx, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Fri, Nov 09, 2018 at 12:41:01PM +0100, Borislav Petkov wrote: > On Fri, Nov 09, 2018 at 03:12:25AM -0800, Greg KH wrote: > > Sure, sounds like a good task. Post it to the driverdevel mailing list > > and see if people are interested. > > By "driverdevel" do you mean this guy, per chance: > > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel Yes. > Also, I guess I should send to kernel-janitors@vger.kernel.org too, no? I don't know if that list is still alive, but it could not hurt :) ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] x86/cpu: fix prototype warning 2018-11-08 15:47 ` [PATCH v2] x86/cpu: fix prototype warning Michael Matz 2018-11-08 17:22 ` Borislav Petkov @ 2018-11-09 22:17 ` Borislav Petkov 1 sibling, 0 replies; 21+ messages in thread From: Borislav Petkov @ 2018-11-09 22:17 UTC (permalink / raw) To: Michael Matz, Thomas Gleixner Cc: Yi Wang, mingo, hpa, x86, suravee.suthikulpanit, puwen, davidwang, linux-kernel, zhong.weidong On Thu, Nov 08, 2018 at 03:47:32PM +0000, Michael Matz wrote: > What tglx said. If you don't intend such functions to be called > from other units make them static, if you do intend them to be callable > declare the properly. Well, I'll be damned! That just caught two bugs, the smp_thermal_interrupt() is *exactly* what the warning is supposed to catch - functions with changed prototype! --- From: Borislav Petkov <bp@suse.de> Date: Fri, 9 Nov 2018 23:13:13 +0100 Subject: [PATCH] x86/mce: Fix -Wmissing-prototypes warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the proper includes and make smca_get_name() static. Fix an actual bug too which the warning triggered: arch/x86/kernel/cpu/mcheck/therm_throt.c:395:39: error: conflicting \ types for ‘smp_thermal_interrupt’ asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) ^~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kernel/cpu/mcheck/therm_throt.c:29: ./arch/x86/include/asm/traps.h:107:17: note: previous declaration of \ ‘smp_thermal_interrupt’ was here asmlinkage void smp_thermal_interrupt(void); Signed-off-by: Borislav Petkov <bp@suse.de> --- arch/x86/kernel/cpu/mcheck/mce_amd.c | 3 ++- arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++- arch/x86/kernel/cpu/mcheck/threshold.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index dd33c357548f..87499b997039 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -23,6 +23,7 @@ #include <linux/string.h> #include <asm/amd_nb.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -99,7 +100,7 @@ static u32 smca_bank_addrs[MAX_NR_BANKS][NR_BLOCKS] __ro_after_init = [0 ... MAX_NR_BANKS - 1] = { [0 ... NR_BLOCKS - 1] = -1 } }; -const char *smca_get_name(enum smca_bank_types t) +static const char *smca_get_name(enum smca_bank_types t) { if (t >= N_SMCA_BANK_TYPES) return NULL; diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 0d3f6b6a5739..70a05de7ea59 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -26,6 +26,7 @@ #include <linux/cpu.h> #include <asm/processor.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/msr.h> @@ -391,7 +392,7 @@ static void unexpected_thermal_interrupt(void) static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; -asmlinkage __visible void __irq_entry smp_thermal_interrupt(struct pt_regs *r) +asmlinkage __visible void __irq_entry smp_thermal_interrupt(void) { entering_irq(); trace_thermal_apic_entry(THERMAL_APIC_VECTOR); diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 2b584b319eff..b0c60beb6312 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -6,6 +6,7 @@ #include <linux/kernel.h> #include <asm/irq_vectors.h> +#include <asm/traps.h> #include <asm/apic.h> #include <asm/mce.h> #include <asm/trace/irq_vectors.h> -- 2.19.1 -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2018-11-14 13:19 UTC | newest] Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-11-08 1:12 [PATCH v2] x86/cpu: fix prototype warning Yi Wang 2018-11-08 15:03 ` Borislav Petkov 2018-11-08 15:32 ` Borislav Petkov 2018-11-08 15:35 ` Thomas Gleixner 2018-11-08 15:41 ` Borislav Petkov 2018-11-09 16:07 ` David Laight 2018-11-10 10:51 ` [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov 2018-11-10 14:16 ` Borislav Petkov 2018-11-12 5:24 ` Ingo Molnar 2018-11-12 12:19 ` Borislav Petkov 2018-11-13 14:22 ` [tip:x86/cleanups] x86/traps: Complete prototype declarations tip-bot for Borislav Petkov 2018-11-14 13:19 ` tip-bot for Borislav Petkov 2018-11-13 14:21 ` [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings tip-bot for Borislav Petkov 2018-11-14 13:18 ` tip-bot for Borislav Petkov 2018-11-08 15:47 ` [PATCH v2] x86/cpu: fix prototype warning Michael Matz 2018-11-08 17:22 ` Borislav Petkov [not found] ` <201811090843126464658@zte.com.cn> 2018-11-09 10:55 ` Borislav Petkov 2018-11-09 11:12 ` Greg KH 2018-11-09 11:41 ` Borislav Petkov 2018-11-09 12:25 ` Greg KH 2018-11-09 22:17 ` Borislav Petkov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.