CC: l...@lists.linux.dev
CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: Arunpravin <arunpravin.paneersel...@amd.com>
CC: 0day robot <l...@intel.com>

tree:   
https://github.com/0day-ci/linux/commits/Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
head:   71b3775a5ce7b59e8c5292ae438284e8569c9e9f
commit: 71b3775a5ce7b59e8c5292ae438284e8569c9e9f Add drm buddy manager support 
to amdgpu driver
date:   8 weeks ago
:::::: branch date: 8 weeks ago
:::::: commit date: 8 weeks ago
config: riscv-randconfig-c006-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/71b3775a5ce7b59e8c5292ae438284e8569c9e9f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Arunpravin/Enable-buddy-memory-manager-support/20210921-032602
        git checkout 71b3775a5ce7b59e8c5292ae438284e8569c9e9f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                                                           ^
   kernel/sched/topology.c:2218:3: note: Loop condition is true.  Entering loop 
body
                   for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) {
                   ^
   kernel/sched/topology.c:2220:8: note: Assuming the condition is false
                           if (sd->flags & SD_OVERLAP) {
                               ^~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/topology.c:2220:4: note: Taking false branch
                           if (sd->flags & SD_OVERLAP) {
                           ^
   kernel/sched/topology.c:2224:9: note: Calling 'build_sched_groups'
                                   if (build_sched_groups(sd, i))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/topology.c:1194:37: note: 'last' initialized to a null pointer 
value
           struct sched_group *first = NULL, *last = NULL;
                                              ^~~~
   kernel/sched/topology.c:1200:2: note: Assuming 'debug_locks' is 0
           lockdep_assert_held(&sched_domains_mutex);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 
'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/lockdep.h:310:15: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                        ^~~~~~~~~~~
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   kernel/sched/topology.c:1200:2: note: Left side of '&&' is false
           lockdep_assert_held(&sched_domains_mutex);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 
'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:27: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                                    ^
   kernel/sched/topology.c:1200:2: note: Taking false branch
           lockdep_assert_held(&sched_domains_mutex);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 
'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:7: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   kernel/sched/topology.c:1200:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&sched_domains_mutex);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 
'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:2: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
           ^
   kernel/sched/topology.c:1205:2: note: Assuming 'i' is >= 8
           for_each_cpu_wrap(i, span, cpu) {
           ^
   include/linux/cpumask.h:271:7: note: expanded from macro 'for_each_cpu_wrap'
                (cpu) < nr_cpumask_bits;                                        
   \
                ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/topology.c:1205:2: note: Loop condition is false. Execution 
continues on line 1221
           for_each_cpu_wrap(i, span, cpu) {
           ^
   include/linux/cpumask.h:270:2: note: expanded from macro 'for_each_cpu_wrap'
           for ((cpu) = cpumask_next_wrap((start)-1, (mask), (start), false);   
   \
           ^
   kernel/sched/topology.c:1221:13: note: Access to field 'next' results in a 
dereference of a null pointer (loaded from variable 'last')
           last->next = first;
           ~~~~       ^
   Suppressed 17 warnings (15 in non-user code, 2 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   10 warnings generated.
   Suppressed 10 warnings (10 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.
   15 warnings generated.
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:9: warning: The left 
>> expression of the compound assignment is an uninitialized value. The 
>> computed value will also be garbage 
>> [clang-analyzer-core.uninitialized.Assign]
                   usage += amdgpu_vram_mgr_vis_size(adev, block);
                   ~~~~~ ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:227:2: note: 'usage' declared 
without an initial value
           u64 usage;
           ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:6: note: Calling 
'amdgpu_gmc_vram_full_visible'
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:286:10: note: Assuming 
field 'real_vram_size' is >= field 'visible_vram_size'
           WARN_ON(gmc->real_vram_size < gmc->visible_vram_size);
                   ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:286:2: note: Taking false 
branch
           WARN_ON(gmc->real_vram_size < gmc->visible_vram_size);
           ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:288:10: note: Assuming 
field 'real_vram_size' is not equal to field 'visible_vram_size'
           return (gmc->real_vram_size == gmc->visible_vram_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:288:2: note: Returning 
zero, which participates in a condition later
           return (gmc->real_vram_size == gmc->visible_vram_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:6: note: Returning from 
'amdgpu_gmc_vram_full_visible'
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:2: note: Taking false branch
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:232:6: note: Assuming the 
condition is false
           if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:232:2: note: Taking false branch
           if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Left side of '&&' 
is false
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Taking false branch
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Loop condition is 
false.  Exiting loop
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Loop condition is 
true.  Entering loop body
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:236:9: note: The left 
expression of the compound assignment is an uninitialized value. The computed 
value will also be garbage
                   usage += amdgpu_vram_mgr_vis_size(adev, block);
                   ~~~~~ ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:238:2: warning: Undefined or 
>> garbage value returned to caller 
>> [clang-analyzer-core.uninitialized.UndefReturn]
           return usage;
           ^      ~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:227:2: note: 'usage' declared 
without an initial value
           u64 usage;
           ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:6: note: Calling 
'amdgpu_gmc_vram_full_visible'
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:286:10: note: Assuming 
field 'real_vram_size' is >= field 'visible_vram_size'
           WARN_ON(gmc->real_vram_size < gmc->visible_vram_size);
                   ^
   include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:286:2: note: Taking false 
branch
           WARN_ON(gmc->real_vram_size < gmc->visible_vram_size);
           ^
   include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:288:10: note: Assuming 
field 'real_vram_size' is not equal to field 'visible_vram_size'
           return (gmc->real_vram_size == gmc->visible_vram_size);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_gmc.h:288:2: note: Returning 
zero, which participates in a condition later
           return (gmc->real_vram_size == gmc->visible_vram_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:6: note: Returning from 
'amdgpu_gmc_vram_full_visible'
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:229:2: note: Taking false branch
           if (amdgpu_gmc_vram_full_visible(&adev->gmc))
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:232:6: note: Assuming the 
condition is false
           if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:232:2: note: Taking false branch
           if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Left side of '&&' 
is false
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Taking false branch
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Loop condition is 
false.  Exiting loop
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:235:2: note: Loop condition is 
false. Execution continues on line 238
           list_for_each_entry(block, &vnode->blocks, link)
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:238:2: note: Undefined or 
garbage value returned to caller
           return usage;
           ^      ~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:590:9: warning: Branch 
>> condition evaluates to a garbage value 
>> [clang-analyzer-core.uninitialized.Branch]
           while (cursor.remaining) {
                  ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:585:6: note: Assuming the 
condition is false
           if (!*sgt)
               ^~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:585:2: note: Taking false branch
           if (!*sgt)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:589:2: note: Calling 
'amdgpu_res_first'
           amdgpu_res_first(res, offset, length, &cursor);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:68:6: note: 
Assuming 'res' is non-null
           if (!res || res->mem_type == TTM_PL_SYSTEM) {
               ^~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:68:6: note: Left 
side of '||' is false
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:68:14: note: 
Assuming field 'mem_type' is not equal to TTM_PL_SYSTEM
           if (!res || res->mem_type == TTM_PL_SYSTEM) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:68:2: note: Taking 
false branch
           if (!res || res->mem_type == TTM_PL_SYSTEM) {
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:77:9: note: 
Assuming the condition is false
           BUG_ON(start + size > res->num_pages << PAGE_SHIFT);
                  ^
   include/asm-generic/bug.h:65:45: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                      ~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:77:2: note: Taking 
false branch
           BUG_ON(start + size > res->num_pages << PAGE_SHIFT);
           ^
   include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                  ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:77:2: note: Loop 
condition is false.  Exiting loop
           BUG_ON(start + size > res->num_pages << PAGE_SHIFT);
           ^
   include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON'
   #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                             ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:81:6: note: 
Assuming field 'mem_type' is not equal to TTM_PL_VRAM
           if (cur->mem_type == TTM_PL_VRAM) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:81:2: note: Taking 
false branch
           if (cur->mem_type == TTM_PL_VRAM) {
           ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:100:13: note: 
Assuming field 'mem_type' is not equal to TTM_PL_TT
           } else if (cur->mem_type == TTM_PL_TT) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:100:9: note: Taking 
false branch
           } else if (cur->mem_type == TTM_PL_TT) {
                  ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:112:1: note: 
Returning without writing to 'cur->remaining', which participates in a 
condition later
   }
   ^
   drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_res_cursor.h:112:1: note: 
Returning without writing to 'cur->remaining'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:589:2: note: Returning from 
'amdgpu_res_first'
           amdgpu_res_first(res, offset, length, &cursor);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:590:9: note: Branch condition 
evaluates to a garbage value
           while (cursor.remaining) {
                  ^~~~~~~~~~~~~~~~
   include/linux/log2.h:57:13: warning: The result of the left shift is 
undefined due to shifting by '32', which is greater or equal to the width of 
type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
           return 1UL << fls_long(n - 1);
                      ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:383:6: note: Assuming 'lpfn' is 
not equal to 0
           if (!lpfn)
               ^~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:383:2: note: Taking false branch
           if (!lpfn)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:387:6: note: Assuming field 
'type' is equal to ttm_bo_type_kernel
           if (tbo->type != ttm_bo_type_kernel)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:387:2: note: Taking false branch
           if (tbo->type != ttm_bo_type_kernel)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:392:6: note: Assuming the 
condition is false
           if (atomic64_add_return(mem_bytes, &mgr->usage) > max_bytes) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:392:2: note: Taking false branch
           if (atomic64_add_return(mem_bytes, &mgr->usage) > max_bytes) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:397:6: note: Assuming the 
condition is false
           if (place->flags & TTM_PL_FLAG_CONTIGUOUS)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:397:2: note: Taking false branch
           if (place->flags & TTM_PL_FLAG_CONTIGUOUS)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:406:20: note: Assuming 
'__UNIQUE_ID___x419' is <= '__UNIQUE_ID___y420'
                   pages_per_node = max_t(uint32_t, pages_per_node,
                                    ^
   include/linux/minmax.h:112:27: note: expanded from macro 'max_t'
   #define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1733:6: note: Left side of '&&' is 
true
           if (!unlocked && !dma_fence_is_signaled(vm->last_unlocked)) {
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1733:2: note: Taking false branch
           if (!unlocked && !dma_fence_is_signaled(vm->last_unlocked)) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1742:6: note: Assuming 'r' is 0
           if (r)
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1742:2: note: Taking false branch
           if (r)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1745:19: note: 'pages_addr' is null
           amdgpu_res_first(pages_addr ? NULL : res, offset,
                            ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1745:19: note: '?' condition is false
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1747:2: note: Loop condition is true. 
 Entering loop body
           while (cursor.remaining) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1751:7: note: 'pages_addr' is null
                   if (pages_addr) {
                       ^~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1751:3: note: Taking false branch
                   if (pages_addr) {
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1782:10: note: Taking true branch
                   } else if (flags & (AMDGPU_PTE_VALID | AMDGPU_PTE_PRT)) {
                          ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1790:7: note: Calling 
'amdgpu_vm_update_ptes'
                   r = amdgpu_vm_update_ptes(&params, start, tmp, addr, flags);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1538:2: note: Calling 
'amdgpu_vm_fragment'
           amdgpu_vm_fragment(params, frag_start, end, flags, &frag, &frag_end);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1491:6: note: Assuming field 
'asic_type' is >= CHIP_VEGA10
           if (params->adev->asic_type < CHIP_VEGA10)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1491:2: note: Taking false branch
           if (params->adev->asic_type < CHIP_VEGA10)
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1497:6: note: Assuming field 
'pages_addr' is non-null
           if (params->pages_addr) {
               ^~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1497:2: note: Taking true branch
           if (params->pages_addr) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1500:3: note: Returning without 
writing to 'params->unlocked', which participates in a condition later
                   return;
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1538:2: note: Returning from 
'amdgpu_vm_fragment'
           amdgpu_vm_fragment(params, frag_start, end, flags, &frag, &frag_end);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1542:9: note: Assuming 'end' is > 
field 'pfn'
           while (cursor.pfn < end) {
                  ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1542:2: note: Loop condition is true. 
 Entering loop body
           while (cursor.pfn < end) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1547:7: note: Assuming field 
'unlocked' is true
                   if (!params->unlocked) {
                       ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1547:3: note: Taking false branch
                   if (!params->unlocked) {
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1557:11: note: Calling 
'amdgpu_vm_level_shift'
                   shift = amdgpu_vm_level_shift(adev, cursor.level);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:169:2: note: Control jumps to the 
'default' case at line 177
           switch (level) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:178:3: note: Returning the value 
4294967295
                   return ~0;
                   ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1557:11: note: Returning from 
'amdgpu_vm_level_shift'
                   shift = amdgpu_vm_level_shift(adev, cursor.level);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1557:3: note: The value 4294967295 is 
assigned to 'shift'
                   shift = amdgpu_vm_level_shift(adev, cursor.level);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1559:15: note: Field 'unlocked' is 
true
                   if (params->unlocked) {
                               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1559:3: note: Taking true branch
                   if (params->unlocked) {
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1561:8: note: Assuming the condition 
is false
                           if (amdgpu_vm_pt_descendant(adev, &cursor))
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1561:4: note: Taking false branch
                           if (amdgpu_vm_pt_descendant(adev, &cursor))
                           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1588:7: note: Assuming 'pt' is 
non-null
                   if (!pt) {
                       ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1588:3: note: Taking false branch
                   if (!pt) {
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1606:41: note: The result of the left 
shift is undefined due to shifting by '4294967295', which is greater or equal 
to the width of type 'uint64_t'
                   incr = (uint64_t)AMDGPU_GPU_PAGE_SIZE << shift;
                                                         ^  ~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1747:9: warning: Branch condition 
>> evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           while (cursor.remaining) {
                  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Left side of '&&' is 
false
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 
'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Taking false branch
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 
'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Loop condition is 
false.  Exiting loop
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
           ^
   include/linux/list.h:715:13: note: expanded from macro 
'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Left side of '&&' is 
false
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
           ^
   include/linux/list.h:716:7: note: expanded from macro 
'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^
   include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Taking false branch
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
           ^
   include/linux/list.h:716:7: note: expanded from macro 
'list_for_each_entry_safe'
                   n = list_next_entry(pos, member);                       \
                       ^
   include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2196:2: note: Loop condition is 
false.  Exiting loop
           list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {

vim +236 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

3c848bb38aca1f Christian König 2017-08-07  212  
5e9244ff585239 Michel Dänzer   2018-06-12  213  /**
ddc21af4d0f37f Michel Dänzer   2018-07-11  214   * 
amdgpu_vram_mgr_bo_visible_size - CPU visible BO size
5e9244ff585239 Michel Dänzer   2018-06-12  215   *
5e9244ff585239 Michel Dänzer   2018-06-12  216   * @bo: &amdgpu_bo buffer 
object (must be in VRAM)
5e9244ff585239 Michel Dänzer   2018-06-12  217   *
5e9244ff585239 Michel Dänzer   2018-06-12  218   * Returns:
ddc21af4d0f37f Michel Dänzer   2018-07-11  219   * How much of the given 
&amdgpu_bo buffer object lies in CPU visible VRAM.
5e9244ff585239 Michel Dänzer   2018-06-12  220   */
ddc21af4d0f37f Michel Dänzer   2018-07-11  221  u64 
amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo)
5e9244ff585239 Michel Dänzer   2018-06-12  222  {
7303b39e46b2f5 Michel Dänzer   2018-06-14  223          struct amdgpu_device 
*adev = amdgpu_ttm_adev(bo->tbo.bdev);
cb1c81467af355 Christian König 2021-04-30  224          struct ttm_resource 
*res = bo->tbo.resource;
71b3775a5ce7b5 Arunpravin      2021-09-21  225          struct 
amdgpu_vram_mgr_node *vnode = to_amdgpu_vram_mgr_node(res);
71b3775a5ce7b5 Arunpravin      2021-09-21  226          struct drm_buddy_block 
*block;
ddc21af4d0f37f Michel Dänzer   2018-07-11  227          u64 usage;
5e9244ff585239 Michel Dänzer   2018-06-12  228  
9735bf1930e658 Michel Dänzer   2018-06-15  229          if 
(amdgpu_gmc_vram_full_visible(&adev->gmc))
ddc21af4d0f37f Michel Dänzer   2018-07-11  230                  return 
amdgpu_bo_size(bo);
7303b39e46b2f5 Michel Dänzer   2018-06-14  231  
cb1c81467af355 Christian König 2021-04-30  232          if (res->start >= 
adev->gmc.visible_vram_size >> PAGE_SHIFT)
ddc21af4d0f37f Michel Dänzer   2018-07-11  233                  return 0;
7303b39e46b2f5 Michel Dänzer   2018-06-14  234  
71b3775a5ce7b5 Arunpravin      2021-09-21 @235          
list_for_each_entry(block, &vnode->blocks, link)
71b3775a5ce7b5 Arunpravin      2021-09-21 @236                  usage += 
amdgpu_vram_mgr_vis_size(adev, block);
7303b39e46b2f5 Michel Dänzer   2018-06-14  237  
7303b39e46b2f5 Michel Dänzer   2018-06-14 @238          return usage;
5e9244ff585239 Michel Dänzer   2018-06-12  239  }
5e9244ff585239 Michel Dänzer   2018-06-12  240  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to