All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org,
	jing.lin@intel.com, bp@alien8.de, x86@kernel.org
Subject: Re: [PATCH] x86/asm: Add support for MOVDIR64B instruction
Date: Thu, 1 Aug 2019 23:28:08 +0300	[thread overview]
Message-ID: <20190801202808.e2cqlqetixie4gcu@box> (raw)
In-Reply-To: <20190801194947.GA12033@agluck-desk2.amr.corp.intel.com>

On Thu, Aug 01, 2019 at 12:49:48PM -0700, Luck, Tony wrote:
> On Thu, Aug 01, 2019 at 10:43:48PM +0300, Alexey Dobriyan wrote:
> > > +static inline void movdir64b(void *dst, const void *src)
> > > +{
> > > +	/* movdir64b [rdx], rax */
> > > +	asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> > > +			: "=m" (*(char *)dst)
> >                                ^^^^^^^^^^
> > 
> > > +			: "d" (src), "a" (dst));
> > > +}
> > 
> > Probably needs fake 64-byte type, so that compiler knows what is dirty.
> 
> Would that be something like this?
> 
> static inline void movdir64b(void *dst, const void *src)
> {
> 	struct dstbytes {
> 		char pad[64];
> 	};
> 
> 	/* movdir64b [rdx], rax */
> 	asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> 		     : "=m" (*(struct dstbytes *)dst)
> 		     : "d" (src), "a" (dst));
> }
> 
> Or did you have something else in mind?

Or should we add "memory" clobber instead, like we do for string
operations?

static inline void movdir64b(void *dst, const void *src)
{
	/* movdir64b [rdx], rax */
	asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
			: : "d" (src), "a" (dst) : "memory");
}

-- 
 Kirill A. Shutemov

  reply	other threads:[~2019-08-01 20:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 19:43 [PATCH] x86/asm: Add support for MOVDIR64B instruction Alexey Dobriyan
2019-08-01 19:49 ` Luck, Tony
2019-08-01 20:28   ` Kirill A. Shutemov [this message]
2019-08-01 20:36     ` Borislav Petkov
2019-08-01 22:06       ` Luck, Tony
2019-08-02 14:40         ` Borislav Petkov
2019-08-05 17:50           ` Lin, Jing
2019-08-01 21:53   ` Alexey Dobriyan
2019-08-02  8:15   ` Peter Zijlstra
2019-08-02 12:58     ` Kirill A. Shutemov
  -- strict thread matches above, loose matches on Subject: below --
2019-07-30 23:05 Kirill A. Shutemov
2019-07-31  0:24 ` jinglin
2019-08-01 10:03 ` Borislav Petkov
2019-08-01 11:03   ` Kirill A. Shutemov
2019-08-01 19:20   ` Luck, Tony
2019-08-01 19:36     ` Borislav Petkov

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=20190801202808.e2cqlqetixie4gcu@box \
    --to=kirill@shutemov.name \
    --cc=adobriyan@gmail.com \
    --cc=bp@alien8.de \
    --cc=jing.lin@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.