Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
* remove set_fs for riscv v2
@ 2020-09-07  5:58 Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 1/8] uaccess: provide a generic TASK_SIZE_MAX definition Christoph Hellwig
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Hi all,

this series converts riscv to the new set_fs less world and is on top of this
branch:

    https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/log/?h=base.set_fs

The first four patches are general improvements and enablement for all nommu
ports, and might make sense to merge through the above base branch.

Changes since v1:
 - implement __get_user_fn and __put_user_fn for the UACCESS_MEMCPY case
   and remove the small constant size optimizations in raw_copy_from_user
   and raw_copy_to_user
 - reshuffle the patch order a little

Diffstat
 arch/riscv/Kconfig                   |    2 
 arch/riscv/include/asm/thread_info.h |    6 -
 arch/riscv/include/asm/uaccess.h     |  177 +++++++++++++++++------------------
 arch/riscv/kernel/process.c          |    1 
 arch/riscv/lib/Makefile              |    2 
 include/asm-generic/uaccess.h        |  109 +++++++++++++--------
 include/linux/uaccess.h              |    4 
 7 files changed, 166 insertions(+), 135 deletions(-)

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/8] uaccess: provide a generic TASK_SIZE_MAX definition
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 2/8] asm-generic: improve the nommu {get,put}_user handling Christoph Hellwig
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Define TASK_SIZE_MAX as TASK_SIZE if not otherwise defined.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/uaccess.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 70073c802b48ed..d0e43761c708d8 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -31,6 +31,10 @@ typedef struct {
 	/* empty dummy */
 } mm_segment_t;
 
+#ifndef TASK_SIZE_MAX
+#define TASK_SIZE_MAX			TASK_SIZE
+#endif
+
 #define uaccess_kernel()		(false)
 #define user_addr_max()			(TASK_SIZE_MAX)
 
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 2/8] asm-generic: improve the nommu {get,put}_user handling
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 1/8] uaccess: provide a generic TASK_SIZE_MAX definition Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 3/8] asm-generic: add nommu implementations of __{get, put}_kernel_nofault Christoph Hellwig
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Instead of reusing raw_{copy,to}_from_user implement separate handlers
using {get,put}_unaligned.  This ensures unaligned access is handled
correctly, and avoid the need for the small constant size optimization
in raw_{copy,to}_from_user.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/asm-generic/uaccess.h | 91 ++++++++++++++++++++---------------
 1 file changed, 51 insertions(+), 40 deletions(-)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index ba68ee4dabfaa7..6de5f524e9e631 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -10,28 +10,60 @@
 #include <linux/string.h>
 
 #ifdef CONFIG_UACCESS_MEMCPY
-static inline __must_check unsigned long
-raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+#include <asm/unaligned.h>
+
+static inline int __get_user_fn(size_t size, const void __user *from, void *to)
 {
-	if (__builtin_constant_p(n)) {
-		switch(n) {
-		case 1:
-			*(u8 *)to = *(u8 __force *)from;
-			return 0;
-		case 2:
-			*(u16 *)to = *(u16 __force *)from;
-			return 0;
-		case 4:
-			*(u32 *)to = *(u32 __force *)from;
-			return 0;
-#ifdef CONFIG_64BIT
-		case 8:
-			*(u64 *)to = *(u64 __force *)from;
-			return 0;
-#endif
-		}
+	BUILD_BUG_ON(!__builtin_constant_p(size));
+
+	switch (size) {
+	case 1:
+		*(u8 *)to = get_unaligned((u8 __force *)from);
+		return 0;
+	case 2:
+		*(u16 *)to = get_unaligned((u16 __force *)from);
+		return 0;
+	case 4:
+		*(u32 *)to = get_unaligned((u32 __force *)from);
+		return 0;
+	case 8:
+		*(u64 *)to = get_unaligned((u64 __force *)from);
+		return 0;
+	default:
+		BUILD_BUG();
+		return 0;
+	}
+
+}
+#define __get_user_fn(sz, u, k)	__get_user_fn(sz, u, k)
+
+static inline int __put_user_fn(size_t size, void __user *to, void *from)
+{
+	BUILD_BUG_ON(!__builtin_constant_p(size));
+
+	switch (size) {
+	case 1:
+		put_unaligned(*(u8 *)from, (u8 __force *)to);
+		return 0;
+	case 2:
+		put_unaligned(*(u16 *)from, (u16 __force *)to);
+		return 0;
+	case 4:
+		put_unaligned(*(u32 *)from, (u32 __force *)to);
+		return 0;
+	case 8:
+		put_unaligned(*(u64 *)from, (u64 __force *)to);
+		return 0;
+	default:
+		BUILD_BUG();
+		return 0;
 	}
+}
+#define __put_user_fn(sz, u, k)	__put_user_fn(sz, u, k)
 
+static inline __must_check unsigned long
+raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+{
 	memcpy(to, (const void __force *)from, n);
 	return 0;
 }
@@ -39,27 +71,6 @@ raw_copy_from_user(void *to, const void __user * from, unsigned long n)
 static inline __must_check unsigned long
 raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-	if (__builtin_constant_p(n)) {
-		switch(n) {
-		case 1:
-			*(u8 __force *)to = *(u8 *)from;
-			return 0;
-		case 2:
-			*(u16 __force *)to = *(u16 *)from;
-			return 0;
-		case 4:
-			*(u32 __force *)to = *(u32 *)from;
-			return 0;
-#ifdef CONFIG_64BIT
-		case 8:
-			*(u64 __force *)to = *(u64 *)from;
-			return 0;
-#endif
-		default:
-			break;
-		}
-	}
-
 	memcpy((void __force *)to, from, n);
 	return 0;
 }
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 3/8] asm-generic: add nommu implementations of __{get, put}_kernel_nofault
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 1/8] uaccess: provide a generic TASK_SIZE_MAX definition Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 2/8] asm-generic: improve the nommu {get,put}_user handling Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 4/8] asm-generic: make the set_fs implementation optional Christoph Hellwig
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Add native implementations of __{get,put}_kernel_nofault using
{get,put}_unaligned, just like the {get,put}_user implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/asm-generic/uaccess.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 6de5f524e9e631..b367f339be1a90 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -61,6 +61,22 @@ static inline int __put_user_fn(size_t size, void __user *to, void *from)
 }
 #define __put_user_fn(sz, u, k)	__put_user_fn(sz, u, k)
 
+#define __get_kernel_nofault(dst, src, type, err_label)			\
+do {									\
+	*((type *)dst) = get_unaligned((type *)(src));			\
+	if (0) /* make sure the label looks used to the compiler */	\
+		goto err_label;						\
+} while (0)
+
+#define __put_kernel_nofault(dst, src, type, err_label)			\
+do {									\
+	put_unaligned(*((type *)src), (type *)(dst));			\
+	if (0) /* make sure the label looks used to the compiler */	\
+		goto err_label;						\
+} while (0)
+
+#define HAVE_GET_KERNEL_NOFAULT 1
+
 static inline __must_check unsigned long
 raw_copy_from_user(void *to, const void __user * from, unsigned long n)
 {
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 4/8] asm-generic: make the set_fs implementation optional
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 3/8] asm-generic: add nommu implementations of __{get, put}_kernel_nofault Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-07  5:58 ` [PATCH 5/8] riscv: use memcpy based uaccess for nommu again Christoph Hellwig
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Put all the set_fs related code under CONFIG_SET_FS so that
asm-generic/uaccess.h can be used for set_fs-less builds.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/asm-generic/uaccess.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index b367f339be1a90..45f9872fd74759 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -94,6 +94,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 #define INLINE_COPY_TO_USER
 #endif /* CONFIG_UACCESS_MEMCPY */
 
+#ifdef CONFIG_SET_FS
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
 #ifndef KERNEL_DS
@@ -116,6 +117,7 @@ static inline void set_fs(mm_segment_t fs)
 #ifndef uaccess_kernel
 #define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
 #endif
+#endif /* CONFIG_SET_FS */
 
 #define access_ok(addr, size) __access_ok((unsigned long)(addr),(size))
 
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 5/8] riscv: use memcpy based uaccess for nommu again
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 4/8] asm-generic: make the set_fs implementation optional Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-09  4:59   ` Palmer Dabbelt
  2020-09-07  5:58 ` [PATCH 6/8] riscv: refactor __get_user and __put_user Christoph Hellwig
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97.

Now that the generic uaccess by mempcy code handles unaligned addresses
the generic code can be used for all RISC-V CPUs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/Kconfig               |  1 +
 arch/riscv/include/asm/uaccess.h | 36 ++++++++++++++++----------------
 arch/riscv/lib/Makefile          |  2 +-
 3 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 07d53044013ede..460e3971a80fde 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -87,6 +87,7 @@ config RISCV
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select SET_FS
+	select UACCESS_MEMCPY if !MMU
 
 config ARCH_MMAP_RND_BITS_MIN
 	default 18 if 64BIT
diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index f56c66b3f5fe21..e8eedf22e90747 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -13,24 +13,6 @@
 /*
  * User space memory access functions
  */
-
-extern unsigned long __must_check __asm_copy_to_user(void __user *to,
-	const void *from, unsigned long n);
-extern unsigned long __must_check __asm_copy_from_user(void *to,
-	const void __user *from, unsigned long n);
-
-static inline unsigned long
-raw_copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-	return __asm_copy_from_user(to, from, n);
-}
-
-static inline unsigned long
-raw_copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-	return __asm_copy_to_user(to, from, n);
-}
-
 #ifdef CONFIG_MMU
 #include <linux/errno.h>
 #include <linux/compiler.h>
@@ -385,6 +367,24 @@ do {								\
 		-EFAULT;					\
 })
 
+
+unsigned long __must_check __asm_copy_to_user(void __user *to,
+	const void *from, unsigned long n);
+unsigned long __must_check __asm_copy_from_user(void *to,
+	const void __user *from, unsigned long n);
+
+static inline unsigned long
+raw_copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+	return __asm_copy_from_user(to, from, n);
+}
+
+static inline unsigned long
+raw_copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+	return __asm_copy_to_user(to, from, n);
+}
+
 extern long strncpy_from_user(char *dest, const char __user *src, long count);
 
 extern long __must_check strlen_user(const char __user *str);
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index 0d0db80800c4ed..47e7a82044608d 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -2,5 +2,5 @@
 lib-y			+= delay.o
 lib-y			+= memcpy.o
 lib-y			+= memset.o
-lib-y			+= uaccess.o
+lib-$(CONFIG_MMU)	+= uaccess.o
 lib-$(CONFIG_64BIT)	+= tishift.o
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 6/8] riscv: refactor __get_user and __put_user
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (4 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 5/8] riscv: use memcpy based uaccess for nommu again Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-09  4:59   ` Palmer Dabbelt
  2020-09-07  5:58 ` [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault Christoph Hellwig
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Add new __get_user_nocheck and __put_user_nocheck that switch on the size
and call the actual inline assembly helpers, and move the uaccess enable
/ disable into the actual __get_user and __put_user.  This prepares for
natively implementing __get_kernel_nofault and __put_kernel_nofault.

Also don't bother with the deprecated register keyword for the error
return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/include/asm/uaccess.h | 94 ++++++++++++++++++--------------
 1 file changed, 52 insertions(+), 42 deletions(-)

diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index e8eedf22e90747..b67d1c616ec348 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -107,7 +107,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
 do {								\
 	uintptr_t __tmp;					\
 	__typeof__(x) __x;					\
-	__enable_user_access();					\
 	__asm__ __volatile__ (					\
 		"1:\n"						\
 		"	" insn " %1, %3\n"			\
@@ -125,7 +124,6 @@ do {								\
 		"	.previous"				\
 		: "+r" (err), "=&r" (__x), "=r" (__tmp)		\
 		: "m" (*(ptr)), "i" (-EFAULT));			\
-	__disable_user_access();				\
 	(x) = __x;						\
 } while (0)
 
@@ -138,7 +136,6 @@ do {								\
 	u32 __user *__ptr = (u32 __user *)(ptr);		\
 	u32 __lo, __hi;						\
 	uintptr_t __tmp;					\
-	__enable_user_access();					\
 	__asm__ __volatile__ (					\
 		"1:\n"						\
 		"	lw %1, %4\n"				\
@@ -162,12 +159,30 @@ do {								\
 			"=r" (__tmp)				\
 		: "m" (__ptr[__LSW]), "m" (__ptr[__MSW]),	\
 			"i" (-EFAULT));				\
-	__disable_user_access();				\
 	(x) = (__typeof__(x))((__typeof__((x)-(x)))(		\
 		(((u64)__hi << 32) | __lo)));			\
 } while (0)
 #endif /* CONFIG_64BIT */
 
+#define __get_user_nocheck(x, __gu_ptr, __gu_err)		\
+do {								\
+	switch (sizeof(*__gu_ptr)) {				\
+	case 1:							\
+		__get_user_asm("lb", (x), __gu_ptr, __gu_err);	\
+		break;						\
+	case 2:							\
+		__get_user_asm("lh", (x), __gu_ptr, __gu_err);	\
+		break;						\
+	case 4:							\
+		__get_user_asm("lw", (x), __gu_ptr, __gu_err);	\
+		break;						\
+	case 8:							\
+		__get_user_8((x), __gu_ptr, __gu_err);	\
+		break;						\
+	default:						\
+		BUILD_BUG();					\
+	}							\
+} while (0)
 
 /**
  * __get_user: - Get a simple variable from user space, with less checking.
@@ -191,25 +206,15 @@ do {								\
  */
 #define __get_user(x, ptr)					\
 ({								\
-	register long __gu_err = 0;				\
 	const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);	\
+	long __gu_err = 0;					\
+								\
 	__chk_user_ptr(__gu_ptr);				\
-	switch (sizeof(*__gu_ptr)) {				\
-	case 1:							\
-		__get_user_asm("lb", (x), __gu_ptr, __gu_err);	\
-		break;						\
-	case 2:							\
-		__get_user_asm("lh", (x), __gu_ptr, __gu_err);	\
-		break;						\
-	case 4:							\
-		__get_user_asm("lw", (x), __gu_ptr, __gu_err);	\
-		break;						\
-	case 8:							\
-		__get_user_8((x), __gu_ptr, __gu_err);	\
-		break;						\
-	default:						\
-		BUILD_BUG();					\
-	}							\
+								\
+	__enable_user_access();					\
+	__get_user_nocheck(x, __gu_ptr, __gu_err);		\
+	__disable_user_access();				\
+								\
 	__gu_err;						\
 })
 
@@ -243,7 +248,6 @@ do {								\
 do {								\
 	uintptr_t __tmp;					\
 	__typeof__(*(ptr)) __x = x;				\
-	__enable_user_access();					\
 	__asm__ __volatile__ (					\
 		"1:\n"						\
 		"	" insn " %z3, %2\n"			\
@@ -260,7 +264,6 @@ do {								\
 		"	.previous"				\
 		: "+r" (err), "=r" (__tmp), "=m" (*(ptr))	\
 		: "rJ" (__x), "i" (-EFAULT));			\
-	__disable_user_access();				\
 } while (0)
 
 #ifdef CONFIG_64BIT
@@ -272,7 +275,6 @@ do {								\
 	u32 __user *__ptr = (u32 __user *)(ptr);		\
 	u64 __x = (__typeof__((x)-(x)))(x);			\
 	uintptr_t __tmp;					\
-	__enable_user_access();					\
 	__asm__ __volatile__ (					\
 		"1:\n"						\
 		"	sw %z4, %2\n"				\
@@ -294,10 +296,28 @@ do {								\
 			"=m" (__ptr[__LSW]),			\
 			"=m" (__ptr[__MSW])			\
 		: "rJ" (__x), "rJ" (__x >> 32), "i" (-EFAULT));	\
-	__disable_user_access();				\
 } while (0)
 #endif /* CONFIG_64BIT */
 
+#define __put_user_nocheck(x, __gu_ptr, __pu_err)					\
+do {								\
+	switch (sizeof(*__gu_ptr)) {				\
+	case 1:							\
+		__put_user_asm("sb", (x), __gu_ptr, __pu_err);	\
+		break;						\
+	case 2:							\
+		__put_user_asm("sh", (x), __gu_ptr, __pu_err);	\
+		break;						\
+	case 4:							\
+		__put_user_asm("sw", (x), __gu_ptr, __pu_err);	\
+		break;						\
+	case 8:							\
+		__put_user_8((x), __gu_ptr, __pu_err);	\
+		break;						\
+	default:						\
+		BUILD_BUG();					\
+	}							\
+} while (0)
 
 /**
  * __put_user: - Write a simple value into user space, with less checking.
@@ -320,25 +340,15 @@ do {								\
  */
 #define __put_user(x, ptr)					\
 ({								\
-	register long __pu_err = 0;				\
 	__typeof__(*(ptr)) __user *__gu_ptr = (ptr);		\
+	long __pu_err = 0;					\
+								\
 	__chk_user_ptr(__gu_ptr);				\
-	switch (sizeof(*__gu_ptr)) {				\
-	case 1:							\
-		__put_user_asm("sb", (x), __gu_ptr, __pu_err);	\
-		break;						\
-	case 2:							\
-		__put_user_asm("sh", (x), __gu_ptr, __pu_err);	\
-		break;						\
-	case 4:							\
-		__put_user_asm("sw", (x), __gu_ptr, __pu_err);	\
-		break;						\
-	case 8:							\
-		__put_user_8((x), __gu_ptr, __pu_err);	\
-		break;						\
-	default:						\
-		BUILD_BUG();					\
-	}							\
+								\
+	__enable_user_access();					\
+	__put_user_nocheck(x, __gu_ptr, __pu_err);		\
+	__disable_user_access();				\
+								\
 	__pu_err;						\
 })
 
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (5 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 6/8] riscv: refactor __get_user and __put_user Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-09  4:59   ` Palmer Dabbelt
  2020-09-07  5:58 ` [PATCH 8/8] riscv: remove address space overrides using set_fs() Christoph Hellwig
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Implement the non-faulting kernel access helpers directly instead of
abusing the uaccess routines under set_fs(KERNEL_DS).

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/include/asm/uaccess.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index b67d1c616ec348..264e52fb62b143 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -486,6 +486,26 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
 	__ret;							\
 })
 
+#define HAVE_GET_KERNEL_NOFAULT
+
+#define __get_kernel_nofault(dst, src, type, err_label)			\
+do {									\
+	long __kr_err;							\
+									\
+	__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err);	\
+	if (unlikely(__kr_err))						\
+		goto err_label;						\
+} while (0)
+
+#define __put_kernel_nofault(dst, src, type, err_label)			\
+do {									\
+	long __kr_err;							\
+									\
+	__put_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err);	\
+	if (unlikely(__kr_err))						\
+		goto err_label;						\
+} while (0)
+
 #else /* CONFIG_MMU */
 #include <asm-generic/uaccess.h>
 #endif /* CONFIG_MMU */
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 8/8] riscv: remove address space overrides using set_fs()
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (6 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault Christoph Hellwig
@ 2020-09-07  5:58 ` Christoph Hellwig
  2020-09-09  4:59   ` Palmer Dabbelt
  2020-09-09  4:59 ` remove set_fs for riscv v2 Palmer Dabbelt
  2020-09-26  6:58 ` Christoph Hellwig
  9 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Stop providing the possibility to override the address space using
set_fs() now that there is no need for that any more.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/Kconfig                   |  1 -
 arch/riscv/include/asm/thread_info.h |  6 ------
 arch/riscv/include/asm/uaccess.h     | 27 +--------------------------
 arch/riscv/kernel/process.c          |  1 -
 4 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 460e3971a80fde..33dde87218ddab 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -86,7 +86,6 @@ config RISCV
 	select SPARSE_IRQ
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
-	select SET_FS
 	select UACCESS_MEMCPY if !MMU
 
 config ARCH_MMAP_RND_BITS_MIN
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
index 464a2bbc97ea33..a390711129de64 100644
--- a/arch/riscv/include/asm/thread_info.h
+++ b/arch/riscv/include/asm/thread_info.h
@@ -24,10 +24,6 @@
 #include <asm/processor.h>
 #include <asm/csr.h>
 
-typedef struct {
-	unsigned long seg;
-} mm_segment_t;
-
 /*
  * low level task data that entry.S needs immediate access to
  * - this struct should fit entirely inside of one cache line
@@ -39,7 +35,6 @@ typedef struct {
 struct thread_info {
 	unsigned long		flags;		/* low level flags */
 	int                     preempt_count;  /* 0=>preemptible, <0=>BUG */
-	mm_segment_t		addr_limit;
 	/*
 	 * These stack pointers are overwritten on every system call or
 	 * exception.  SP is also saved to the stack it can be recovered when
@@ -59,7 +54,6 @@ struct thread_info {
 {						\
 	.flags		= 0,			\
 	.preempt_count	= INIT_PREEMPT_COUNT,	\
-	.addr_limit	= KERNEL_DS,		\
 }
 
 #endif /* !__ASSEMBLY__ */
diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
index 264e52fb62b143..c47e6b35c551f4 100644
--- a/arch/riscv/include/asm/uaccess.h
+++ b/arch/riscv/include/asm/uaccess.h
@@ -26,29 +26,6 @@
 #define __disable_user_access()							\
 	__asm__ __volatile__ ("csrc sstatus, %0" : : "r" (SR_SUM) : "memory")
 
-/*
- * The fs value determines whether argument validity checking should be
- * performed or not.  If get_fs() == USER_DS, checking is performed, with
- * get_fs() == KERNEL_DS, checking is bypassed.
- *
- * For historical reasons, these macros are grossly misnamed.
- */
-
-#define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
-
-#define KERNEL_DS	MAKE_MM_SEG(~0UL)
-#define USER_DS		MAKE_MM_SEG(TASK_SIZE)
-
-#define get_fs()	(current_thread_info()->addr_limit)
-
-static inline void set_fs(mm_segment_t fs)
-{
-	current_thread_info()->addr_limit = fs;
-}
-
-#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
-#define user_addr_max()	(get_fs().seg)
-
 /**
  * access_ok: - Checks if a user space pointer is valid
  * @addr: User space pointer to start of block to check
@@ -76,9 +53,7 @@ static inline void set_fs(mm_segment_t fs)
  */
 static inline int __access_ok(unsigned long addr, unsigned long size)
 {
-	const mm_segment_t fs = get_fs();
-
-	return size <= fs.seg && addr <= fs.seg - size;
+	return size <= TASK_SIZE && addr <= TASK_SIZE - size;
 }
 
 /*
diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
index 2b97c493427c9e..19225ec65db62f 100644
--- a/arch/riscv/kernel/process.c
+++ b/arch/riscv/kernel/process.c
@@ -84,7 +84,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
 	}
 	regs->epc = pc;
 	regs->sp = sp;
-	set_fs(USER_DS);
 }
 
 void flush_thread(void)
-- 
2.28.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/8] riscv: use memcpy based uaccess for nommu again
  2020-09-07  5:58 ` [PATCH 5/8] riscv: use memcpy based uaccess for nommu again Christoph Hellwig
@ 2020-09-09  4:59   ` Palmer Dabbelt
  0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  4:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv

On Sun, 06 Sep 2020 22:58:22 PDT (-0700), Christoph Hellwig wrote:
> This reverts commit adccfb1a805ea84d2db38eb53032533279bdaa97.
>
> Now that the generic uaccess by mempcy code handles unaligned addresses
> the generic code can be used for all RISC-V CPUs.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/riscv/Kconfig               |  1 +
>  arch/riscv/include/asm/uaccess.h | 36 ++++++++++++++++----------------
>  arch/riscv/lib/Makefile          |  2 +-
>  3 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 07d53044013ede..460e3971a80fde 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -87,6 +87,7 @@ config RISCV
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
>  	select SET_FS
> +	select UACCESS_MEMCPY if !MMU
>
>  config ARCH_MMAP_RND_BITS_MIN
>  	default 18 if 64BIT
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index f56c66b3f5fe21..e8eedf22e90747 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -13,24 +13,6 @@
>  /*
>   * User space memory access functions
>   */
> -
> -extern unsigned long __must_check __asm_copy_to_user(void __user *to,
> -	const void *from, unsigned long n);
> -extern unsigned long __must_check __asm_copy_from_user(void *to,
> -	const void __user *from, unsigned long n);
> -
> -static inline unsigned long
> -raw_copy_from_user(void *to, const void __user *from, unsigned long n)
> -{
> -	return __asm_copy_from_user(to, from, n);
> -}
> -
> -static inline unsigned long
> -raw_copy_to_user(void __user *to, const void *from, unsigned long n)
> -{
> -	return __asm_copy_to_user(to, from, n);
> -}
> -
>  #ifdef CONFIG_MMU
>  #include <linux/errno.h>
>  #include <linux/compiler.h>
> @@ -385,6 +367,24 @@ do {								\
>  		-EFAULT;					\
>  })
>
> +
> +unsigned long __must_check __asm_copy_to_user(void __user *to,
> +	const void *from, unsigned long n);
> +unsigned long __must_check __asm_copy_from_user(void *to,
> +	const void __user *from, unsigned long n);
> +
> +static inline unsigned long
> +raw_copy_from_user(void *to, const void __user *from, unsigned long n)
> +{
> +	return __asm_copy_from_user(to, from, n);
> +}
> +
> +static inline unsigned long
> +raw_copy_to_user(void __user *to, const void *from, unsigned long n)
> +{
> +	return __asm_copy_to_user(to, from, n);
> +}
> +
>  extern long strncpy_from_user(char *dest, const char __user *src, long count);
>
>  extern long __must_check strlen_user(const char __user *str);
> diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
> index 0d0db80800c4ed..47e7a82044608d 100644
> --- a/arch/riscv/lib/Makefile
> +++ b/arch/riscv/lib/Makefile
> @@ -2,5 +2,5 @@
>  lib-y			+= delay.o
>  lib-y			+= memcpy.o
>  lib-y			+= memset.o
> -lib-y			+= uaccess.o
> +lib-$(CONFIG_MMU)	+= uaccess.o
>  lib-$(CONFIG_64BIT)	+= tishift.o

Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 6/8] riscv: refactor __get_user and __put_user
  2020-09-07  5:58 ` [PATCH 6/8] riscv: refactor __get_user and __put_user Christoph Hellwig
@ 2020-09-09  4:59   ` Palmer Dabbelt
  0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  4:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv

On Sun, 06 Sep 2020 22:58:23 PDT (-0700), Christoph Hellwig wrote:
> Add new __get_user_nocheck and __put_user_nocheck that switch on the size
> and call the actual inline assembly helpers, and move the uaccess enable
> / disable into the actual __get_user and __put_user.  This prepares for
> natively implementing __get_kernel_nofault and __put_kernel_nofault.
>
> Also don't bother with the deprecated register keyword for the error
> return.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/riscv/include/asm/uaccess.h | 94 ++++++++++++++++++--------------
>  1 file changed, 52 insertions(+), 42 deletions(-)
>
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index e8eedf22e90747..b67d1c616ec348 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -107,7 +107,6 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
>  do {								\
>  	uintptr_t __tmp;					\
>  	__typeof__(x) __x;					\
> -	__enable_user_access();					\
>  	__asm__ __volatile__ (					\
>  		"1:\n"						\
>  		"	" insn " %1, %3\n"			\
> @@ -125,7 +124,6 @@ do {								\
>  		"	.previous"				\
>  		: "+r" (err), "=&r" (__x), "=r" (__tmp)		\
>  		: "m" (*(ptr)), "i" (-EFAULT));			\
> -	__disable_user_access();				\
>  	(x) = __x;						\
>  } while (0)
>
> @@ -138,7 +136,6 @@ do {								\
>  	u32 __user *__ptr = (u32 __user *)(ptr);		\
>  	u32 __lo, __hi;						\
>  	uintptr_t __tmp;					\
> -	__enable_user_access();					\
>  	__asm__ __volatile__ (					\
>  		"1:\n"						\
>  		"	lw %1, %4\n"				\
> @@ -162,12 +159,30 @@ do {								\
>  			"=r" (__tmp)				\
>  		: "m" (__ptr[__LSW]), "m" (__ptr[__MSW]),	\
>  			"i" (-EFAULT));				\
> -	__disable_user_access();				\
>  	(x) = (__typeof__(x))((__typeof__((x)-(x)))(		\
>  		(((u64)__hi << 32) | __lo)));			\
>  } while (0)
>  #endif /* CONFIG_64BIT */
>
> +#define __get_user_nocheck(x, __gu_ptr, __gu_err)		\
> +do {								\
> +	switch (sizeof(*__gu_ptr)) {				\
> +	case 1:							\
> +		__get_user_asm("lb", (x), __gu_ptr, __gu_err);	\
> +		break;						\
> +	case 2:							\
> +		__get_user_asm("lh", (x), __gu_ptr, __gu_err);	\
> +		break;						\
> +	case 4:							\
> +		__get_user_asm("lw", (x), __gu_ptr, __gu_err);	\
> +		break;						\
> +	case 8:							\
> +		__get_user_8((x), __gu_ptr, __gu_err);	\
> +		break;						\
> +	default:						\
> +		BUILD_BUG();					\
> +	}							\
> +} while (0)
>
>  /**
>   * __get_user: - Get a simple variable from user space, with less checking.
> @@ -191,25 +206,15 @@ do {								\
>   */
>  #define __get_user(x, ptr)					\
>  ({								\
> -	register long __gu_err = 0;				\
>  	const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);	\
> +	long __gu_err = 0;					\
> +								\
>  	__chk_user_ptr(__gu_ptr);				\
> -	switch (sizeof(*__gu_ptr)) {				\
> -	case 1:							\
> -		__get_user_asm("lb", (x), __gu_ptr, __gu_err);	\
> -		break;						\
> -	case 2:							\
> -		__get_user_asm("lh", (x), __gu_ptr, __gu_err);	\
> -		break;						\
> -	case 4:							\
> -		__get_user_asm("lw", (x), __gu_ptr, __gu_err);	\
> -		break;						\
> -	case 8:							\
> -		__get_user_8((x), __gu_ptr, __gu_err);	\
> -		break;						\
> -	default:						\
> -		BUILD_BUG();					\
> -	}							\
> +								\
> +	__enable_user_access();					\
> +	__get_user_nocheck(x, __gu_ptr, __gu_err);		\
> +	__disable_user_access();				\
> +								\
>  	__gu_err;						\
>  })
>
> @@ -243,7 +248,6 @@ do {								\
>  do {								\
>  	uintptr_t __tmp;					\
>  	__typeof__(*(ptr)) __x = x;				\
> -	__enable_user_access();					\
>  	__asm__ __volatile__ (					\
>  		"1:\n"						\
>  		"	" insn " %z3, %2\n"			\
> @@ -260,7 +264,6 @@ do {								\
>  		"	.previous"				\
>  		: "+r" (err), "=r" (__tmp), "=m" (*(ptr))	\
>  		: "rJ" (__x), "i" (-EFAULT));			\
> -	__disable_user_access();				\
>  } while (0)
>
>  #ifdef CONFIG_64BIT
> @@ -272,7 +275,6 @@ do {								\
>  	u32 __user *__ptr = (u32 __user *)(ptr);		\
>  	u64 __x = (__typeof__((x)-(x)))(x);			\
>  	uintptr_t __tmp;					\
> -	__enable_user_access();					\
>  	__asm__ __volatile__ (					\
>  		"1:\n"						\
>  		"	sw %z4, %2\n"				\
> @@ -294,10 +296,28 @@ do {								\
>  			"=m" (__ptr[__LSW]),			\
>  			"=m" (__ptr[__MSW])			\
>  		: "rJ" (__x), "rJ" (__x >> 32), "i" (-EFAULT));	\
> -	__disable_user_access();				\
>  } while (0)
>  #endif /* CONFIG_64BIT */
>
> +#define __put_user_nocheck(x, __gu_ptr, __pu_err)					\
> +do {								\
> +	switch (sizeof(*__gu_ptr)) {				\
> +	case 1:							\
> +		__put_user_asm("sb", (x), __gu_ptr, __pu_err);	\
> +		break;						\
> +	case 2:							\
> +		__put_user_asm("sh", (x), __gu_ptr, __pu_err);	\
> +		break;						\
> +	case 4:							\
> +		__put_user_asm("sw", (x), __gu_ptr, __pu_err);	\
> +		break;						\
> +	case 8:							\
> +		__put_user_8((x), __gu_ptr, __pu_err);	\
> +		break;						\
> +	default:						\
> +		BUILD_BUG();					\
> +	}							\
> +} while (0)
>
>  /**
>   * __put_user: - Write a simple value into user space, with less checking.
> @@ -320,25 +340,15 @@ do {								\
>   */
>  #define __put_user(x, ptr)					\
>  ({								\
> -	register long __pu_err = 0;				\
>  	__typeof__(*(ptr)) __user *__gu_ptr = (ptr);		\
> +	long __pu_err = 0;					\
> +								\
>  	__chk_user_ptr(__gu_ptr);				\
> -	switch (sizeof(*__gu_ptr)) {				\
> -	case 1:							\
> -		__put_user_asm("sb", (x), __gu_ptr, __pu_err);	\
> -		break;						\
> -	case 2:							\
> -		__put_user_asm("sh", (x), __gu_ptr, __pu_err);	\
> -		break;						\
> -	case 4:							\
> -		__put_user_asm("sw", (x), __gu_ptr, __pu_err);	\
> -		break;						\
> -	case 8:							\
> -		__put_user_8((x), __gu_ptr, __pu_err);	\
> -		break;						\
> -	default:						\
> -		BUILD_BUG();					\
> -	}							\
> +								\
> +	__enable_user_access();					\
> +	__put_user_nocheck(x, __gu_ptr, __pu_err);		\
> +	__disable_user_access();				\
> +								\
>  	__pu_err;						\
>  })

Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault
  2020-09-07  5:58 ` [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault Christoph Hellwig
@ 2020-09-09  4:59   ` Palmer Dabbelt
  0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  4:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv

On Sun, 06 Sep 2020 22:58:24 PDT (-0700), Christoph Hellwig wrote:
> Implement the non-faulting kernel access helpers directly instead of
> abusing the uaccess routines under set_fs(KERNEL_DS).
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/riscv/include/asm/uaccess.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index b67d1c616ec348..264e52fb62b143 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -486,6 +486,26 @@ unsigned long __must_check clear_user(void __user *to, unsigned long n)
>  	__ret;							\
>  })
>
> +#define HAVE_GET_KERNEL_NOFAULT
> +
> +#define __get_kernel_nofault(dst, src, type, err_label)			\
> +do {									\
> +	long __kr_err;							\
> +									\
> +	__get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err);	\
> +	if (unlikely(__kr_err))						\
> +		goto err_label;						\
> +} while (0)
> +
> +#define __put_kernel_nofault(dst, src, type, err_label)			\
> +do {									\
> +	long __kr_err;							\
> +									\
> +	__put_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err);	\
> +	if (unlikely(__kr_err))						\
> +		goto err_label;						\
> +} while (0)
> +
>  #else /* CONFIG_MMU */
>  #include <asm-generic/uaccess.h>
>  #endif /* CONFIG_MMU */

Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 8/8] riscv: remove address space overrides using set_fs()
  2020-09-07  5:58 ` [PATCH 8/8] riscv: remove address space overrides using set_fs() Christoph Hellwig
@ 2020-09-09  4:59   ` Palmer Dabbelt
  0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  4:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv

On Sun, 06 Sep 2020 22:58:25 PDT (-0700), Christoph Hellwig wrote:
> Stop providing the possibility to override the address space using
> set_fs() now that there is no need for that any more.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/riscv/Kconfig                   |  1 -
>  arch/riscv/include/asm/thread_info.h |  6 ------
>  arch/riscv/include/asm/uaccess.h     | 27 +--------------------------
>  arch/riscv/kernel/process.c          |  1 -
>  4 files changed, 1 insertion(+), 34 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 460e3971a80fde..33dde87218ddab 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -86,7 +86,6 @@ config RISCV
>  	select SPARSE_IRQ
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
> -	select SET_FS
>  	select UACCESS_MEMCPY if !MMU
>
>  config ARCH_MMAP_RND_BITS_MIN
> diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
> index 464a2bbc97ea33..a390711129de64 100644
> --- a/arch/riscv/include/asm/thread_info.h
> +++ b/arch/riscv/include/asm/thread_info.h
> @@ -24,10 +24,6 @@
>  #include <asm/processor.h>
>  #include <asm/csr.h>
>
> -typedef struct {
> -	unsigned long seg;
> -} mm_segment_t;
> -
>  /*
>   * low level task data that entry.S needs immediate access to
>   * - this struct should fit entirely inside of one cache line
> @@ -39,7 +35,6 @@ typedef struct {
>  struct thread_info {
>  	unsigned long		flags;		/* low level flags */
>  	int                     preempt_count;  /* 0=>preemptible, <0=>BUG */
> -	mm_segment_t		addr_limit;
>  	/*
>  	 * These stack pointers are overwritten on every system call or
>  	 * exception.  SP is also saved to the stack it can be recovered when
> @@ -59,7 +54,6 @@ struct thread_info {
>  {						\
>  	.flags		= 0,			\
>  	.preempt_count	= INIT_PREEMPT_COUNT,	\
> -	.addr_limit	= KERNEL_DS,		\
>  }
>
>  #endif /* !__ASSEMBLY__ */
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index 264e52fb62b143..c47e6b35c551f4 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -26,29 +26,6 @@
>  #define __disable_user_access()							\
>  	__asm__ __volatile__ ("csrc sstatus, %0" : : "r" (SR_SUM) : "memory")
>
> -/*
> - * The fs value determines whether argument validity checking should be
> - * performed or not.  If get_fs() == USER_DS, checking is performed, with
> - * get_fs() == KERNEL_DS, checking is bypassed.
> - *
> - * For historical reasons, these macros are grossly misnamed.
> - */
> -
> -#define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
> -
> -#define KERNEL_DS	MAKE_MM_SEG(~0UL)
> -#define USER_DS		MAKE_MM_SEG(TASK_SIZE)
> -
> -#define get_fs()	(current_thread_info()->addr_limit)
> -
> -static inline void set_fs(mm_segment_t fs)
> -{
> -	current_thread_info()->addr_limit = fs;
> -}
> -
> -#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg)
> -#define user_addr_max()	(get_fs().seg)
> -
>  /**
>   * access_ok: - Checks if a user space pointer is valid
>   * @addr: User space pointer to start of block to check
> @@ -76,9 +53,7 @@ static inline void set_fs(mm_segment_t fs)
>   */
>  static inline int __access_ok(unsigned long addr, unsigned long size)
>  {
> -	const mm_segment_t fs = get_fs();
> -
> -	return size <= fs.seg && addr <= fs.seg - size;
> +	return size <= TASK_SIZE && addr <= TASK_SIZE - size;
>  }
>
>  /*
> diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
> index 2b97c493427c9e..19225ec65db62f 100644
> --- a/arch/riscv/kernel/process.c
> +++ b/arch/riscv/kernel/process.c
> @@ -84,7 +84,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
>  	}
>  	regs->epc = pc;
>  	regs->sp = sp;
> -	set_fs(USER_DS);
>  }
>
>  void flush_thread(void)

Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (7 preceding siblings ...)
  2020-09-07  5:58 ` [PATCH 8/8] riscv: remove address space overrides using set_fs() Christoph Hellwig
@ 2020-09-09  4:59 ` Palmer Dabbelt
  2020-09-09  6:55   ` Christoph Hellwig
  2020-09-26  6:58 ` Christoph Hellwig
  9 siblings, 1 reply; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09  4:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv

On Sun, 06 Sep 2020 22:58:17 PDT (-0700), Christoph Hellwig wrote:
> Hi all,
>
> this series converts riscv to the new set_fs less world and is on top of this
> branch:
>
>     https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/log/?h=base.set_fs
>
> The first four patches are general improvements and enablement for all nommu
> ports, and might make sense to merge through the above base branch.

Seems like it to me.  These won't work without the SET_FS code so I'm OK if you
guys want to keep them all together.  Otherwise I think I'd need to wait until
the SET_FS stuff gets merged before taking any of these, which would be a bit
of a headache.

Thanks!

> Changes since v1:
>  - implement __get_user_fn and __put_user_fn for the UACCESS_MEMCPY case
>    and remove the small constant size optimizations in raw_copy_from_user
>    and raw_copy_to_user
>  - reshuffle the patch order a little
>
> Diffstat
>  arch/riscv/Kconfig                   |    2
>  arch/riscv/include/asm/thread_info.h |    6 -
>  arch/riscv/include/asm/uaccess.h     |  177 +++++++++++++++++------------------
>  arch/riscv/kernel/process.c          |    1
>  arch/riscv/lib/Makefile              |    2
>  include/asm-generic/uaccess.h        |  109 +++++++++++++--------
>  include/linux/uaccess.h              |    4
>  7 files changed, 166 insertions(+), 135 deletions(-)

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-09  4:59 ` remove set_fs for riscv v2 Palmer Dabbelt
@ 2020-09-09  6:55   ` Christoph Hellwig
  2020-09-09 20:38     ` Palmer Dabbelt
  2020-09-22  4:37     ` Christoph Hellwig
  0 siblings, 2 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-09  6:55 UTC (permalink / raw)
  To: Palmer Dabbelt, viro, Arnd Bergmann
  Cc: linux-arch, linux-kernel, linux-riscv, Christoph Hellwig, Paul Walmsley

On Tue, Sep 08, 2020 at 09:59:29PM -0700, Palmer Dabbelt wrote:
>>
>> The first four patches are general improvements and enablement for all nommu
>> ports, and might make sense to merge through the above base branch.
>
> Seems like it to me.  These won't work without the SET_FS code so I'm OK if you
> guys want to keep them all together.  Otherwise I think I'd need to wait until
> the SET_FS stuff gets merged before taking any of these, which would be a bit
> of a headache.

now that we've sorted out a remaining issue base.set_fs should not
be rebased any more, so you could pull it into the riscv tree or a topic
branch.

The first four patch should go into base.set_fs, though.  Arnd, can you
re-review the updated patches?

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-09  6:55   ` Christoph Hellwig
@ 2020-09-09 20:38     ` Palmer Dabbelt
  2020-09-22  4:37     ` Christoph Hellwig
  1 sibling, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-09 20:38 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv, Christoph Hellwig

On Tue, 08 Sep 2020 23:55:15 PDT (-0700), Christoph Hellwig wrote:
> On Tue, Sep 08, 2020 at 09:59:29PM -0700, Palmer Dabbelt wrote:
>>>
>>> The first four patches are general improvements and enablement for all nommu
>>> ports, and might make sense to merge through the above base branch.
>>
>> Seems like it to me.  These won't work without the SET_FS code so I'm OK if you
>> guys want to keep them all together.  Otherwise I think I'd need to wait until
>> the SET_FS stuff gets merged before taking any of these, which would be a bit
>> of a headache.
>
> now that we've sorted out a remaining issue base.set_fs should not
> be rebased any more, so you could pull it into the riscv tree or a topic
> branch.
>
> The first four patch should go into base.set_fs, though.  Arnd, can you
> re-review the updated patches?

OK, assuming the first four land through vfs I'll take the rest through my
tree.  I wasn't sure it was OK to merge another subtree into my tree, as IIRC I
got told not to do something like that before, but I'll go figure out a sane
way to handle it.

Thanks!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-09  6:55   ` Christoph Hellwig
  2020-09-09 20:38     ` Palmer Dabbelt
@ 2020-09-22  4:37     ` Christoph Hellwig
  2020-09-26 17:50       ` Palmer Dabbelt
  1 sibling, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-22  4:37 UTC (permalink / raw)
  To: Palmer Dabbelt, viro, Arnd Bergmann
  Cc: linux-arch, linux-kernel, linux-riscv, Christoph Hellwig, Paul Walmsley

Given tht we've not made much progress with the common branch,
are you fine just picking this up through the riscv tree for 5.10?

I'll defer other architectures that depend on the common changes to
5.11 then.

On Wed, Sep 09, 2020 at 08:55:15AM +0200, Christoph Hellwig wrote:
> now that we've sorted out a remaining issue base.set_fs should not
> be rebased any more, so you could pull it into the riscv tree or a topic
> branch.
> 
> The first four patch should go into base.set_fs, though.  Arnd, can you
> re-review the updated patches?
---end quoted text---

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
                   ` (8 preceding siblings ...)
  2020-09-09  4:59 ` remove set_fs for riscv v2 Palmer Dabbelt
@ 2020-09-26  6:58 ` Christoph Hellwig
  9 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-26  6:58 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Arnd Bergmann, Alexander Viro
  Cc: linux-arch, linux-riscv, linux-kernel

Can we get this series picked up either in Al's base.set_fs tree, or
a branch in the riscv tree?

On Mon, Sep 07, 2020 at 07:58:17AM +0200, Christoph Hellwig wrote:
> Hi all,
> 
> this series converts riscv to the new set_fs less world and is on top of this
> branch:
> 
>     https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/log/?h=base.set_fs
> 
> The first four patches are general improvements and enablement for all nommu
> ports, and might make sense to merge through the above base branch.
> 
> Changes since v1:
>  - implement __get_user_fn and __put_user_fn for the UACCESS_MEMCPY case
>    and remove the small constant size optimizations in raw_copy_from_user
>    and raw_copy_to_user
>  - reshuffle the patch order a little
> 
> Diffstat
>  arch/riscv/Kconfig                   |    2 
>  arch/riscv/include/asm/thread_info.h |    6 -
>  arch/riscv/include/asm/uaccess.h     |  177 +++++++++++++++++------------------
>  arch/riscv/kernel/process.c          |    1 
>  arch/riscv/lib/Makefile              |    2 
>  include/asm-generic/uaccess.h        |  109 +++++++++++++--------
>  include/linux/uaccess.h              |    4 
>  7 files changed, 166 insertions(+), 135 deletions(-)
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
---end quoted text---

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-22  4:37     ` Christoph Hellwig
@ 2020-09-26 17:50       ` Palmer Dabbelt
  2020-09-26 19:13         ` Arnd Bergmann
  2020-09-28 12:49         ` Christoph Hellwig
  0 siblings, 2 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-26 17:50 UTC (permalink / raw)
  To: Christoph Hellwig, viro, Arnd Bergmann
  Cc: linux-arch, linux-kernel, linux-riscv, Christoph Hellwig, Paul Walmsley

On Mon, 21 Sep 2020 21:37:52 PDT (-0700), Christoph Hellwig wrote:
> Given tht we've not made much progress with the common branch,
> are you fine just picking this up through the riscv tree for 5.10?
>
> I'll defer other architectures that depend on the common changes to
> 5.11 then.

I'm OK taking it, but there's a few things I'd like to sort out.  IIRC I put it
on a temporary branch over here

    https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs

under the assumption it might get lost otherwise, but let me know if that's not
what you were looking for.

Arnd: Are you OK with the asm-generic stuff?  I couldn't find anything in my
mail history, so sorry if I just missed it.

Al: IIRC the plan here was to have me merge in a feature branch with this
stuff, but it'd have to be based on your for-next as there are some
dependencies over there.  I see 5ae4998b5d6f ("powerpc: remove address space
overrides using set_fs()") in vfs/for-next so I think we should be OK, but let
me know if I'm doing something wrong.

> On Wed, Sep 09, 2020 at 08:55:15AM +0200, Christoph Hellwig wrote:
>> now that we've sorted out a remaining issue base.set_fs should not
>> be rebased any more, so you could pull it into the riscv tree or a topic
>> branch.
>>
>> The first four patch should go into base.set_fs, though.  Arnd, can you
>> re-review the updated patches?
> ---end quoted text---

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-26 17:50       ` Palmer Dabbelt
@ 2020-09-26 19:13         ` Arnd Bergmann
  2020-10-04 17:27           ` Palmer Dabbelt
  2020-09-28 12:49         ` Christoph Hellwig
  1 sibling, 1 reply; 24+ messages in thread
From: Arnd Bergmann @ 2020-09-26 19:13 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: linux-arch, linux-kernel, Al Viro, Paul Walmsley, linux-riscv,
	Christoph Hellwig

On Sat, Sep 26, 2020 at 7:50 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
> I'm OK taking it, but there's a few things I'd like to sort out.  IIRC I put it
> on a temporary branch over here
>
>     https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs
>
> under the assumption it might get lost otherwise, but let me know if that's not
> what you were looking for.
>
> Arnd: Are you OK with the asm-generic stuff?  I couldn't find anything in my
> mail history, so sorry if I just missed it.

For some reason I had missed that __copy_from_user() change earlier,
but I had a closer look now and this is all very good, feel free to
add an

Acked-by: Arnd Bergmann <arnd@arndb.de>

       Arnd

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-26 17:50       ` Palmer Dabbelt
  2020-09-26 19:13         ` Arnd Bergmann
@ 2020-09-28 12:49         ` Christoph Hellwig
  2020-09-28 16:45           ` Palmer Dabbelt
  1 sibling, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-28 12:49 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv, Christoph Hellwig

On Sat, Sep 26, 2020 at 10:50:52AM -0700, Palmer Dabbelt wrote:
> On Mon, 21 Sep 2020 21:37:52 PDT (-0700), Christoph Hellwig wrote:
>> Given tht we've not made much progress with the common branch,
>> are you fine just picking this up through the riscv tree for 5.10?
>>
>> I'll defer other architectures that depend on the common changes to
>> 5.11 then.
>
> I'm OK taking it, but there's a few things I'd like to sort out.  IIRC I put it
> on a temporary branch over here
>
>    https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs
>
> under the assumption it might get lost otherwise, but let me know if that's not
> what you were looking for.

Well, we'll want it in linux-next and then 5.10.  Either a merge through
the RISC-V maintainer, or as part of the base branch from Al would
make sense to me.

>
> Arnd: Are you OK with the asm-generic stuff?  I couldn't find anything in my
> mail history, so sorry if I just missed it.
>
> Al: IIRC the plan here was to have me merge in a feature branch with this
> stuff, but it'd have to be based on your for-next as there are some
> dependencies over there.  I see 5ae4998b5d6f ("powerpc: remove address space
> overrides using set_fs()") in vfs/for-next so I think we should be OK, but let
> me know if I'm doing something wrong.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-28 12:49         ` Christoph Hellwig
@ 2020-09-28 16:45           ` Palmer Dabbelt
  2020-09-29 18:03             ` Christoph Hellwig
  0 siblings, 1 reply; 24+ messages in thread
From: Palmer Dabbelt @ 2020-09-28 16:45 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv, Christoph Hellwig

On Mon, 28 Sep 2020 05:49:28 PDT (-0700), Christoph Hellwig wrote:
> On Sat, Sep 26, 2020 at 10:50:52AM -0700, Palmer Dabbelt wrote:
>> On Mon, 21 Sep 2020 21:37:52 PDT (-0700), Christoph Hellwig wrote:
>>> Given tht we've not made much progress with the common branch,
>>> are you fine just picking this up through the riscv tree for 5.10?
>>>
>>> I'll defer other architectures that depend on the common changes to
>>> 5.11 then.
>>
>> I'm OK taking it, but there's a few things I'd like to sort out.  IIRC I put it
>> on a temporary branch over here
>>
>>    https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs
>>
>> under the assumption it might get lost otherwise, but let me know if that's not
>> what you were looking for.
>
> Well, we'll want it in linux-next and then 5.10.  Either a merge through
> the RISC-V maintainer, or as part of the base branch from Al would
> make sense to me.

Sorry, I guess my question was really: does that branch have all the
dependencies necessary for the RISC-V stuff to actually work?  IIRC this actual
patch set depended on some other one, and while I thinK I got everything I
don't want to pull in something broken.

>> Arnd: Are you OK with the asm-generic stuff?  I couldn't find anything in my
>> mail history, so sorry if I just missed it.
>>
>> Al: IIRC the plan here was to have me merge in a feature branch with this
>> stuff, but it'd have to be based on your for-next as there are some
>> dependencies over there.  I see 5ae4998b5d6f ("powerpc: remove address space
>> overrides using set_fs()") in vfs/for-next so I think we should be OK, but let
>> me know if I'm doing something wrong.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-28 16:45           ` Palmer Dabbelt
@ 2020-09-29 18:03             ` Christoph Hellwig
  0 siblings, 0 replies; 24+ messages in thread
From: Christoph Hellwig @ 2020-09-29 18:03 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: linux-arch, Arnd Bergmann, linux-kernel, viro, Paul Walmsley,
	linux-riscv, Christoph Hellwig

On Mon, Sep 28, 2020 at 09:45:30AM -0700, Palmer Dabbelt wrote:
>>>    https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs
>>>
>>> under the assumption it might get lost otherwise, but let me know if that's not
>>> what you were looking for.
>>
>> Well, we'll want it in linux-next and then 5.10.  Either a merge through
>> the RISC-V maintainer, or as part of the base branch from Al would
>> make sense to me.
>
> Sorry, I guess my question was really: does that branch have all the
> dependencies necessary for the RISC-V stuff to actually work?  IIRC this actual
> patch set depended on some other one, and while I thinK I got everything I
> don't want to pull in something broken.

The riscv patchset depend only on the base.set_fs branch in Als tree.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: remove set_fs for riscv v2
  2020-09-26 19:13         ` Arnd Bergmann
@ 2020-10-04 17:27           ` Palmer Dabbelt
  0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2020-10-04 17:27 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-kernel, viro, Paul Walmsley, linux-riscv,
	Christoph Hellwig

On Sat, 26 Sep 2020 12:13:41 PDT (-0700), Arnd Bergmann wrote:
> On Sat, Sep 26, 2020 at 7:50 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>> I'm OK taking it, but there's a few things I'd like to sort out.  IIRC I put it
>> on a temporary branch over here
>>
>>     https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/log/?h=riscv-remove_set_fs
>>
>> under the assumption it might get lost otherwise, but let me know if that's not
>> what you were looking for.
>>
>> Arnd: Are you OK with the asm-generic stuff?  I couldn't find anything in my
>> mail history, so sorry if I just missed it.
>
> For some reason I had missed that __copy_from_user() change earlier,
> but I had a closer look now and this is all very good, feel free to
> add an
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks.  These (along with the rest of Christoph's patch set, and a merge from
base.set_fs) are on my for-next.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, back to index

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07  5:58 remove set_fs for riscv v2 Christoph Hellwig
2020-09-07  5:58 ` [PATCH 1/8] uaccess: provide a generic TASK_SIZE_MAX definition Christoph Hellwig
2020-09-07  5:58 ` [PATCH 2/8] asm-generic: improve the nommu {get,put}_user handling Christoph Hellwig
2020-09-07  5:58 ` [PATCH 3/8] asm-generic: add nommu implementations of __{get, put}_kernel_nofault Christoph Hellwig
2020-09-07  5:58 ` [PATCH 4/8] asm-generic: make the set_fs implementation optional Christoph Hellwig
2020-09-07  5:58 ` [PATCH 5/8] riscv: use memcpy based uaccess for nommu again Christoph Hellwig
2020-09-09  4:59   ` Palmer Dabbelt
2020-09-07  5:58 ` [PATCH 6/8] riscv: refactor __get_user and __put_user Christoph Hellwig
2020-09-09  4:59   ` Palmer Dabbelt
2020-09-07  5:58 ` [PATCH 7/8] riscv: implement __get_kernel_nofault and __put_user_nofault Christoph Hellwig
2020-09-09  4:59   ` Palmer Dabbelt
2020-09-07  5:58 ` [PATCH 8/8] riscv: remove address space overrides using set_fs() Christoph Hellwig
2020-09-09  4:59   ` Palmer Dabbelt
2020-09-09  4:59 ` remove set_fs for riscv v2 Palmer Dabbelt
2020-09-09  6:55   ` Christoph Hellwig
2020-09-09 20:38     ` Palmer Dabbelt
2020-09-22  4:37     ` Christoph Hellwig
2020-09-26 17:50       ` Palmer Dabbelt
2020-09-26 19:13         ` Arnd Bergmann
2020-10-04 17:27           ` Palmer Dabbelt
2020-09-28 12:49         ` Christoph Hellwig
2020-09-28 16:45           ` Palmer Dabbelt
2020-09-29 18:03             ` Christoph Hellwig
2020-09-26  6:58 ` Christoph Hellwig

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git