Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2F82137742 for ; Wed, 23 Oct 2024 10:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.166.238 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729677768; cv=none; b=q4Vg7VHA45k4TlD+Ax8SgUnPWjgmvnI6xR1MXhBvAhsGDaSZBo30zT4K01B3IJdFmVumEsyWs2jXYvHt2AYBIARFLQ+u51TTsldtBzZfQmawzpx1ZWlCJCf88qGaj4cv+eJI0abRZn5kio1ADFMPO+uznbEjcDLUHCc5P9cQj0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729677768; c=relaxed/simple; bh=OPTQc8YVXJOcwAayXWqFSDiWEJRPihRq4R2yJd8710g=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qBvx9DAn7dDBUFOCoEf6A50U+wCO44NK8OXRI9dU/9cUH5lWYAvNBU/ECLcvsO70J0nGazlsnrugGm9lfCwlY1rb1QpEwgV57ThIgnBI+Hn0lwTtUfidoZ6kG+cnyyR9Vn8y2TRxcZ5WAw7JeGWxBJIYcYXjrAp9RmTkNuzm7vg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; arc=none smtp.client-ip=205.220.166.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49N3ssnO010159; Wed, 23 Oct 2024 03:02:27 -0700 Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 42cc9kvk7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 23 Oct 2024 03:02:26 -0700 (PDT) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 03:02:26 -0700 Received: from pek-kkang-d2.wrs.com (128.224.34.219) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 23 Oct 2024 03:02:24 -0700 From: To: CC: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter Subject: [PATCH] drm/i915/gt: Cleanup partial engine discovery failures Date: Wed, 23 Oct 2024 18:01:12 +0800 Message-ID: <20241023100112.2992697-1-kai.kang@windriver.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Authority-Analysis: v=2.4 cv=ZYlPNdVA c=1 sm=1 tr=0 ts=6718c9b2 cx=c_pps a=K4BcnWQioVPsTJd46EJO2w==:117 a=K4BcnWQioVPsTJd46EJO2w==:17 a=DAUX931o1VcA:10 a=QyXUC8HyAAAA:8 a=e5mUnYsNAAAA:8 a=VwQbUJbxAAAA:8 a=5jjrFKfR0PwuKcLNdasA:9 a=Vxmtnl_E_bksehYqCbjh:22 X-Proofpoint-GUID: NHGZjOt_0yT1F8U_WOdg6k4JkA0Fxt25 X-Proofpoint-ORIG-GUID: NHGZjOt_0yT1F8U_WOdg6k4JkA0Fxt25 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-23_08,2024-10-22_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1011 suspectscore=0 adultscore=0 impostorscore=0 mlxlogscore=917 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2409260000 definitions=main-2410230061 From: Chris Wilson commit 78a033433a5ae4fee85511ee075bc9a48312c79e upstream. If we abort driver initialisation in the middle of gt/engine discovery, some engines will be fully setup and some not. Those incompletely setup engines only have 'engine->release == NULL' and so will leak any of the common objects allocated. v2: - Drop the destroy_pinned_context() helper for now. It's not really worth it with just a single callsite at the moment. (Janusz) Signed-off-by: Chris Wilson Cc: Janusz Krzysztofik Signed-off-by: Matt Roper Reviewed-by: Janusz Krzysztofik Link: https://patchwork.freedesktop.org/patch/msgid/20220915232654.3283095-2-matthew.d.roper@intel.com Cc: # 5.10+ --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index a19537706ed1..eb6f4d7f1e34 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -904,8 +904,13 @@ int intel_engines_init(struct intel_gt *gt) return err; err = setup(engine); - if (err) + if (err) { + intel_engine_cleanup_common(engine); return err; + } + + /* The backend should now be responsible for cleanup */ + GEM_BUG_ON(engine->release == NULL); err = engine_init_common(engine); if (err) -- 2.34.1