diff options
author | Coly Li <colyli@suse.de> | 2018-07-17 14:39:20 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2018-07-17 14:39:20 +0800 |
commit | f755cfbf3c7446b643f5dfa2200edf17a9e1aa75 (patch) | |
tree | 9f9f509db274fd4eb0f4636dba96320cdf8f9ef9 | |
parent | 06e93482db0f8a282140e9df952330fe950dbaad (diff) | |
download | bcache-patches-f755cfbf3c7446b643f5dfa2200edf17a9e1aa75.tar.gz |
for-test: update crc codes
5 files changed, 30 insertions, 28 deletions
diff --git a/for-test/libcrc64/0000-cover-letter.patch b/for-test/libcrc64/0000-cover-letter.patch index c2aba24..af12f3a 100644 --- a/for-test/libcrc64/0000-cover-letter.patch +++ b/for-test/libcrc64/0000-cover-letter.patch @@ -22,6 +22,7 @@ Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Michael Lyle <mlyle@lyle.org> Cc: Kent Overstreet <kent.overstreet@gmail.com> +Cc: Kate Stewart <kstewart@linuxfoundation.org> --- Andy Shevchenko (1): lib/crc64: add crc64 option to lib/Kconfig diff --git a/for-test/libcrc64/0001-lib-crc64-add-crc64-option-to-lib-Kconfig.patch b/for-test/libcrc64/0001-lib-crc64-add-crc64-option-to-lib-Kconfig.patch index 3eff1bb..1207bee 100644 --- a/for-test/libcrc64/0001-lib-crc64-add-crc64-option-to-lib-Kconfig.patch +++ b/for-test/libcrc64/0001-lib-crc64-add-crc64-option-to-lib-Kconfig.patch @@ -1,4 +1,4 @@ -From 3940d3fc4dbed6e5b56549bb02bdab5a9e8c1a12 Mon Sep 17 00:00:00 2001 +From 1623688f9edd81e6df67962efc0d72b5554dc3eb Mon Sep 17 00:00:00 2001 From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Date: Wed, 23 May 2018 13:23:32 +0800 Subject: [PATCH 1/4] lib/crc64: add crc64 option to lib/Kconfig @@ -13,12 +13,13 @@ Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> +Cc: Kate Stewart <kstewart@linuxfoundation.org> --- lib/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Kconfig b/lib/Kconfig -index 706836ec314d..4059df9ec4c7 100644 +index 706836ec314d..9c10b9852563 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -170,6 +170,14 @@ config CRC32_BIT @@ -31,7 +32,7 @@ index 706836ec314d..4059df9ec4c7 100644 + This option is provided for the case where no in-kernel-tree + modules require CRC64 functions, but a module built outside + the kernel tree does. Such modules that use library CRC64 -+ functions require M he ++ functions require M here. + config CRC4 tristate "CRC4 functions" diff --git a/for-test/libcrc64/0002-lib-add-crc64-calculation-routines.patch b/for-test/libcrc64/0002-lib-add-crc64-calculation-routines.patch index 0627c1d..82a8c37 100644 --- a/for-test/libcrc64/0002-lib-add-crc64-calculation-routines.patch +++ b/for-test/libcrc64/0002-lib-add-crc64-calculation-routines.patch @@ -1,4 +1,4 @@ -From 5703a85f7485b9e838a59ddf2a5039e126349d80 Mon Sep 17 00:00:00 2001 +From ac19e8574ac8d4b455b60d5d3f537dab74f21dd6 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 28 Jun 2018 11:19:24 +0800 Subject: [PATCH 2/4] lib: add crc64 calculation routines @@ -28,6 +28,7 @@ Cc: Kent Overstreet <kent.overstreet@gmail.com> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> +Cc: Kate Stewart <kstewart@linuxfoundation.org> --- include/linux/crc64.h | 15 +++++++++ lib/.gitignore | 2 ++ @@ -111,7 +112,7 @@ index 90dc5520b784..40c215181687 100644 # diff --git a/lib/crc64.c b/lib/crc64.c new file mode 100644 -index 000000000000..03f078303bd3 +index 000000000000..6341de4c7ab4 --- /dev/null +++ b/lib/crc64.c @@ -0,0 +1,71 @@ @@ -168,7 +169,7 @@ index 000000000000..03f078303bd3 + +__le64 crc64_le(const void *p, size_t len) +{ -+ __le64 crc = 0x0000000000000000ULL; ++ __le64 crc = 0x0ULL; + + crc = crc64_le_update(crc, p, len); + diff --git a/for-test/libcrc64/0003-bcache-use-routines-from-lib-crc64.c-for-CRC64-calcu.patch b/for-test/libcrc64/0003-bcache-use-routines-from-lib-crc64.c-for-CRC64-calcu.patch index 9f47a42..84d61cd 100644 --- a/for-test/libcrc64/0003-bcache-use-routines-from-lib-crc64.c-for-CRC64-calcu.patch +++ b/for-test/libcrc64/0003-bcache-use-routines-from-lib-crc64.c-for-CRC64-calcu.patch @@ -1,4 +1,4 @@ -From 59c2c6880468298a681fadddee1c06c397c0d10a Mon Sep 17 00:00:00 2001 +From be65fdc0601a876f30d09372d044c3d4870f9335 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 23 May 2018 16:02:35 +0800 Subject: [PATCH 3/4] bcache: use routines from lib/crc64.c for CRC64 @@ -14,6 +14,7 @@ Cc: Michael Lyle <mlyle@lyle.org> Cc: Kent Overstreet <kent.overstreet@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> +Cc: Kate Stewart <kstewart@linuxfoundation.org> --- drivers/md/bcache/Kconfig | 1 + drivers/md/bcache/bcache.h | 7 +- diff --git a/for-test/libcrc64/0004-lib-test_crc-Add-test-cases-for-crc-calculation.patch b/for-test/libcrc64/0004-lib-test_crc-Add-test-cases-for-crc-calculation.patch index f2b4e50..da88f3a 100644 --- a/for-test/libcrc64/0004-lib-test_crc-Add-test-cases-for-crc-calculation.patch +++ b/for-test/libcrc64/0004-lib-test_crc-Add-test-cases-for-crc-calculation.patch @@ -1,4 +1,4 @@ -From a40200bea47aae92003f23d27d4265ed438e8b86 Mon Sep 17 00:00:00 2001 +From 4a53393e3e450316f278b19784358d2138630e91 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 6 Jun 2018 21:20:46 +0800 Subject: [PATCH 4/4] lib/test_crc: Add test cases for crc calculation @@ -16,7 +16,7 @@ kernel 0day system has framework to check kernel message, then the above result can be handled by 0day system. If crc calculation inconsistency happens, it can be detected quite soon. -lib/test_crc.c can is a testing frame work for all crc consistency +lib/test_crc.c is a testing frame work for many crc consistency testings. For now, there are only test caes for 3 crc routines, - crc64_le() - crc64_le_bch() @@ -27,15 +27,16 @@ Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> +Cc: Kate Stewart <kstewart@linuxfoundation.org> --- lib/Kconfig.debug | 11 ++++ lib/Makefile | 1 + - lib/test_crc.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 148 insertions(+) + lib/test_crc.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 145 insertions(+) create mode 100644 lib/test_crc.c diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 8838d1158d19..c7deb4e2e4eb 100644 +index 8838d1158d19..de7bddd23c30 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1911,6 +1911,17 @@ config TEST_SYSCTL @@ -44,8 +45,8 @@ index 8838d1158d19..c7deb4e2e4eb 100644 +config TEST_CRC + tristate "CRC calculation test driver" -+ default n + depends on CRC64 ++ default n + help + This builds the "test_crc" module. This driver enables to test the + CRC calculation consistency to make sure new modification does not @@ -70,10 +71,10 @@ index 40c215181687..224d047d026a 100644 CFLAGS_test_kasan.o += -fno-builtin diff --git a/lib/test_crc.c b/lib/test_crc.c new file mode 100644 -index 000000000000..3a9442252de5 +index 000000000000..3a793005b813 --- /dev/null +++ b/lib/test_crc.c -@@ -0,0 +1,136 @@ +@@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * CRC test driver @@ -81,7 +82,7 @@ index 000000000000..3a9442252de5 + * Copyright (C) 2018 Coly Li <colyli@suse.de> + * + * This module provides an simple framework to check the consistency of -+ * Linux kernel crc calculation routines in lib/crc*.c. This driver ++ * Linux kernel CRC calculation routines in lib/crc*.c. This driver + * requires CONFIG_CRC* items to be enabled if the associated routines are + * tested here. The test results will be printed to kernel message + * when this test driver is loaded. @@ -93,21 +94,19 @@ index 000000000000..3a9442252de5 + * + */ + -+#include <linux/init.h> ++#include <linux/async.h> ++#include <linux/delay.h> ++#include <linux/fs.h> +#include <linux/list.h> +#include <linux/module.h> +#include <linux/printk.h> -+#include <linux/fs.h> +#include <linux/miscdevice.h> +#include <linux/slab.h> +#include <linux/uaccess.h> -+#include <linux/async.h> -+#include <linux/delay.h> +#include <linux/vmalloc.h> +#include <linux/crc64.h> + +struct crc_test_record { -+ + char *name; + __le64 data[4]; + __le64 initval; @@ -120,10 +119,10 @@ index 000000000000..3a9442252de5 + int ret = 0; + + if (crc == expval) { -+ pr_info("test_crc: %s: PASSED:(0x%016llx, expval 0x%016llx)", ++ pr_info("test_crc: %s: PASSED:(0x%016llx, expected 0x%016llx)", + name, crc, expval); + } else { -+ pr_err("test_crc: %s: FAILED:(0x%016llx, expval 0x%016llx)", ++ pr_err("test_crc: %s: FAILED:(0x%016llx, expected 0x%016llx)", + name, crc, expval); + ret = -EINVAL; + } @@ -131,14 +130,13 @@ index 000000000000..3a9442252de5 + return ret; +} + -+/* Add your crc test caese here */ ++/* Add your crc test cases here */ +static int test_crc64_le(struct crc_test_record *rec) +{ + __le64 crc; + + crc = crc64_le(rec->data, sizeof(rec->data)); + return chk_and_msg(rec->name, crc, rec->expval); -+ +} + +static int test_crc64_le_bch(struct crc_test_record *rec) @@ -184,7 +182,7 @@ index 000000000000..3a9442252de5 + .expval = 0xb2c863673f4292bf, + .handler = test_crc64_le_update, + }, -+ { .name = NULL, } ++ {} +}; + + @@ -193,7 +191,7 @@ index 000000000000..3a9442252de5 + int i; + int v, ret = 0; + -+ pr_info("Kernel crc consitency testing:"); ++ pr_info("Kernel CRC consitency testing:"); + for (i = 0; test_data[i].name; i++) { + v = test_data[i].handler(&test_data[i]); + if (v < 0 && ret == 0) @@ -209,7 +207,7 @@ index 000000000000..3a9442252de5 + +MODULE_DESCRIPTION("CRC consistency testing driver"); +MODULE_AUTHOR("Coly Li <colyli@suse.de>"); -+MODULE_LICENSE("GPL"); ++MODULE_LICENSE("GPL v2"); -- 2.17.1 |