public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix vmi time header bug
@ 2007-03-12 22:58 Zachary Amsden
  2007-03-13  6:31 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Zachary Amsden @ 2007-03-12 22:58 UTC (permalink / raw)
  To: Andrew Morton, Andi Kleen, Linux Kernel Mailing List,
	Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

Some gcc put this function in .init.text because the header didn't 
match.  For 2.6.21-rc.

Zach

[-- Attachment #2: vmi-devinit-header-fix.patch --]
[-- Type: text/plain, Size: 605 bytes --]



Index: linux-2.6.21/include/asm-i386/vmi_time.h
===================================================================
--- linux-2.6.21.orig/include/asm-i386/vmi_time.h	2007-03-06 18:56:03.000000000 -0800
+++ linux-2.6.21/include/asm-i386/vmi_time.h	2007-03-12 13:55:16.000000000 -0800
@@ -54,7 +54,7 @@ extern unsigned long vmi_cpu_khz(void);
 
 #ifdef CONFIG_X86_LOCAL_APIC
 extern void __init vmi_timer_setup_boot_alarm(void);
-extern void __init vmi_timer_setup_secondary_alarm(void);
+extern void __devinit vmi_timer_setup_secondary_alarm(void);
 extern void apic_vmi_timer_interrupt(void);
 #endif
 

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13  6:31 ` Andrew Morton
@ 2007-03-13  6:21   ` Zachary Amsden
  2007-03-13  6:46   ` Zachary Amsden
  1 sibling, 0 replies; 8+ messages in thread
From: Zachary Amsden @ 2007-03-13  6:21 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ak, linux-kernel, torvalds

Andrew Morton wrote:
> Really truly?   I think we have a _lot_ of declarations which omit the section
> qualifier altogether.  How come they don't all break too?
>   

According to the report I have.  Perhaps a bogus section qualifier does 
more damage than an omitted one.  I'll get gcc  / linker version, but 
this could be a combination of user error, a strange toolchain, and 
perhaps a real bug somewhere.

> (ARM (at least) in fact does require the section tagging on the declaration as
> well as the definition, but we've thus far only fixed that in a couple of places
> which were causing breakage).
>   

Yes, I was surprised by this as well, and I'm still skeptical about this 
being the real cause.  Still, this reportedly fixed the problem, and is 
certainly not a bad thing.

Zach

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-12 22:58 [PATCH] Fix vmi time header bug Zachary Amsden
@ 2007-03-13  6:31 ` Andrew Morton
  2007-03-13  6:21   ` Zachary Amsden
  2007-03-13  6:46   ` Zachary Amsden
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Morton @ 2007-03-13  6:31 UTC (permalink / raw)
  To: Zachary Amsden; +Cc: ak, linux-kernel, torvalds

> On Mon, 12 Mar 2007 14:58:08 -0800 Zachary Amsden <zach@vmware.com> wrote:
> Some gcc put this function in .init.text because the header didn't 
> match.  For 2.6.21-rc.
> 
> Zach
> 
> 
> [vmi-devinit-header-fix.patch  text/plain (606B)]
> 
> 
> Index: linux-2.6.21/include/asm-i386/vmi_time.h
> ===================================================================
> --- linux-2.6.21.orig/include/asm-i386/vmi_time.h	2007-03-06 18:56:03.000000000 -0800
> +++ linux-2.6.21/include/asm-i386/vmi_time.h	2007-03-12 13:55:16.000000000 -0800
> @@ -54,7 +54,7 @@ extern unsigned long vmi_cpu_khz(void);
>  
>  #ifdef CONFIG_X86_LOCAL_APIC
>  extern void __init vmi_timer_setup_boot_alarm(void);
> -extern void __init vmi_timer_setup_secondary_alarm(void);
> +extern void __devinit vmi_timer_setup_secondary_alarm(void);
>  extern void apic_vmi_timer_interrupt(void);
>  #endif

Really truly?   I think we have a _lot_ of declarations which omit the section
qualifier altogether.  How come they don't all break too?

(ARM (at least) in fact does require the section tagging on the declaration as
well as the definition, but we've thus far only fixed that in a couple of places
which were causing breakage).

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13  6:31 ` Andrew Morton
  2007-03-13  6:21   ` Zachary Amsden
@ 2007-03-13  6:46   ` Zachary Amsden
  2007-03-13 12:45     ` Andi Kleen
  1 sibling, 1 reply; 8+ messages in thread
From: Zachary Amsden @ 2007-03-13  6:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ak, linux-kernel, torvalds

Andrew Morton wrote:
> Really truly?   I think we have a _lot_ of declarations which omit the section
> qualifier altogether.  How come they don't all break too?
>   

User build was smoking this:

make O=build -j16

This and non-repeatable results make me suspect some kind of build 
dependency problem, or perhaps a make bug.  Still, please apply, as it 
doesn't hurt.

Zach

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13  6:46   ` Zachary Amsden
@ 2007-03-13 12:45     ` Andi Kleen
  2007-03-13 13:59       ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2007-03-13 12:45 UTC (permalink / raw)
  To: Zachary Amsden; +Cc: Andrew Morton, linux-kernel, torvalds

On Tuesday 13 March 2007 07:46, Zachary Amsden wrote:
> Andrew Morton wrote:
> > Really truly?   I think we have a _lot_ of declarations which omit the
> > section qualifier altogether.  How come they don't all break too?
>
> User build was smoking this:
>
> make O=build -j16
>
> This and non-repeatable results make me suspect some kind of build
> dependency problem, or perhaps a make bug.  Still, please apply, as it
> doesn't hurt.

I don't think the patch should make any difference, so that's not needed.

-Andi

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13 12:45     ` Andi Kleen
@ 2007-03-13 13:59       ` Andrew Morton
  2007-03-13 17:32         ` Jeremy Fitzhardinge
  2007-03-13 17:53         ` Linus Torvalds
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Morton @ 2007-03-13 13:59 UTC (permalink / raw)
  To: Andi Kleen; +Cc: zach, linux-kernel, torvalds

> On Tue, 13 Mar 2007 13:45:06 +0100 Andi Kleen <ak@suse.de> wrote:
> On Tuesday 13 March 2007 07:46, Zachary Amsden wrote:
> > Andrew Morton wrote:
> > > Really truly?   I think we have a _lot_ of declarations which omit the
> > > section qualifier altogether.  How come they don't all break too?
> >
> > User build was smoking this:
> >
> > make O=build -j16
> >
> > This and non-repeatable results make me suspect some kind of build
> > dependency problem, or perhaps a make bug.  Still, please apply, as it
> > doesn't hurt.
> 
> I don't think the patch should make any difference, so that's not needed.
> 

Correctly matching the section annotation on declarations and definitions
is needed by at least ARM.  We should ensure that we do this on all future
patches and we should also apply this patch if only for this reason.

(The ARM thing is a pain, because the compiler cannot check that the
definition and declaration match.  However something like sparse could do
so).


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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13 13:59       ` Andrew Morton
@ 2007-03-13 17:32         ` Jeremy Fitzhardinge
  2007-03-13 17:53         ` Linus Torvalds
  1 sibling, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-13 17:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, zach, linux-kernel, torvalds

Andrew Morton wrote:
> Correctly matching the section annotation on declarations and definitions
> is needed by at least ARM.  We should ensure that we do this on all future
> patches and we should also apply this patch if only for this reason.
>
> (The ARM thing is a pain, because the compiler cannot check that the
> definition and declaration match.  However something like sparse could do
> so).
>   

It's also useful documentation.  Knowing whether a function is __init is
an important part of its interface.

    J

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

* Re: [PATCH] Fix vmi time header bug
  2007-03-13 13:59       ` Andrew Morton
  2007-03-13 17:32         ` Jeremy Fitzhardinge
@ 2007-03-13 17:53         ` Linus Torvalds
  1 sibling, 0 replies; 8+ messages in thread
From: Linus Torvalds @ 2007-03-13 17:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, zach, linux-kernel



On Tue, 13 Mar 2007, Andrew Morton wrote:
> 
> (The ARM thing is a pain, because the compiler cannot check that the
> definition and declaration match.  However something like sparse could do
> so).

Well, I guess sparse could do it, but the fact is, this is just a gcc bug. 
It would be much better if *gcc* just checked the function attributes it 
cared about. Anybody want to send a bug-report to the gcc lists?

Here's a trivial test-case.

	#define section(x) __attribute__((__section__(x)))

	extern int section(".text.one") test_function(int);

	int section(".text.two") test_function(int arg)
	{
		return arg+1;
	}

and the bug is that gcc doesn't warn about the section mismatch, and still 
seems to care.

(Now, if gcc doesn't care, missing the section from the declaration could 
be considered ok. But having explicit but *different* section declarations 
can clearly not be ok, and it seems that gcc sometimes *does* require 
sections to match, so it probably should always require them to match 
exactly).

We could make sparse care, but right now sparse ignores the section 
attribute *entirely*.

		Linus

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

end of thread, other threads:[~2007-03-13 17:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-12 22:58 [PATCH] Fix vmi time header bug Zachary Amsden
2007-03-13  6:31 ` Andrew Morton
2007-03-13  6:21   ` Zachary Amsden
2007-03-13  6:46   ` Zachary Amsden
2007-03-13 12:45     ` Andi Kleen
2007-03-13 13:59       ` Andrew Morton
2007-03-13 17:32         ` Jeremy Fitzhardinge
2007-03-13 17:53         ` Linus Torvalds

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