Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp347887ybg; Wed, 3 Jun 2020 02:20:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxkJxCTBu6L9tyeeOEEzpHSf18kb6QfiXVF1iJMhIDDVOlsD5o0D0Nx4y1rsy/T6eH5i4V X-Received: by 2002:aa7:d1d9:: with SMTP id g25mr30725807edp.301.1591176023188; Wed, 03 Jun 2020 02:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591176023; cv=none; d=google.com; s=arc-20160816; b=QwItzhRowt2WP355zyDT5GYO6saYowKTKSlvfrzjRqMjQ177mhLAim+kOj4PwIiz27 zzPW2Mo2SSqaztDgOFCc6S9pE/U9sm2TPkmE7lYMz0m7bE4IlsjZydpvQ9aYPzOxnIPo 3qt4urEnjPFGZbnG5/rt0Hoss1K8dQcMWpe83mv6jPalVagh/GpGOyUqmfVH50QiaDKS GqIGUnvAW/L80ERUZqtEGrsTD8zoCthxFZnEzBhnKOAD+xrTiNAE92gAb5JdSjpXNi8Q 1ZO44ZnKHQx/pnCpsVBQfaiLjzVkO4ng5s0OSiEViH+uE4WTqPK8x5V3uNh++XYqovDL yAlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=0Hp47orGU9ZXDIPhx1olMXV/PUi0bDvlo74Rrevx/68=; b=Zsa20GYqg0oruCZ+khKrBoHuXPLLuSSaBi/XhNodx6nYNccGIN6dX9WhVZxtYhPwfT ZG/odU1MQhEvvQgn4/zXQ5O+SeXuWHG0uAHPIudTNEhJowQOyC8iLqtcgWqoat6HRR+e HKcQLbXCClVb9v4FiXItvJd2mpmHfXdPAsMuzmaWHBuc4GPybICb9m+do0a/tnp8E9wP CyNXKBHGHUqKzsFfMbKHvwSNkOcJrHnz60uO0jl1ZivKLWxE+Mxua1PAdFVu633ESmxl 9NTN0/lRbjBqROVb6tiTAH8LgIOojnVtN5srRElO+0ZRDdbnSHHOKWOjeu2vzgPmLcoJ /5Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si813743edf.484.2020.06.03.02.19.58; Wed, 03 Jun 2020 02:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726569AbgFCJSC (ORCPT + 99 others); Wed, 3 Jun 2020 05:18:02 -0400 Received: from mga02.intel.com ([134.134.136.20]:44651 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbgFCJSB (ORCPT ); Wed, 3 Jun 2020 05:18:01 -0400 IronPort-SDR: VNF3EFgQRKIPfkDwrbR0n3HJIuN1o2IfhURCP6bII/+GL5Z/fmM2xTTaNdXiw/vhu90nL/ascx unZQJTsoZiEA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 02:18:00 -0700 IronPort-SDR: lcV0hIJtkR4mv0VBdYlE+o3u2RojrAHcL55zTPoXsiBstjpzJxUiksp7xvLjh/8A2ZqUF1s/R+ I33+2Prd+WiQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,467,1583222400"; d="scan'208";a="471064857" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga005.fm.intel.com with ESMTP; 03 Jun 2020 02:17:58 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jgPX8-00Aaqv-1X; Wed, 03 Jun 2020 12:18:02 +0300 Date: Wed, 3 Jun 2020 12:18:02 +0300 From: Andy Shevchenko To: Wei Yang Cc: akpm@linux-foundation.org, christian.brauner@ubuntu.com, linux-kernel@vger.kernel.org Subject: Re: [Patch v2] lib: test get_count_order/long in test_bitops.c Message-ID: <20200603091802.GN2428291@smile.fi.intel.com> References: <20200602223728.32722-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200602223728.32722-1-richard.weiyang@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 02, 2020 at 10:37:28PM +0000, Wei Yang wrote: > Add some test for get_count_order/long in test_bitops.c. Thanks! LGTM, Reviewed-by: Andy Shevchenko Note, we can have as many MODULE_AUTHOR() lines as we want. > Signed-off-by: Wei Yang > > --- > v2: merge the test into test_bitops.c > --- > lib/Kconfig.debug | 10 +++++----- > lib/test_bitops.c | 40 ++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 43 insertions(+), 7 deletions(-) > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index f80d5609798f..512111a72e34 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -1987,15 +1987,15 @@ config TEST_LKM > If unsure, say N. > > config TEST_BITOPS > - tristate "Test module for compilation of clear_bit/set_bit operations" > + tristate "Test module for compilation of bitops operations" > depends on m > help > This builds the "test_bitops" module that is much like the > TEST_LKM module except that it does a basic exercise of the > - clear_bit and set_bit macros to make sure there are no compiler > - warnings from C=1 sparse checker or -Wextra compilations. It has > - no dependencies and doesn't run or load unless explicitly requested > - by name. for example: modprobe test_bitops. > + set/clear_bit macros and get_count_order/long to make sure there are > + no compiler warnings from C=1 sparse checker or -Wextra > + compilations. It has no dependencies and doesn't run or load unless > + explicitly requested by name. for example: modprobe test_bitops. > > If unsure, say N. > > diff --git a/lib/test_bitops.c b/lib/test_bitops.c > index fd50b3ae4a14..702d5973a5b6 100644 > --- a/lib/test_bitops.c > +++ b/lib/test_bitops.c > @@ -9,7 +9,11 @@ > #include > #include > > -/* a tiny module only meant to test set/clear_bit */ > +/* a tiny module only meant to test > + * > + * set/clear_bit > + * get_count_order/long > + */ > > /* use an enum because thats the most common BITMAP usage */ > enum bitops_fun { > @@ -24,6 +28,26 @@ enum bitops_fun { > > static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH); > > +unsigned int order_comb[][2] = { > + {0x00000003, 2}, > + {0x00000004, 2}, > + {0x00001fff, 13}, > + {0x00002000, 13}, > + {0x50000000, 31}, > + {0x80000000, 31}, > + {0x80003000, 32}, > +}; > + > +unsigned long order_comb_long[][2] = { > + {0x0000000300000000, 34}, > + {0x0000000400000000, 34}, > + {0x00001fff00000000, 45}, > + {0x0000200000000000, 45}, > + {0x5000000000000000, 63}, > + {0x8000000000000000, 63}, > + {0x8000300000000000, 64}, > +}; > + > static int __init test_bitops_startup(void) > { > pr_warn("Loaded test module\n"); > @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void) > set_bit(BITOPS_11, g_bitmap); > set_bit(BITOPS_31, g_bitmap); > set_bit(BITOPS_88, g_bitmap); > + > + for (i = 0; i < ARRAY_SIZE(order_comb); i++) { > + if (order_comb[i][1] != get_count_order(order_comb[i][0])) > + pr_warn("get_count_order wrong for %x\n", > + order_comb[i][0]); } > + > + for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) { > + if (order_comb_long[i][1] != > + get_count_order_long(order_comb_long[i][0])) > + pr_warn("get_count_order_long wrong for %lx\n", > + order_comb_long[i][0]); } > + > return 0; > } > > @@ -55,6 +91,6 @@ static void __exit test_bitops_unstartup(void) > module_init(test_bitops_startup); > module_exit(test_bitops_unstartup); > > -MODULE_AUTHOR("Jesse Brandeburg "); > +MODULE_AUTHOR("Jesse Brandeburg , Wei Yang "); > MODULE_LICENSE("GPL"); > MODULE_DESCRIPTION("Bit testing module"); > -- > 2.23.0 > -- With Best Regards, Andy Shevchenko