CC: l...@lists.linux.dev
CC: kbuild-...@lists.01.org
BCC: l...@intel.com
CC: Linux Memory Management List <linux...@kvack.org>
TO: "Christian König" <christian.koe...@amd.com>
CC: Alex Deucher <alexander.deuc...@amd.com>
CC: Felix Kuehling <felix.kuehl...@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   6d72dda014a4753974eb08950089ddf71fec4f60
commit: 22f7cc7524081bb2bfb2720e43ab9889e2ed5b00 [2939/13576] drm/amdgpu: 
restructure amdgpu_fill_buffer v2
:::::: branch date: 2 days ago
:::::: commit date: 7 weeks ago
config: riscv-randconfig-c006-20220310 
(https://download.01.org/0day-ci/archive/20220320/202203202242.yzvcezyu-...@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
276ca87382b8f16a65bddac700202924228982f6)
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=22f7cc7524081bb2bfb2720e43ab9889e2ed5b00
        git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 22f7cc7524081bb2bfb2720e43ab9889e2ed5b00
        # save the config file 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 >>)
   drivers/media/cec/core/cec-adap.c:921:2: note: Taking true branch
           if (!data->completed)
           ^
   drivers/media/cec/core/cec-adap.c:922:3: note: Calling 'cec_data_cancel'
                   cec_data_cancel(data, CEC_TX_STATUS_ABORTED);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:378:6: note: Assuming 'data' is equal to 
field 'transmitting'
           if (data->adap->transmitting == data) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:378:2: note: Taking true branch
           if (data->adap->transmitting == data) {
           ^
   drivers/media/cec/core/cec-adap.c:387:6: note: Assuming the condition is true
           if (data->msg.tx_status & CEC_TX_STATUS_OK) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:387:2: note: Taking true branch
           if (data->msg.tx_status & CEC_TX_STATUS_OK) {
           ^
   drivers/media/cec/core/cec-adap.c:401:2: note: Calling 'cec_data_completed'
           cec_data_completed(data);
           ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:344:6: note: Assuming field 'fh' is null
           if (data->fh)
               ^~~~~~~~
   drivers/media/cec/core/cec-adap.c:344:2: note: Taking false branch
           if (data->fh)
           ^
   drivers/media/cec/core/cec-adap.c:347:6: note: Assuming field 'blocking' is 
false
           if (data->blocking) {
               ^~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:347:2: note: Taking false branch
           if (data->blocking) {
           ^
   drivers/media/cec/core/cec-adap.c:359:13: note: Field 'fh' is null
                   if (data->fh)
                             ^
   drivers/media/cec/core/cec-adap.c:359:3: note: Taking false branch
                   if (data->fh)
                   ^
   drivers/media/cec/core/cec-adap.c:361:3: note: Memory is released
                   kfree(data);
                   ^~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:401:2: note: Returning; memory was 
released via 1st parameter
           cec_data_completed(data);
           ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:922:3: note: Returning; memory was 
released via 1st parameter
                   cec_data_cancel(data, CEC_TX_STATUS_ABORTED);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/cec/core/cec-adap.c:925:9: note: Use of memory after it is 
freed
           *msg = data->msg;
                  ^~~~~~~~~
   Suppressed 6 warnings (6 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   9 warnings generated.
   drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c:62:17: warning: Although the value 
stored to 'hdp_clk_cntl1' is used in the enclosing expression, the value is 
never actually read from 'hdp_clk_cntl1' [clang-analyzer-deadcode.DeadStores]
           hdp_clk_cntl = hdp_clk_cntl1 = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL);
                          ^
   drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c:62:17: note: Although the value stored 
to 'hdp_clk_cntl1' is used in the enclosing expression, the value is never 
actually read from 'hdp_clk_cntl1'
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   12 warnings generated.
   drivers/gpu/drm/amd/amdgpu/atom.c:960:2: warning: Value stored to 'dst' is 
never read [clang-analyzer-deadcode.DeadStores]
           dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/atom.c:960:2: note: Value stored to 'dst' is 
never read
           dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/atom.c:979:2: warning: Value stored to 'dst' is 
never read [clang-analyzer-deadcode.DeadStores]
           dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/atom.c:979:2: note: Value stored to 'dst' is 
never read
           dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/atom.c:1386:2: warning: Value stored to 'str_off' 
is never read [clang-analyzer-deadcode.DeadStores]
           str_off = 0;
           ^         ~
   drivers/gpu/drm/amd/amdgpu/atom.c:1386:2: note: Value stored to 'str_off' is 
never read
           str_off = 0;
           ^         ~
   drivers/gpu/drm/amd/amdgpu/atom.c:1409:2: warning: Value stored to 
'off_to_vbios_str' is never read [clang-analyzer-deadcode.DeadStores]
           off_to_vbios_str = 0;
           ^                  ~
   drivers/gpu/drm/amd/amdgpu/atom.c:1409:2: note: Value stored to 
'off_to_vbios_str' is never read
           off_to_vbios_str = 0;
           ^                  ~
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   9 warnings generated.
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2109:2: warning: Undefined or 
>> garbage value returned to caller 
>> [clang-analyzer-core.uninitialized.UndefReturn]
           return r;
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:460:6: note: Assuming field 
'mem_type' is not equal to TTM_PL_TT
           if (new_mem->mem_type == TTM_PL_TT ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:460:6: note: Left side of '||' is 
false
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:461:6: note: Assuming the condition 
is false
               new_mem->mem_type == AMDGPU_PL_PREEMPT) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:460:2: note: Taking false branch
           if (new_mem->mem_type == TTM_PL_TT ||
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:469:19: note: Assuming field 
'pin_count' is <= 0
           if (WARN_ON_ONCE(abo->tbo.pin_count > 0))
                            ^
   include/asm-generic/bug.h:179:41: note: expanded from macro 'WARN_ON_ONCE'
   #define WARN_ON_ONCE(condition) WARN_ON(condition)
                                           ^~~~~~~~~
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:469:2: note: Taking false branch
           if (WARN_ON_ONCE(abo->tbo.pin_count > 0))
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:474:6: note: Assuming field 
'mem_type' is not equal to TTM_PL_SYSTEM
           if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:474:41: note: Left side of '&&' is 
false
           if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
                                                  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:478:15: note: Field 'mem_type' is 
not equal to TTM_PL_SYSTEM
           if (old_mem->mem_type == TTM_PL_SYSTEM &&
                        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:478:41: note: Left side of '&&' is 
false
           if (old_mem->mem_type == TTM_PL_SYSTEM &&
                                                  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:484:7: note: Assuming field 
'mem_type' is not equal to TTM_PL_TT
           if ((old_mem->mem_type == TTM_PL_TT ||
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:484:7: note: Left side of '||' is 
false
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:485:7: note: Assuming the condition 
is false
                old_mem->mem_type == AMDGPU_PL_PREEMPT) &&
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:485:47: note: Left side of '&&' is 
false
                old_mem->mem_type == AMDGPU_PL_PREEMPT) &&
                                                        ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Assuming the condition 
is false
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Left side of '||' is 
false
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:498:6: note: Assuming the condition 
is false
               old_mem->mem_type == AMDGPU_PL_GWS ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Left side of '||' is 
false
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:499:6: note: Assuming the condition 
is false
               old_mem->mem_type == AMDGPU_PL_OA ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Left side of '||' is 
false
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:500:6: note: Assuming the condition 
is false
               new_mem->mem_type == AMDGPU_PL_GDS ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Left side of '||' is 
false
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:501:6: note: Assuming the condition 
is false
               new_mem->mem_type == AMDGPU_PL_GWS ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:6: note: Left side of '||' is 
false
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
               ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:502:6: note: Assuming the condition 
is false
               new_mem->mem_type == AMDGPU_PL_OA) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:497:2: note: Taking false branch
           if (old_mem->mem_type == AMDGPU_PL_GDS ||
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:508:6: note: Assuming field 'type' 
is not equal to ttm_bo_type_device
           if (bo->type == ttm_bo_type_device &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:508:37: note: Left side of '&&' is 
false
           if (bo->type == ttm_bo_type_device &&
                                              ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:517:6: note: Assuming field 
'buffer_funcs_enabled' is true
           if (adev->mman.buffer_funcs_enabled) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:517:2: note: Taking true branch
           if (adev->mman.buffer_funcs_enabled) {
           ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:518:18: note: Field 'mem_type' is 
not equal to TTM_PL_SYSTEM
                   if (((old_mem->mem_type == TTM_PL_SYSTEM &&
                                  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:518:44: note: Left side of '&&' is 
false
                   if (((old_mem->mem_type == TTM_PL_SYSTEM &&
                                                            ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:520:9: note: Assuming field 
'mem_type' is not equal to TTM_PL_VRAM
                        (old_mem->mem_type == TTM_PL_VRAM &&

vim +2109 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

22f7cc7524081b Christian König 2022-01-28  2062  
22f7cc7524081b Christian König 2022-01-28  2063  int amdgpu_fill_buffer(struct 
amdgpu_bo *bo,
22f7cc7524081b Christian König 2022-01-28  2064                         
uint32_t src_data,
22f7cc7524081b Christian König 2022-01-28  2065                         struct 
dma_resv *resv,
22f7cc7524081b Christian König 2022-01-28  2066                         struct 
dma_fence **f)
22f7cc7524081b Christian König 2022-01-28  2067  {
22f7cc7524081b Christian König 2022-01-28  2068         struct amdgpu_device 
*adev = amdgpu_ttm_adev(bo->tbo.bdev);
22f7cc7524081b Christian König 2022-01-28  2069         struct amdgpu_ring 
*ring = adev->mman.buffer_funcs_ring;
22f7cc7524081b Christian König 2022-01-28  2070         struct dma_fence *fence 
= NULL;
22f7cc7524081b Christian König 2022-01-28  2071         struct 
amdgpu_res_cursor dst;
22f7cc7524081b Christian König 2022-01-28  2072         int r;
22f7cc7524081b Christian König 2022-01-28  2073  
22f7cc7524081b Christian König 2022-01-28  2074         if 
(!adev->mman.buffer_funcs_enabled) {
22f7cc7524081b Christian König 2022-01-28  2075                 
DRM_ERROR("Trying to clear memory with ring turned off.\n");
22f7cc7524081b Christian König 2022-01-28  2076                 return -EINVAL;
22f7cc7524081b Christian König 2022-01-28  2077         }
22f7cc7524081b Christian König 2022-01-28  2078  
22f7cc7524081b Christian König 2022-01-28  2079         
amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &dst);
22f7cc7524081b Christian König 2022-01-28  2080  
22f7cc7524081b Christian König 2022-01-28  2081         
mutex_lock(&adev->mman.gtt_window_lock);
22f7cc7524081b Christian König 2022-01-28  2082         while (dst.remaining) {
22f7cc7524081b Christian König 2022-01-28  2083                 struct 
dma_fence *next;
22f7cc7524081b Christian König 2022-01-28  2084                 uint64_t 
cur_size, to;
22f7cc7524081b Christian König 2022-01-28  2085  
22f7cc7524081b Christian König 2022-01-28  2086                 /* Never fill 
more than 256MiB at once to avoid timeouts */
22f7cc7524081b Christian König 2022-01-28  2087                 cur_size = 
min(dst.size, 256ULL << 20);
22f7cc7524081b Christian König 2022-01-28  2088  
22f7cc7524081b Christian König 2022-01-28  2089                 r = 
amdgpu_ttm_map_buffer(&bo->tbo, bo->tbo.resource, &dst,
22f7cc7524081b Christian König 2022-01-28  2090                                 
          1, ring, false, &cur_size, &to);
22f7cc7524081b Christian König 2022-01-28  2091                 if (r)
22f7cc7524081b Christian König 2022-01-28  2092                         goto 
error;
22f7cc7524081b Christian König 2022-01-28  2093  
22f7cc7524081b Christian König 2022-01-28  2094                 r = 
amdgpu_ttm_fill_mem(ring, src_data, to, cur_size, resv,
22f7cc7524081b Christian König 2022-01-28  2095                                 
        &next, true);
22f7cc7524081b Christian König 2022-01-28  2096                 if (r)
22f7cc7524081b Christian König 2022-01-28  2097                         goto 
error;
22f7cc7524081b Christian König 2022-01-28  2098  
22f7cc7524081b Christian König 2022-01-28  2099                 
dma_fence_put(fence);
22f7cc7524081b Christian König 2022-01-28  2100                 fence = next;
22f7cc7524081b Christian König 2022-01-28  2101  
22f7cc7524081b Christian König 2022-01-28  2102                 
amdgpu_res_next(&dst, cur_size);
22f7cc7524081b Christian König 2022-01-28  2103         }
22f7cc7524081b Christian König 2022-01-28  2104  error:
22f7cc7524081b Christian König 2022-01-28  2105         
mutex_unlock(&adev->mman.gtt_window_lock);
22f7cc7524081b Christian König 2022-01-28  2106         if (f)
22f7cc7524081b Christian König 2022-01-28  2107                 *f = 
dma_fence_get(fence);
22f7cc7524081b Christian König 2022-01-28  2108         dma_fence_put(fence);
59b4a97742888d Flora Cui       2016-07-19 @2109         return r;
59b4a97742888d Flora Cui       2016-07-19  2110  }
59b4a97742888d Flora Cui       2016-07-19  2111  

:::::: The code at line 2109 was first introduced by commit
:::::: 59b4a97742888d9d3c4daa96bd15157ebd496f81 drm/amdgpu: implement 
amdgpu_fill_buffer()

:::::: TO: Flora Cui <flora....@amd.com>
:::::: CC: Alex Deucher <alexander.deuc...@amd.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to