All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [intel-linux-intel-lts:5.4/yocto 8/24] drivers/gpu/drm/i915/gvt/display.c:2137:21-23: ERROR: disp_path is NULL but dereferenced.
Date: Tue, 13 Apr 2021 02:43:33 +0800	[thread overview]
Message-ID: <202104130222.Od26THF1-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10496 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Colin Xu <colin.xu@intel.com>
CC: "Qin, Chao" <chao.qin@intel.com>
CC: Hang Yuan <hang.yuan@intel.com>

tree:   https://github.com/intel/linux-intel-lts.git 5.4/yocto
head:   8bbfe55bfdb2905c35914605bc1b4a4404d86649
commit: 2521b097a48688b899e3db9cb855aa1ec59b02e8 [8/24] drm/i915/gvt: Rebase IDV 2.1 direct display to 5.4.x.
:::::: branch date: 10 months ago
:::::: commit date: 10 months ago
config: x86_64-randconfig-c002-20210412 (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: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/i915/gvt/display.c:2137:21-23: ERROR: disp_path is NULL but dereferenced.
   drivers/gpu/drm/i915/gvt/display.c:2138:31-37: ERROR: disp_path is NULL but dereferenced.
   drivers/gpu/drm/i915/gvt/display.c:2139:31-37: ERROR: disp_path is NULL but dereferenced.
   drivers/gpu/drm/i915/gvt/display.c:2140:21-31: ERROR: disp_path is NULL but dereferenced.
   drivers/gpu/drm/i915/gvt/display.c:2141:21-37: ERROR: disp_path is NULL but dereferenced.
--
>> drivers/gpu/drm/i915/gvt/display.c:1917:2-8: preceding lock on line 1908
--
>> drivers/gpu/drm/i915/gvt/display.c:1904:7-16: ERROR: invalid reference to the index variable of the iterator on line 1899
   drivers/gpu/drm/i915/gvt/display.c:2119:39-48: ERROR: invalid reference to the index variable of the iterator on line 2114
   drivers/gpu/drm/i915/gvt/display.c:2120:8-17: ERROR: invalid reference to the index variable of the iterator on line 2114
   drivers/gpu/drm/i915/gvt/display.c:2121:9-18: ERROR: invalid reference to the index variable of the iterator on line 2114
   drivers/gpu/drm/i915/gvt/display.c:1611:6-15: ERROR: invalid reference to the index variable of the iterator on line 1607
   drivers/gpu/drm/i915/gvt/display.c:1798:6-15: ERROR: invalid reference to the index variable of the iterator on line 1794
   drivers/gpu/drm/i915/gvt/display.c:1223:6-15: ERROR: invalid reference to the index variable of the iterator on line 1219

vim +2137 drivers/gpu/drm/i915/gvt/display.c

2521b097a48688b Colin Xu 2020-04-14  2071  
2521b097a48688b Colin Xu 2020-04-14  2072  static void intel_gvt_switch_display_work(struct work_struct *w)
2521b097a48688b Colin Xu 2020-04-14  2073  {
2521b097a48688b Colin Xu 2020-04-14  2074  	struct intel_gvt *gvt = container_of(w,
2521b097a48688b Colin Xu 2020-04-14  2075  		struct intel_gvt, switch_display_work);
2521b097a48688b Colin Xu 2020-04-14  2076  	struct intel_vgpu *vgpu, *old_v, *new_v;
2521b097a48688b Colin Xu 2020-04-14  2077  	struct intel_vgpu_display_path *disp_path = NULL, *n;
2521b097a48688b Colin Xu 2020-04-14  2078  	int id, old, new;
2521b097a48688b Colin Xu 2020-04-14  2079  	u32 new_owner = 0;
2521b097a48688b Colin Xu 2020-04-14  2080  	enum pipe pipe;
2521b097a48688b Colin Xu 2020-04-14  2081  	enum port port;
2521b097a48688b Colin Xu 2020-04-14  2082  	bool do_switch = false;
2521b097a48688b Colin Xu 2020-04-14  2083  
2521b097a48688b Colin Xu 2020-04-14  2084  	mutex_lock(&gvt->lock);
2521b097a48688b Colin Xu 2020-04-14  2085  	mutex_lock(&gvt->sw_in_progress);
2521b097a48688b Colin Xu 2020-04-14  2086  
2521b097a48688b Colin Xu 2020-04-14  2087  	/* Switch base on port */
2521b097a48688b Colin Xu 2020-04-14  2088  	for_each_pipe(gvt->dev_priv, pipe) {
2521b097a48688b Colin Xu 2020-04-14  2089  		port = intel_gvt_port_from_pipe(gvt->dev_priv, pipe);
2521b097a48688b Colin Xu 2020-04-14  2090  
2521b097a48688b Colin Xu 2020-04-14  2091  		if (port == PORT_NONE)
2521b097a48688b Colin Xu 2020-04-14  2092  			continue;
2521b097a48688b Colin Xu 2020-04-14  2093  
2521b097a48688b Colin Xu 2020-04-14  2094  		gvt_dbg_dpy("Check display switch on PIPE_%c, PORT_%c\n",
2521b097a48688b Colin Xu 2020-04-14  2095  			    pipe_name(pipe), port_name(port));
2521b097a48688b Colin Xu 2020-04-14  2096  
2521b097a48688b Colin Xu 2020-04-14  2097  		old = gvt->pipe_info[pipe].owner;
2521b097a48688b Colin Xu 2020-04-14  2098  		new = (gvt->disp_owner >> port * 4) & 0xF;
2521b097a48688b Colin Xu 2020-04-14  2099  
2521b097a48688b Colin Xu 2020-04-14  2100  		old_v = NULL;
2521b097a48688b Colin Xu 2020-04-14  2101  		new_v = NULL;
2521b097a48688b Colin Xu 2020-04-14  2102  		do_switch = false;
2521b097a48688b Colin Xu 2020-04-14  2103  		// Get old and new owners, either host or vGPU-x
2521b097a48688b Colin Xu 2020-04-14  2104  		idr_for_each_entry((&(gvt)->vgpu_idr), vgpu, id) {
2521b097a48688b Colin Xu 2020-04-14  2105  			if (old && id == old)
2521b097a48688b Colin Xu 2020-04-14  2106  				old_v = vgpu;
2521b097a48688b Colin Xu 2020-04-14  2107  			if (new && id == new)
2521b097a48688b Colin Xu 2020-04-14  2108  				new_v = vgpu;
2521b097a48688b Colin Xu 2020-04-14  2109  		}
2521b097a48688b Colin Xu 2020-04-14  2110  
2521b097a48688b Colin Xu 2020-04-14  2111  		if (new != old) {
2521b097a48688b Colin Xu 2020-04-14  2112  			if (new_v) {
2521b097a48688b Colin Xu 2020-04-14  2113  				disp_path = NULL;
2521b097a48688b Colin Xu 2020-04-14  2114  				list_for_each_entry_safe(disp_path, n, &new_v->disp_cfg.path_list, list) {
2521b097a48688b Colin Xu 2020-04-14  2115  					if (disp_path->p_pipe != INVALID_PIPE &&
2521b097a48688b Colin Xu 2020-04-14  2116  					    disp_path->p_port == port)
2521b097a48688b Colin Xu 2020-04-14  2117  						break;
2521b097a48688b Colin Xu 2020-04-14  2118  				}
2521b097a48688b Colin Xu 2020-04-14  2119  				if (atomic_read(&new_v->active) && disp_path &&
2521b097a48688b Colin Xu 2020-04-14  2120  				    disp_path->foreground &&
2521b097a48688b Colin Xu 2020-04-14  2121  				    !disp_path->foreground_state) {
2521b097a48688b Colin Xu 2020-04-14  2122  					do_switch = true;
2521b097a48688b Colin Xu 2020-04-14  2123  					gvt_dbg_dpy("Switch display to vGPU-%d, path-%d, PIPE_%c, PORT_%c\n",
2521b097a48688b Colin Xu 2020-04-14  2124  						    new_v->id, disp_path->id,
2521b097a48688b Colin Xu 2020-04-14  2125  						    pipe_name(disp_path->p_pipe),
2521b097a48688b Colin Xu 2020-04-14  2126  						    port_name(disp_path->p_port));
2521b097a48688b Colin Xu 2020-04-14  2127  				} else {
2521b097a48688b Colin Xu 2020-04-14  2128  					// If can't switch to new vGPU,
2521b097a48688b Colin Xu 2020-04-14  2129  					// maintain old owner.
2521b097a48688b Colin Xu 2020-04-14  2130  					new_owner = gvt->disp_owner;
2521b097a48688b Colin Xu 2020-04-14  2131  					new_owner &= ~(0xF << port * 4);
2521b097a48688b Colin Xu 2020-04-14  2132  					new_owner |= (old << port * 4);
2521b097a48688b Colin Xu 2020-04-14  2133  					gvt->disp_owner = new_owner;
2521b097a48688b Colin Xu 2020-04-14  2134  					do_switch = false;
2521b097a48688b Colin Xu 2020-04-14  2135  					gvt_dbg_dpy("Can't switch display to vGPU-%d active-%d, path-%d, PIPE_%c, PORT_%c, foreground-%d, foreground_state-%d\n",
2521b097a48688b Colin Xu 2020-04-14  2136  						    new_v->id, atomic_read(&new_v->active),
2521b097a48688b Colin Xu 2020-04-14 @2137  						    disp_path->id,
2521b097a48688b Colin Xu 2020-04-14  2138  						    pipe_name(disp_path->p_pipe),
2521b097a48688b Colin Xu 2020-04-14  2139  						    port_name(disp_path->p_port),
2521b097a48688b Colin Xu 2020-04-14  2140  						    disp_path->foreground,
2521b097a48688b Colin Xu 2020-04-14  2141  						    disp_path->foreground_state);
2521b097a48688b Colin Xu 2020-04-14  2142  				}
2521b097a48688b Colin Xu 2020-04-14  2143  			} else {
2521b097a48688b Colin Xu 2020-04-14  2144  				// Switch to host is always expected possible
2521b097a48688b Colin Xu 2020-04-14  2145  				do_switch = true;
2521b097a48688b Colin Xu 2020-04-14  2146  				gvt_dbg_dpy("Switch display to host\n");
2521b097a48688b Colin Xu 2020-04-14  2147  			}
2521b097a48688b Colin Xu 2020-04-14  2148  		} else {
2521b097a48688b Colin Xu 2020-04-14  2149  			do_switch = false;
2521b097a48688b Colin Xu 2020-04-14  2150  			gvt_dbg_dpy("Skip switch display due to unchanged owner\n");
2521b097a48688b Colin Xu 2020-04-14  2151  		}
2521b097a48688b Colin Xu 2020-04-14  2152  
2521b097a48688b Colin Xu 2020-04-14  2153  		if (do_switch && !prepare_for_switch_display(gvt, pipe)) {
2521b097a48688b Colin Xu 2020-04-14  2154  			intel_gvt_switch_display_pipe(gvt, pipe, old_v, new_v);
2521b097a48688b Colin Xu 2020-04-14  2155  			if (old_v && new_v)
2521b097a48688b Colin Xu 2020-04-14  2156  				gvt_dbg_dpy("Change PIPE_%c PORT_%c owner from "
2521b097a48688b Colin Xu 2020-04-14  2157  					    "vGPU-%d to vGPU-%d\n",
2521b097a48688b Colin Xu 2020-04-14  2158  					    pipe_name(pipe), port_name(port),
2521b097a48688b Colin Xu 2020-04-14  2159  					    old_v->id, new_v->id);
2521b097a48688b Colin Xu 2020-04-14  2160  			else if (old_v && !new_v)
2521b097a48688b Colin Xu 2020-04-14  2161  				gvt_dbg_dpy("Change PIPE_%c PORT_%c owner from "
2521b097a48688b Colin Xu 2020-04-14  2162  					    "vGPU-%d to host\n",
2521b097a48688b Colin Xu 2020-04-14  2163  					    pipe_name(pipe), port_name(port),
2521b097a48688b Colin Xu 2020-04-14  2164  					    old_v->id);
2521b097a48688b Colin Xu 2020-04-14  2165  			else if (!old_v && new_v)
2521b097a48688b Colin Xu 2020-04-14  2166  				gvt_dbg_dpy("Change PIPE_%c PORT_%c owner from "
2521b097a48688b Colin Xu 2020-04-14  2167  					    "host to vGPU-%d\n",
2521b097a48688b Colin Xu 2020-04-14  2168  					    pipe_name(pipe), port_name(port),
2521b097a48688b Colin Xu 2020-04-14  2169  					    new_v->id);
2521b097a48688b Colin Xu 2020-04-14  2170  			else
2521b097a48688b Colin Xu 2020-04-14  2171  				gvt_dbg_dpy("Unexpected change PIPE_%c PORT_%c "
2521b097a48688b Colin Xu 2020-04-14  2172  					    "owner from host to host\n",
2521b097a48688b Colin Xu 2020-04-14  2173  					    pipe_name(pipe), port_name(port));
2521b097a48688b Colin Xu 2020-04-14  2174  		}
2521b097a48688b Colin Xu 2020-04-14  2175  	}
2521b097a48688b Colin Xu 2020-04-14  2176  
2521b097a48688b Colin Xu 2020-04-14  2177  	mutex_unlock(&gvt->sw_in_progress);
2521b097a48688b Colin Xu 2020-04-14  2178  	mutex_unlock(&gvt->lock);
2521b097a48688b Colin Xu 2020-04-14  2179  }
2521b097a48688b Colin Xu 2020-04-14  2180  

---
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: 33580 bytes --]

             reply	other threads:[~2021-04-12 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 18:43 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-09 12:55 [intel-linux-intel-lts:5.4/yocto 8/24] drivers/gpu/drm/i915/gvt/display.c:2137:21-23: ERROR: disp_path is NULL but dereferenced kernel test robot

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=202104130222.Od26THF1-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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 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.