From: David Laight <David.Laight@ACULAB.COM>
To: 'Dave Jiang' <dave.jiang@intel.com>, Borislav Petkov <bp@alien8.de>
Cc: "vkoul@kernel.org" <vkoul@kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"tony.luck@intel.com" <tony.luck@intel.com>,
"jing.lin@intel.com" <jing.lin@intel.com>,
"ashok.raj@intel.com" <ashok.raj@intel.com>,
"sanjay.k.kumar@intel.com" <sanjay.k.kumar@intel.com>,
"fenghua.yu@intel.com" <fenghua.yu@intel.com>,
"kevin.tian@intel.com" <kevin.tian@intel.com>,
"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v4 1/5] x86/asm: move the raw asm in iosubmit_cmds512() to special_insns.h
Date: Wed, 23 Sep 2020 16:00:45 +0000 [thread overview]
Message-ID: <da596c9c5a4c4368b887ac171db952eb@AcuMS.aculab.com> (raw)
In-Reply-To: <c38406b7-f1d1-35d8-8015-bacce7a52226@intel.com>
From: Dave Jiang
> Sent: 23 September 2020 16:43
...
> >
> > On Thu, Sep 17, 2020 at 02:15:16PM -0700, Dave Jiang wrote:
> >> diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
> >> index 59a3e13204c3..7bc8e714f37e 100644
> >> --- a/arch/x86/include/asm/special_insns.h
> >> +++ b/arch/x86/include/asm/special_insns.h
> >> @@ -234,6 +234,23 @@ static inline void clwb(volatile void *__p)
> >>
> >> #define nop() asm volatile ("nop")
> >>
> >> +static inline void movdir64b(void *__dst, const void *src)
> >
> > Make __dst be the function local variable name and keep "dst", i.e.,
> > without the underscores, the function parameter name.
>
> Ok will fix
>
> >
> >> + /*
> >> + * Note that this isn't an "on-stack copy", just definition of "dst"
> >> + * as a pointer to 64-bytes of stuff that is going to be overwritten.
> >> + * In the MOVDIR64B case that may be needed as you can use the
> >> + * MOVDIR64B instruction to copy arbitrary memory around. This trick
> >> + * lets the compiler know how much gets clobbered.
> >> + */
> >> + volatile struct { char _[64]; } *dst = __dst;
> >> +
> >> + /* MOVDIR64B [rdx], rax */
> >> + asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> >> + : "=m" (dst)
> >> + : "d" (src), "a" (dst));
> >> +}
Since 'dst' needs to be 64byte aligned it isn't clear that 'void *'
is the right type for 'dst'.
At least add a comment.
Your asm constraints are also just wrong.
There is no real point specifying "=m" (dst) as an output.
The write rather bypasses the cache and the caller better
know what they are doing.
OTOH you'd better add "m" ((struct { char _[64];} *)src) as
an input constraint.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-09-23 16:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 21:15 [PATCH v4 0/5] Add shared workqueue support for idxd driver Dave Jiang
2020-09-17 21:15 ` [PATCH v4 1/5] x86/asm: move the raw asm in iosubmit_cmds512() to special_insns.h Dave Jiang
2020-09-23 10:41 ` Borislav Petkov
2020-09-23 15:43 ` Dave Jiang
2020-09-23 16:00 ` David Laight [this message]
2020-09-17 21:15 ` [PATCH v4 2/5] x86/asm: add enqcmds() to support ENQCMDS instruction Dave Jiang
2020-09-23 11:08 ` Borislav Petkov
2020-09-23 15:47 ` Dave Jiang
2020-09-17 21:15 ` [PATCH v4 4/5] dmaengine: idxd: clean up descriptors with fault error Dave Jiang
2020-09-17 21:15 ` [PATCH v4 5/5] dmaengine: idxd: add ABI documentation for shared wq Dave Jiang
2020-09-17 23:43 ` [PATCH v4 0/5] Add shared workqueue support for idxd driver Randy Dunlap
2020-09-17 23:51 ` Dave Jiang
2020-09-17 23:56 ` Randy Dunlap
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=da596c9c5a4c4368b887ac171db952eb@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ashok.raj@intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fenghua.yu@intel.com \
--cc=jing.lin@intel.com \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sanjay.k.kumar@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=vkoul@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