Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752725AbdHIWwt (ORCPT ); Wed, 9 Aug 2017 18:52:49 -0400 Received: from mail-cys01nam02on0065.outbound.protection.outlook.com ([104.47.37.65]:30976 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752149AbdHIWwq (ORCPT ); Wed, 9 Aug 2017 18:52:46 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Date: Thu, 10 Aug 2017 01:52:31 +0300 From: Yury Norov To: Andrew Morton Cc: kbuild test robot , kbuild-all@01.org, Noam Camus , Rasmus Villemoes , Matthew Wilcox , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] lib: add test for bitmap_parselist() Message-ID: <20170809225231.ythrktk43gswfnjd@yury-thinkpad> References: <20170807225438.16161-2-ynorov@caviumnetworks.com> <201708091143.QqTgSaxI%fengguang.wu@intel.com> <20170809133309.746aafee5e22c9345debd671@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170809133309.746aafee5e22c9345debd671@linux-foundation.org> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [105.157.217.155] X-ClientProxiedBy: VI1P189CA0006.EURP189.PROD.OUTLOOK.COM (10.165.188.19) To DM3PR07MB2123.namprd07.prod.outlook.com (10.164.4.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2414aa8-71ed-41ce-56a6-08d4df7958ba X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM3PR07MB2123; X-Microsoft-Exchange-Diagnostics: 1;DM3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eaa7pokX0gu7QYtwGxbNbxij3nnHLlPE0rQUecvgtpkNXm2P2LMSIUNtxJDJPB0ivQlWROMdEMbkUX3/OxiIl1jFopNsjCFI8eCEQoeaUpZQQzzfluKeQ9+IhTZLKkBBxt607xnSUFofYzLmeRFI18pbfOzQEHkTzJw+sg+I+JzG3FIPc+TCqdbskoU/md/yWnC0932jRK/DOPxVyIJ3tyYPl7k5T7UZ61JJf1UwgEz04pkDWwRawrSWpJPIKvs7Y05wYRDEKucMEDzGZ/h3CRgNfNr+KvNqM+l9G4Rl2IIEvARDN4CfbJwevwc5Rp7NBL7HNL3UMEJ2X54JdM25A1loi4JCf+RWIfytufk/9e4HZUpUPUXZ43qw++V8ZjnUKJrXF987ECGf53eOO8pMGrvXX2N90rh+G9nlB7DzBSPsmSCodP9gb6ojePLMM9lzElSAgD9+KI= X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(100000703101)(100105400095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR07MB2123;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR07MB2123; X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2123;4:P4tTvqNREFVP1X+6Txi5ooiA22bRdqNvsf7FpSHCodOsjVHK5VqAzqcPWeC6k1yCSe6VV4tQ4P1make9hBNGL2VZsMT3gNzbKSzz3mw9/IzFA7L9+Rm/biXozqzigHaE7fxV0aHjU1zxwCDcLMQwjuIYOsxP7MrH8Mwwr7KR9dNmGcSe67Qo7XDnlGGv4VS6HHKUfLrSblQEbIUI2GnBA3fDViOhn6aTukTp7Pqdc5zpyJrlettcBlBXuDerhMnSmLYjYbuL0H5b5Zz01tsQSf1PJcSc5JlfJ026aZT4ODQAQQYtq1mc5BTR6/9QXbwl/tSmqOtBDPrZZH6wijqnPw== X-Forefront-PRVS: 0394259C80 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(979002)(6069001)(6009001)(39840400002)(39850400002)(39450400003)(39400400002)(39410400002)(199003)(189002)(24454002)(54356999)(76176999)(66066001)(189998001)(6116002)(2950100002)(6916009)(97736004)(3846002)(229853002)(305945005)(101416001)(6666003)(7736002)(6486002)(1076002)(42882006)(23726003)(575784001)(7350300001)(5660300001)(47776003)(2906002)(81166006)(81156014)(110136004)(5890100001)(6246003)(50986999)(478600001)(42186005)(38730400002)(53936002)(50466002)(8676002)(33716001)(4001350100001)(966005)(53546010)(8666007)(6496005)(72206003)(54906002)(6306002)(25786009)(9686003)(4326008)(68736007)(76506005)(105586002)(33646002)(83506001)(106356001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR07MB2123;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR07MB2123;23:khFOE36ndUqRnKHGHQwApfTic1kVXLZ+i+5FvEVF4?= =?us-ascii?Q?NHJVv65pHAT1k6udEMwrMwDP1ZQBsnNDJX8K2DyJGAQG4HuQSnKOvkWWGg8R?= =?us-ascii?Q?CSYB1y0vWG/6wjp1liAOH5dwscSClQQze47Zm+pXD4DPOfJh0rIhSw9AklzD?= =?us-ascii?Q?LAA+uWRUdHVc++6M4KdlQXeoGD6FGQNDThQHNwn7oe3wB9yvA71wuiGwrkH+?= =?us-ascii?Q?yWIATywtGmhkZnfIICrn3ejqg4nj3Hk88sD3LaGI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QPRt2Zn4tU4VB9x6S1JdWhp11/N9KPAXe04jYd0xCPiI/xwH8O/SJgpBbwjwqxgh5GGXhBcTAVewnhnDCWqeXGxacSzea47eD7kwlEJ57IbKS88qoQ==;24:85cUZMloOPkX596J+ssoqwbzVO1GLkbWs2VCXYHnHjyuVDUyp/6ZNoN6h5Dp6gozlTSm3WukyljJQN0Ah+jrh/4sonOvSECYYSQYHuWyvRE=;7:9tVhe3d5maGdW+lhAwGYl+hySE2oG6x18MWQVwHrGVUqTbOAysFbh9xY0ZppqTZazH7/I460/1/wUsfiSKIyIjtBvTL+abTvOySqL4CMsxw8NpS8/ECTNSR6uTWd7cZXsIPCOctzBF3OETA7EWDbkhhAXHqoyUmHpODqnBOz1n25yaIp29nJrH01E9Efmdzrz+BSw6VE8vrYr3m1Sf9FDBMeNXEfGubaQEZBaPFK+Co= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2017 22:52:43.1226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2123 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3750 Lines: 105 On Wed, Aug 09, 2017 at 01:33:09PM -0700, Andrew Morton wrote: > On Wed, 9 Aug 2017 11:28:56 +0800 kbuild test robot wrote: > > > [auto build test WARNING on linus/master] > > [also build test WARNING on v4.13-rc4 next-20170808] > > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > > > url: https://github.com/0day-ci/linux/commits/Yury-Norov/lib-make-bitmap_parselist-thread-safe-and-much-faster/20170809-105307 > > config: i386-randconfig-x000-201732 (attached as .config) > > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 > > reproduce: > > # save the attached .config to linux build tree > > make ARCH=i386 > > > > All warnings (new ones prefixed by >>): > > > > >> lib/test_bitmap.c:180:17: warning: large integer implicitly truncated to unsigned type [-Woverflow] > > 0xfffffffe, 0x3333333311111111, 0xffffffff77777777}; > > ^~~~~~~~~~~~~~~~~~ Ahh... I didn't take 32-bit arches into account... > I assume that a simple convertion to unsigned long long will fix that, > but I'll await Yuri's input (and testing). The conversion to unsigned long long will work only for little endian 32-bit arches. We trapped into it once: https://patchwork.kernel.org/patch/9260919+/ It should be the compile-time analogue of bitmap_from_u64() The patch is attached and seems working to me. But I need some time for testing... Yury >From be0e663b804daff0d0512e72cf94b5143270bd29 Mon Sep 17 00:00:00 2001 From: Yury Norov Date: Thu, 10 Aug 2017 01:25:46 +0300 Subject: [PATCH] bitmap: introduce BITMAP_FROM_U64() and use it in test for bitmap_parselist() The macro is the compile-time analogue of bitmap_from_u64() with the same purpose: convert the 64-bit number to the properly ordered pair of 32-bit parts to be suitable for filling the bitmap. Signed-off-by: Yury Norov --- include/linux/bitmap.h | 6 ++++++ lib/test_bitmap.c | 23 +++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 5797ca6fdfe2..bdc487e47de1 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -378,6 +378,12 @@ static inline void bitmap_from_u64(unsigned long *dst, u64 mask) dst[1] = mask >> 32; } +#if __BITS_PER_LONG == 64 +#define BITMAP_FROM_U64(n) (n) +#else +#define BITMAP_FROM_U64(n) ((n) & ULONG_MAX), ((unsigned long long) (n) >> 32) +#endif + #endif /* __ASSEMBLY__ */ #endif /* __LINUX_BITMAP_H */ diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index 5b80dd94e4d1..65b8fcc41fd0 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -175,10 +175,25 @@ struct test_bitmap_parselist{ const int flags; }; -static const unsigned long exp[] = {1, 2, 0x0000ffff, 0xffff0000, 0x55555555, - 0xaaaaaaaa, 0x11111111, 0x22222222, 0xffffffff, - 0xfffffffe, 0x3333333311111111, 0xffffffff77777777}; -static const unsigned long exp2[] = {0x3333333311111111, 0xffffffff77777777}; +static const unsigned long exp[] __initconst = { + BITMAP_FROM_U64(1), + BITMAP_FROM_U64(2), + BITMAP_FROM_U64(0x0000ffff), + BITMAP_FROM_U64(0xffff0000), + BITMAP_FROM_U64(0x55555555), + BITMAP_FROM_U64(0xaaaaaaaa), + BITMAP_FROM_U64(0x11111111), + BITMAP_FROM_U64(0x22222222), + BITMAP_FROM_U64(0xffffffff), + BITMAP_FROM_U64(0xfffffffe), + BITMAP_FROM_U64(0x3333333311111111), + BITMAP_FROM_U64(0xffffffff77777777) +}; + +static const unsigned long exp2[] __initconst = { + BITMAP_FROM_U64(0x3333333311111111), + BITMAP_FROM_U64(0xffffffff77777777) +}; static const struct test_bitmap_parselist parselist_tests[] __initconst = { {0, "0", &exp[0], 8, 0}, -- 2.11.0