mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [Bug 8679] New: Section mismatch: reference to .init.text
       [not found] <bug-8679-10286@http.bugzilla.kernel.org/>
@ 2007-06-26 19:01 ` Randy Dunlap
  2007-06-26 21:32   ` Satyam Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2007-06-26 19:01 UTC (permalink / raw)
  To: bugme-daemon, lkml; +Cc: wbrana

On Tue, 26 Jun 2007 10:46:36 -0700 (PDT) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=8679
> 
>            Summary: Section mismatch: reference to .init.text
>            Product: Other
>            Version: 2.5
>      KernelVersion: 2.6.22-rc6
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Configuration
>         AssignedTo: zippel@linux-m68k.org
>         ReportedBy: wbrana@gmail.com
> 
> 
> Software Environment:
> gcc 3.4.6, binutils 2.17
> 
> Problem Description:
> Warnings appeared while building kernel:
> 
> WARNING: arch/i386/kernel/built-in.o(.data+0x2148): Section mismatch: reference
> to .init.text: (between 'thermal_throttle_cpu_notifier' and 'mtrr_mutex')
> WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> .init.text: (between 'kthreadd' and 'init_waitqueue_head')


I don't see the kernel/built-in.o warning when I build this (I have
binutils 2.16++).  Can you test the patch below to verify that it
fixes the warning?

On the other warning ('thermal_throttle_cpu_notifier'), we have:

static struct notifier_block thermal_throttle_cpu_notifier =
{
	.notifier_call = thermal_throttle_cpu_callback,
};

where CONFIG_CPU_HOTPLUG=n, so __cpuinit == __init in:

static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb,
						   unsigned long action,
						   void *hcpu)


so CPU hotplug actions should never happen here.  Still, we have
a registered notifier that is in __init space and has been discarded... :(
Any suggestions out there?



---
From: Randy Dunlap <randy.dunlap@oracle.com>

kthreadd_setup() is in an __init section, but we know that it's
safe to be called from kthreadd() since the latter is only called
at kernel init time, so mark kthreadd_setup() __init_refok so
that modpost won't complain about what text section it is in.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 kernel/kthread.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.22-rc6.orig/kernel/kthread.c
+++ linux-2.6.22-rc6/kernel/kthread.c
@@ -215,7 +215,7 @@ int kthread_stop(struct task_struct *k)
 EXPORT_SYMBOL(kthread_stop);
 
 
-static __init void kthreadd_setup(void)
+static __init_refok void kthreadd_setup(void)
 {
 	struct task_struct *tsk = current;
 

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

* Re: [Bug 8679] New: Section mismatch: reference to .init.text
  2007-06-26 19:01 ` [Bug 8679] New: Section mismatch: reference to .init.text Randy Dunlap
@ 2007-06-26 21:32   ` Satyam Sharma
  2007-06-26 21:42     ` Satyam Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: Satyam Sharma @ 2007-06-26 21:32 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: bugme-daemon, lkml, wbrana, Sam Ravnborg

On 6/27/07, Randy Dunlap <randy.dunlap@oracle.com> wrote:
> > [...]
> > Software Environment:
> > gcc 3.4.6, binutils 2.17
> >
> > Problem Description:
> > Warnings appeared while building kernel:
> >
> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')
> [...]
> From: Randy Dunlap <randy.dunlap@oracle.com>
>
> kthreadd_setup() is in an __init section, but we know that it's
> safe to be called from kthreadd() since the latter is only called
> at kernel init time, so mark kthreadd_setup() __init_refok so
> that modpost won't complain about what text section it is in.

Hi Randy,

__init_refok is for callers, so we should actually be marking kthreadd()
as __init_refok. But I feel kthreadd_setup() doesn't want to be a separate
function at all. This is for 2.6.22-rc6, so kindly apply.

---

From: Satyam Sharma <satyam.sharma@gmail.com>

> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')

is because kernel/kthread.c:kthreadd() is not __init but calls kthreadd_setup()
which is __init. But this is ok, because kthreadd_setup() is only ever called at
init time, and then kthreadd() proceeds into its "for (;;)" loop.

We could mark kthreadd() __init_refok, but I feel kthreadd_setup() with just one
call site and 4 lines in it shouldn't be a separate function at all.
So let's lose it
and code it explicitly in kthreadd() itself.

Signed-off-by: Satyam Sharma <satyam.sharma@gmail.com>

---

 kernel/kthread.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

---

diff -ruNp a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	2007-06-26 06:33:08.000000000 +0530
+++ b/kernel/kthread.c	2007-06-27 02:57:46.000000000 +0530
@@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
 }
 EXPORT_SYMBOL(kthread_stop);

-
-static __init void kthreadd_setup(void)
+int kthreadd(void *unused)
 {
 	struct task_struct *tsk = current;

+	/* Setup a clean context for our children to inherit. */
 	set_task_comm(tsk, "kthreadd");
-
 	ignore_signals(tsk);
-
 	set_user_nice(tsk, -5);
 	set_cpus_allowed(tsk, CPU_MASK_ALL);
-}
-
-int kthreadd(void *unused)
-{
-	/* Setup a clean context for our children to inherit. */
-	kthreadd_setup();

 	current->flags |= PF_NOFREEZE;

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

* Re: [Bug 8679] New: Section mismatch: reference to .init.text
  2007-06-26 21:32   ` Satyam Sharma
@ 2007-06-26 21:42     ` Satyam Sharma
  0 siblings, 0 replies; 3+ messages in thread
From: Satyam Sharma @ 2007-06-26 21:42 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: bugme-daemon, lkml, wbrana, Sam Ravnborg

[ I have a sinking feeling Gmail mangled the patch yet again. So,
resending. And I'm getting myself a decent mailer ASAP. Sorry for
all the noise. ]

On 6/27/07, Satyam Sharma <satyam.sharma@gmail.com> wrote:
> On 6/27/07, Randy Dunlap <randy.dunlap@oracle.com> wrote:
> > > [...]
> > > Software Environment:
> > > gcc 3.4.6, binutils 2.17
> > >
> > > Problem Description:
> > > Warnings appeared while building kernel:
> > >
> > > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > > .init.text: (between 'kthreadd' and 'init_waitqueue_head')
> > [...]
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> >
> > kthreadd_setup() is in an __init section, but we know that it's
> > safe to be called from kthreadd() since the latter is only called
> > at kernel init time, so mark kthreadd_setup() __init_refok so
> > that modpost won't complain about what text section it is in.
>
> Hi Randy,
>
> __init_refok is for callers, so we should actually be marking kthreadd()
> as __init_refok. But I feel kthreadd_setup() doesn't want to be a separate
> function at all. This is for 2.6.22-rc6, so kindly apply.

---

From: Satyam Sharma <satyam.sharma@gmail.com>

> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')

is because kernel/kthread.c:kthreadd() is not __init but calls
kthreadd_setup() which is __init. But this is ok, because kthreadd_setup()
is only ever called at init time, and then kthreadd() proceeds into its
"for (;;)" loop.

We could mark kthreadd() __init_refok, but I feel kthreadd_setup() with
just one call site and 4 lines in it shouldn't be a separate function at
all. So let's lose it and code it explicitly in kthreadd() itself.

Signed-off-by: Satyam Sharma <satyam.sharma@gmail.com>

---

 kernel/kthread.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

---

diff -ruNp a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	2007-06-26 06:33:08.000000000 +0530
+++ b/kernel/kthread.c	2007-06-27 02:57:46.000000000 +0530
@@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
 }
 EXPORT_SYMBOL(kthread_stop);

-
-static __init void kthreadd_setup(void)
+int kthreadd(void *unused)
 {
 	struct task_struct *tsk = current;

+	/* Setup a clean context for our children to inherit. */
 	set_task_comm(tsk, "kthreadd");
-
 	ignore_signals(tsk);
-
 	set_user_nice(tsk, -5);
 	set_cpus_allowed(tsk, CPU_MASK_ALL);
-}
-
-int kthreadd(void *unused)
-{
-	/* Setup a clean context for our children to inherit. */
-	kthreadd_setup();

 	current->flags |= PF_NOFREEZE;

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

end of thread, other threads:[~2007-06-26 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-8679-10286@http.bugzilla.kernel.org/>
2007-06-26 19:01 ` [Bug 8679] New: Section mismatch: reference to .init.text Randy Dunlap
2007-06-26 21:32   ` Satyam Sharma
2007-06-26 21:42     ` Satyam Sharma

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

all inboxes | Powered by JetHome®