DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Roman Dementiev <roman.dementiev@intel.com>,
	Matthew Hall <mhall@mhcomputing.net>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] RTM instruction compile failure for XABORT when AVX is active
Date: Mon, 29 Jun 2015 12:19:20 +0200	[thread overview]
Message-ID: <2576181.dRfjlrHRWI@xps13> (raw)
In-Reply-To: <386858255.20150629121137@intel.com>

2015-06-29 12:11, Roman Dementiev:
> >> On Jun 28, 2015, at 10:16 AM, Matthew Hall <mhall@mhcomputing.net> wrote:
> >> > I am getting a strange error compiling some RTM instructions when
> >> > I upgraded my VM environment from VirtualBox 4 to VirtualBox 5 and
> >> > AVX instructions from the host CPU became available. However when
> >> > I am reading the opcode description for XABORT it supposedly allows
> >> > an immediate operand for the argument so I can't understand why this
> >> > code would not compile. Any advice?
> >> > 
> >> >  CC test_hash_scaling.o
> >> > In file included from /vagrant/external/dpdk/app/test/test_hash_scaling.c:37:
> >> > In file included from /vagrant/external/dpdk/build/include/rte_spinlock.h:42:
> >> > /vagrant/external/dpdk/build/include/rte_rtm.h:56:15: error: invalid operand for inline asm constraint 'i'
> >> >        asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory");

There is no such bug with my compiler:
	clang version 3.6.1 (tags/RELEASE_361/final)
	Target: x86_64-unknown-linux-gnu

Matthew, which version are you using?

> It  looks  like  a  compiler  bug for me. In the meantime Clang should
> have native TSX intrinsics (but    most   compilers   fail   to   implement
> them correctly  on  a first attempt allowing instruction reordering). Could
> you try this workaround:
> 
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_rtm.h b/lib/librte_eal/common/include/arch/x86/rte_rtm.h
> index d935641..ee73dd4 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_rtm.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_rtm.h
> @@ -50,10 +50,14 @@ void rte_xend(void)
>          asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory");
>  }
> 
> +#include <immintrin.h>
> +
>  static __attribute__((__always_inline__)) inline
>  void rte_xabort(const unsigned int status)
>  {
> -       asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory");
> +       asm volatile(::: "memory");
> +       _xabort(status);
> +       asm volatile(::: "memory");
>  }
> 
>  static __attribute__((__always_inline__)) inline

  reply	other threads:[~2015-06-29 10:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-28 17:16 Matthew Hall
2015-06-28 17:59 ` Matthew Hall
2015-06-28 19:38   ` Thomas Monjalon
2015-06-29 10:11     ` Roman Dementiev
2015-06-29 10:19       ` Thomas Monjalon [this message]
2015-07-01  4:28         ` Matthew Hall
2015-07-01  5:17           ` Matthew Hall
2015-07-01  5:49             ` Matthew Hall
2015-07-01 11:10               ` Bruce Richardson
2015-07-01 15:53                 ` Matthew Hall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2576181.dRfjlrHRWI@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=mhall@mhcomputing.net \
    --cc=roman.dementiev@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).