* [thomash:topic/ttm_branch_v3 8/14] drivers/gpu/drm/ttm/ttm_bo.c:582 ttm_bo_evict_swapout_allowable() warn: variable dereferenced before check 'locked' (see line 570)
@ 2021-05-20 18:20 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-05-20 18:05 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4221 bytes --]
CC: kbuild-all(a)lists.01.org
TO: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
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
:::::: branch date: 27 hours ago
:::::: commit date: 29 hours ago
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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@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
a2ab19fed9d1dc Christian König 2016-08-30 548
108cfddf00d1cb Lee Jones 2020-11-16 549 /*
d5769ba315d8ff Roger He 2017-12-21 550 * Check the target bo is allowable to be evicted or swapout, including cases:
d5769ba315d8ff Roger He 2017-12-21 551 *
d5769ba315d8ff Roger He 2017-12-21 552 * a. if share same reservation object with ctx->resv, have assumption
d5769ba315d8ff Roger He 2017-12-21 553 * reservation objects should already be locked, so not lock again and
d5769ba315d8ff Roger He 2017-12-21 554 * return true directly when either the opreation allow_reserved_eviction
d5769ba315d8ff Roger He 2017-12-21 555 * or the target bo already is in delayed free list;
d5769ba315d8ff Roger He 2017-12-21 556 *
d5769ba315d8ff Roger He 2017-12-21 557 * b. Otherwise, trylock it.
d5769ba315d8ff Roger He 2017-12-21 558 */
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)
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 }
d5769ba315d8ff Roger He 2017-12-21 588
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27637 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [thomash:topic/ttm_branch_v3 8/14] drivers/gpu/drm/ttm/ttm_bo.c:582 ttm_bo_evict_swapout_allowable() warn: variable dereferenced before check 'locked' (see line 570)
@ 2021-05-20 18:20 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-05-20 18:20 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3100 bytes --]
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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@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(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [thomash:topic/ttm_branch_v3 8/14] drivers/gpu/drm/ttm/ttm_bo.c:582 ttm_bo_evict_swapout_allowable() warn: variable dereferenced before check 'locked' (see line 570)
2021-05-20 18:20 ` Dan Carpenter
(?)
@ 2021-05-20 18:35 ` Thomas Hellström
-1 siblings, 0 replies; 3+ messages in thread
From: Thomas Hellström @ 2021-05-20 18:35 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]
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@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@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(a)lists.01.org
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-20 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 18:05 [thomash:topic/ttm_branch_v3 8/14] drivers/gpu/drm/ttm/ttm_bo.c:582 ttm_bo_evict_swapout_allowable() warn: variable dereferenced before check 'locked' (see line 570) kernel test robot
2021-05-20 18:20 ` Dan Carpenter
2021-05-20 18:35 ` Thomas Hellström
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.