From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [RFC PATCH 2/2] sbitmap: Spread sbitmap word allocation over NUMA nodes
Date: Wed, 11 May 2022 16:54:04 +0800 [thread overview]
Message-ID: <202205111616.bVssFWeh-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 20820 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <1652181274-136198-3-git-send-email-john.garry@huawei.com>
References: <1652181274-136198-3-git-send-email-john.garry@huawei.com>
TO: John Garry <john.garry@huawei.com>
Hi John,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on linux/master linus/master v5.18-rc6 next-20220510]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/John-Garry/sbitmap-NUMA-node-spreading/20220510-192122
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: i386-randconfig-c001-20220509 (https://download.01.org/0day-ci/archive/20220511/202205111616.bVssFWeh-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd123c56754edf62c7042dcf23185c3727610f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/9cb4cd7060790dcb3d7f9405c11a0da884a0c616
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review John-Garry/sbitmap-NUMA-node-spreading/20220510-192122
git checkout 9cb4cd7060790dcb3d7f9405c11a0da884a0c616
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
fs/ntfs/mft.c:1798:2: note: Taking false branch
if (IS_ERR(rl)) {
^
fs/ntfs/mft.c:1811:2: note: Taking false branch
ntfs_debug("Allocated %lli clusters.", (long long)nr);
^
fs/ntfs/debug.h:39:2: note: expanded from macro 'ntfs_debug'
if (0) \
^
fs/ntfs/mft.c:1811:2: note: Loop condition is false. Exiting loop
ntfs_debug("Allocated %lli clusters.", (long long)nr);
^
fs/ntfs/debug.h:37:35: note: expanded from macro 'ntfs_debug'
#define ntfs_debug(fmt, ...) \
^
fs/ntfs/mft.c:1813:2: note: Loop condition is false. Execution continues on line 1816
for (; rl[1].length; rl++)
^
fs/ntfs/mft.c:1817:2: note: Taking true branch
if (IS_ERR(mrec)) {
^
fs/ntfs/mft.c:1820:3: note: Control jumps to line 1953
goto undo_alloc;
^
fs/ntfs/mft.c:1953:6: note: Assuming the condition is false
if (ntfs_cluster_free(mft_ni, old_last_vcn, -1, ctx) < 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/mft.c:1953:2: note: Taking false branch
if (ntfs_cluster_free(mft_ni, old_last_vcn, -1, ctx) < 0) {
^
fs/ntfs/mft.c:1958:6: note: Access to field 'attr' results in a dereference of a null pointer (loaded from variable 'ctx')
a = ctx->attr;
^~~
fs/ntfs/mft.c:2019:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(m, 0, vol->mft_record_size);
^
arch/x86/include/asm/string_32.h:195:29: note: expanded from macro 'memset'
#define memset(s, c, count) __builtin_memset(s, c, count)
^~~~~~~~~~~~~~~~
fs/ntfs/mft.c:2019:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(m, 0, vol->mft_record_size);
^
arch/x86/include/asm/string_32.h:195:29: note: expanded from macro 'memset'
#define memset(s, c, count) __builtin_memset(s, c, count)
^~~~~~~~~~~~~~~~
fs/ntfs/mft.c:2813:3: warning: Call to function 'memmove' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memmove_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memmove(extent_nis, extent_nis + 1, (base_ni->nr_extents - i) *
^~~~~~~
fs/ntfs/mft.c:2813:3: note: Call to function 'memmove' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memmove_s' in case of C11
memmove(extent_nis, extent_nis + 1, (base_ni->nr_extents - i) *
^~~~~~~
fs/ntfs/mft.c:2893:4: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(extent_nis, base_ni->ext.extent_ntfs_inos,
^
arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy'
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
^~~~~~~~~~~~~~~~
fs/ntfs/mft.c:2893:4: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(extent_nis, base_ni->ext.extent_ntfs_inos,
^
arch/x86/include/asm/string_32.h:150:25: note: expanded from macro 'memcpy'
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
^~~~~~~~~~~~~~~~
Suppressed 43 warnings (43 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
20 warnings generated.
lib/oid_registry.c:142:16: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
ret = count = snprintf(buffer, bufsize, "%u.%u", n / 40, n % 40);
^~~~~~~~
lib/oid_registry.c:142:16: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
ret = count = snprintf(buffer, bufsize, "%u.%u", n / 40, n % 40);
^~~~~~~~
lib/oid_registry.c:149:3: warning: Value stored to 'num' is never read [clang-analyzer-deadcode.DeadStores]
num = 0;
^ ~
lib/oid_registry.c:149:3: note: Value stored to 'num' is never read
num = 0;
^ ~
lib/oid_registry.c:163:18: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
ret += count = snprintf(buffer, bufsize, ".%lu", num);
^~~~~~~~
lib/oid_registry.c:163:18: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
ret += count = snprintf(buffer, bufsize, ".%lu", num);
^~~~~~~~
lib/oid_registry.c:173:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
snprintf(buffer, bufsize, "(bad)");
^~~~~~~~
lib/oid_registry.c:173:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
snprintf(buffer, bufsize, "(bad)");
^~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19 warnings generated.
Suppressed 19 warnings (12 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
31 warnings generated.
>> lib/sbitmap.c:138:63: warning: The expression is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
for (index = 0, nid = 0; index < sb->map_nr; index++, map++, map_nr_cnt++) {
^
lib/sbitmap.c:481:8: note: Calling 'sbitmap_init_node'
ret = sbitmap_init_node(&sbq->sb, depth, shift, flags, node,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/sbitmap.c:103:11: note: 'map_nr_cnt' declared without an initial value
int nid, map_nr_cnt;
^~~~~~~~~~
lib/sbitmap.c:105:6: note: Assuming 'shift' is >= 0
if (shift < 0)
^~~~~~~~~
lib/sbitmap.c:105:2: note: Taking false branch
if (shift < 0)
^
lib/sbitmap.c:109:6: note: Assuming 'bits_per_word' is <= BITS_PER_LONG
if (bits_per_word > BITS_PER_LONG)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/sbitmap.c:109:2: note: Taking false branch
if (bits_per_word > BITS_PER_LONG)
^
lib/sbitmap.c:117:6: note: Assuming 'depth' is not equal to 0
if (depth == 0) {
^~~~~~~~~~
lib/sbitmap.c:117:2: note: Taking false branch
if (depth == 0) {
^
lib/sbitmap.c:122:6: note: Assuming 'num_nodes' is <= field 'map_nr'
if (sb->map_nr < num_nodes) {
^~~~~~~~~~~~~~~~~~~~~~
lib/sbitmap.c:122:2: note: Taking false branch
if (sb->map_nr < num_nodes) {
^
lib/sbitmap.c:127:6: note: 'alloc_hint' is true
if (alloc_hint) {
^~~~~~~~~~
lib/sbitmap.c:127:2: note: Taking true branch
if (alloc_hint) {
^
lib/sbitmap.c:128:7: note: Calling 'init_alloc_hint'
if (init_alloc_hint(sb, flags))
^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/sbitmap.c:28:6: note: Assuming field 'alloc_hint' is non-null
if (!sb->alloc_hint)
^~~~~~~~~~~~~~~
lib/sbitmap.c:28:2: note: Taking false branch
if (!sb->alloc_hint)
^
lib/sbitmap.c:31:6: note: 'depth' is not equal to 0
if (depth && !sb->round_robin) {
^~~~~
lib/sbitmap.c:31:6: note: Left side of '&&' is true
lib/sbitmap.c:31:15: note: Assuming field 'round_robin' is true
if (depth && !sb->round_robin) {
^~~~~~~~~~~~~~~~
lib/sbitmap.c:31:2: note: Taking false branch
if (depth && !sb->round_robin) {
^
lib/sbitmap.c:39:2: note: Returning without writing to 'sb->map', which participates in a condition later
return 0;
^
lib/sbitmap.c:128:7: note: Returning from 'init_alloc_hint'
if (init_alloc_hint(sb, flags))
^~~~~~~~~~~~~~~~~~~~~~~~~~
lib/sbitmap.c:128:3: note: Taking false branch
if (init_alloc_hint(sb, flags))
^
lib/sbitmap.c:135:6: note: Assuming field 'map' is non-null
if (!sb->map)
^~~~~~~~
lib/sbitmap.c:135:2: note: Taking false branch
if (!sb->map)
^
lib/sbitmap.c:138:27: note: 'index' is < field 'map_nr'
for (index = 0, nid = 0; index < sb->map_nr; index++, map++, map_nr_cnt++) {
^~~~~
lib/sbitmap.c:138:2: note: Loop condition is true. Entering loop body
for (index = 0, nid = 0; index < sb->map_nr; index++, map++, map_nr_cnt++) {
^
lib/sbitmap.c:141:3: note: Taking true branch
if ((index % sb->map_nr_per_node) == 0) {
^
lib/sbitmap.c:144:8: note: 'index' is equal to 0
if (index == 0) {
^~~~~
lib/sbitmap.c:144:4: note: Taking true branch
if (index == 0) {
^
lib/sbitmap.c:152:8: note: Assuming 'map' is non-null
if (!map)
^~~~
lib/sbitmap.c:152:4: note: Taking false branch
if (!map)
^
lib/sbitmap.c:138:63: note: The expression is an uninitialized value. The computed value will also be garbage
for (index = 0, nid = 0; index < sb->map_nr; index++, map++, map_nr_cnt++) {
^~~~~~~~~~
Suppressed 30 warnings (29 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
36 warnings generated.
Suppressed 36 warnings (36 in non-user code).
vim +138 lib/sbitmap.c
b2dbff1bb893d5 Jens Axboe 2018-12-11 95
88459642cba452 Omar Sandoval 2016-09-17 96 int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
c548e62bcf6adc Ming Lei 2021-01-22 97 gfp_t flags, int node, bool round_robin,
c548e62bcf6adc Ming Lei 2021-01-22 98 bool alloc_hint)
88459642cba452 Omar Sandoval 2016-09-17 99 {
88459642cba452 Omar Sandoval 2016-09-17 100 unsigned int bits_per_word;
829ed3bea2e697 John Garry 2022-05-10 101 struct sbitmap_word *map;
9cb4cd7060790d John Garry 2022-05-10 102 int index, num_nodes = num_online_nodes();
9cb4cd7060790d John Garry 2022-05-10 103 int nid, map_nr_cnt;
88459642cba452 Omar Sandoval 2016-09-17 104
2d13b1ea9f4aff Ming Lei 2021-01-22 105 if (shift < 0)
2d13b1ea9f4aff Ming Lei 2021-01-22 106 shift = sbitmap_calculate_shift(depth);
2d13b1ea9f4aff Ming Lei 2021-01-22 107
88459642cba452 Omar Sandoval 2016-09-17 108 bits_per_word = 1U << shift;
88459642cba452 Omar Sandoval 2016-09-17 109 if (bits_per_word > BITS_PER_LONG)
88459642cba452 Omar Sandoval 2016-09-17 110 return -EINVAL;
88459642cba452 Omar Sandoval 2016-09-17 111
88459642cba452 Omar Sandoval 2016-09-17 112 sb->shift = shift;
88459642cba452 Omar Sandoval 2016-09-17 113 sb->depth = depth;
88459642cba452 Omar Sandoval 2016-09-17 114 sb->map_nr = DIV_ROUND_UP(sb->depth, bits_per_word);
efe1f3a1d5833c Ming Lei 2021-01-22 115 sb->round_robin = round_robin;
88459642cba452 Omar Sandoval 2016-09-17 116
88459642cba452 Omar Sandoval 2016-09-17 117 if (depth == 0) {
88459642cba452 Omar Sandoval 2016-09-17 118 sb->map = NULL;
88459642cba452 Omar Sandoval 2016-09-17 119 return 0;
88459642cba452 Omar Sandoval 2016-09-17 120 }
88459642cba452 Omar Sandoval 2016-09-17 121
9cb4cd7060790d John Garry 2022-05-10 122 if (sb->map_nr < num_nodes) {
9cb4cd7060790d John Garry 2022-05-10 123 sb->map_nr_per_node = 1;
9cb4cd7060790d John Garry 2022-05-10 124 } else {
9cb4cd7060790d John Garry 2022-05-10 125 sb->map_nr_per_node = sb->map_nr / num_nodes;
9cb4cd7060790d John Garry 2022-05-10 126 }
c548e62bcf6adc Ming Lei 2021-01-22 127 if (alloc_hint) {
c548e62bcf6adc Ming Lei 2021-01-22 128 if (init_alloc_hint(sb, flags))
c548e62bcf6adc Ming Lei 2021-01-22 129 return -ENOMEM;
c548e62bcf6adc Ming Lei 2021-01-22 130 } else {
c548e62bcf6adc Ming Lei 2021-01-22 131 sb->alloc_hint = NULL;
c548e62bcf6adc Ming Lei 2021-01-22 132 }
c548e62bcf6adc Ming Lei 2021-01-22 133
863a66cdb4df25 Ming Lei 2022-03-16 134 sb->map = kvzalloc_node(sb->map_nr * sizeof(*sb->map), flags, node);
9cb4cd7060790d John Garry 2022-05-10 135 if (!sb->map)
9cb4cd7060790d John Garry 2022-05-10 136 goto err_map;
9cb4cd7060790d John Garry 2022-05-10 137
9cb4cd7060790d John Garry 2022-05-10 @138 for (index = 0, nid = 0; index < sb->map_nr; index++, map++, map_nr_cnt++) {
9cb4cd7060790d John Garry 2022-05-10 139 struct sbitmap_word **_map;
9cb4cd7060790d John Garry 2022-05-10 140
9cb4cd7060790d John Garry 2022-05-10 141 if ((index % sb->map_nr_per_node) == 0) {
9cb4cd7060790d John Garry 2022-05-10 142 int cnt;
9cb4cd7060790d John Garry 2022-05-10 143
9cb4cd7060790d John Garry 2022-05-10 144 if (index == 0) {
9cb4cd7060790d John Garry 2022-05-10 145 cnt = sb->map_nr_per_node +
9cb4cd7060790d John Garry 2022-05-10 146 (sb->map_nr % sb->map_nr_per_node);
9cb4cd7060790d John Garry 2022-05-10 147 } else {
9cb4cd7060790d John Garry 2022-05-10 148 cnt = sb->map_nr_per_node;
c548e62bcf6adc Ming Lei 2021-01-22 149 }
88459642cba452 Omar Sandoval 2016-09-17 150
9cb4cd7060790d John Garry 2022-05-10 151 map = kvzalloc_node(cnt * sizeof(**sb->map), flags, nid);
829ed3bea2e697 John Garry 2022-05-10 152 if (!map)
9cb4cd7060790d John Garry 2022-05-10 153 goto err_map_numa;
9cb4cd7060790d John Garry 2022-05-10 154 nid++;
9cb4cd7060790d John Garry 2022-05-10 155 }
829ed3bea2e697 John Garry 2022-05-10 156
829ed3bea2e697 John Garry 2022-05-10 157 _map = &sb->map[index];
829ed3bea2e697 John Garry 2022-05-10 158 *_map = map;
829ed3bea2e697 John Garry 2022-05-10 159 }
829ed3bea2e697 John Garry 2022-05-10 160
88459642cba452 Omar Sandoval 2016-09-17 161 return 0;
9cb4cd7060790d John Garry 2022-05-10 162 err_map_numa:
9cb4cd7060790d John Garry 2022-05-10 163 for (index = 0; index < sb->map_nr; index++, map++) {
9cb4cd7060790d John Garry 2022-05-10 164 if ((index % sb->map_nr_per_node) == 0) {
9cb4cd7060790d John Garry 2022-05-10 165 kfree(map);
9cb4cd7060790d John Garry 2022-05-10 166 }
9cb4cd7060790d John Garry 2022-05-10 167 }
9cb4cd7060790d John Garry 2022-05-10 168 err_map:
9cb4cd7060790d John Garry 2022-05-10 169 free_percpu(sb->alloc_hint);
9cb4cd7060790d John Garry 2022-05-10 170
9cb4cd7060790d John Garry 2022-05-10 171 return -ENOMEM;
88459642cba452 Omar Sandoval 2016-09-17 172 }
88459642cba452 Omar Sandoval 2016-09-17 173 EXPORT_SYMBOL_GPL(sbitmap_init_node);
88459642cba452 Omar Sandoval 2016-09-17 174
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next reply other threads:[~2022-05-11 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 8:54 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-10 11:14 [RFC PATCH 0/2] sbitmap: NUMA node spreading John Garry
2022-05-10 11:14 ` [RFC PATCH 2/2] sbitmap: Spread sbitmap word allocation over NUMA nodes John Garry
2022-05-10 19:31 ` kernel test robot
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=202205111616.bVssFWeh-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.