Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-26 Thread Al Viro
On Sun, Jul 26, 2020 at 08:11:32AM +0100, Christoph Hellwig wrote:
> On Fri, Jul 24, 2020 at 01:30:40PM +0100, Al Viro wrote:
> > > Sorry, I meant csum_and_copy_from_nocheck, just as in this patch.
> > > 
> > > Merging your branch into the net-next tree thus will conflict in
> > > the nios2 and asm-geneeric/checksum.h as well as lib/checksum.c.
> > 
> > Noted, but that asm-generic/checksum.h conflict will be "massage
> > in net-next/outright removal in this branch"; the same goes for
> > lib/checksum.c and nios2.  It's c6x that is unpleasant in that respect...
> 
> What about just rebasing your branch on the net-next tree?

For now I've just cherry-picked your commit in there.  net-next interaction
there is minimal; most of the PITA (and potential breakage) is in arch/*...


Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-26 Thread Christoph Hellwig
On Fri, Jul 24, 2020 at 01:30:40PM +0100, Al Viro wrote:
> > Sorry, I meant csum_and_copy_from_nocheck, just as in this patch.
> > 
> > Merging your branch into the net-next tree thus will conflict in
> > the nios2 and asm-geneeric/checksum.h as well as lib/checksum.c.
> 
> Noted, but that asm-generic/checksum.h conflict will be "massage
> in net-next/outright removal in this branch"; the same goes for
> lib/checksum.c and nios2.  It's c6x that is unpleasant in that respect...

What about just rebasing your branch on the net-next tree?


Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Al Viro
On Fri, Jul 24, 2020 at 01:23:37PM +0100, Christoph Hellwig wrote:
> On Fri, Jul 24, 2020 at 01:19:18PM +0100, Al Viro wrote:
> > > net-next has a patch from me killing off csum_and_copy_from_user
> > > already:
> > > 
> > > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f1bfd71c8662f20d53e71ef4e18bfb0e5677c27f
> > 
> > Nothing in that patch of yours touches csum_and_copy_from_user(). what
> > are you talking about?
> 
> Sorry, I meant csum_and_copy_from_nocheck, just as in this patch.
> 
> Merging your branch into the net-next tree thus will conflict in
> the nios2 and asm-geneeric/checksum.h as well as lib/checksum.c.

Noted, but that asm-generic/checksum.h conflict will be "massage
in net-next/outright removal in this branch"; the same goes for
lib/checksum.c and nios2.  It's c6x that is unpleasant in that respect...


Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Christoph Hellwig
On Fri, Jul 24, 2020 at 01:19:18PM +0100, Al Viro wrote:
> > net-next has a patch from me killing off csum_and_copy_from_user
> > already:
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f1bfd71c8662f20d53e71ef4e18bfb0e5677c27f
> 
> Nothing in that patch of yours touches csum_and_copy_from_user(). what
> are you talking about?

Sorry, I meant csum_and_copy_from_nocheck, just as in this patch.

Merging your branch into the net-next tree thus will conflict in
the nios2 and asm-geneeric/checksum.h as well as lib/checksum.c.


Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Al Viro
On Fri, Jul 24, 2020 at 07:41:17AM +0100, Christoph Hellwig wrote:
> On Fri, Jul 24, 2020 at 02:25:30AM +0100, Al Viro wrote:
> > From: Al Viro 
> > 
> > quite a few architectures have the same csum_partial_copy_nocheck() -
> > simply memcpy() the data and then return the csum of the copy.
> > 
> > hexagon, parisc, ia64, s390, um: explicitly spelled out that way.
> > 
> > arc, arm64, csky, h8300, m68k/nommu, microblaze, mips/GENERIC_CSUM, nds32,
> > nios2, openrisc, riscv, unicore32: end up picking the same thing spelled
> > out in lib/checksum.h (with varying amounts of perversions along the way).
> > 
> > everybody else (alpha, arm, c6x, m68k/mmu, mips/!GENERIC_CSUM, powerpc,
> > sh, sparc, x86, xtensa) have non-generic variants.  For all except c6x
> > the declaration is in their asm/checksum.h.  c6x uses the wrapper
> > from asm-generic/checksum.h that would normally lead to the lib/checksum.h
> > instance, but in case of c6x we end up using an asm function from arch/c6x
> > instead.
> > 
> > Screw that mess - have architectures with private instances define
> > _HAVE_ARCH_CSUM_AND_COPY in their asm/checksum.h and have the default
> > one right in net/checksum.h conditional on _HAVE_ARCH_CSUM_AND_COPY
> > *not* defined.
> 
> net-next has a patch from me killing off csum_and_copy_from_user
> already:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f1bfd71c8662f20d53e71ef4e18bfb0e5677c27f

Nothing in that patch of yours touches csum_and_copy_from_user(). what
are you talking about?


Re: [PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-24 Thread Christoph Hellwig
On Fri, Jul 24, 2020 at 02:25:30AM +0100, Al Viro wrote:
> From: Al Viro 
> 
> quite a few architectures have the same csum_partial_copy_nocheck() -
> simply memcpy() the data and then return the csum of the copy.
> 
> hexagon, parisc, ia64, s390, um: explicitly spelled out that way.
> 
> arc, arm64, csky, h8300, m68k/nommu, microblaze, mips/GENERIC_CSUM, nds32,
> nios2, openrisc, riscv, unicore32: end up picking the same thing spelled
> out in lib/checksum.h (with varying amounts of perversions along the way).
> 
> everybody else (alpha, arm, c6x, m68k/mmu, mips/!GENERIC_CSUM, powerpc,
> sh, sparc, x86, xtensa) have non-generic variants.  For all except c6x
> the declaration is in their asm/checksum.h.  c6x uses the wrapper
> from asm-generic/checksum.h that would normally lead to the lib/checksum.h
> instance, but in case of c6x we end up using an asm function from arch/c6x
> instead.
> 
> Screw that mess - have architectures with private instances define
> _HAVE_ARCH_CSUM_AND_COPY in their asm/checksum.h and have the default
> one right in net/checksum.h conditional on _HAVE_ARCH_CSUM_AND_COPY
> *not* defined.

net-next has a patch from me killing off csum_and_copy_from_user
already:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f1bfd71c8662f20d53e71ef4e18bfb0e5677c27f


[PATCH v2 04/20] unify generic instances of csum_partial_copy_nocheck()

2020-07-23 Thread Al Viro
From: Al Viro 

quite a few architectures have the same csum_partial_copy_nocheck() -
simply memcpy() the data and then return the csum of the copy.

hexagon, parisc, ia64, s390, um: explicitly spelled out that way.

arc, arm64, csky, h8300, m68k/nommu, microblaze, mips/GENERIC_CSUM, nds32,
nios2, openrisc, riscv, unicore32: end up picking the same thing spelled
out in lib/checksum.h (with varying amounts of perversions along the way).

everybody else (alpha, arm, c6x, m68k/mmu, mips/!GENERIC_CSUM, powerpc,
sh, sparc, x86, xtensa) have non-generic variants.  For all except c6x
the declaration is in their asm/checksum.h.  c6x uses the wrapper
from asm-generic/checksum.h that would normally lead to the lib/checksum.h
instance, but in case of c6x we end up using an asm function from arch/c6x
instead.

Screw that mess - have architectures with private instances define
_HAVE_ARCH_CSUM_AND_COPY in their asm/checksum.h and have the default
one right in net/checksum.h conditional on _HAVE_ARCH_CSUM_AND_COPY
*not* defined.

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/checksum.h   |  1 +
 arch/arm/include/asm/checksum.h |  1 +
 arch/c6x/include/asm/checksum.h |  6 ++
 arch/hexagon/include/asm/checksum.h | 11 ---
 arch/hexagon/lib/checksum.c | 11 ---
 arch/ia64/include/asm/checksum.h|  3 ---
 arch/ia64/lib/csum_partial_copy.c   | 15 ---
 arch/m68k/include/asm/checksum.h|  1 +
 arch/mips/include/asm/checksum.h|  2 +-
 arch/nios2/include/asm/checksum.h   |  5 -
 arch/parisc/include/asm/checksum.h  |  8 
 arch/parisc/lib/checksum.c  | 17 -
 arch/powerpc/include/asm/checksum.h |  1 +
 arch/s390/include/asm/checksum.h|  7 ---
 arch/sh/include/asm/checksum_32.h   |  1 +
 arch/sparc/include/asm/checksum.h   |  1 +
 arch/x86/include/asm/checksum.h |  1 +
 arch/x86/um/asm/checksum.h  | 16 
 arch/xtensa/include/asm/checksum.h  |  1 +
 include/asm-generic/checksum.h  | 14 --
 include/net/checksum.h  |  9 +
 lib/checksum.c  | 11 ---
 22 files changed, 24 insertions(+), 119 deletions(-)

diff --git a/arch/alpha/include/asm/checksum.h 
b/arch/alpha/include/asm/checksum.h
index 0eac81624d01..7e8e4fa4362d 100644
--- a/arch/alpha/include/asm/checksum.h
+++ b/arch/alpha/include/asm/checksum.h
@@ -42,6 +42,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum 
sum);
  * better 64-bit) boundary
  */
 #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
+#define _HAVE_ARCH_CSUM_AND_COPY
 __wsum csum_and_copy_from_user(const void __user *src, void *dst, int len, 
__wsum sum, int *errp);
 
 __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum 
sum);
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
index ed6073fee338..53f769508540 100644
--- a/arch/arm/include/asm/checksum.h
+++ b/arch/arm/include/asm/checksum.h
@@ -41,6 +41,7 @@ __wsum
 csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum 
sum, int *err_ptr);
 
 #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
+#define _HAVE_ARCH_CSUM_AND_COPY
 static inline
 __wsum csum_and_copy_from_user (const void __user *src, void *dst,
  int len, __wsum sum, int *err_ptr)
diff --git a/arch/c6x/include/asm/checksum.h b/arch/c6x/include/asm/checksum.h
index 36770b8308d9..facdd636af85 100644
--- a/arch/c6x/include/asm/checksum.h
+++ b/arch/c6x/include/asm/checksum.h
@@ -26,6 +26,12 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
 }
 #define csum_tcpudp_nofold csum_tcpudp_nofold
 
+extern __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum 
sum);
+
+#define _HAVE_ARCH_CSUM_AND_COPY
+#define csum_partial_copy_nocheck(src, dst, len, sum)  \
+   csum_partial_copy((src), (dst), (len), (sum))
+
 #include 
 
 #endif /* _ASM_C6X_CHECKSUM_H */
diff --git a/arch/hexagon/include/asm/checksum.h 
b/arch/hexagon/include/asm/checksum.h
index a5c42f4614c1..4bc6ad96c4c5 100644
--- a/arch/hexagon/include/asm/checksum.h
+++ b/arch/hexagon/include/asm/checksum.h
@@ -10,17 +10,6 @@
 unsigned int do_csum(const void *voidptr, int len);
 
 /*
- * the same as csum_partial, but copies from src while it
- * checksums
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- */
-#define csum_partial_copy_nocheck csum_partial_copy_nocheck
-__wsum csum_partial_copy_nocheck(const void *src, void *dst,
-   int len, __wsum sum);
-
-/*
  * computes the checksum of the TCP/UDP pseudo-header
  * returns a 16-bit checksum, already complemented
  */
diff --git a/arch/hexagon/lib/checksum.c b/arch/hexagon/lib/checksum.c
index c4a6b72d97de..ba50822a0800 100644
--- a/arch/hexagon/lib/checksum.c
+++ b/arch/hexagon/lib/checksum.c
@@ -176,14 +176,3 @@ unsigned int do_csum(const void *voidptr, int len)
 
return