<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi Xin Xong,</p>
<p>I have seen insufficient vcpi ports issues with MST daisy chain.
While running the IGT tests on MST, some times the vcpi ports are
all used up.</p>
<p>Due to this the atomic check fails and the flips start failing
with ENOSPC.<a
href="https://gitlab.freedesktop.org/drm/intel/-/issues/1255"><br>
</a></p>
<p><a href="https://gitlab.freedesktop.org/drm/intel/-/issues/1255">https://gitlab.freedesktop.org/drm/intel/-/issues/1255</a></p>
I think this patch would be fixing this.<br>
<br>
Regards,<br>
Ankit<br>
<br>
<div class="moz-cite-prefix">On 7/19/2020 9:15 PM, Xin Xiong wrote:<br>
</div>
<blockquote cite="mid:20200719154545.GA41231@xin-virtual-machine"
type="cite">
<pre wrap="">drm_dp_mst_allocate_vcpi() invokes
drm_dp_mst_topology_get_port_validated(), which increases the refcount
of the "port".
These reference counting issues take place in two exception handling
paths separately. Either when “slots” is less than 0 or when
drm_dp_init_vcpi() returns a negative value, the function forgets to
reduce the refcnt increased drm_dp_mst_topology_get_port_validated(),
which results in a refcount leak.
Fix these issues by pulling up the error handling when "slots" is less
than 0, and calling drm_dp_mst_topology_put_port() before termination
when drm_dp_init_vcpi() returns a negative value.
Signed-off-by: Xiyu Yang <a class="moz-txt-link-rfc2396E" href="mailto:xiyuyang19@fudan.edu.cn"><xiyuyang19@fudan.edu.cn></a>
Signed-off-by: Xin Tan <a class="moz-txt-link-rfc2396E" href="mailto:tanxin.ctf@gmail.com"><tanxin.ctf@gmail.com></a>
Signed-off-by: Xin Xiong <a class="moz-txt-link-rfc2396E" href="mailto:xiongx18@fudan.edu.cn"><xiongx18@fudan.edu.cn></a>
---
drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 1e26b89628f9..97b48b531ec6 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -4261,11 +4261,11 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
{
int ret;
- port = drm_dp_mst_topology_get_port_validated(mgr, port);
- if (!port)
+ if (slots < 0)
return false;
- if (slots < 0)
+ port = drm_dp_mst_topology_get_port_validated(mgr, port);
+ if (!port)
return false;
if (port->vcpi.vcpi > 0) {
@@ -4281,6 +4281,7 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
if (ret) {
DRM_DEBUG_KMS("failed to init vcpi slots=%d max=63 ret=%d\n",
DIV_ROUND_UP(pbn, mgr->pbn_div), ret);
+ drm_dp_mst_topology_put_port(port);
goto out;
}
DRM_DEBUG_KMS("initing vcpi for pbn=%d slots=%d\n",
</pre>
</blockquote>
<br>
</body>
</html>