All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] crc/csum follow-ups
@ 2013-11-04 16:10 Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 1/3] net: checksum: fix warning in skb_checksum Daniel Borkmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel Borkmann @ 2013-11-04 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, fengguang.wu

Daniel Borkmann (3):
  net: checksum: fix warning in skb_checksum
  lib: crc32: conditionally resched when running testcases
  lib: crc32: reduce number of tests for crc32{,c}_combine

 include/net/checksum.h | 5 +++++
 lib/crc32.c            | 7 +++++--
 net/core/skbuff.c      | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

-- 
1.8.3.1

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

* [PATCH net-next 1/3] net: checksum: fix warning in skb_checksum
  2013-11-04 16:10 [PATCH net-next 0/3] crc/csum follow-ups Daniel Borkmann
@ 2013-11-04 16:10 ` Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 2/3] lib: crc32: conditionally resched when running testcases Daniel Borkmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2013-11-04 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, fengguang.wu

This patch fixes a build warning in skb_checksum() by wrapping the
csum_partial() usage in skb_checksum(). The problem is that on a few
architectures, csum_partial is used with prefix asmlinkage whereas
on most architectures it's not. So fix this up generically as we did
with csum_block_add_ext() to match the signature. Introduced by
2817a336d4d ("net: skb_checksum: allow custom update/combine for
walking skb").

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 Only net-next affected, nothing else.

 include/net/checksum.h | 5 +++++
 net/core/skbuff.c      | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/net/checksum.h b/include/net/checksum.h
index 15f33fd..37a0e24 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -98,6 +98,11 @@ static inline __wsum csum_unfold(__sum16 n)
 	return (__force __wsum)n;
 }
 
+static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
+{
+	return csum_partial(buff, len, sum);
+}
+
 #define CSUM_MANGLED_0 ((__force __sum16)0xffff)
 
 static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 31aab53..e411559 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2003,7 +2003,7 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset,
 		    int len, __wsum csum)
 {
 	const struct skb_checksum_ops ops = {
-		.update  = csum_partial,
+		.update  = csum_partial_ext,
 		.combine = csum_block_add_ext,
 	};
 
-- 
1.8.3.1

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

* [PATCH net-next 2/3] lib: crc32: conditionally resched when running testcases
  2013-11-04 16:10 [PATCH net-next 0/3] crc/csum follow-ups Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 1/3] net: checksum: fix warning in skb_checksum Daniel Borkmann
@ 2013-11-04 16:10 ` Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 3/3] lib: crc32: reduce number of cases for crc32{,c}_combine Daniel Borkmann
  2013-11-04 20:27 ` [PATCH net-next 0/3] crc/csum follow-ups David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2013-11-04 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, fengguang.wu

Fengguang reports that when crc32 selftests are running on startup, on
some e.g. 32bit systems, we can get a CPU stall like "INFO: rcu_sched
self-detected stall on CPU { 0} (t=2101 jiffies g=4294967081 c=4294967080
q=41)". As this is not intended, add a cond_resched() at the end of a
test case to fix it. Introduced by efba721f63 ("lib: crc32: add test cases
for crc32{, c}_combine routines").

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 lib/crc32.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/crc32.c b/lib/crc32.c
index 69dd124..3a1dfa8 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -29,6 +29,7 @@
 #include <linux/crc32.h>
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/sched.h>
 #include "crc32defs.h"
 
 #if CRC_LE_BITS > 8
@@ -1054,6 +1055,7 @@ static int __init crc32c_combine_test(void)
 			      crc_full == test[i].crc32c_le))
 				errors++;
 			runs++;
+			cond_resched();
 		}
 	}
 
@@ -1147,6 +1149,7 @@ static int __init crc32_combine_test(void)
 			      crc_full == test[i].crc_le))
 				errors++;
 			runs++;
+			cond_resched();
 		}
 	}
 
-- 
1.8.3.1

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

* [PATCH net-next 3/3] lib: crc32: reduce number of cases for crc32{,c}_combine
  2013-11-04 16:10 [PATCH net-next 0/3] crc/csum follow-ups Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 1/3] net: checksum: fix warning in skb_checksum Daniel Borkmann
  2013-11-04 16:10 ` [PATCH net-next 2/3] lib: crc32: conditionally resched when running testcases Daniel Borkmann
@ 2013-11-04 16:10 ` Daniel Borkmann
  2013-11-04 20:27 ` [PATCH net-next 0/3] crc/csum follow-ups David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2013-11-04 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, fengguang.wu

We can safely reduce the number of test cases by a tenth.
There is no particular need to run as many as we're running
now for crc32{,c}_combine, that gives us still ~8000 tests
we're doing if people run kernels with crc selftests enabled
which is perfectly fine.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 lib/crc32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index 3a1dfa8..70f00ca 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -1037,7 +1037,7 @@ static int __init crc32c_combine_test(void)
 	int i, j;
 	int errors = 0, runs = 0;
 
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < 10; i++) {
 		u32 crc_full;
 
 		crc_full = __crc32c_le(test[i].crc, test_buf + test[i].start,
@@ -1131,7 +1131,7 @@ static int __init crc32_combine_test(void)
 	int i, j;
 	int errors = 0, runs = 0;
 
-	for (i = 0; i < 100; i++) {
+	for (i = 0; i < 10; i++) {
 		u32 crc_full;
 
 		crc_full = crc32_le(test[i].crc, test_buf + test[i].start,
-- 
1.8.3.1

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

* Re: [PATCH net-next 0/3] crc/csum follow-ups
  2013-11-04 16:10 [PATCH net-next 0/3] crc/csum follow-ups Daniel Borkmann
                   ` (2 preceding siblings ...)
  2013-11-04 16:10 ` [PATCH net-next 3/3] lib: crc32: reduce number of cases for crc32{,c}_combine Daniel Borkmann
@ 2013-11-04 20:27 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-11-04 20:27 UTC (permalink / raw)
  To: dborkman; +Cc: netdev, fengguang.wu

From: Daniel Borkmann <dborkman@redhat.com>
Date: Mon,  4 Nov 2013 17:10:24 +0100

> Daniel Borkmann (3):
>   net: checksum: fix warning in skb_checksum
>   lib: crc32: conditionally resched when running testcases
>   lib: crc32: reduce number of tests for crc32{,c}_combine

Series applied, thanks for responding to this so quickly Daniel.

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

end of thread, other threads:[~2013-11-04 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 16:10 [PATCH net-next 0/3] crc/csum follow-ups Daniel Borkmann
2013-11-04 16:10 ` [PATCH net-next 1/3] net: checksum: fix warning in skb_checksum Daniel Borkmann
2013-11-04 16:10 ` [PATCH net-next 2/3] lib: crc32: conditionally resched when running testcases Daniel Borkmann
2013-11-04 16:10 ` [PATCH net-next 3/3] lib: crc32: reduce number of cases for crc32{,c}_combine Daniel Borkmann
2013-11-04 20:27 ` [PATCH net-next 0/3] crc/csum follow-ups David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.