2018-11-08 01:11:45

by Yi Wang

[permalink] [raw]
Subject: [PATCH v2] x86/cpu: fix prototype warning

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 <[email protected]>
---
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



2018-11-08 15:06:41

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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.

2018-11-08 15:34:09

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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.

2018-11-08 15:38:40

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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

2018-11-08 15:42:06

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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.

2018-11-08 15:48:38

by Michael Matz

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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.

2018-11-08 17:25:40

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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.

2018-11-09 10:57:48

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

On Fri, Nov 09, 2018 at 08:43:12AM +0800, [email protected] 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.

2018-11-09 11:13:06

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

On Fri, Nov 09, 2018 at 11:55:38AM +0100, Borislav Petkov wrote:
> On Fri, Nov 09, 2018 at 08:43:12AM +0800, [email protected] 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

2018-11-09 11:42:04

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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 [email protected] too, no?

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

2018-11-09 12:26:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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 [email protected] too, no?

I don't know if that list is still alive, but it could not hurt :)

2018-11-09 16:10:30

by David Laight

[permalink] [raw]
Subject: RE: [PATCH v2] x86/cpu: fix prototype warning

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)


2018-11-09 22:18:51

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH v2] x86/cpu: fix prototype warning

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 <[email protected]>
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 <[email protected]>
---
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.

Subject: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings

Commit-ID: d813dfb28641306f66cf1e2c3586f39ab4f84b27
Gitweb: https://git.kernel.org/tip/d813dfb28641306f66cf1e2c3586f39ab4f84b27
Author: Borislav Petkov <[email protected]>
AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100
Committer: Borislav Petkov <[email protected]>
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 <[email protected]>
Cc: Yi Wang <[email protected]>
Cc: Michael Matz <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
---
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>

2018-11-10 14:18:57

by Borislav Petkov

[permalink] [raw]
Subject: Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings

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 <[email protected]>
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 <[email protected]>
Cc: Yi Wang <[email protected]>
Cc: Michael Matz <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
---
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)

2018-11-12 05:25:41

by Ingo Molnar

[permalink] [raw]
Subject: Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings


* Borislav Petkov <[email protected]> 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 <[email protected]>
> Cc: Yi Wang <[email protected]>
> Cc: Michael Matz <[email protected]>
> Cc: [email protected]
> Link: https://lkml.kernel.org/r/[email protected]
> ---
> 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

2018-11-12 12:19:49

by Borislav Petkov

[permalink] [raw]
Subject: Re: [tip:ras/core] x86/mce: Fix -Wmissing-prototypes warnings

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)

Subject: [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings

Commit-ID: 83a204daa40315a38204493f60768910c8604e9c
Gitweb: https://git.kernel.org/tip/83a204daa40315a38204493f60768910c8604e9c
Author: Borislav Petkov <[email protected]>
AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100
Committer: Borislav Petkov <[email protected]>
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 <[email protected]>
Cc: Yi Wang <[email protected]>
Cc: Michael Matz <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
---
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);

Subject: [tip:x86/cleanups] x86/traps: Complete prototype declarations

Commit-ID: 95715a3f0e4f0abc4749c6a4fdf2c08c3ff18450
Gitweb: https://git.kernel.org/tip/95715a3f0e4f0abc4749c6a4fdf2c08c3ff18450
Author: Borislav Petkov <[email protected]>
AuthorDate: Mon, 12 Nov 2018 13:20:36 +0100
Committer: Borislav Petkov <[email protected]>
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 <[email protected]>
Cc: <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
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)
{

Subject: [tip:x86/cleanups] x86/mce: Fix -Wmissing-prototypes warnings

Commit-ID: 68b5e4326e4b8ac9080835005d8254fed0fb3c56
Gitweb: https://git.kernel.org/tip/68b5e4326e4b8ac9080835005d8254fed0fb3c56
Author: Borislav Petkov <[email protected]>
AuthorDate: Fri, 9 Nov 2018 23:13:13 +0100
Committer: Borislav Petkov <[email protected]>
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 <[email protected]>
Cc: Yi Wang <[email protected]>
Cc: Michael Matz <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
---
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);

Subject: [tip:x86/cleanups] x86/traps: Complete prototype declarations

Commit-ID: 8e1599fcac2efda8b7d433ef69d2492f0b351e3f
Gitweb: https://git.kernel.org/tip/8e1599fcac2efda8b7d433ef69d2492f0b351e3f
Author: Borislav Petkov <[email protected]>
AuthorDate: Mon, 12 Nov 2018 13:20:36 +0100
Committer: Borislav Petkov <[email protected]>
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 <[email protected]>
Cc: <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
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)
{