From: Tim Deegan Subject: Re: [PATCH 2 of 6] x86: don't use .subsection to out-of-line failure path in spinlock.h Date: Thu, 5 Apr 2012 15:05:49 +0100 Message-ID: <20120405140549.GF14774@ocelot.phlegethon.org> References: <0ecf439475e12f185553.1333627635@whitby.uk.xensource.com> <4F7DBA1A020000780007CB28@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <4F7DBA1A020000780007CB28@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 14:28 +0100 on 05 Apr (1333636106), Jan Beulich wrote: > >>> On 05.04.12 at 14:07, Tim Deegan wrote: > > # HG changeset patch > > # User Tim Deegan > > # 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;