2008-11-11 04:15:40

by Rakib Mullick

[permalink] [raw]
Subject: [PATCH 1/2] x86: Fixing improper annotation.

The macro __init used in function 'init_thread_xstate' is not
appropriate. It should be __cpuinit , because it's been called from
__cpuinit functions several times ( I myself found twice, once from
'cpu_init' and other is from 'fpu_init'). Thus produces the following
warning:

WARNING: arch/x86/kernel/built-in.o(.cpuinit.text+0x2237): Section
mismatch in reference from the function cpu_init() to the function
.init.text:init_thread_xstate()
The function __cpuinit cpu_init() references
a function __init init_thread_xstate().
If init_thread_xstate is only used by cpu_init then
annotate init_thread_xstate with a matching annotation.

This patch fixes the above warning. If anything else please notice.

Signed-off-by: Rakib Mullick <[email protected]>

--- linux-2.6-orig/arch/x86/kernel/i387.c 2008-11-10 13:28:17.000000000 +0600
+++ linux-2.6/arch/x86/kernel/i387.c 2008-11-10 23:35:09.000000000 +0600
@@ -58,7 +58,7 @@ void __cpuinit mxcsr_feature_mask_init(v
stts();
}

-void __init init_thread_xstate(void)
+void __cpuinit init_thread_xstate(void)
{
if (!HAVE_HWFP) {
xstate_size = sizeof(struct i387_soft_struct);


2008-11-11 07:57:42

by Rufus & Azrael

[permalink] [raw]
Subject: Re:[PATCH 1/2] x86: Fixing improper annotation.

Hi Rakib,


Your two patches set for x86 init_thread_xsate function section mismatch
is correct to fix the compilation warning, but generates this other one :

> WARNING: vmlinux.o(.cpuinit.text+0x7de): Section mismatch in reference
> from the function xsave_cntxt_init() to the function
> .init.text:__alloc_bootmem()
> The function __cpuinit xsave_cntxt_init() references
> a function __init __alloc_bootmem().
> If __alloc_bootmem is only used by xsave_cntxt_init then
> annotate __alloc_bootmem with a matching annotation.
Thanks for your good job.

Regards.

2008-11-11 10:37:16

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.


* Rufus & Azrael <[email protected]> wrote:

> Hi Rakib,
>
>
> Your two patches set for x86 init_thread_xsate function section
> mismatch is correct to fix the compilation warning, but generates
> this other one :
>
>> WARNING: vmlinux.o(.cpuinit.text+0x7de): Section mismatch in reference
>> from the function xsave_cntxt_init() to the function
>> .init.text:__alloc_bootmem()
>> The function __cpuinit xsave_cntxt_init() references
>> a function __init __alloc_bootmem().
>> If __alloc_bootmem is only used by xsave_cntxt_init then
>> annotate __alloc_bootmem with a matching annotation.

that's with both 1/2 and 2/2 applied?

Ingo

2008-11-11 10:39:25

by Rufus & Azrael

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.

Ingo Molnar wrote:
> * Rufus& Azrael<[email protected]> wrote:
>
>
>> Hi Rakib,
>>
>>
>> Your two patches set for x86 init_thread_xsate function section
>> mismatch is correct to fix the compilation warning, but generates
>> this other one :
>>
>>
>>> WARNING: vmlinux.o(.cpuinit.text+0x7de): Section mismatch in reference
>>> from the function xsave_cntxt_init() to the function
>>> .init.text:__alloc_bootmem()
>>> The function __cpuinit xsave_cntxt_init() references
>>> a function __init __alloc_bootmem().
>>> If __alloc_bootmem is only used by xsave_cntxt_init then
>>> annotate __alloc_bootmem with a matching annotation.
>>>
>
> that's with both 1/2 and 2/2 applied?
>
> Ingo
>
>
Yes Ingo with the two patches applied.

Regards.

2008-11-11 10:41:26

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.


* Rufus & Azrael <[email protected]> wrote:

> Ingo Molnar wrote:
>> * Rufus& Azrael<[email protected]> wrote:
>>
>>
>>> Hi Rakib,
>>>
>>>
>>> Your two patches set for x86 init_thread_xsate function section
>>> mismatch is correct to fix the compilation warning, but generates
>>> this other one :
>>>
>>>
>>>> WARNING: vmlinux.o(.cpuinit.text+0x7de): Section mismatch in reference
>>>> from the function xsave_cntxt_init() to the function
>>>> .init.text:__alloc_bootmem()
>>>> The function __cpuinit xsave_cntxt_init() references
>>>> a function __init __alloc_bootmem().
>>>> If __alloc_bootmem is only used by xsave_cntxt_init then
>>>> annotate __alloc_bootmem with a matching annotation.
>>>>
>>
>> that's with both 1/2 and 2/2 applied?
>>
>> Ingo
>>
>>
> Yes Ingo with the two patches applied.

okay - so i wont apply them until the full scope of the problems here
is mapped. We might be best off by marking xsave_cntxt_init() non-init
altogether for the time being?

Ingo

2008-11-12 00:46:18

by Rakib Mullick

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.

On 11/11/08, Ingo Molnar <[email protected]> wrote:

>
> okay - so i wont apply them until the full scope of the problems here
> is mapped. We might be best off by marking xsave_cntxt_init() non-init
> altogether for the time being?
But, it's been called from an __init section, it will also trigger an
warning too. So, it
will remain as it was. If we goes to hunt these warnings ( I mean
we've to replace __init __alloc_bootmem() with __cpuinit
__alloc_bootmem() ) , it's not certain when it will stop. Likely , we
need to replace a lots of __init with __cpuinit.

Rakib
>
> Ingo
>

2008-11-14 03:27:23

by Rakib Mullick

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.

On 11/12/08, Rakib Mullick <[email protected]> wrote:
> On 11/11/08, Ingo Molnar <[email protected]> wrote:
>
> >
> > okay - so i wont apply them until the full scope of the problems here
> > is mapped. We might be best off by marking xsave_cntxt_init() non-init
> > altogether for the time being?
>
> But, it's been called from an __init section, it will also trigger an
> warning too. So, it
> will remain as it was. If we goes to hunt these warnings ( I mean
> we've to replace __init __alloc_bootmem() with __cpuinit
> __alloc_bootmem() ) , it's not certain when it will stop. Likely , we
> need to replace a lots of __init with __cpuinit.
>
Actually , if we replace __init __alloc_bootmem() with __cpuinit
__alloc_bootmem() that doesn't solve the problem. The mentioned
warning generates when CONFIG_ARCH_BOOTMEM_NODE=y is set. I think Ingo
is right. We can mark xsave_cntxt_init() as non-init. And we could
teach modpost to not to generate the warning
with __ref. Can we, Ingo ?
> Rakib
> >
> > Ingo
> >
>

2008-11-18 21:39:23

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Fixing improper annotation.


* Rakib Mullick <[email protected]> wrote:

> On 11/12/08, Rakib Mullick <[email protected]> wrote:
> > On 11/11/08, Ingo Molnar <[email protected]> wrote:
> >
> > >
> > > okay - so i wont apply them until the full scope of the problems here
> > > is mapped. We might be best off by marking xsave_cntxt_init() non-init
> > > altogether for the time being?
> >
> > But, it's been called from an __init section, it will also trigger an
> > warning too. So, it
> > will remain as it was. If we goes to hunt these warnings ( I mean
> > we've to replace __init __alloc_bootmem() with __cpuinit
> > __alloc_bootmem() ) , it's not certain when it will stop. Likely , we
> > need to replace a lots of __init with __cpuinit.
> >
>
> Actually , if we replace __init __alloc_bootmem() with __cpuinit
> __alloc_bootmem() that doesn't solve the problem. The mentioned
> warning generates when CONFIG_ARCH_BOOTMEM_NODE=y is set. I think
> Ingo is right. We can mark xsave_cntxt_init() as non-init. And we
> could teach modpost to not to generate the warning with __ref. Can
> we, Ingo ?

sure. Marking stuff non-init is inherently safe as well.

Ingo