lkml.org 
[lkml]   [2017]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Part1 PATCH v4 13/17] x86/io: Unroll string I/O when SEV is active
On Sat, Sep 16, 2017 at 07:34:14AM -0500, Brijesh Singh wrote:
> From: Tom Lendacky <thomas.lendacky@amd.com>
>
> Secure Encrypted Virtualization (SEV) does not support string I/O, so
> unroll the string I/O operation into a loop operating on one element at
> a time.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: David Laight <David.Laight@ACULAB.COM>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: x86@kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
> arch/x86/include/asm/io.h | 42 ++++++++++++++++++++++++++++++++++++++----
> arch/x86/mm/mem_encrypt.c | 8 ++++++++
> 2 files changed, 46 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> index c40a95c33bb8..07c28ee398d9 100644
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -265,6 +265,20 @@ static inline void slow_down_io(void)
>
> #endif
>
> +#ifdef CONFIG_AMD_MEM_ENCRYPT
> +
> +extern struct static_key_false __sev;
> +static inline bool __sev_active(void)
> +{
> + return static_branch_unlikely(&__sev);
> +}

I'm still not happy about the two's sev_active() and __sev_active()
naming. Perhaps the __ variant should be called sev_key_active() or ...

Blergh, my naming sux. In any case, it would be cool to be more obvious
from the naming which variant uses the static key and which is the slow
one.

I'm also thinking of maybe having a single sev_active() which uses the
static key but that is perhaps an overkill on slow paths...

Hrrmmm.

In any case, looking at gcc output, the unrolled variant gets put
out-of-line, as expected.

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--

\
 
 \ /
  Last update: 2017-09-17 17:09    [W:0.239 / U:2.520 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site