linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-bcache@vger.kernel.org, linux-block@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kate Stewart <kstewart@linuxfoundation.org>
Subject: Re: [PATCH v2 3/3] lib/test_crc: Add test cases for crc calculation
Date: Tue, 17 Jul 2018 22:21:17 +0800	[thread overview]
Message-ID: <c5f4089e-2794-8f11-7b04-5993fbcad25b@suse.de> (raw)
In-Reply-To: <CAHp75Vfe34n31UAxyqdX63hP7kCYWHo-_LEWx2KLsiW5F9xEEQ@mail.gmail.com>

On 2018/7/17 3:32 PM, Andy Shevchenko wrote:
> On Tue, Jul 17, 2018 at 9:57 AM, Coly Li <colyli@suse.de> wrote:
>> This patch adds a kernel module to test the consistency of multiple crc
>> calculation in Linux kernel. It is enabled with CONFIG_TEST_CRC enabled.
>>
>> The test results are printed into kernel message, which look like,
>>
>> test_crc: crc64_le: PASSED (0x4e6b1ff972fa8c55, expval 0x4e6b1ff972fa8c55)
>> test_crc: crc64_le_bch: PASSED (0x0e4f1391d7a4a62e, expval 0x0e4f1391d7a4a62e)
>> test_crc: crc64_le_update: FAILED (0x03d4d0d85685d9a1, expval 0x3d4d0d85685d9a1f)
>>
>> 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 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()
>> - crc64_le_update()
> 
>> +config TEST_CRC
>> +       tristate "CRC calculation test driver"
>> +       depends on CRC64
> 
>> +       default n
> 
> Please, remove it.
> You Cc'ed the guy who did this:
> http://git.infradead.org/linux-platform-drivers-x86.git/commit/0192f17529fa3f8d78ca0181a2b2aaa7cbb0784d
> 

Sure, this line is removed in v3 series.

>> +       help
>> +         This builds the "test_crc" module. This driver enables to test the
>> +         CRC calculation consistency to make sure new modification does not
>> +         break existing checksum calculation.
> 
>> +static int chk_and_msg(const char *name, __le64 crc, __le64 expval)
>> +{
>> +       int ret = 0;
>> +
>> +       if (crc == expval) {
>> +               pr_info("test_crc: %s: PASSED:(0x%016llx, expected 0x%016llx)",
>> +                       name, crc, expval);
>> +       } else {
>> +               pr_err("test_crc: %s: FAILED:(0x%016llx, expected 0x%016llx)",
>> +                       name, crc, expval);
>> +               ret = -EINVAL;
>> +       }
>> +
>> +       return ret;
>> +}
> 
>> +
>> +
> 
> One of the blank lines is redundant.
> 

removed.

>> +static int __init test_crc_init(void)
>> +{
>> +       int i;
>> +       int v, ret = 0;
>> +
>> +       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)
>> +                       ret = -EINVAL;
>> +       }
>> +
>> +       return ret;
>> +}
> 
> Didn't notice anything about statistics.
> 
> See, for example,
> https://elixir.bootlin.com/linux/v4.18-rc5/source/lib/test_printf.c#L536
> 

The code is added into v3 series.

Thanks for your review :-)

Coly Li

      reply	other threads:[~2018-07-17 14:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  6:57 [PATCH 0/4] add crc64 calculation as kernel library Coly Li
2018-07-17  6:57 ` [PATCH v2 1/3] lib: add crc64 calculation routines Coly Li
2018-07-17  9:57   ` Andy Shevchenko
2018-07-17 14:19     ` Coly Li
2018-07-17 16:27   ` kbuild test robot
2018-07-17  6:57 ` [PATCH v2 2/3] bcache: use routines from lib/crc64.c for CRC64 calculation Coly Li
2018-07-17  6:57 ` [PATCH v2 3/3] lib/test_crc: Add test cases for crc calculation Coly Li
2018-07-17  7:32   ` Andy Shevchenko
2018-07-17 14:21     ` Coly Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5f4089e-2794-8f11-7b04-5993fbcad25b@suse.de \
    --to=colyli@suse.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).