Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753530AbdCFNrs convert rfc822-to-8bit (ORCPT ); Mon, 6 Mar 2017 08:47:48 -0500 Received: from terminus.zytor.com ([65.50.211.136]:36064 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855AbdCFNqT (ORCPT ); Mon, 6 Mar 2017 08:46:19 -0500 Date: Mon, 06 Mar 2017 05:41:22 -0800 User-Agent: K-9 Mail for Android In-Reply-To: <20170306133327.usksddtpum7fftqs@pd.tnic> References: <5CCEF10D-5647-4503-A398-0681DF2C8847@zytor.com> <20170305001447.kcxignj3nsq35vci@pd.tnic> <20170305003349.6kgq4ovj7ipezfxu@pd.tnic> <20170305095059.l4od2yjqm5yxx6ln@pd.tnic> <20170305195432.6occvwaujq3l4ejl@pd.tnic> <5be40886-b468-d828-f948-2ad99b95a230@deltatee.com> <20170306133327.usksddtpum7fftqs@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: Question Regarding ERMS memcpy To: Borislav Petkov , Logan Gunthorpe , Linus Torvalds CC: Thomas Gleixner , Ingo Molnar , Tony Luck , Al Viro , the arch/x86 maintainers , Linux Kernel Mailing List From: hpa@zytor.com Message-ID: <86022C23-30AA-4501-ABEE-1154CB4FF61D@zytor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2795 Lines: 82 On March 6, 2017 5:33:28 AM PST, Borislav Petkov wrote: >On Mon, Mar 06, 2017 at 12:01:10AM -0700, Logan Gunthorpe wrote: >> Well honestly my issue was solved by fixing my kernel config. I have >no >> idea why I had optimize for size in there in the first place. > >I still think that we should address the iomem memcpy Linus mentioned. >So how about this partial revert. I've made 32-bit use the same special >__memcpy() version. > >Hmmm? > >--- >diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h >index 7afb0e2f07f4..9e378a10796d 100644 >--- a/arch/x86/include/asm/io.h >+++ b/arch/x86/include/asm/io.h >@@ -201,6 +201,7 @@ extern void set_iounmap_nonlazy(void); > #ifdef __KERNEL__ > > #include >+#include > > /* > * Convert a virtual cached pointer to an uncached pointer >@@ -227,12 +228,13 @@ memset_io(volatile void __iomem *addr, unsigned >char val, size_t count) > * @src: The (I/O memory) source for the data > * @count: The number of bytes to copy > * >- * Copy a block of data from I/O memory. >+ * Copy a block of data from I/O memory. IO memory is different from >+ * cached memory so we use special memcpy version. > */ > static inline void >memcpy_fromio(void *dst, const volatile void __iomem *src, size_t >count) > { >- memcpy(dst, (const void __force *)src, count); >+ __inline_memcpy(dst, (const void __force *)src, count); > } > > /** >@@ -241,12 +243,13 @@ memcpy_fromio(void *dst, const volatile void >__iomem *src, size_t count) > * @src: The (RAM) source for the data > * @count: The number of bytes to copy > * >- * Copy a block of data to I/O memory. >+ * Copy a block of data to I/O memory. IO memory is different from >+ * cached memory so we use special memcpy version. > */ > static inline void > memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) > { >- memcpy((void __force *)dst, src, count); >+ __inline_memcpy((void __force *)dst, src, count); > } > > /* >diff --git a/arch/x86/include/asm/string_32.h >b/arch/x86/include/asm/string_32.h >index 3d3e8353ee5c..556fa4a975ff 100644 >--- a/arch/x86/include/asm/string_32.h >+++ b/arch/x86/include/asm/string_32.h >@@ -29,6 +29,7 @@ extern char *strchr(const char *s, int c); > #define __HAVE_ARCH_STRLEN > extern size_t strlen(const char *s); > >+#define __inline_memcpy __memcpy >static __always_inline void *__memcpy(void *to, const void *from, >size_t n) > { > int d0, d1, d2; It isn't really that straightforward IMO. For UC memory transaction size really needs to be specified explicitly at all times and should be part of the API, rather than implicit. For WC/WT/WB device memory, the ordinary memcpy is valid and preferred. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.