Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp505236ybg; Wed, 3 Jun 2020 06:32:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo9myM4rvbNgxgOHSk7+AQ4oiPp4UYWrgQwlVzlDK1+r5z8z6ZKx3GSdfHXsm3A07cWNqn X-Received: by 2002:aa7:d492:: with SMTP id b18mr6380484edr.339.1591191162300; Wed, 03 Jun 2020 06:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591191162; cv=none; d=google.com; s=arc-20160816; b=UVCpA0GRkRGr30xvGYBlbVS1vtF2L46rXggVitsWO+crmhVxmpHZY/onZb/fxJvORs aAHmDJMKr7wHVAa3MkfAsKBk9KLkiDsdT8+YsHzLx5amowuINfi+R7JPW4q6MrAW5mCz AUtR/Ij2BgLqbVICyHKqQNwiI6S5xaICsh6WgpXPFXtPNg2E19FCIKHTuTsWfQJb6bky laWaid3UndRpwQ7Mwa7i+TU0rqroo4G2JatCKgt+nliJZEg3i+iW76JZP3RiAR8JsvSY Sy2/B4tItj5F/hiBXnCQp7As5sQ/3PZ6Z+iBfDVusITQdIhi1Im8RDfA0dhsNXeu4ywy fpKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=MrO7sCuvFyHZzOxK1ts6WQ6CYsJDG8B8zQZ1TEMOj6M=; b=uDYs/yhlvqG/F5VLiMMz0hXMcL7hTvY4cKyeTmFFZTe7LVCowciXsG+moTLD07x8KV DMHs291mZ8jS50O7CYy4BT5OaL5qlyNj+jqk3nzAgGNndQ/NsSlFjGCCt6Qz/beYXgJX Gfp5Iqg/qWvlfMxEjC/7Od3r2CGAcXDUIj1PbjqhiiXj9uMtRayY2iim4DPeqF34HeTq bojtEnklsDVlkZCsEskJylOl4ulxkdGI3CKjMksMYdNkTi48NA4j+Ps7NEzIsaA4ewDM JLdgnj9sF+rJNinM8r9o8QPqWjFgcRf/+RPBymVVaxMCe/KAcCbiz70YB8lcI5pX4Ofl g+VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LQvztgNb; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si1286814edn.602.2020.06.03.06.32.19; Wed, 03 Jun 2020 06:32:42 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LQvztgNb; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725930AbgFCN3s (ORCPT + 99 others); Wed, 3 Jun 2020 09:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgFCN3r (ORCPT ); Wed, 3 Jun 2020 09:29:47 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B8FEC08C5C0 for ; Wed, 3 Jun 2020 06:29:46 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id a2so2146451ejb.10 for ; Wed, 03 Jun 2020 06:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MrO7sCuvFyHZzOxK1ts6WQ6CYsJDG8B8zQZ1TEMOj6M=; b=LQvztgNbZi/5Bd+RPl4q+1MBA5O5ivjuMN3AA+e98ZZwdY+YxjnIemhInYS8JfJ67s 15ZOjJdypvDQ+97RShyx+Upl6t84hq8kQKiWN4lSK+JY+fmSDWPheOgC5mp8kNbWwcZl efQt23wChX7w+eBtWhQjBM6QIDHTae2IBV4kDMKt9fB7l9EvVoU9LFRYwEbNdP6xd31F BkC1zLx3TFoniCaI1t/aYO2x0QMad/TyqHGB2Jqj+quDU1sOHbqkSPhqrBXe2KJfABPA fgDosPAWfAaq7MPY7Tul9LW0NSjoqLcfOetKc/PbGLZIpJEfShMgn1SpyN0lbuwHo4ku F8lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=MrO7sCuvFyHZzOxK1ts6WQ6CYsJDG8B8zQZ1TEMOj6M=; b=IeWSKK9xzfBgUiMsdM4XTkNOd5FLhwk/yKD1BLYqCI4dbNJ5mmE5RBMzXq1TLTNDHH V7S2diSNkZOD6MT/8on0ynNNNJIDhIPxWRQyVfvf1za4H1Q+tsQQyq95LwbIP9awCl3t M6JW5ZAG38t0+fG0tB9bqWHkhFMFgvF5hrYduGmSbMzThrlXn8rsIfWwztGDsHJmMlP1 ydBFXDcZf3uvunUG67A8PvMCuaHhkASTbV+J5+QhCuYiyuGRjQttKFQzCC6IyesDR35D hFffIhaSkDNi78wGAAb+jqar6+SiBtIEUZmMDOawoab7nFG+woAxJRYUkI8IIYWwS8g1 XAqA== X-Gm-Message-State: AOAM531k2qjxHl4XZx3b7cJe9f/722h8Pw7gNyT8Eb98bXaoXrJurM03 p57NAAvQTycIhnjHuoXrxpM= X-Received: by 2002:a17:906:ecef:: with SMTP id qt15mr12427740ejb.91.1591190984750; Wed, 03 Jun 2020 06:29:44 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id j11sm1116444ejf.53.2020.06.03.06.29.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Jun 2020 06:29:43 -0700 (PDT) Date: Wed, 3 Jun 2020 13:29:43 +0000 From: Wei Yang To: Andy Shevchenko Cc: Wei Yang , 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: <20200603132943.7e2wz6cyzyejtgrm@master> Reply-To: Wei Yang References: <20200602223728.32722-1-richard.weiyang@gmail.com> <20200603091802.GN2428291@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200603091802.GN2428291@smile.fi.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 03, 2020 at 12:18:02PM +0300, Andy Shevchenko wrote: >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. > Ah, got it. >> 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 > -- Wei Yang Help you, Help me