linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org,
	jing.lin@intel.com, x86@kernel.org
Subject: Re: [PATCH] x86/asm: Add support for MOVDIR64B instruction
Date: Thu, 1 Aug 2019 22:36:14 +0200	[thread overview]
Message-ID: <20190801203614.GA16228@zn.tnic> (raw)
In-Reply-To: <20190801202808.e2cqlqetixie4gcu@box>

On Thu, Aug 01, 2019 at 11:28:08PM +0300, Kirill A. Shutemov wrote:
> 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?

I think Tony's in the right direction. We already do dst "sizing" like
that for the compiler in clwb().

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  reply	other threads:[~2019-08-01 20:36 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
2019-08-01 20:36     ` Borislav Petkov [this message]
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=20190801203614.GA16228@zn.tnic \
    --to=bp@alien8.de \
    --cc=adobriyan@gmail.com \
    --cc=jing.lin@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --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 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).