All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org, Michael Matz <matz@suse.de>,
	Dave Jiang <dave.jiang@intel.com>, Borislav Petkov <bp@suse.de>,
	Tony Luck <tony.luck@intel.com>, x86 <x86@kernel.org>
Subject: Re: [tip: x86/pasid] x86/asm: Carve out a generic movdir64b() helper for general usage
Date: Wed, 7 Oct 2020 19:08:35 +0200	[thread overview]
Message-ID: <20201007170835.GM2628@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <160208728972.7002.18130814269550766361.tip-bot2@tip-bot2>

On Wed, Oct 07, 2020 at 04:14:49PM -0000, tip-bot2 for Dave Jiang wrote:
> diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
> index 59a3e13..d4baa0e 100644
> --- a/arch/x86/include/asm/special_insns.h
> +++ b/arch/x86/include/asm/special_insns.h
> @@ -234,6 +234,28 @@ static inline void clwb(volatile void *__p)
>  
>  #define nop() asm volatile ("nop")
>  
> +/* The dst parameter must be 64-bytes aligned */
> +static inline void movdir64b(void *dst, const void *src)
> +{
> +	const struct { char _[64]; } *__src = src;
> +	struct { char _[64]; } *__dst = dst;
> +
> +	/*
> +	 * MOVDIR64B %(rdx), rax.

(%rdx), %rax, surely? Also, that's a horrible convention, but I suppose
(%rdx), (%rax) was out?

> +	 *
> +	 * Both __src and __dst must be memory constraints in order to tell the
> +	 * compiler that no other memory accesses should be reordered around
> +	 * this one.
> +	 *
> +	 * Also, both must be supplied as lvalues because this tells
> +	 * the compiler what the object is (its size) the instruction accesses.
> +	 * I.e., not the pointers but what they point to, thus the deref'ing '*'.

Can we pretty please get a binutils version that knows about this
instruction, such that we know when we can get rid of the silly .byte
encoded mess?

> +	 */
> +	asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> +		     : "+m" (*__dst)
> +		     :  "m" (*__src), "a" (__dst), "d" (__src));
> +}
> +
>  #endif /* __KERNEL__ */
>  
>  #endif /* _ASM_X86_SPECIAL_INSNS_H */

  reply	other threads:[~2020-10-07 17:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:11 [PATCH v7 0/5] Add shared workqueue support for idxd driver Dave Jiang
2020-10-05 15:11 ` [PATCH v7 1/5] x86/asm: Carve out a generic movdir64b() helper for general usage Dave Jiang
2020-10-07 16:14   ` [tip: x86/pasid] " tip-bot2 for Dave Jiang
2020-10-07 17:08     ` Peter Zijlstra [this message]
2020-10-07 21:13       ` Borislav Petkov
2020-10-08  6:49         ` Peter Zijlstra
2020-10-05 15:11 ` [PATCH v7 2/5] x86/asm: Add an enqcmds() wrapper for the ENQCMDS instruction Dave Jiang
2020-10-05 15:11 ` [PATCH v7 3/5] dmaengine: idxd: Add shared workqueue support Dave Jiang
2020-10-05 15:11 ` [PATCH v7 4/5] dmaengine: idxd: Clean up descriptors with fault error Dave Jiang
2020-10-05 15:11 ` [PATCH v7 5/5] dmaengine: idxd: Add ABI documentation for shared wq Dave Jiang
2020-10-07  7:01 ` [PATCH v7 0/5] Add shared workqueue support for idxd driver Vinod Koul
2020-10-07  8:48   ` Borislav Petkov
2020-10-07  9:53     ` Vinod Koul
2020-10-07 10:04       ` Borislav Petkov
2020-10-07 14:57         ` Vinod Koul
2020-10-07 16:16           ` Borislav Petkov
2020-10-07 16:50   ` Dave Jiang

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=20201007170835.GM2628@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@suse.de \
    --cc=dave.jiang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=matz@suse.de \
    --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.