From: "H. Peter Anvin" <hpa@zytor.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>,
Linux Raid <linux-raid@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Neil Brown <neilb@suse.de>
Subject: Re: [PATCH] lib/raid6: Add AVX2 optimized recovery functions
Date: Thu, 29 Nov 2012 13:13:28 -0800 [thread overview]
Message-ID: <50B7CFF8.7010401@zytor.com> (raw)
In-Reply-To: <m2obigf9xa.fsf@firstfloor.org>
On 11/29/2012 12:09 PM, Andi Kleen wrote:
> Jim Kukunas <james.t.kukunas@linux.intel.com> writes:
>> +
>> + /* ymm0 = x0f[16] */
>> + asm volatile("vpbroadcastb %0, %%ymm7" : : "m" (x0f));
>> +
>> + while (bytes) {
>> +#ifdef CONFIG_X86_64
>> + asm volatile("vmovdqa %0, %%ymm1" : : "m" (q[0]));
>> + asm volatile("vmovdqa %0, %%ymm9" : : "m" (q[32]));
>> + asm volatile("vmovdqa %0, %%ymm0" : : "m" (p[0]));
>> + asm volatile("vmovdqa %0, %%ymm8" : : "m" (p[32]));
>
> This is somewhat dangerous to assume registers do not get changed
> between assembler statements or assembler statements do not get
> reordered. Better always put such values into explicit variables or
> merge them into a single asm statement.
>
> asm volatile is also not enough to prevent reordering. If anything
> you would need a memory clobber.
>
The code is compiled so that the xmm/ymm registers are not available to
the compiler. Do you have any known examples of asm volatiles being
reordered *with respect to each other*? My understandings of gcc is
that volatile operations are ordered with respect to each other (not
necessarily with respect to non-volatile operations, though.)
Either way, this implementatin technique was used for the MMX/SSE
implementations without any problems for 9 years now.
-h[a
next prev parent reply other threads:[~2012-11-29 21:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-08 21:47 [PATCH] lib/raid6: Add AVX2 optimized recovery functions Jim Kukunas
2012-11-09 11:35 ` Paul Menzel
2012-11-09 11:39 ` H. Peter Anvin
2012-11-09 11:46 ` Paul Menzel
2012-11-09 11:50 ` NeilBrown
2012-11-09 12:24 ` H. Peter Anvin
2012-11-09 19:56 ` Jim Kukunas
2012-11-19 0:57 ` NeilBrown
2012-11-29 20:09 ` Andi Kleen
2012-11-29 21:13 ` H. Peter Anvin [this message]
2012-11-29 21:18 ` Andi Kleen
2012-11-29 22:27 ` H. Peter Anvin
2012-11-29 22:28 ` H. Peter Anvin
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=50B7CFF8.7010401@zytor.com \
--to=hpa@zytor.com \
--cc=andi@firstfloor.org \
--cc=james.t.kukunas@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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