* [PATCH] x86-64: Prevent gcc from optimizing away venosys_1()
[not found] <313387488.1201.1307114323524.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2011-06-03 15:20 ` Dave Anderson
2011-06-03 20:48 ` Andi Kleen
2011-06-06 17:22 ` Ingo Molnar
0 siblings, 2 replies; 5+ messages in thread
From: Dave Anderson @ 2011-06-03 15:20 UTC (permalink / raw)
To: linux-kernel; +Cc: mingo, andi, jstancek, anderson
One of the changes in commit a4928cffe6435caf427ae673131a633c1329dbf3
made the venosys_1() system call static, which causes it to be
optimized out of the kernel:
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Apr 23 13:20:56 2008 +0200
"make namespacecheck" fixes
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Commit 2e8ad43ec07545780ce7992cb18e2d82c7abd24c had originally
changed all vsyscalls from being static for the same reason:
Author: Andi Kleen <ak@suse.de>
Date: Mon Sep 12 18:49:24 2005 +0200
[PATCH] x86-64: Prevent gcc 4 from optimizing away vsyscalls
They were previously static.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Dave Anderson <anderson@redhat.com>
---
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 3e68218..60a34af 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -222,7 +222,7 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
return 0;
}
-static long __vsyscall(3) venosys_1(void)
+long __vsyscall(3) venosys_1(void)
{
return -ENOSYS;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] x86-64: Prevent gcc from optimizing away venosys_1()
2011-06-03 15:20 ` [PATCH] x86-64: Prevent gcc from optimizing away venosys_1() Dave Anderson
@ 2011-06-03 20:48 ` Andi Kleen
2011-06-03 21:32 ` Dave Anderson
2011-06-06 17:22 ` Ingo Molnar
1 sibling, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2011-06-03 20:48 UTC (permalink / raw)
To: Dave Anderson; +Cc: linux-kernel, mingo, andi, jstancek
> return 0;
> }
>
> -static long __vsyscall(3) venosys_1(void)
> +long __vsyscall(3) venosys_1(void)
Better add a __used too. Otherwise it can be optimized out again
in some builds e.g. when someone enables gc-sections for the linker.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86-64: Prevent gcc from optimizing away venosys_1()
2011-06-03 20:48 ` Andi Kleen
@ 2011-06-03 21:32 ` Dave Anderson
2011-06-03 21:37 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Dave Anderson @ 2011-06-03 21:32 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, mingo, jstancek
----- Original Message -----
> > return 0;
> > }
> >
> > -static long __vsyscall(3) venosys_1(void)
> > +long __vsyscall(3) venosys_1(void)
>
> Better add a __used too. Otherwise it can be optimized out again
> in some builds e.g. when someone enables gc-sections for the linker.
Considering that all of the vsyscall prototypes have this attribute:
#define __vsyscall(nr) \
__attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace
How would any of them work?
Dave
>
> -Andi
> --
> ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] x86-64: Prevent gcc from optimizing away venosys_1()
2011-06-03 21:32 ` Dave Anderson
@ 2011-06-03 21:37 ` Andi Kleen
0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2011-06-03 21:37 UTC (permalink / raw)
To: Dave Anderson; +Cc: Andi Kleen, linux-kernel, mingo, jstancek
On Fri, Jun 03, 2011 at 05:32:06PM -0400, Dave Anderson wrote:
>
>
> ----- Original Message -----
> > > return 0;
> > > }
> > >
> > > -static long __vsyscall(3) venosys_1(void)
> > > +long __vsyscall(3) venosys_1(void)
> >
> > Better add a __used too. Otherwise it can be optimized out again
> > in some builds e.g. when someone enables gc-sections for the linker.
>
> Considering that all of the vsyscall prototypes have this attribute:
>
> #define __vsyscall(nr) \
> __attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace
>
> How would any of them work?
unused is just to prevent warnings I think. used stops the optimizer
from throwing it away.
It would make more sense to drop the unused and add an used. I think
used prevents the warnings too.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86-64: Prevent gcc from optimizing away venosys_1()
2011-06-03 15:20 ` [PATCH] x86-64: Prevent gcc from optimizing away venosys_1() Dave Anderson
2011-06-03 20:48 ` Andi Kleen
@ 2011-06-06 17:22 ` Ingo Molnar
1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2011-06-06 17:22 UTC (permalink / raw)
To: Dave Anderson, Andy Lutomirski
Cc: linux-kernel, andi, jstancek, Thomas Gleixner, H. Peter Anvin
* Dave Anderson <anderson@redhat.com> wrote:
> One of the changes in commit a4928cffe6435caf427ae673131a633c1329dbf3
> made the venosys_1() system call static, which causes it to be
> optimized out of the kernel:
>
> Author: Ingo Molnar <mingo@elte.hu>
> Date: Wed Apr 23 13:20:56 2008 +0200
>
> "make namespacecheck" fixes
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Andy noticed this recently, so we got rid of that broken (and unused)
syscall in:
bb5fe2f78ead: x86-64: Remove vsyscall number 3 (venosys)
which is in the tip:x86/vdso branch at:
http://people.redhat.com/mingo/tip.git/README
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-06 17:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <313387488.1201.1307114323524.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2011-06-03 15:20 ` [PATCH] x86-64: Prevent gcc from optimizing away venosys_1() Dave Anderson
2011-06-03 20:48 ` Andi Kleen
2011-06-03 21:32 ` Dave Anderson
2011-06-03 21:37 ` Andi Kleen
2011-06-06 17:22 ` Ingo Molnar
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®