* drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
@ 2025-04-02 7:23 kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-04-02 7:23 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: "Maíra Canal" <mcanal@igalia.com>
CC: Melissa Wen <mwen@igalia.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
date: 2 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 2 months ago
config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
cdec4d3613230f Eric Anholt 2017-04-12 581
cdec4d3613230f Eric Anholt 2017-04-12 582 /* Takes the reservation lock on all the BOs being referenced, so that
cdec4d3613230f Eric Anholt 2017-04-12 583 * at queue submit time we can update the reservations.
cdec4d3613230f Eric Anholt 2017-04-12 584 *
cdec4d3613230f Eric Anholt 2017-04-12 585 * We don't lock the RCL the tile alloc/state BOs, or overflow memory
cdec4d3613230f Eric Anholt 2017-04-12 586 * (all of which are on exec->unref_list). They're entirely private
cdec4d3613230f Eric Anholt 2017-04-12 587 * to vc4, so we don't attach dma-buf fences to them.
cdec4d3613230f Eric Anholt 2017-04-12 588 */
cdec4d3613230f Eric Anholt 2017-04-12 589 static int
04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
cdec4d3613230f Eric Anholt 2017-04-12 592 {
04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
cdec4d3613230f Eric Anholt 2017-04-12 594
cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
cdec4d3613230f Eric Anholt 2017-04-12 597 */
04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
04630796c437a9 Maíra Canal 2024-12-20 602 }
cdec4d3613230f Eric Anholt 2017-04-12 603
cdec4d3613230f Eric Anholt 2017-04-12 @604 if (ret) {
04630796c437a9 Maíra Canal 2024-12-20 605 drm_exec_fini(exec_ctx);
cdec4d3613230f Eric Anholt 2017-04-12 606 return ret;
7edabee06a5622 Eric Anholt 2016-09-27 607 }
d5b1a78a772f1e Eric Anholt 2015-11-30 608
cdec4d3613230f Eric Anholt 2017-04-12 609 return 0;
cdec4d3613230f Eric Anholt 2017-04-12 610 }
cdec4d3613230f Eric Anholt 2017-04-12 611
:::::: The code at line 604 was first introduced by commit
:::::: cdec4d3613230fc15723fae206cb17825b914cee drm/vc4: Expose dma-buf fences for V3D rendering.
:::::: TO: Eric Anholt <eric@anholt.net>
:::::: CC: Eric Anholt <eric@anholt.net>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
@ 2025-04-02 8:43 Dan Carpenter
2025-04-09 19:49 ` Maíra Canal
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-04-02 8:43 UTC (permalink / raw)
To: oe-kbuild, Maíra Canal; +Cc: lkp, oe-kbuild-all, linux-kernel, Melissa Wen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
date: 2 months ago
config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
cdec4d3613230f Eric Anholt 2017-04-12 589 static int
04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
cdec4d3613230f Eric Anholt 2017-04-12 592 {
04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
cdec4d3613230f Eric Anholt 2017-04-12 594
cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
cdec4d3613230f Eric Anholt 2017-04-12 597 */
04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
This is a false positive in Smatch. I can silence the warning on my
end easily enough to say that we always enter the drm_exec_until_all_locked()
loop. But the question is why do we only test the last "ret" instead of
testing all of them?
04630796c437a9 Maíra Canal 2024-12-20 602 }
cdec4d3613230f Eric Anholt 2017-04-12 603
cdec4d3613230f Eric Anholt 2017-04-12 @604 if (ret) {
04630796c437a9 Maíra Canal 2024-12-20 605 drm_exec_fini(exec_ctx);
cdec4d3613230f Eric Anholt 2017-04-12 606 return ret;
7edabee06a5622 Eric Anholt 2016-09-27 607 }
d5b1a78a772f1e Eric Anholt 2015-11-30 608
cdec4d3613230f Eric Anholt 2017-04-12 609 return 0;
cdec4d3613230f Eric Anholt 2017-04-12 610 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
2025-04-02 8:43 Dan Carpenter
@ 2025-04-09 19:49 ` Maíra Canal
2025-04-10 9:27 ` Christian König
0 siblings, 1 reply; 6+ messages in thread
From: Maíra Canal @ 2025-04-09 19:49 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild, Christian König
Cc: lkp, oe-kbuild-all, linux-kernel, Melissa Wen
+ König
Hi Dan,
On 02/04/25 05:43, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
> commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
> date: 2 months ago
> config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
>
> smatch warnings:
> drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
>
> vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
>
> cdec4d3613230f Eric Anholt 2017-04-12 589 static int
> 04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
> 04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
> cdec4d3613230f Eric Anholt 2017-04-12 592 {
> 04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
> cdec4d3613230f Eric Anholt 2017-04-12 594
> cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
> cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
> cdec4d3613230f Eric Anholt 2017-04-12 597 */
> 04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
> 04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
> 04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
> 04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
>
> This is a false positive in Smatch. I can silence the warning on my
> end easily enough to say that we always enter the drm_exec_until_all_locked()
> loop. But the question is why do we only test the last "ret" instead of
> testing all of them?
AFAIU `drm_exec_until_all_locked` will loop until all GEM objects are
locked and no more contention exists. As we have a single operation
inside the loop, we don't need to check "ret" for every iteration.
I believe Christian will possibly give you a more precise answer as he
designed the API.
Best Regards,
- Maíra
>
> 04630796c437a9 Maíra Canal 2024-12-20 602 }
> cdec4d3613230f Eric Anholt 2017-04-12 603
> cdec4d3613230f Eric Anholt 2017-04-12 @604 if (ret) {
> 04630796c437a9 Maíra Canal 2024-12-20 605 drm_exec_fini(exec_ctx);
> cdec4d3613230f Eric Anholt 2017-04-12 606 return ret;
> 7edabee06a5622 Eric Anholt 2016-09-27 607 }
> d5b1a78a772f1e Eric Anholt 2015-11-30 608
> cdec4d3613230f Eric Anholt 2017-04-12 609 return 0;
> cdec4d3613230f Eric Anholt 2017-04-12 610 }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
2025-04-09 19:49 ` Maíra Canal
@ 2025-04-10 9:27 ` Christian König
2025-04-10 9:57 ` Dan Carpenter
0 siblings, 1 reply; 6+ messages in thread
From: Christian König @ 2025-04-10 9:27 UTC (permalink / raw)
To: Maíra Canal, Dan Carpenter, oe-kbuild
Cc: lkp, oe-kbuild-all, linux-kernel, Melissa Wen
Hi Maira,
Am 09.04.25 um 21:49 schrieb Maíra Canal:
> + König
>
> Hi Dan,
>
> On 02/04/25 05:43, Dan Carpenter wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
>> commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
>> date: 2 months ago
>> config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
>> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> | Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
>>
>> smatch warnings:
>> drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
>>
>> vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
>>
>> cdec4d3613230f Eric Anholt 2017-04-12 589 static int
>> 04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
>> 04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
>> cdec4d3613230f Eric Anholt 2017-04-12 592 {
>> 04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
>> cdec4d3613230f Eric Anholt 2017-04-12 594
>> cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
>> cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
>> cdec4d3613230f Eric Anholt 2017-04-12 597 */
>> 04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
>> 04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
>> 04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
>> 04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
>>
>> This is a false positive in Smatch. I can silence the warning on my
>> end easily enough to say that we always enter the drm_exec_until_all_locked()
>> loop. But the question is why do we only test the last "ret" instead of
>> testing all of them?
>
> AFAIU `drm_exec_until_all_locked` will loop until all GEM objects are
> locked and no more contention exists. As we have a single operation
> inside the loop, we don't need to check "ret" for every iteration.
>
> I believe Christian will possibly give you a more precise answer as he
> designed the API.
Yeah that explanation is absolutely correct.
The drm_exec_until_all_locked() helper loops until all contention is resolved and all buffer locked.
You could avoid the snatch warning if you move the error handling into the loop, e.g. something like this here:
drm_exec_until_all_locked(exec_ctx) {
ret = drm_exec_prepare_array(exec_ctx, exec->bo, exec->bo_count, 1);
drm_exec_continue_on_contention(exec_ctx);
if (ret) {
drm_exec_fini(exec_ctx);
return ret;
}
}
Regards,
Christian.
>
> Best Regards,
> - Maíra
>
>>
>> 04630796c437a9 Maíra Canal 2024-12-20 602 }
>> cdec4d3613230f Eric Anholt 2017-04-12 603
>> cdec4d3613230f Eric Anholt 2017-04-12 @604 if (ret) {
>> 04630796c437a9 Maíra Canal 2024-12-20 605 drm_exec_fini(exec_ctx);
>> cdec4d3613230f Eric Anholt 2017-04-12 606 return ret;
>> 7edabee06a5622 Eric Anholt 2016-09-27 607 }
>> d5b1a78a772f1e Eric Anholt 2015-11-30 608
>> cdec4d3613230f Eric Anholt 2017-04-12 609 return 0;
>> cdec4d3613230f Eric Anholt 2017-04-12 610 }
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
2025-04-10 9:27 ` Christian König
@ 2025-04-10 9:57 ` Dan Carpenter
2025-04-10 10:59 ` Maíra Canal
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-04-10 9:57 UTC (permalink / raw)
To: Christian König
Cc: Maíra Canal, oe-kbuild, lkp, oe-kbuild-all, linux-kernel,
Melissa Wen
On Thu, Apr 10, 2025 at 11:27:43AM +0200, Christian König wrote:
> Hi Maira,
>
> Am 09.04.25 um 21:49 schrieb Maíra Canal:
> > + König
> >
> > Hi Dan,
> >
> > On 02/04/25 05:43, Dan Carpenter wrote:
> >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> >> head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
> >> commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
> >> date: 2 months ago
> >> config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
> >> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
> >>
> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> >> the same patch/commit), kindly add following tags
> >> | Reported-by: kernel test robot <lkp@intel.com>
> >> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> >> | Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
> >>
> >> smatch warnings:
> >> drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
> >>
> >> vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
> >>
> >> cdec4d3613230f Eric Anholt 2017-04-12 589 static int
> >> 04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
> >> 04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
> >> cdec4d3613230f Eric Anholt 2017-04-12 592 {
> >> 04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
> >> cdec4d3613230f Eric Anholt 2017-04-12 594
> >> cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
> >> cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
> >> cdec4d3613230f Eric Anholt 2017-04-12 597 */
> >> 04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
> >> 04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
> >> 04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
> >> 04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
> >>
> >> This is a false positive in Smatch. I can silence the warning on my
> >> end easily enough to say that we always enter the drm_exec_until_all_locked()
> >> loop. But the question is why do we only test the last "ret" instead of
> >> testing all of them?
> >
> > AFAIU `drm_exec_until_all_locked` will loop until all GEM objects are
> > locked and no more contention exists. As we have a single operation
> > inside the loop, we don't need to check "ret" for every iteration.
> >
> > I believe Christian will possibly give you a more precise answer as he
> > designed the API.
>
> Yeah that explanation is absolutely correct.
>
> The drm_exec_until_all_locked() helper loops until all contention is resolved and all buffer locked.
>
> You could avoid the snatch warning if you move the error handling into the loop, e.g. something like this here:
>
> drm_exec_until_all_locked(exec_ctx) {
> ret = drm_exec_prepare_array(exec_ctx, exec->bo, exec->bo_count, 1);
> drm_exec_continue_on_contention(exec_ctx);
> if (ret) {
> drm_exec_fini(exec_ctx);
> return ret;
> }
> }
>
Don't worry about silencing it. I already silenced it in Smatch a couple
days ago.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
2025-04-10 9:57 ` Dan Carpenter
@ 2025-04-10 10:59 ` Maíra Canal
0 siblings, 0 replies; 6+ messages in thread
From: Maíra Canal @ 2025-04-10 10:59 UTC (permalink / raw)
To: Dan Carpenter, Christian König
Cc: oe-kbuild, lkp, oe-kbuild-all, linux-kernel, Melissa Wen
Hi Dan,
On 10/04/25 06:57, Dan Carpenter wrote:
> On Thu, Apr 10, 2025 at 11:27:43AM +0200, Christian König wrote:
>> Hi Maira,
>>
>> Am 09.04.25 um 21:49 schrieb Maíra Canal:
>>> + König
>>>
>>> Hi Dan,
>>>
>>> On 02/04/25 05:43, Dan Carpenter wrote:
>>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>> head: acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1
>>>> commit: 04630796c437a9285643097825cbd3cd06603f47 drm/vc4: Use DRM Execution Contexts
>>>> date: 2 months ago
>>>> config: arm64-randconfig-r073-20250402 (https://download.01.org/0day-ci/archive/20250402/202504021500.3AM1hKKS-lkp@intel.com/config)
>>>> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
>>>>
>>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>>> the same patch/commit), kindly add following tags
>>>> | Reported-by: kernel test robot <lkp@intel.com>
>>>> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>>>> | Closes: https://lore.kernel.org/r/202504021500.3AM1hKKS-lkp@intel.com/
>>>>
>>>> smatch warnings:
>>>> drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret'.
>>>>
>>>> vim +/ret +604 drivers/gpu/drm/vc4/vc4_gem.c
>>>>
>>>> cdec4d3613230f Eric Anholt 2017-04-12 589 static int
>>>> 04630796c437a9 Maíra Canal 2024-12-20 590 vc4_lock_bo_reservations(struct vc4_exec_info *exec,
>>>> 04630796c437a9 Maíra Canal 2024-12-20 591 struct drm_exec *exec_ctx)
>>>> cdec4d3613230f Eric Anholt 2017-04-12 592 {
>>>> 04630796c437a9 Maíra Canal 2024-12-20 593 int ret;
>>>> cdec4d3613230f Eric Anholt 2017-04-12 594
>>>> cdec4d3613230f Eric Anholt 2017-04-12 595 /* Reserve space for our shared (read-only) fence references,
>>>> cdec4d3613230f Eric Anholt 2017-04-12 596 * before we commit the CL to the hardware.
>>>> cdec4d3613230f Eric Anholt 2017-04-12 597 */
>>>> 04630796c437a9 Maíra Canal 2024-12-20 598 drm_exec_init(exec_ctx, DRM_EXEC_INTERRUPTIBLE_WAIT, exec->bo_count);
>>>> 04630796c437a9 Maíra Canal 2024-12-20 599 drm_exec_until_all_locked(exec_ctx) {
>>>> 04630796c437a9 Maíra Canal 2024-12-20 600 ret = drm_exec_prepare_array(exec_ctx, exec->bo,
>>>> 04630796c437a9 Maíra Canal 2024-12-20 601 exec->bo_count, 1);
>>>>
>>>> This is a false positive in Smatch. I can silence the warning on my
>>>> end easily enough to say that we always enter the drm_exec_until_all_locked()
>>>> loop. But the question is why do we only test the last "ret" instead of
>>>> testing all of them?
>>>
>>> AFAIU `drm_exec_until_all_locked` will loop until all GEM objects are
>>> locked and no more contention exists. As we have a single operation
>>> inside the loop, we don't need to check "ret" for every iteration.
>>>
>>> I believe Christian will possibly give you a more precise answer as he
>>> designed the API.
>>
>> Yeah that explanation is absolutely correct.
>>
>> The drm_exec_until_all_locked() helper loops until all contention is resolved and all buffer locked.
>>
>> You could avoid the snatch warning if you move the error handling into the loop, e.g. something like this here:
>>
>> drm_exec_until_all_locked(exec_ctx) {
>> ret = drm_exec_prepare_array(exec_ctx, exec->bo, exec->bo_count, 1);
>> drm_exec_continue_on_contention(exec_ctx);
>> if (ret) {
>> drm_exec_fini(exec_ctx);
>> return ret;
>> }
>> }
>>
>
> Don't worry about silencing it. I already silenced it in Smatch a couple
> days ago.
Thanks for silencing the warning!
Best Regards,
- Maíra
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-04-10 10:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 7:23 drivers/gpu/drm/vc4/vc4_gem.c:604 vc4_lock_bo_reservations() error: uninitialized symbol 'ret' kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2025-04-02 8:43 Dan Carpenter
2025-04-09 19:49 ` Maíra Canal
2025-04-10 9:27 ` Christian König
2025-04-10 9:57 ` Dan Carpenter
2025-04-10 10:59 ` Maíra Canal
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.