Hi Matthew,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip v5.11-rc5 next-20210122]
[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/0day-ci/linux/commits/Matthew-Auld/drm-i915-buddy-document-the-unused-header-bits/20210125-111101
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-a012-20210125 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-20) 9.3.0
reproduce (this is a W=1 build):
        # 
https://github.com/0day-ci/linux/commit/9d12a23788459bd678c0f5979acaaf94a88d808c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Matthew-Auld/drm-i915-buddy-document-the-unused-header-bits/20210125-111101
        git checkout 9d12a23788459bd678c0f5979acaaf94a88d808c
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:5,
                    from arch/x86/include/asm/bug.h:93,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from include/linux/kmemleak.h:12,
                    from drivers/gpu/drm/i915/i915_buddy.c:6:
   drivers/gpu/drm/i915/selftests/i915_buddy.c: In function 
'igt_buddy_alloc_limit':
>> include/linux/log2.h:194:8: warning: left shift count >= width of type 
>> [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
         |                                                    ^~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:2: note: in expansion of 
macro 'if'
     761 |  if (i915_buddy_block_size(&mm, block) != 
rounddown_pow_of_two(size)) {
         |  ^~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of 
macro 'rounddown_pow_of_two'
     761 |  if (i915_buddy_block_size(&mm, block) != 
rounddown_pow_of_two(size)) {
         |                                           ^~~~~~~~~~~~~~~~~~~~
>> include/linux/log2.h:194:8: warning: left shift count >= width of type 
>> [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/compiler.h:69:3: note: in definition of macro 
'__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) 
) )
         |                            ^~~~~~~~~~~~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:2: note: in expansion of 
macro 'if'
     761 |  if (i915_buddy_block_size(&mm, block) != 
rounddown_pow_of_two(size)) {
         |  ^~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:761:43: note: in expansion of 
macro 'rounddown_pow_of_two'
     761 |  if (i915_buddy_block_size(&mm, block) != 
rounddown_pow_of_two(size)) {
         |                                           ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:20,
                    from arch/x86/include/asm/bug.h:93,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from include/linux/kmemleak.h:12,
                    from drivers/gpu/drm/i915/i915_buddy.c:6:
>> include/linux/log2.h:194:8: warning: left shift count >= width of type 
>> [-Wshift-count-overflow]
     194 |   (1UL << ilog2(n))) :  \
         |        ^~
   include/linux/printk.h:343:33: note: in expansion of macro 
'rounddown_pow_of_two'
     343 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                                 ^~~~~~~~~~~
   drivers/gpu/drm/i915/selftests/i915_buddy.c:762:3: note: in expansion of 
macro 'pr_err'
     762 |   pr_err("block size(%llu) != %lu\n",
         |   ^~~~~~


vim +194 include/linux/log2.h

b311e921b385b5a Robert P. J. Day 2007-10-16   69  
f0d1b0b30d250a0 David Howells    2006-12-08   70  /**
dbef91ec5482239 Martin Wilck     2018-04-18   71   * const_ilog2 - log base 2 
of 32-bit or a 64-bit constant unsigned value
a1c4d24e02d093e Randy Dunlap     2017-09-30   72   * @n: parameter
f0d1b0b30d250a0 David Howells    2006-12-08   73   *
dbef91ec5482239 Martin Wilck     2018-04-18   74   * Use this where sparse 
expects a true constant expression, e.g. for array
dbef91ec5482239 Martin Wilck     2018-04-18   75   * indices.
f0d1b0b30d250a0 David Howells    2006-12-08   76   */
dbef91ec5482239 Martin Wilck     2018-04-18   77  #define const_ilog2(n)        
                        \
f0d1b0b30d250a0 David Howells    2006-12-08   78  (                             
                \
f0d1b0b30d250a0 David Howells    2006-12-08   79        __builtin_constant_p(n) 
? (             \
474c90156c8dcc2 Linus Torvalds   2017-03-02   80                (n) < 2 ? 0 :   
                \
f0d1b0b30d250a0 David Howells    2006-12-08   81                (n) & (1ULL << 
63) ? 63 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   82                (n) & (1ULL << 
62) ? 62 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   83                (n) & (1ULL << 
61) ? 61 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   84                (n) & (1ULL << 
60) ? 60 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   85                (n) & (1ULL << 
59) ? 59 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   86                (n) & (1ULL << 
58) ? 58 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   87                (n) & (1ULL << 
57) ? 57 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   88                (n) & (1ULL << 
56) ? 56 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   89                (n) & (1ULL << 
55) ? 55 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   90                (n) & (1ULL << 
54) ? 54 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   91                (n) & (1ULL << 
53) ? 53 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   92                (n) & (1ULL << 
52) ? 52 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   93                (n) & (1ULL << 
51) ? 51 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   94                (n) & (1ULL << 
50) ? 50 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   95                (n) & (1ULL << 
49) ? 49 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   96                (n) & (1ULL << 
48) ? 48 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   97                (n) & (1ULL << 
47) ? 47 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   98                (n) & (1ULL << 
46) ? 46 :       \
f0d1b0b30d250a0 David Howells    2006-12-08   99                (n) & (1ULL << 
45) ? 45 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  100                (n) & (1ULL << 
44) ? 44 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  101                (n) & (1ULL << 
43) ? 43 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  102                (n) & (1ULL << 
42) ? 42 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  103                (n) & (1ULL << 
41) ? 41 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  104                (n) & (1ULL << 
40) ? 40 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  105                (n) & (1ULL << 
39) ? 39 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  106                (n) & (1ULL << 
38) ? 38 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  107                (n) & (1ULL << 
37) ? 37 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  108                (n) & (1ULL << 
36) ? 36 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  109                (n) & (1ULL << 
35) ? 35 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  110                (n) & (1ULL << 
34) ? 34 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  111                (n) & (1ULL << 
33) ? 33 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  112                (n) & (1ULL << 
32) ? 32 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  113                (n) & (1ULL << 
31) ? 31 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  114                (n) & (1ULL << 
30) ? 30 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  115                (n) & (1ULL << 
29) ? 29 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  116                (n) & (1ULL << 
28) ? 28 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  117                (n) & (1ULL << 
27) ? 27 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  118                (n) & (1ULL << 
26) ? 26 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  119                (n) & (1ULL << 
25) ? 25 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  120                (n) & (1ULL << 
24) ? 24 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  121                (n) & (1ULL << 
23) ? 23 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  122                (n) & (1ULL << 
22) ? 22 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  123                (n) & (1ULL << 
21) ? 21 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  124                (n) & (1ULL << 
20) ? 20 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  125                (n) & (1ULL << 
19) ? 19 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  126                (n) & (1ULL << 
18) ? 18 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  127                (n) & (1ULL << 
17) ? 17 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  128                (n) & (1ULL << 
16) ? 16 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  129                (n) & (1ULL << 
15) ? 15 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  130                (n) & (1ULL << 
14) ? 14 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  131                (n) & (1ULL << 
13) ? 13 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  132                (n) & (1ULL << 
12) ? 12 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  133                (n) & (1ULL << 
11) ? 11 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  134                (n) & (1ULL << 
10) ? 10 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  135                (n) & (1ULL <<  
9) ?  9 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  136                (n) & (1ULL <<  
8) ?  8 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  137                (n) & (1ULL <<  
7) ?  7 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  138                (n) & (1ULL <<  
6) ?  6 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  139                (n) & (1ULL <<  
5) ?  5 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  140                (n) & (1ULL <<  
4) ?  4 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  141                (n) & (1ULL <<  
3) ?  3 :       \
f0d1b0b30d250a0 David Howells    2006-12-08  142                (n) & (1ULL <<  
2) ?  2 :       \
474c90156c8dcc2 Linus Torvalds   2017-03-02  143                1) :            
                \
dbef91ec5482239 Martin Wilck     2018-04-18  144        -1)
dbef91ec5482239 Martin Wilck     2018-04-18  145  
dbef91ec5482239 Martin Wilck     2018-04-18  146  /**
dbef91ec5482239 Martin Wilck     2018-04-18  147   * ilog2 - log base 2 of 
32-bit or a 64-bit unsigned value
dbef91ec5482239 Martin Wilck     2018-04-18  148   * @n: parameter
dbef91ec5482239 Martin Wilck     2018-04-18  149   *
dbef91ec5482239 Martin Wilck     2018-04-18  150   * constant-capable log of 
base 2 calculation
dbef91ec5482239 Martin Wilck     2018-04-18  151   * - this can be used to 
initialise global variables from constant data, hence
dbef91ec5482239 Martin Wilck     2018-04-18  152   * the massive ternary 
operator construction
dbef91ec5482239 Martin Wilck     2018-04-18  153   *
dbef91ec5482239 Martin Wilck     2018-04-18  154   * selects the 
appropriately-sized optimised version depending on sizeof(n)
dbef91ec5482239 Martin Wilck     2018-04-18  155   */
dbef91ec5482239 Martin Wilck     2018-04-18  156  #define ilog2(n) \
dbef91ec5482239 Martin Wilck     2018-04-18  157  ( \
dbef91ec5482239 Martin Wilck     2018-04-18  158        __builtin_constant_p(n) 
?       \
2f78788b55baa34 Jakub Jelinek    2020-12-15  159        ((n) < 2 ? 0 :          
        \
2f78788b55baa34 Jakub Jelinek    2020-12-15  160         63 - 
__builtin_clzll(n)) :     \
f0d1b0b30d250a0 David Howells    2006-12-08  161        (sizeof(n) <= 4) ?      
        \
f0d1b0b30d250a0 David Howells    2006-12-08  162        __ilog2_u32(n) :        
        \
f0d1b0b30d250a0 David Howells    2006-12-08  163        __ilog2_u64(n)          
        \
f0d1b0b30d250a0 David Howells    2006-12-08  164   )
f0d1b0b30d250a0 David Howells    2006-12-08  165  
312a0c170945b49 David Howells    2006-12-08  166  /**
312a0c170945b49 David Howells    2006-12-08  167   * roundup_pow_of_two - round 
the given value up to nearest power of two
a1c4d24e02d093e Randy Dunlap     2017-09-30  168   * @n: parameter
312a0c170945b49 David Howells    2006-12-08  169   *
6fb189c2a4f3bea Robert P. J. Day 2007-02-17  170   * round the given value up 
to the nearest power of two
312a0c170945b49 David Howells    2006-12-08  171   * - the result is undefined 
when n == 0
312a0c170945b49 David Howells    2006-12-08  172   * - this can be used to 
initialise global variables from constant data
312a0c170945b49 David Howells    2006-12-08  173   */
312a0c170945b49 David Howells    2006-12-08  174  #define roundup_pow_of_two(n) 
                \
312a0c170945b49 David Howells    2006-12-08  175  (                             
                \
312a0c170945b49 David Howells    2006-12-08  176        __builtin_constant_p(n) 
? (             \
428fc0aff4e5939 Jason Gunthorpe  2020-09-04  177                ((n) == 1) ? 1 
:                \
312a0c170945b49 David Howells    2006-12-08  178                (1UL << 
(ilog2((n) - 1) + 1))   \
312a0c170945b49 David Howells    2006-12-08  179                                
   ) :          \
312a0c170945b49 David Howells    2006-12-08  180        __roundup_pow_of_two(n) 
                \
312a0c170945b49 David Howells    2006-12-08  181   )
312a0c170945b49 David Howells    2006-12-08  182  
b311e921b385b5a Robert P. J. Day 2007-10-16  183  /**
b311e921b385b5a Robert P. J. Day 2007-10-16  184   * rounddown_pow_of_two - 
round the given value down to nearest power of two
a1c4d24e02d093e Randy Dunlap     2017-09-30  185   * @n: parameter
b311e921b385b5a Robert P. J. Day 2007-10-16  186   *
b311e921b385b5a Robert P. J. Day 2007-10-16  187   * round the given value down 
to the nearest power of two
b311e921b385b5a Robert P. J. Day 2007-10-16  188   * - the result is undefined 
when n == 0
b311e921b385b5a Robert P. J. Day 2007-10-16  189   * - this can be used to 
initialise global variables from constant data
b311e921b385b5a Robert P. J. Day 2007-10-16  190   */
b311e921b385b5a Robert P. J. Day 2007-10-16  191  #define 
rounddown_pow_of_two(n)                       \
b311e921b385b5a Robert P. J. Day 2007-10-16  192  (                             
                \
b311e921b385b5a Robert P. J. Day 2007-10-16  193        __builtin_constant_p(n) 
? (             \
b311e921b385b5a Robert P. J. Day 2007-10-16 @194                (1UL << 
ilog2(n))) :            \
b311e921b385b5a Robert P. J. Day 2007-10-16  195        
__rounddown_pow_of_two(n)               \
b311e921b385b5a Robert P. J. Day 2007-10-16  196   )
b311e921b385b5a Robert P. J. Day 2007-10-16  197  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to