mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* .exit.text section in vmlinux
@ 2006-06-30  6:54 Magnus Damm
  2006-06-30 16:31 ` Chase Venters
  0 siblings, 1 reply; 3+ messages in thread
From: Magnus Damm @ 2006-06-30  6:54 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi guys,

I understand why ".exit.text" is present in the case of modules, but I
can't get my head around why it is included in the vmlinux file.
Functions like the ones below puzzle me:

kernel/configs.c: static void __exit ikconfig_cleanup(void)
drivers/net/ne2k-pci.c: static void __exit ne2k_pci_cleanup(void)
drivers/net/ne2k-pci.c: static void __devexit ne2k_pci_remove_one
(struct pci_dev *pdev)

I can see how the last "__devexit" function might be called during
some hotplug event, but are the two "__exit" functions ever going to
be called from the kernel? Since my kernel is configured without
CONFIG_HOTPLUG both both "__exit" and "__devexit"  end up in the
".exit.text" section.

The linker script arch/i386/kernel/vmlinux.lds.S mentions the following:

  /* .exit.text is discard at runtime, not link time, to deal with references
     from .altinstructions and .eh_frame */

The text above seems to answer my question, but I cannot say I fully
understand the comment. I'd appreciate if someone could explain a bit
more if possible.

Ok, so the section should be discarded at runtime. Sounds ok. But
where in the code is this section discarded? -ENOSYS?

Thanks,

/ magnus

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

* Re: .exit.text section in vmlinux
  2006-06-30  6:54 .exit.text section in vmlinux Magnus Damm
@ 2006-06-30 16:31 ` Chase Venters
  2006-07-03  7:31   ` Magnus Damm
  0 siblings, 1 reply; 3+ messages in thread
From: Chase Venters @ 2006-06-30 16:31 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux Kernel Mailing List

On Fri, 30 Jun 2006, Magnus Damm wrote:

> Hi guys,
>
> I understand why ".exit.text" is present in the case of modules, but I
> can't get my head around why it is included in the vmlinux file.
> Functions like the ones below puzzle me:
>
> kernel/configs.c: static void __exit ikconfig_cleanup(void)
> drivers/net/ne2k-pci.c: static void __exit ne2k_pci_cleanup(void)
> drivers/net/ne2k-pci.c: static void __devexit ne2k_pci_remove_one
> (struct pci_dev *pdev)
>
> I can see how the last "__devexit" function might be called during
> some hotplug event, but are the two "__exit" functions ever going to
> be called from the kernel? Since my kernel is configured without
> CONFIG_HOTPLUG both both "__exit" and "__devexit"  end up in the
> ".exit.text" section.
>
> The linker script arch/i386/kernel/vmlinux.lds.S mentions the following:
>
>  /* .exit.text is discard at runtime, not link time, to deal with references
>     from .altinstructions and .eh_frame */

.altinstructions is for alternatives code (code that is rewritten at 
runtime based on some factor such as UP-vs-SMP). .eh_frame has call 
framing information used for unwinding. I think it's copied into the 
vsyscall page (not entirely familiar with this mechanism though).

> The text above seems to answer my question, but I cannot say I fully
> understand the comment. I'd appreciate if someone could explain a bit
> more if possible.
>
> Ok, so the section should be discarded at runtime. Sounds ok. But
> where in the code is this section discarded? -ENOSYS?

When you see "Freeing unused kernel memory", the memory between 
__init_begin and __init_end (as marked in vmlinux.ld.S) is released. See 
arch-specific mm/init.c.

> Thanks,
>
> / magnus

Thanks,
Chase

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

* Re: .exit.text section in vmlinux
  2006-06-30 16:31 ` Chase Venters
@ 2006-07-03  7:31   ` Magnus Damm
  0 siblings, 0 replies; 3+ messages in thread
From: Magnus Damm @ 2006-07-03  7:31 UTC (permalink / raw)
  To: Chase Venters; +Cc: Linux Kernel Mailing List

On 7/1/06, Chase Venters <chase.venters@clientec.com> wrote:
> On Fri, 30 Jun 2006, Magnus Damm wrote:
> > The linker script arch/i386/kernel/vmlinux.lds.S mentions the following:
> >
> >  /* .exit.text is discard at runtime, not link time, to deal with references
> >     from .altinstructions and .eh_frame */
>
> .altinstructions is for alternatives code (code that is rewritten at
> runtime based on some factor such as UP-vs-SMP). .eh_frame has call
> framing information used for unwinding. I think it's copied into the
> vsyscall page (not entirely familiar with this mechanism though).

Thanks for clarifying.

> > The text above seems to answer my question, but I cannot say I fully
> > understand the comment. I'd appreciate if someone could explain a bit
> > more if possible.
> >
> > Ok, so the section should be discarded at runtime. Sounds ok. But
> > where in the code is this section discarded? -ENOSYS?
>
> When you see "Freeing unused kernel memory", the memory between
> __init_begin and __init_end (as marked in vmlinux.ld.S) is released. See
> arch-specific mm/init.c.

Oh, I see. It looks like things are working as expected then. Thank you!

Cheers,

/ magnus

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

end of thread, other threads:[~2006-07-03  7:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30  6:54 .exit.text section in vmlinux Magnus Damm
2006-06-30 16:31 ` Chase Venters
2006-07-03  7:31   ` Magnus Damm

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®