public inbox for oe-kbuild@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [android-common:android14-kiwi-6.1 38/38] drivers/gpu/drm/etnaviv/etnaviv_sched.c:66 etnaviv_sched_timedout_job() warn: variable dereferenced before check 'sched_job' (see line 37)
Date: Sat, 11 Apr 2026 01:30:45 +0800	[thread overview]
Message-ID: <202604110106.aMi7vRva-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android14-kiwi-6.1
head:   831eddf6244dd5478d58b2f2f83a856781ba030b
commit: f503efe2c5da084dc5ee2db38409f7a7e4f1bc1e [38/38] drm/etnaviv: Protect the scheduler's pending list with its lock
:::::: branch date: 22 hours ago
:::::: commit date: 9 months ago
config: i386-randconfig-141-20260410 (https://download.01.org/0day-ci/archive/20260411/202604110106.aMi7vRva-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
smatch: v0.5.0-9004-gb810ac53

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/202604110106.aMi7vRva-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/etnaviv/etnaviv_sched.c:66 etnaviv_sched_timedout_job() warn: variable dereferenced before check 'sched_job' (see line 37)

vim +/sched_job +66 drivers/gpu/drm/etnaviv/etnaviv_sched.c

e93b6deeb45a78 Lucas Stach       2017-12-04  32  
a6a1f036c74e3d Luben Tuikov      2021-01-20  33  static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
a6a1f036c74e3d Luben Tuikov      2021-01-20  34  							  *sched_job)
e93b6deeb45a78 Lucas Stach       2017-12-04  35  {
6d7a20c0776036 Lucas Stach       2017-12-06  36  	struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
f503efe2c5da08 Maíra Canal       2025-06-02 @37  	struct drm_gpu_scheduler *sched = sched_job->sched;
6d7a20c0776036 Lucas Stach       2017-12-06  38  	struct etnaviv_gpu *gpu = submit->gpu;
2c83a726d6fbb5 Lucas Stach       2018-06-27  39  	u32 dma_addr;
2c83a726d6fbb5 Lucas Stach       2018-06-27  40  	int change;
2c83a726d6fbb5 Lucas Stach       2018-06-27  41  
2c83a726d6fbb5 Lucas Stach       2018-06-27  42  	/*
2c83a726d6fbb5 Lucas Stach       2018-06-27  43  	 * If the GPU managed to complete this jobs fence, the timout is
2c83a726d6fbb5 Lucas Stach       2018-06-27  44  	 * spurious. Bail out.
2c83a726d6fbb5 Lucas Stach       2018-06-27  45  	 */
6fce3a406108ee Lucas Stach       2018-10-04  46  	if (dma_fence_is_signaled(submit->out_fence))
50248a3ec0f5e5 Lucas Stach       2020-08-24  47  		goto out_no_timeout;
2c83a726d6fbb5 Lucas Stach       2018-06-27  48  
2c83a726d6fbb5 Lucas Stach       2018-06-27  49  	/*
2c83a726d6fbb5 Lucas Stach       2018-06-27  50  	 * If the GPU is still making forward progress on the front-end (which
2c83a726d6fbb5 Lucas Stach       2018-06-27  51  	 * should never loop) we shift out the timeout to give it a chance to
2c83a726d6fbb5 Lucas Stach       2018-06-27  52  	 * finish the job.
2c83a726d6fbb5 Lucas Stach       2018-06-27  53  	 */
2c83a726d6fbb5 Lucas Stach       2018-06-27  54  	dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
2c83a726d6fbb5 Lucas Stach       2018-06-27  55  	change = dma_addr - gpu->hangcheck_dma_addr;
cdd156955f946b Lucas Stach       2021-12-22  56  	if (gpu->completed_fence != gpu->hangcheck_fence ||
cdd156955f946b Lucas Stach       2021-12-22  57  	    change < 0 || change > 16) {
2c83a726d6fbb5 Lucas Stach       2018-06-27  58  		gpu->hangcheck_dma_addr = dma_addr;
cdd156955f946b Lucas Stach       2021-12-22  59  		gpu->hangcheck_fence = gpu->completed_fence;
50248a3ec0f5e5 Lucas Stach       2020-08-24  60  		goto out_no_timeout;
2c83a726d6fbb5 Lucas Stach       2018-06-27  61  	}
6d7a20c0776036 Lucas Stach       2017-12-06  62  
2dd415c2e34c5a Lucas Stach       2024-06-21  63  	/* block scheduler */
2dd415c2e34c5a Lucas Stach       2024-06-21  64  	drm_sched_stop(&gpu->sched, sched_job);
2dd415c2e34c5a Lucas Stach       2024-06-21  65  
222b5f04415987 Andrey Grodzovsky 2018-12-04 @66  	if(sched_job)
222b5f04415987 Andrey Grodzovsky 2018-12-04  67  		drm_sched_increase_karma(sched_job);
6d7a20c0776036 Lucas Stach       2017-12-06  68  
6d7a20c0776036 Lucas Stach       2017-12-06  69  	/* get the GPU back into the init state */
9a1fdae5876016 Lucas Stach       2019-08-09  70  	etnaviv_core_dump(submit);
6d7a20c0776036 Lucas Stach       2017-12-06  71  	etnaviv_gpu_recover_hang(gpu);
6d7a20c0776036 Lucas Stach       2017-12-06  72  
222b5f04415987 Andrey Grodzovsky 2018-12-04  73  	drm_sched_resubmit_jobs(&gpu->sched);
222b5f04415987 Andrey Grodzovsky 2018-12-04  74  
a6a1f036c74e3d Luben Tuikov      2021-01-20  75  	drm_sched_start(&gpu->sched, true);
a6a1f036c74e3d Luben Tuikov      2021-01-20  76  	return DRM_GPU_SCHED_STAT_NOMINAL;
a6a1f036c74e3d Luben Tuikov      2021-01-20  77  
50248a3ec0f5e5 Lucas Stach       2020-08-24  78  out_no_timeout:
f503efe2c5da08 Maíra Canal       2025-06-02  79  	spin_lock(&sched->job_list_lock);
f503efe2c5da08 Maíra Canal       2025-06-02  80  	list_add(&sched_job->list, &sched->pending_list);
f503efe2c5da08 Maíra Canal       2025-06-02  81  	spin_unlock(&sched->job_list_lock);
a6a1f036c74e3d Luben Tuikov      2021-01-20  82  	return DRM_GPU_SCHED_STAT_NOMINAL;
e93b6deeb45a78 Lucas Stach       2017-12-04  83  }
e93b6deeb45a78 Lucas Stach       2017-12-04  84  

:::::: The code at line 66 was first introduced by commit
:::::: 222b5f044159877504dbac9bc1910f89a74136e2 drm/sched: Refactor ring mirror list handling.

:::::: TO: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
:::::: CC: Alex Deucher <alexander.deucher@amd.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, cros-kernel-buildreports@googlegroups.com
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: [android-common:android14-kiwi-6.1 38/38] drivers/gpu/drm/etnaviv/etnaviv_sched.c:66 etnaviv_sched_timedout_job() warn: variable dereferenced before check 'sched_job' (see line 37)
Date: Fri, 10 Apr 2026 21:05:39 +0300	[thread overview]
Message-ID: <202604110106.aMi7vRva-lkp@intel.com> (raw)
Message-ID: <20260410180539.l0kIhLoIErDG0klS_ysdPAEi_baOuLFs5QJcIQ3ozUE@z> (raw)

tree:   https://android.googlesource.com/kernel/common android14-kiwi-6.1
head:   831eddf6244dd5478d58b2f2f83a856781ba030b
commit: f503efe2c5da084dc5ee2db38409f7a7e4f1bc1e [38/38] drm/etnaviv: Protect the scheduler's pending list with its lock
config: i386-randconfig-141-20260410 (https://download.01.org/0day-ci/archive/20260411/202604110106.aMi7vRva-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
smatch: v0.5.0-9004-gb810ac53

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/202604110106.aMi7vRva-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/etnaviv/etnaviv_sched.c:66 etnaviv_sched_timedout_job() warn: variable dereferenced before check 'sched_job' (see line 37)

vim +/sched_job +66 drivers/gpu/drm/etnaviv/etnaviv_sched.c
e93b6deeb45a78 Lucas Stach       2017-12-04  32  
a6a1f036c74e3d Luben Tuikov      2021-01-20  33  static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
a6a1f036c74e3d Luben Tuikov      2021-01-20  34  							  *sched_job)
e93b6deeb45a78 Lucas Stach       2017-12-04  35  {
6d7a20c0776036 Lucas Stach       2017-12-06  36  	struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
f503efe2c5da08 Maíra Canal       2025-06-02 @37  	struct drm_gpu_scheduler *sched = sched_job->sched;
                                                                                          ^^^^^^^^^^^^^^^^
Dereferenced.

6d7a20c0776036 Lucas Stach       2017-12-06  38  	struct etnaviv_gpu *gpu = submit->gpu;
2c83a726d6fbb5 Lucas Stach       2018-06-27  39  	u32 dma_addr;
2c83a726d6fbb5 Lucas Stach       2018-06-27  40  	int change;
2c83a726d6fbb5 Lucas Stach       2018-06-27  41  
2c83a726d6fbb5 Lucas Stach       2018-06-27  42  	/*
2c83a726d6fbb5 Lucas Stach       2018-06-27  43  	 * If the GPU managed to complete this jobs fence, the timout is
2c83a726d6fbb5 Lucas Stach       2018-06-27  44  	 * spurious. Bail out.
2c83a726d6fbb5 Lucas Stach       2018-06-27  45  	 */
6fce3a406108ee Lucas Stach       2018-10-04  46  	if (dma_fence_is_signaled(submit->out_fence))
50248a3ec0f5e5 Lucas Stach       2020-08-24  47  		goto out_no_timeout;
2c83a726d6fbb5 Lucas Stach       2018-06-27  48  
2c83a726d6fbb5 Lucas Stach       2018-06-27  49  	/*
2c83a726d6fbb5 Lucas Stach       2018-06-27  50  	 * If the GPU is still making forward progress on the front-end (which
2c83a726d6fbb5 Lucas Stach       2018-06-27  51  	 * should never loop) we shift out the timeout to give it a chance to
2c83a726d6fbb5 Lucas Stach       2018-06-27  52  	 * finish the job.
2c83a726d6fbb5 Lucas Stach       2018-06-27  53  	 */
2c83a726d6fbb5 Lucas Stach       2018-06-27  54  	dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
2c83a726d6fbb5 Lucas Stach       2018-06-27  55  	change = dma_addr - gpu->hangcheck_dma_addr;
cdd156955f946b Lucas Stach       2021-12-22  56  	if (gpu->completed_fence != gpu->hangcheck_fence ||
cdd156955f946b Lucas Stach       2021-12-22  57  	    change < 0 || change > 16) {
2c83a726d6fbb5 Lucas Stach       2018-06-27  58  		gpu->hangcheck_dma_addr = dma_addr;
cdd156955f946b Lucas Stach       2021-12-22  59  		gpu->hangcheck_fence = gpu->completed_fence;
50248a3ec0f5e5 Lucas Stach       2020-08-24  60  		goto out_no_timeout;
2c83a726d6fbb5 Lucas Stach       2018-06-27  61  	}
6d7a20c0776036 Lucas Stach       2017-12-06  62  
2dd415c2e34c5a Lucas Stach       2024-06-21  63  	/* block scheduler */
2dd415c2e34c5a Lucas Stach       2024-06-21  64  	drm_sched_stop(&gpu->sched, sched_job);
2dd415c2e34c5a Lucas Stach       2024-06-21  65  
222b5f04415987 Andrey Grodzovsky 2018-12-04 @66  	if(sched_job)
                                                           ^^^^^^^^^
Checked too late.  Probably just delete this check.

222b5f04415987 Andrey Grodzovsky 2018-12-04  67  		drm_sched_increase_karma(sched_job);
6d7a20c0776036 Lucas Stach       2017-12-06  68  
6d7a20c0776036 Lucas Stach       2017-12-06  69  	/* get the GPU back into the init state */
9a1fdae5876016 Lucas Stach       2019-08-09  70  	etnaviv_core_dump(submit);
6d7a20c0776036 Lucas Stach       2017-12-06  71  	etnaviv_gpu_recover_hang(gpu);
6d7a20c0776036 Lucas Stach       2017-12-06  72  
222b5f04415987 Andrey Grodzovsky 2018-12-04  73  	drm_sched_resubmit_jobs(&gpu->sched);
222b5f04415987 Andrey Grodzovsky 2018-12-04  74  
a6a1f036c74e3d Luben Tuikov      2021-01-20  75  	drm_sched_start(&gpu->sched, true);
a6a1f036c74e3d Luben Tuikov      2021-01-20  76  	return DRM_GPU_SCHED_STAT_NOMINAL;
a6a1f036c74e3d Luben Tuikov      2021-01-20  77  
50248a3ec0f5e5 Lucas Stach       2020-08-24  78  out_no_timeout:
f503efe2c5da08 Maíra Canal       2025-06-02  79  	spin_lock(&sched->job_list_lock);
f503efe2c5da08 Maíra Canal       2025-06-02  80  	list_add(&sched_job->list, &sched->pending_list);
f503efe2c5da08 Maíra Canal       2025-06-02  81  	spin_unlock(&sched->job_list_lock);
a6a1f036c74e3d Luben Tuikov      2021-01-20  82  	return DRM_GPU_SCHED_STAT_NOMINAL;
e93b6deeb45a78 Lucas Stach       2017-12-04  83  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


             reply	other threads:[~2026-04-10 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 17:30 kernel test robot [this message]
2026-04-10 18:05 ` [android-common:android14-kiwi-6.1 38/38] drivers/gpu/drm/etnaviv/etnaviv_sched.c:66 etnaviv_sched_timedout_job() warn: variable dereferenced before check 'sched_job' (see line 37) Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202604110106.aMi7vRva-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox