mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Zhi Wang <zhi.wang.linux@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Zhenyu Wang <zhenyuw@linux.intel.com>
Subject: drivers/gpu/drm/i915/gvt/scheduler.c:646 prepare_shadow_wa_ctx() warn: inconsistent returns 'wa_ctx->indirect_ctx.obj->base.resv'.
Date: Tue, 28 Sep 2021 09:23:47 +0300	[thread overview]
Message-ID: <202109280539.c3pVHuGH-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   92477dd1faa650e50bd3bb35a6c0b8d09198cc35
commit: 67f1120381df022a7016f4acc8d4880da9a66c03 drm/i915/gvt: Introduce per object locking in GVT scheduler.
config: x86_64-randconfig-m001-20210927 (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/i915/gvt/scheduler.c:646 prepare_shadow_wa_ctx() warn: inconsistent returns 'wa_ctx->indirect_ctx.obj->base.resv'.

vim +646 drivers/gpu/drm/i915/gvt/scheduler.c

d8235b5e55845d Zhi Wang 2017-09-12  605  static int prepare_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
d8235b5e55845d Zhi Wang 2017-09-12  606  {
d8235b5e55845d Zhi Wang 2017-09-12  607  	struct i915_vma *vma;
d8235b5e55845d Zhi Wang 2017-09-12  608  	unsigned char *per_ctx_va =
d8235b5e55845d Zhi Wang 2017-09-12  609  		(unsigned char *)wa_ctx->indirect_ctx.shadow_va +
d8235b5e55845d Zhi Wang 2017-09-12  610  		wa_ctx->indirect_ctx.size;
67f1120381df02 Zhi Wang 2021-01-10  611  	struct i915_gem_ww_ctx ww;
67f1120381df02 Zhi Wang 2021-01-10  612  	int ret;
d8235b5e55845d Zhi Wang 2017-09-12  613  
d8235b5e55845d Zhi Wang 2017-09-12  614  	if (wa_ctx->indirect_ctx.size == 0)
d8235b5e55845d Zhi Wang 2017-09-12  615  		return 0;
d8235b5e55845d Zhi Wang 2017-09-12  616  
67f1120381df02 Zhi Wang 2021-01-10  617  	i915_gem_ww_ctx_init(&ww, false);
67f1120381df02 Zhi Wang 2021-01-10  618  retry:
67f1120381df02 Zhi Wang 2021-01-10  619  	i915_gem_object_lock(wa_ctx->indirect_ctx.obj, &ww);
67f1120381df02 Zhi Wang 2021-01-10  620  
67f1120381df02 Zhi Wang 2021-01-10  621  	vma = i915_gem_object_ggtt_pin_ww(wa_ctx->indirect_ctx.obj, &ww, NULL,
d8235b5e55845d Zhi Wang 2017-09-12  622  					  0, CACHELINE_BYTES, 0);
67f1120381df02 Zhi Wang 2021-01-10  623  	if (IS_ERR(vma)) {
67f1120381df02 Zhi Wang 2021-01-10  624  		ret = PTR_ERR(vma);
67f1120381df02 Zhi Wang 2021-01-10  625  		if (ret == -EDEADLK) {
67f1120381df02 Zhi Wang 2021-01-10  626  			ret = i915_gem_ww_ctx_backoff(&ww);
67f1120381df02 Zhi Wang 2021-01-10  627  			if (!ret)
67f1120381df02 Zhi Wang 2021-01-10  628  				goto retry;

Does this path result in a double lock?  (I haven't looked carefully).

67f1120381df02 Zhi Wang 2021-01-10  629  		}
67f1120381df02 Zhi Wang 2021-01-10  630  		return ret;

Call i915_gem_object_unlock() before returning.

67f1120381df02 Zhi Wang 2021-01-10  631  	}
67f1120381df02 Zhi Wang 2021-01-10  632  
67f1120381df02 Zhi Wang 2021-01-10  633  	i915_gem_object_unlock(wa_ctx->indirect_ctx.obj);
d8235b5e55845d Zhi Wang 2017-09-12  634  
d8235b5e55845d Zhi Wang 2017-09-12  635  	/* FIXME: we are not tracking our pinned VMA leaving it
d8235b5e55845d Zhi Wang 2017-09-12  636  	 * up to the core to fix up the stray pin_count upon
d8235b5e55845d Zhi Wang 2017-09-12  637  	 * free.
d8235b5e55845d Zhi Wang 2017-09-12  638  	 */
d8235b5e55845d Zhi Wang 2017-09-12  639  
d8235b5e55845d Zhi Wang 2017-09-12  640  	wa_ctx->indirect_ctx.shadow_gma = i915_ggtt_offset(vma);
d8235b5e55845d Zhi Wang 2017-09-12  641  
d8235b5e55845d Zhi Wang 2017-09-12  642  	wa_ctx->per_ctx.shadow_gma = *((unsigned int *)per_ctx_va + 1);
d8235b5e55845d Zhi Wang 2017-09-12  643  	memset(per_ctx_va, 0, CACHELINE_BYTES);
d8235b5e55845d Zhi Wang 2017-09-12  644  
d8235b5e55845d Zhi Wang 2017-09-12  645  	update_wa_ctx_2_shadow_ctx(wa_ctx);
d8235b5e55845d Zhi Wang 2017-09-12 @646  	return 0;
d8235b5e55845d Zhi Wang 2017-09-12  647  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


                 reply	other threads:[~2021-09-28  6:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202109280539.c3pVHuGH-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.wang.linux@gmail.com \
    /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

all inboxes | Powered by JetHome®