From: Joe Damato <jdamato@fastly.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Cc: Joe Damato <jdamato@fastly.com>
Subject: [RFC,x86 v2 1/8] arch, x86, uaccess: Add nontemporal copy functions
Date: Sun, 12 Jun 2022 01:57:50 -0700 [thread overview]
Message-ID: <1655024280-23827-2-git-send-email-jdamato@fastly.com> (raw)
In-Reply-To: <1655024280-23827-1-git-send-email-jdamato@fastly.com>
Add a generic non-temporal wrapper to uaccess which can be overridden by
arches that support non-temporal copies.
An implementation is added for x86 which wraps an existing non-temporal
copy in the kernel.
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
arch/x86/include/asm/uaccess_64.h | 6 ++++++
include/linux/uaccess.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 45697e0..ed41dba 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -65,6 +65,12 @@ extern long __copy_user_flushcache(void *dst, const void __user *src, unsigned s
extern void memcpy_page_flushcache(char *to, struct page *page, size_t offset,
size_t len);
+static inline unsigned long
+__copy_from_user_nocache(void *dst, const void __user *src, unsigned long size)
+{
+ return (unsigned long)__copy_user_nocache(dst, src, (unsigned int) size, 0);
+}
+
static inline int
__copy_from_user_inatomic_nocache(void *dst, const void __user *src,
unsigned size)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 5a328cf..6612c37 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -256,6 +256,12 @@ static inline size_t probe_subpage_writeable(char __user *uaddr, size_t size)
#ifndef ARCH_HAS_NOCACHE_UACCESS
static inline __must_check unsigned long
+__copy_from_user_nocache(void *to, const void __user *from, unsigned long n)
+{
+ return __copy_from_user(to, from, n);
+}
+
+static inline __must_check unsigned long
__copy_from_user_inatomic_nocache(void *to, const void __user *from,
unsigned long n)
{
--
2.7.4
next prev parent reply other threads:[~2022-06-12 9:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 8:57 [RFC,net-next,x86 v2 0/8] Nontemporal copies in sendmsg path Joe Damato
2022-06-12 8:57 ` Joe Damato [this message]
2022-06-12 8:57 ` [RFC,iov_iter v2 2/8] iov_iter: Introduce iter_copy_type Joe Damato
2022-06-12 8:57 ` [RFC,iov_iter v2 3/8] iov_iter: add copyin_iovec helper Joe Damato
2022-06-13 4:25 ` Al Viro
2022-06-13 6:32 ` Joe Damato
2022-06-13 7:53 ` David Laight
2022-06-13 14:42 ` Joe Damato
2022-06-13 15:31 ` David Laight
2022-06-12 8:57 ` [RFC,net-next v2 4/8] net: Add MSG_NTCOPY sendmsg flag Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 5/8] net: unix: Support MSG_NTCOPY Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 6/8] net: ip: " Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 7/8] net: udplite: " Joe Damato
2022-06-12 8:57 ` [RFC,net-next v2 8/8] net: tcp: " Joe Damato
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=1655024280-23827-2-git-send-email-jdamato@fastly.com \
--to=jdamato@fastly.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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
all inboxes | Powered by JetHome®