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

Re: [Xen-devel] [PATCH 2 of 6] x86: don't use .subsection to out-of-line failure path in spinlock.h



At 14:28 +0100 on 05 Apr (1333636106), Jan Beulich wrote:
> >>> On 05.04.12 at 14:07, Tim Deegan <tim@xxxxxxx> wrote:
> > # HG changeset patch
> > # User Tim Deegan <tim@xxxxxxx>
> > # Date 1333626954 -3600
> > # Node ID 0ecf439475e12f185553f42f56f099be5f328cce
> > # Parent  8518fb0c8c996dca67efd39d31962a6d3502c2ed
> > x86: don't use .subsection to out-of-line failure path in spinlock.h
> > 
> > LLVM's assembler doesn't support the .subsection directive.  Instead,
> > leave the failure path inline with an unconditional jump past it in
> > the success path (so the conditional jump is still forwards).
> 
> Please don't - the failure path should really be out-of-line here; that's
> why the .subsection directive got added in the first place. And there
> are more uses of .subsection elsewhere, which I hope you're not
> intending to all undo just because of a shortcoming of a non-standard
> assembler. 

The other uses are all in .S files, so don't go through clang's
assembler.

> Abstracting this in some way might be doable, e.g.
> moving the code into .text.1 or some such when non-gas is used.

OK.  How about something like this?

diff -r ea2bf1456a52 xen/include/asm-x86/spinlock.h
--- a/xen/include/asm-x86/spinlock.h    Thu Apr 05 14:51:31 2012 +0100
+++ b/xen/include/asm-x86/spinlock.h    Thu Apr 05 15:03:31 2012 +0100
@@ -45,11 +45,11 @@ static always_inline int _raw_read_trylo
     asm volatile (
         "    lock; decl %0         \n"
         "    jns 2f                \n"
-        "1:  .subsection 1         \n"
+        "1:  .pushsection .fixup   \n"
         "2:  lock; incl %0         \n"
         "    decl %1               \n"
         "    jmp 1b                \n"
-        "    .subsection 0         \n"
+        "    .popsection           \n"
         : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
 
     return acquired;

_______________________________________________
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®.