Hi, Dan,
Thanks for reporting. That was reported by Maaren Lankhorst a couple of
days ago.
/Thomas
On 5/20/21 8:20 PM, Dan Carpenter wrote:
> tree:
git://people.freedesktop.org/~thomash/linux topic/ttm_branch_v3
> head: ed0bde777934916c30fbecb2b351f549eb3a0d0f
> commit: dd4d9fc44dbd04b20f2f3a8d7d2512cf271ebe8a [8/14] drm/ttm, drm/amdgpu: Allow
the driver some control over swapping
> config: x86_64-randconfig-m001-20210520 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp(a)intel.com>
> Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
>
> New smatch warnings:
> drivers/gpu/drm/ttm/ttm_bo.c:582 ttm_bo_evict_swapout_allowable() warn: variable
dereferenced before check 'locked' (see line 570)
>
> Old smatch warnings:
> drivers/gpu/drm/ttm/ttm_bo.c:687 ttm_mem_evict_first() warn: inconsistent returns
'&bdev->lru_lock'.
>
> vim +/locked +582 drivers/gpu/drm/ttm/ttm_bo.c
>
> d5769ba315d8ff Roger He 2017-12-21 559 static bool
ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 560 struct ttm_operation_ctx
*ctx,
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 561 const struct ttm_place
*place,
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 562 bool *locked, bool *busy)
> d5769ba315d8ff Roger He 2017-12-21 563 {
> d5769ba315d8ff Roger He 2017-12-21 564 bool ret = false;
> d5769ba315d8ff Roger He 2017-12-21 565
> e532a135d7044b Gerd Hoffmann 2019-08-05 566 if (bo->base.resv ==
ctx->resv) {
> 52791eeec1d9f4 Christian König 2019-08-11 567
dma_resv_assert_held(bo->base.resv);
> c44dfe4de05391 Christian König 2020-11-02 568 if (ctx->allow_res_evict)
> d5769ba315d8ff Roger He 2017-12-21 569 ret = true;
> d367bd2a5e2b12 Christian König 2019-05-22 @570 *locked = false;
> d367bd2a5e2b12 Christian König 2019-05-22 571 if (busy)
> d367bd2a5e2b12 Christian König 2019-05-22 572 *busy = false;
> d5769ba315d8ff Roger He 2017-12-21 573 } else {
> 52791eeec1d9f4 Christian König 2019-08-11 574 ret =
dma_resv_trylock(bo->base.resv);
> d367bd2a5e2b12 Christian König 2019-05-22 575 *locked = ret;
> d367bd2a5e2b12 Christian König 2019-05-22 576 if (busy)
> d367bd2a5e2b12 Christian König 2019-05-22 577 *busy = !ret;
> d5769ba315d8ff Roger He 2017-12-21 578 }
> d5769ba315d8ff Roger He 2017-12-21 579
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 580 if (ret && place &&
!bo->bdev->funcs->eviction_valuable(bo, place)) {
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 581 ret = false;
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 @582 if (locked)
>
> It should be "if (*locked)"
>
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 583
dma_resv_unlock(bo->base.resv);
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 584 }
> dd4d9fc44dbd04 Thomas Hellström 2021-05-17 585
> d5769ba315d8ff Roger He 2017-12-21 586 return ret;
> d5769ba315d8ff Roger He 2017-12-21 587 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
>
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>