mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: fix section mismatch on load_ucode_ap
@ 2013-06-19 15:15 Paul Gortmaker
  2013-06-19 22:03 ` [tip:x86/urgent] x86: Fix " tip-bot for Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2013-06-19 15:15 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Paul Gortmaker, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, stable

We are in the process of removing all the __cpuinit annotations.
While working on making that change, an existing problem was
made evident:

  WARNING: arch/x86/kernel/built-in.o(.text+0x198f2): Section mismatch
  in reference from the function cpu_init() to the function
  .init.text:load_ucode_ap()   The function cpu_init() references
  the function __init load_ucode_ap().  This is often because cpu_init
  lacks a __init annotation or the annotation of load_ucode_ap is wrong.

This now appears because in my working tree, cpu_init() is no longer
tagged as __cpuinit, and so the audit picks up the mismatch.  The 2nd
hypothesis from the audit is the correct one, as there was an incorrect
__init tag on the prototype in the header (but __cpuinit was used on
the function itself.)

The audit is telling us that the prototype's __init annotation took
effect and the function did land in the .init.text section.  Checking
with objdump on a mainline tree that still has __cpuinit shows that
the __cpuinit on the function takes precedence over the __init on the
prototype, but that won't be true once we make __cpuinit a no-op.

Even though we are removing __cpuinit, we temporarily align both
the function and the prototype on __cpuinit so that the changeset
can be applied to stable trees  if desired.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: stable <stable@vger.kernel.org> # 3.9+
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/include/asm/microcode.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 6825e2e..6bc3985 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
 #ifdef CONFIG_MICROCODE_EARLY
 #define MAX_UCODE_COUNT 128
 extern void __init load_ucode_bsp(void);
-extern __init void load_ucode_ap(void);
+extern void __cpuinit load_ucode_ap(void);
 extern int __init save_microcode_in_initrd(void);
 #else
 static inline void __init load_ucode_bsp(void) {}
-static inline __init void load_ucode_ap(void) {}
+static inline void __cpuinit load_ucode_ap(void) {}
 static inline int __init save_microcode_in_initrd(void)
 {
 	return 0;
-- 
1.8.1.2


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

* [tip:x86/urgent] x86: Fix section mismatch on load_ucode_ap
  2013-06-19 15:15 [PATCH] x86: fix section mismatch on load_ucode_ap Paul Gortmaker
@ 2013-06-19 22:03 ` tip-bot for Paul Gortmaker
  2013-06-20  0:02   ` Yinghai Lu
  0 siblings, 1 reply; 4+ messages in thread
From: tip-bot for Paul Gortmaker @ 2013-06-19 22:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, hpa, mingo, tglx, hpa, paul.gortmaker

Commit-ID:  949785996ec2250fa958fc3a924e5186e9a8fa2c
Gitweb:     http://git.kernel.org/tip/949785996ec2250fa958fc3a924e5186e9a8fa2c
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 19 Jun 2013 11:15:26 -0400
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 19 Jun 2013 14:43:59 -0700

x86: Fix section mismatch on load_ucode_ap

We are in the process of removing all the __cpuinit annotations.
While working on making that change, an existing problem was
made evident:

  WARNING: arch/x86/kernel/built-in.o(.text+0x198f2): Section mismatch
  in reference from the function cpu_init() to the function
  .init.text:load_ucode_ap()   The function cpu_init() references
  the function __init load_ucode_ap().  This is often because cpu_init
  lacks a __init annotation or the annotation of load_ucode_ap is wrong.

This now appears because in my working tree, cpu_init() is no longer
tagged as __cpuinit, and so the audit picks up the mismatch.  The 2nd
hypothesis from the audit is the correct one, as there was an incorrect
__init tag on the prototype in the header (but __cpuinit was used on
the function itself.)

The audit is telling us that the prototype's __init annotation took
effect and the function did land in the .init.text section.  Checking
with objdump on a mainline tree that still has __cpuinit shows that
the __cpuinit on the function takes precedence over the __init on the
prototype, but that won't be true once we make __cpuinit a no-op.

Even though we are removing __cpuinit, we temporarily align both
the function and the prototype on __cpuinit so that the changeset
can be applied to stable trees  if desired.

[ hpa: build fix only, no object code change ]

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: stable <stable@vger.kernel.org> # 3.9+
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Link: http://lkml.kernel.org/r/1371654926-11729-1-git-send-email-paul.gortmaker@windriver.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/microcode.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 6825e2e..6bc3985 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
 #ifdef CONFIG_MICROCODE_EARLY
 #define MAX_UCODE_COUNT 128
 extern void __init load_ucode_bsp(void);
-extern __init void load_ucode_ap(void);
+extern void __cpuinit load_ucode_ap(void);
 extern int __init save_microcode_in_initrd(void);
 #else
 static inline void __init load_ucode_bsp(void) {}
-static inline __init void load_ucode_ap(void) {}
+static inline void __cpuinit load_ucode_ap(void) {}
 static inline int __init save_microcode_in_initrd(void)
 {
 	return 0;

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

* Re: [tip:x86/urgent] x86: Fix section mismatch on load_ucode_ap
  2013-06-19 22:03 ` [tip:x86/urgent] x86: Fix " tip-bot for Paul Gortmaker
@ 2013-06-20  0:02   ` Yinghai Lu
  2013-06-20  0:36     ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2013-06-20  0:02 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Ingo Molnar,
	Linux Kernel Mailing List, Thomas Gleixner, H. Peter Anvin,
	Paul Gortmaker
  Cc: linux-tip-commits

On Wed, Jun 19, 2013 at 3:03 PM, tip-bot for Paul Gortmaker
<tipbot@zytor.com> wrote:
> Commit-ID:  949785996ec2250fa958fc3a924e5186e9a8fa2c
> Gitweb:     http://git.kernel.org/tip/949785996ec2250fa958fc3a924e5186e9a8fa2c
> Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
> AuthorDate: Wed, 19 Jun 2013 11:15:26 -0400
> Committer:  H. Peter Anvin <hpa@linux.intel.com>
> CommitDate: Wed, 19 Jun 2013 14:43:59 -0700
>
> x86: Fix section mismatch on load_ucode_ap
>
> We are in the process of removing all the __cpuinit annotations.
> While working on making that change, an existing problem was
> made evident:
>
>   WARNING: arch/x86/kernel/built-in.o(.text+0x198f2): Section mismatch
>   in reference from the function cpu_init() to the function
>   .init.text:load_ucode_ap()   The function cpu_init() references
>   the function __init load_ucode_ap().  This is often because cpu_init
>   lacks a __init annotation or the annotation of load_ucode_ap is wrong.
>
> This now appears because in my working tree, cpu_init() is no longer
> tagged as __cpuinit, and so the audit picks up the mismatch.  The 2nd
> hypothesis from the audit is the correct one, as there was an incorrect
> __init tag on the prototype in the header (but __cpuinit was used on
> the function itself.)
>
> The audit is telling us that the prototype's __init annotation took
> effect and the function did land in the .init.text section.  Checking
> with objdump on a mainline tree that still has __cpuinit shows that
> the __cpuinit on the function takes precedence over the __init on the
> prototype, but that won't be true once we make __cpuinit a no-op.
>
> Even though we are removing __cpuinit, we temporarily align both
> the function and the prototype on __cpuinit so that the changeset
> can be applied to stable trees  if desired.
>
> [ hpa: build fix only, no object code change ]
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: stable <stable@vger.kernel.org> # 3.9+
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> Link: http://lkml.kernel.org/r/1371654926-11729-1-git-send-email-paul.gortmaker@windriver.com
> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> ---
>  arch/x86/include/asm/microcode.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
> index 6825e2e..6bc3985 100644
> --- a/arch/x86/include/asm/microcode.h
> +++ b/arch/x86/include/asm/microcode.h
> @@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
>  #ifdef CONFIG_MICROCODE_EARLY
>  #define MAX_UCODE_COUNT 128
>  extern void __init load_ucode_bsp(void);
> -extern __init void load_ucode_ap(void);
> +extern void __cpuinit load_ucode_ap(void);

why not just dropping __init in header file?


>  extern int __init save_microcode_in_initrd(void);
>  #else
>  static inline void __init load_ucode_bsp(void) {}
> -static inline __init void load_ucode_ap(void) {}
> +static inline void __cpuinit load_ucode_ap(void) {}
>  static inline int __init save_microcode_in_initrd(void)
>  {
>         return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [tip:x86/urgent] x86: Fix section mismatch on load_ucode_ap
  2013-06-20  0:02   ` Yinghai Lu
@ 2013-06-20  0:36     ` Paul Gortmaker
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Gortmaker @ 2013-06-20  0:36 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, H. Peter Anvin, Ingo Molnar,
	Linux Kernel Mailing List, Thomas Gleixner, H. Peter Anvin,
	linux-tip-commits

[Re: [tip:x86/urgent] x86: Fix section mismatch on load_ucode_ap] On 19/06/2013 (Wed 17:02) Yinghai Lu wrote:

> On Wed, Jun 19, 2013 at 3:03 PM, tip-bot for Paul Gortmaker
> <tipbot@zytor.com> wrote:
> > Commit-ID:  949785996ec2250fa958fc3a924e5186e9a8fa2c
> > Gitweb:     http://git.kernel.org/tip/949785996ec2250fa958fc3a924e5186e9a8fa2c
> > Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
> > AuthorDate: Wed, 19 Jun 2013 11:15:26 -0400
> > Committer:  H. Peter Anvin <hpa@linux.intel.com>
> > CommitDate: Wed, 19 Jun 2013 14:43:59 -0700
> >
> > x86: Fix section mismatch on load_ucode_ap
> >
> > We are in the process of removing all the __cpuinit annotations.
> > While working on making that change, an existing problem was
> > made evident:
> >
> >   WARNING: arch/x86/kernel/built-in.o(.text+0x198f2): Section mismatch
> >   in reference from the function cpu_init() to the function
> >   .init.text:load_ucode_ap()   The function cpu_init() references
> >   the function __init load_ucode_ap().  This is often because cpu_init
> >   lacks a __init annotation or the annotation of load_ucode_ap is wrong.
> >
> > This now appears because in my working tree, cpu_init() is no longer
> > tagged as __cpuinit, and so the audit picks up the mismatch.  The 2nd
> > hypothesis from the audit is the correct one, as there was an incorrect
> > __init tag on the prototype in the header (but __cpuinit was used on
> > the function itself.)
> >
> > The audit is telling us that the prototype's __init annotation took
> > effect and the function did land in the .init.text section.  Checking
> > with objdump on a mainline tree that still has __cpuinit shows that
> > the __cpuinit on the function takes precedence over the __init on the
> > prototype, but that won't be true once we make __cpuinit a no-op.
> >
> > Even though we are removing __cpuinit, we temporarily align both
> > the function and the prototype on __cpuinit so that the changeset
> > can be applied to stable trees  if desired.
> >
> > [ hpa: build fix only, no object code change ]
> >
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: stable <stable@vger.kernel.org> # 3.9+
> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > Link: http://lkml.kernel.org/r/1371654926-11729-1-git-send-email-paul.gortmaker@windriver.com
> > Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> > ---
> >  arch/x86/include/asm/microcode.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
> > index 6825e2e..6bc3985 100644
> > --- a/arch/x86/include/asm/microcode.h
> > +++ b/arch/x86/include/asm/microcode.h
> > @@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
> >  #ifdef CONFIG_MICROCODE_EARLY
> >  #define MAX_UCODE_COUNT 128
> >  extern void __init load_ucode_bsp(void);
> > -extern __init void load_ucode_ap(void);
> > +extern void __cpuinit load_ucode_ap(void);
> 
> why not just dropping __init in header file?

Why?  Because then the mis-match remains, and the next person along who
cares about understanding what it really means, has to repeat the same
research that I did in order to understand what was really happening
(or in this case, not happening).  Why do that?  That doesn't make sense.

Paul.
--

> 
> 
> >  extern int __init save_microcode_in_initrd(void);
> >  #else
> >  static inline void __init load_ucode_bsp(void) {}
> > -static inline __init void load_ucode_ap(void) {}
> > +static inline void __cpuinit load_ucode_ap(void) {}
> >  static inline int __init save_microcode_in_initrd(void)
> >  {
> >         return 0;
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2013-06-20  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-19 15:15 [PATCH] x86: fix section mismatch on load_ucode_ap Paul Gortmaker
2013-06-19 22:03 ` [tip:x86/urgent] x86: Fix " tip-bot for Paul Gortmaker
2013-06-20  0:02   ` Yinghai Lu
2013-06-20  0:36     ` Paul Gortmaker

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

Powered by JetHome