From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86: Fix build following c/s 623c720f "x86: use CLFLUSHOPT when available" Date: Thu, 11 Feb 2016 19:41:23 +0000 Message-ID: <56BCE3E3.8050105@citrix.com> References: <1455218743-12751-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1455218743-12751-1-git-send-email-andrew.cooper3@citrix.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: Xen-devel Cc: Jan Beulich List-Id: xen-devel@lists.xenproject.org On 11/02/16 19:25, Andrew Cooper wrote: > CentOS 7 gets into trouble when compiling Xen citing: > > flushtlb.c: Assembler messages: > flushtlb.c:149: Error: value of 256 too large for field of 1 bytes at 1 > > The line number is wrong, and the error message not helpful. It turns out > that the intermediate generated assembly was > > # 139 "arch/x86/flushtlb.c" 1 > 661: > rex clflush (%r15) > 662: > .pushsection .altinstructions,"a" > > and it was having trouble combining the explicit REX prefix with the REX.B > required for the use of %r15. > > Follow what Linux does and use a redundant %ds prefix instead, for a final > generated instruction of `3e 41 0f ae 3f` > > While modifying this line, fix the indentation which was out by one space. > > Signed-off-by: Andrew Cooper > --- > CC: Jan Beulich > --- > xen/arch/x86/flushtlb.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c > index 90a004f..727434e 100644 > --- a/xen/arch/x86/flushtlb.c > +++ b/xen/arch/x86/flushtlb.c > @@ -141,10 +141,10 @@ void flush_area_local(const void *va, unsigned int flags) > { > alternative(ASM_NOP3, "sfence", X86_FEATURE_CLFLUSHOPT); > for ( i = 0; i < sz; i += c->x86_clflush_size ) > - alternative_input("rex clflush %0", > - "data16 clflush %0", > - X86_FEATURE_CLFLUSHOPT, > - "m" (((const char *)va)[i])); > + alternative_input(".byte 0x3e; clflush %0", /* %ds override. */ > + "data16 clflush %0", /* clflushopt. */ > + X86_FEATURE_CLFLUSHOPT, > + "m" (((const char *)va)[i])); > } > else > { It turns out that Clang is far more useful at diagnosing this issue than GCC. flushtlb.c:144:18: error: invalid instruction mnemonic 'rex' alternative_input("rex clflush %0", ^ /local/xen.git/xen/include/asm/alternative.h:98:16: note: expanded from macro 'alternative_input' asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ /local/xen.git/xen/include/asm/alternative.h:60:2: note: expanded from macro 'ALTERNATIVE' OLDINSTR(oldinstr) \ ^ /local/xen.git/xen/include/asm/alternative.h:28:40: note: expanded from macro 'OLDINSTR' #define OLDINSTR(oldinstr) "661:\n\t" oldinstr "\n662:\n" ^ :2:2: note: instantiated into assembly here rex clflush (%r15,%rdx) ^~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ~Andrew