public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* swiotlb: Add missing __init annotations
@ 2008-12-31  4:18 Roland Dreier
  2009-01-01 13:02 ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Roland Dreier @ 2008-12-31  4:18 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Jeremy Fitzhardinge, FUJITA Tomonori

The current kernel build warns:

    WARNING: vmlinux.o(.text+0x11458): Section mismatch in reference from the function swiotlb_alloc_boot() to the function .init.text:__alloc_bootmem_low()
    The function swiotlb_alloc_boot() references
    the function __init __alloc_bootmem_low().
    This is often because swiotlb_alloc_boot lacks a __init
    annotation or the annotation of __alloc_bootmem_low is wrong.
    
    WARNING: vmlinux.o(.text+0x1011f2): Section mismatch in reference from the function swiotlb_late_init_with_default_size() to the function .init.text:__alloc_bootmem_low()
    The function swiotlb_late_init_with_default_size() references
    the function __init __alloc_bootmem_low().
    This is often because swiotlb_late_init_with_default_size lacks a __init
    annotation or the annotation of __alloc_bootmem_low is wrong.

and indeed the functions calling __alloc_bootmem_low() can be marked
__init as well.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
Not 100% sure if this is the correct fix but it seems OK for me.

 arch/x86/kernel/pci-swiotlb_64.c |    2 +-
 lib/swiotlb.c                    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 242c344..8cba374 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -13,7 +13,7 @@
 
 int swiotlb __read_mostly;
 
-void *swiotlb_alloc_boot(size_t size, unsigned long nslabs)
+void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
 {
 	return alloc_bootmem_low_pages(size);
 }
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fa2dc4e..1b76f78 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -116,7 +116,7 @@ setup_io_tlb_npages(char *str)
 __setup("swiotlb=", setup_io_tlb_npages);
 /* make io_tlb_overflow tunable too? */
 
-void * __weak swiotlb_alloc_boot(size_t size, unsigned long nslabs)
+void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
 {
 	return alloc_bootmem_low_pages(size);
 }
@@ -186,7 +186,7 @@ static void swiotlb_print_info(unsigned long bytes)
  * Statically reserve bounce buffer space and initialize bounce buffer data
  * structures for the software IO TLB used to implement the DMA API.
  */
-void __init
+void __init __weak
 swiotlb_init_with_default_size(size_t default_size)
 {
 	unsigned long i, bytes;

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

* Re: swiotlb: Add missing __init annotations
  2008-12-31  4:18 swiotlb: Add missing __init annotations Roland Dreier
@ 2009-01-01 13:02 ` Sam Ravnborg
  2009-01-02 19:25   ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2009-01-01 13:02 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-kernel, Ingo Molnar, Jeremy Fitzhardinge, FUJITA Tomonori

On Tue, Dec 30, 2008 at 08:18:00PM -0800, Roland Dreier wrote:
> The current kernel build warns:
> 
>     WARNING: vmlinux.o(.text+0x11458): Section mismatch in reference from the function swiotlb_alloc_boot() to the function .init.text:__alloc_bootmem_low()
>     The function swiotlb_alloc_boot() references
>     the function __init __alloc_bootmem_low().
>     This is often because swiotlb_alloc_boot lacks a __init
>     annotation or the annotation of __alloc_bootmem_low is wrong.
>     
>     WARNING: vmlinux.o(.text+0x1011f2): Section mismatch in reference from the function swiotlb_late_init_with_default_size() to the function .init.text:__alloc_bootmem_low()
>     The function swiotlb_late_init_with_default_size() references
>     the function __init __alloc_bootmem_low().
>     This is often because swiotlb_late_init_with_default_size lacks a __init
>     annotation or the annotation of __alloc_bootmem_low is wrong.
> 
> and indeed the functions calling __alloc_bootmem_low() can be marked
> __init as well.
> 
> Signed-off-by: Roland Dreier <rolandd@cisco.com>
> ---
> Not 100% sure if this is the correct fix but it seems OK for me.
> 
>  arch/x86/kernel/pci-swiotlb_64.c |    2 +-
>  lib/swiotlb.c                    |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
> index 242c344..8cba374 100644
> --- a/arch/x86/kernel/pci-swiotlb_64.c
> +++ b/arch/x86/kernel/pci-swiotlb_64.c
> @@ -13,7 +13,7 @@
>  
>  int swiotlb __read_mostly;
>  
> -void *swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> +void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
>  {
>  	return alloc_bootmem_low_pages(size);
>  }
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index fa2dc4e..1b76f78 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -116,7 +116,7 @@ setup_io_tlb_npages(char *str)
>  __setup("swiotlb=", setup_io_tlb_npages);
>  /* make io_tlb_overflow tunable too? */
>  
> -void * __weak swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> +void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
>  {
>  	return alloc_bootmem_low_pages(size);
>  }
> @@ -186,7 +186,7 @@ static void swiotlb_print_info(unsigned long bytes)
>   * Statically reserve bounce buffer space and initialize bounce buffer data
>   * structures for the software IO TLB used to implement the DMA API.
>   */
> -void __init
> +void __init __weak
>  swiotlb_init_with_default_size(size_t default_size)

This change looks unrealted to __init annotation described in the changelog.
Was it intentional?

	Sam

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

* Re: swiotlb: Add missing __init annotations
  2009-01-01 13:02 ` Sam Ravnborg
@ 2009-01-02 19:25   ` Ingo Molnar
  2009-01-02 20:02     ` Roland Dreier
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2009-01-02 19:25 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Roland Dreier, linux-kernel, Jeremy Fitzhardinge, FUJITA Tomonori


* Sam Ravnborg <sam@ravnborg.org> wrote:

> On Tue, Dec 30, 2008 at 08:18:00PM -0800, Roland Dreier wrote:
> > The current kernel build warns:
> > 
> >     WARNING: vmlinux.o(.text+0x11458): Section mismatch in reference from the function swiotlb_alloc_boot() to the function .init.text:__alloc_bootmem_low()
> >     The function swiotlb_alloc_boot() references
> >     the function __init __alloc_bootmem_low().
> >     This is often because swiotlb_alloc_boot lacks a __init
> >     annotation or the annotation of __alloc_bootmem_low is wrong.
> >     
> >     WARNING: vmlinux.o(.text+0x1011f2): Section mismatch in reference from the function swiotlb_late_init_with_default_size() to the function .init.text:__alloc_bootmem_low()
> >     The function swiotlb_late_init_with_default_size() references
> >     the function __init __alloc_bootmem_low().
> >     This is often because swiotlb_late_init_with_default_size lacks a __init
> >     annotation or the annotation of __alloc_bootmem_low is wrong.
> > 
> > and indeed the functions calling __alloc_bootmem_low() can be marked
> > __init as well.
> > 
> > Signed-off-by: Roland Dreier <rolandd@cisco.com>
> > ---
> > Not 100% sure if this is the correct fix but it seems OK for me.
> > 
> >  arch/x86/kernel/pci-swiotlb_64.c |    2 +-
> >  lib/swiotlb.c                    |    4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
> > index 242c344..8cba374 100644
> > --- a/arch/x86/kernel/pci-swiotlb_64.c
> > +++ b/arch/x86/kernel/pci-swiotlb_64.c
> > @@ -13,7 +13,7 @@
> >  
> >  int swiotlb __read_mostly;
> >  
> > -void *swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> > +void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> >  {
> >  	return alloc_bootmem_low_pages(size);
> >  }
> > diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> > index fa2dc4e..1b76f78 100644
> > --- a/lib/swiotlb.c
> > +++ b/lib/swiotlb.c
> > @@ -116,7 +116,7 @@ setup_io_tlb_npages(char *str)
> >  __setup("swiotlb=", setup_io_tlb_npages);
> >  /* make io_tlb_overflow tunable too? */
> >  
> > -void * __weak swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> > +void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> >  {
> >  	return alloc_bootmem_low_pages(size);
> >  }
> > @@ -186,7 +186,7 @@ static void swiotlb_print_info(unsigned long bytes)
> >   * Statically reserve bounce buffer space and initialize bounce buffer data
> >   * structures for the software IO TLB used to implement the DMA API.
> >   */
> > -void __init
> > +void __init __weak
> >  swiotlb_init_with_default_size(size_t default_size)
> 
> This change looks unrealted to __init annotation described in the 
> changelog. Was it intentional?

that hunk definitely looks wrong.

	Ingo

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

* Re: swiotlb: Add missing __init annotations
  2009-01-02 19:25   ` Ingo Molnar
@ 2009-01-02 20:02     ` Roland Dreier
  2009-01-02 20:46       ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Roland Dreier @ 2009-01-02 20:02 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Sam Ravnborg, linux-kernel, Jeremy Fitzhardinge, FUJITA Tomonori

> > @@ -186,7 +186,7 @@ static void swiotlb_print_info(unsigned long bytes)
> >   * Statically reserve bounce buffer space and initialize bounce buffer data
> >   * structures for the software IO TLB used to implement the DMA API.
> >   */
> > -void __init
> > +void __init __weak
> >  swiotlb_init_with_default_size(size_t default_size)
> 
> This change looks unrealted to __init annotation described in the 
> changelog. Was it intentional?

Yes, that was a thinko -- somehow while reading it I saw the __init
without __weak as being missing an annotation.  Should I resend a fixed
patch?

 - R.

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

* Re: swiotlb: Add missing __init annotations
  2009-01-02 20:02     ` Roland Dreier
@ 2009-01-02 20:46       ` Ingo Molnar
  2009-01-02 22:36         ` Roland Dreier
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2009-01-02 20:46 UTC (permalink / raw)
  To: Roland Dreier
  Cc: Sam Ravnborg, linux-kernel, Jeremy Fitzhardinge, FUJITA Tomonori


* Roland Dreier <rdreier@cisco.com> wrote:

> > > @@ -186,7 +186,7 @@ static void swiotlb_print_info(unsigned long bytes)
> > >   * Statically reserve bounce buffer space and initialize bounce buffer data
> > >   * structures for the software IO TLB used to implement the DMA API.
> > >   */
> > > -void __init
> > > +void __init __weak
> > >  swiotlb_init_with_default_size(size_t default_size)
> > 
> > This change looks unrealted to __init annotation described in the 
> > changelog. Was it intentional?
> 
> Yes, that was a thinko -- somehow while reading it I saw the __init 
> without __weak as being missing an annotation.  Should I resend a fixed 
> patch?

no need - so it wasnt needed to make a section warning go away - i.e. your 
patch sans the last hunk is tested to solve the problem, right?

	Ingo

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

* Re: swiotlb: Add missing __init annotations
  2009-01-02 20:46       ` Ingo Molnar
@ 2009-01-02 22:36         ` Roland Dreier
  2009-01-02 22:42           ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Roland Dreier @ 2009-01-02 22:36 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Sam Ravnborg, linux-kernel, Jeremy Fitzhardinge, FUJITA Tomonori

 > no need - so it wasnt needed to make a section warning go away - i.e. your 
 > patch sans the last hunk is tested to solve the problem, right?

I hadn't tested without that hunk... so I just redid it.  For
simplicity, here's the exact patch I just tested to solve the warnings:

===

The current kernel build warns:

    WARNING: vmlinux.o(.text+0x11458): Section mismatch in reference from the function swiotlb_alloc_boot() to the function .init.text:__alloc_bootmem_low()
    The function swiotlb_alloc_boot() references
    the function __init __alloc_bootmem_low().
    This is often because swiotlb_alloc_boot lacks a __init
    annotation or the annotation of __alloc_bootmem_low is wrong.
    
    WARNING: vmlinux.o(.text+0x1011f2): Section mismatch in reference from the function swiotlb_late_init_with_default_size() to the function .init.text:__alloc_bootmem_low()
    The function swiotlb_late_init_with_default_size() references
    the function __init __alloc_bootmem_low().
    This is often because swiotlb_late_init_with_default_size lacks a __init
    annotation or the annotation of __alloc_bootmem_low is wrong.

and indeed the functions calling __alloc_bootmem_low() can be marked
__init as well.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
 arch/x86/kernel/pci-swiotlb_64.c |    2 +-
 lib/swiotlb.c                    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 242c344..8cba374 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -13,7 +13,7 @@
 
 int swiotlb __read_mostly;
 
-void *swiotlb_alloc_boot(size_t size, unsigned long nslabs)
+void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
 {
 	return alloc_bootmem_low_pages(size);
 }
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fa2dc4e..f684d55 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -116,7 +116,7 @@ setup_io_tlb_npages(char *str)
 __setup("swiotlb=", setup_io_tlb_npages);
 /* make io_tlb_overflow tunable too? */
 
-void * __weak swiotlb_alloc_boot(size_t size, unsigned long nslabs)
+void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
 {
 	return alloc_bootmem_low_pages(size);
 }
@@ -238,7 +238,7 @@ swiotlb_init(void)
  * initialize the swiotlb later using the slab allocator if needed.
  * This should be just like above, but with some error catching.
  */
-int
+int __init
 swiotlb_late_init_with_default_size(size_t default_size)
 {
 	unsigned long i, bytes, req_nslabs = io_tlb_nslabs;

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

* Re: swiotlb: Add missing __init annotations
  2009-01-02 22:36         ` Roland Dreier
@ 2009-01-02 22:42           ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-01-02 22:42 UTC (permalink / raw)
  To: Roland Dreier
  Cc: Sam Ravnborg, linux-kernel, Jeremy Fitzhardinge, FUJITA Tomonori


* Roland Dreier <rdreier@cisco.com> wrote:

>  > no need - so it wasnt needed to make a section warning go away - i.e. your 
>  > patch sans the last hunk is tested to solve the problem, right?
> 
> I hadn't tested without that hunk... so I just redid it.  For
> simplicity, here's the exact patch I just tested to solve the warnings:

applied to tip/core/urgent, thanks Roland!

	Ingo

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

end of thread, other threads:[~2009-01-02 22:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-31  4:18 swiotlb: Add missing __init annotations Roland Dreier
2009-01-01 13:02 ` Sam Ravnborg
2009-01-02 19:25   ` Ingo Molnar
2009-01-02 20:02     ` Roland Dreier
2009-01-02 20:46       ` Ingo Molnar
2009-01-02 22:36         ` Roland Dreier
2009-01-02 22:42           ` Ingo Molnar

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