[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



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

Jan

> Signed-off-by: Tim Deegan <tim@xxxxxxx>
> 
> diff -r 8518fb0c8c99 -r 0ecf439475e1 xen/include/asm-x86/spinlock.h
> --- a/xen/include/asm-x86/spinlock.h  Thu Apr 05 12:55:54 2012 +0100
> +++ b/xen/include/asm-x86/spinlock.h  Thu Apr 05 12:55:54 2012 +0100
> @@ -44,12 +44,11 @@ static always_inline int _raw_read_trylo
>  
>      asm volatile (
>          "    lock; decl %0         \n"
> -        "    jns 2f                \n"
> -        "1:  .subsection 1         \n"
> -        "2:  lock; incl %0         \n"
> +        "    jns 1f                \n"
> +        "    jmp 2f                \n"
> +        "1:  lock; incl %0         \n"
>          "    decl %1               \n"
> -        "    jmp 1b                \n"
> -        "    .subsection 0         \n"
> +        "2:                        \n"
>          : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
>  
>      return acquired;
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx 
> http://lists.xen.org/xen-devel 




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