[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] linux-next: manual merge of the xen-tip tree with the tip tree



On Wed, Aug 12, 2015 at 02:44:52PM -0400, Boris Ostrovsky wrote:
> On 08/12/2015 02:36 PM, Peter Zijlstra wrote:
> >On Wed, Aug 12, 2015 at 11:26:41AM -0700, H. Peter Anvin wrote:
> >>One option might be to do the addition in assembly, i.e.:
> >>
> >>"i" (key), "i" (index)
> >>
> >>... and put the addition into the assembly source.
> >Like so? Seems to build on gcc-4.6.
> 
> Yes, this builds on 4.4.4. as well.

Thanks, Ingo / Hpa, can you make the below patch appear in the right tip
branch?

---
Subject: jump_label, x86: Fix asm for older GCCs
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Wed Aug 12 20:58:48 CEST 2015

Boris reported that: gcc version 4.4.4 20100503 (Red Hat 4.4.4-2)
fails to build. The problem appears that even though @key and @branch
are compile time constants it doesn't see: &((char *)key)[branch]
as an immediate. More recent GCCs don't appear to have this problem.

In particular, Red Hat backported the asm goto feature into 4.4,
'normal' 4.4 compilers will not have this feature and thus not run
into this asm.

The solution is to supply both values to the asm as immediates and do
the addition in asm.

Suggested-by: "H. Peter Anvin" <hpa@xxxxxxxxx>
Reported-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Tested-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
 arch/x86/include/asm/jump_label.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -22,9 +22,9 @@ static __always_inline bool arch_static_
                ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t"
                ".pushsection __jump_table,  \"aw\" \n\t"
                _ASM_ALIGN "\n\t"
-               _ASM_PTR "1b, %l[l_yes], %c0 \n\t"
+               _ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t"
                ".popsection \n\t"
-               : :  "i" (&((char *)key)[branch]) : : l_yes);
+               : :  "i" (key), "i" (branch) : : l_yes);
 
        return false;
 l_yes:
@@ -38,9 +38,9 @@ static __always_inline bool arch_static_
                "2:\n\t"
                ".pushsection __jump_table,  \"aw\" \n\t"
                _ASM_ALIGN "\n\t"
-               _ASM_PTR "1b, %l[l_yes], %c0 \n\t"
+               _ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t"
                ".popsection \n\t"
-               : :  "i" (&((char *)key)[branch]) : : l_yes);
+               : :  "i" (key), "i" (branch) : : l_yes);
 
        return false;
 l_yes:

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.