Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Bruce Cran <bruce@cran.org.uk>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>
Subject: Re: Bug in x86_64 do_cpuid()
Date: Thu, 31 Oct 2013 10:55:18 -0600	[thread overview]
Message-ID: <20131031165518.GI29372@kernel.dk> (raw)
In-Reply-To: <52711104.3020604@cran.org.uk>

On Wed, Oct 30 2013, Bruce Cran wrote:
> It seems there's a bug in the x86_64 version of do_cpuid() that causes fio
> to segfault when built with clang at lower optimization levels:
> 
> static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
>                 unsigned int *ecx, unsigned int *edx)
> {
>     asm volatile("cpuid"
>         : "=a" (*eax), "=b" (*ebx), "=r" (*ecx), "=d" (*edx)
>         : "0" (*eax), "2" (*ecx)
>         : "memory");
> }
> 
> via Tijl Coosemans:
> 
> Should be: "=c" (*ecx)
> 
> But you can also use the '+' modifier and remove the input operands:
> 
> : "+a" (*eax), "=b" (*ebx), "+c" (*ecx), "=d" (*edx)
> :
> : "memory"

+a/+c doesn't work, but =c will do the trick.

-- 
Jens Axboe


      reply	other threads:[~2013-10-31 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 14:00 Bug in x86_64 do_cpuid() Bruce Cran
2013-10-31 16:55 ` Jens Axboe [this message]

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=20131031165518.GI29372@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=bruce@cran.org.uk \
    --cc=fio@vger.kernel.org \
    /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