Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796021849; b=Pdew3GYCCHavAGtCWF/31pm05jAqx1A0LTOazeXrFb0o10xWIWYWRkIajB1+aQtcX9yk KsWBBOi9DcWnBQKz+LfHFUjbPKOp/qT6xOD49KRAG6NJ0f963lh6NHAdBN7WnffuFp2VO Hij4ZlVFZr9j7LNYDPqLwq4QoPRZUiZoHxXS49iQeuJf2+keiHA9fozPI0OsNkk/v6bdV XFBJSgnIPP6rZcoLpsYAzo7PSixhsha0sWGLZkqAVEARDuK4gz9vSA/1kXcyVLVBofQpR c7B+NZimlDOaNY5g4fDff/kKNktFqZatsHbIOzxy5ZaBUTAF5lrXuMRMPcOmjpZk6Ag== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796021849; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:X-Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Authority-Analysis:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=Thc1b5aiuvcCQ8iFugcDGgU41gHgY5HswZ3x/GX5xqw=; b=yZY80ZDuFh34VJraz2R2ACWqaJMRvXHkNx7GzSqun5MPetNviGDcUo9I0/5mdE6P+6rF LutTQUZs0nmHHr5mlfEouBu23d6GZIqGIdFL9RW5iefZ85szx2ymDAQgEUJz7uqna8Nt7 EW2rWNs8qMssFTg0jCQ6rfAiNPnyH56DmRYEBHL3R6uFegXuszQbrU/ECIO3V8gBvYemF JR0bBp7ppfIBa4vCNXj46pEmlyUHh54NEsVRxvcetZLSmk6YV3d3/REmL1LNroE9rWA01 PVafNnbzt7792PgEvwp0jxLcl9wphkK8An432hj/jOrefBBBYTYfAwgg8tIRTevQ9yg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=i4Khu8kC; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Y39XctT3; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED8B7606A32D for ; Mon, 30 Nov 2026 06:57:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ED8B7606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=i4Khu8kC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Y39XctT3 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU5HIaV3367465 for ; Mon, 30 Nov 2026 06:57:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Thc1b5aiuvcCQ8iFugcDGgU41gHgY5HswZ3x/GX5xqw=; b=i4Khu8kCtJnhuKm2 tNEBvME+oJVI3oL9ckf3jzwHJVibAfL7MJ0dQfL9KXQJ70xQdRAJSF8wcqZhCpg0 ZIBvGzYjKvqELfT78rwoCyumDikVUzchJJeAgxz4GWkON2pEtV6RkLLUmUbO8cVj 5/7Tj6lL/ra0t92zh3Q1hCooa40Q+e5a8f2rPvaL/kZNucE83hx4enj3wy78CGBH rmshbfeXmqbbW4Uds5nwFw0Y3Vo7apZcPAcB4Ujd9w1JhY+YV6gabkg25/H3itFc q6LIsnaE4bNHIB/AtQhJJTzF+Tj+lOSKnGOXPB5oLLgEtz9VIhv+Wz7UCT7+AZ3H M/EqKg== Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j8skyhg4r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 06:57:27 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-3b4092b645aso8660959a91.2 for ; Sun, 29 Nov 2026 22:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796021847; x=1796626647; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Thc1b5aiuvcCQ8iFugcDGgU41gHgY5HswZ3x/GX5xqw=; b=Y39XctT3Orjkpo/Fj9ivZO7Q9wbgdfV82tt0JjfXsGM9S5rn3YIJf93b8wr7h7NnlB lQbFl60+TRkz0Z99TypJNiLvDUo+DZ/pzFNR1b3ymaafjc7kwrnZUjXdG6VCTrjUkcXI WyyspljCOJtebTELKJDNT6lgsCbQU1/87MU7/ZtjP9A18nVNijfRDF9Letr0jRvKmmXX OCdjJC9OEj/rCrFhdZfNgVPHS47JeAXAu5NUehprHs8I4d7yOi1Piiv77Opbl2AKKvjc T0o3SG72wMmJ/3eCdzBURKMUx9RsNsYCpeHa4Gr8yAGJiCFdznfNmijbAfJMb01Xlys7 4YjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796021847; x=1796626647; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Thc1b5aiuvcCQ8iFugcDGgU41gHgY5HswZ3x/GX5xqw=; b=cc0JzRVBeL2r1CafkyuhUVleCaIs4cD8ZWRBJZt3jeDkgH7e8gs5AaeOmlX4YN0XNm NYdvl/AHfsSaP4/m1zMIwHXVB3LvtaW9TtHHrt7QOrI8YcnLfwLBfRWBa5043vrJC63v /BUPvNl5hd66O9Cgpeux9LTGfCg0juMi9+mNwlxbX26UJpW9dtF3j11f8zg9plq3LWZD awuo/JXHXvjynJknzW4WzFM6Wt/a4oe1T9eykMUXsmO/imn4F4VrVxp5vnvWZUQ3msSp CErXZk+GvXp6A4ycfMKZ/kVIblYTvLoeLzRUxBH5/XyemjgfanTSTnj0khAP8E2F2kSP 3OzA== X-Gm-Message-State: APuU4Z8GOKWLBWbxYmKDoMZDErrCnvDv8DAu/bY1lBCFVXgtcBcm3LWi RPLWr22IWbm5prTkBNdZ1ZIWQUQ/I/YLD9lC0v+bsU1mZkXpFqi6s2kgVnl/XpGOApuKrxNOeGf nRIv1VlT8NFxDwt8bdOjQ6UGpn7J4uCow5TeJ/IPgWz7x/ujwvFP4bTJ+6m9XUSvU3FZY X-Gm-Gg: AZFdTZdjlyPn/srsejzyzlTFeyOuPX1XnpgHxBqoXQbCwO0GwDtqLNhUsdl9dp+RgzO 868yxLvMVRqZODep70Q0qm8lu8n5hyumZElatSasCEpj3qWUoes0I4UM0vDax2xna+qEYyCVq4W vCARzy5z8Jp8B/vXZZkOVNng8ohbavh64MFvoDakTQq40QayitZ8eI6oacfxYNKoT5/tJVKbrPZ 3C+F/FTFNMgyzVslMShJpobXS+I0es6pPqK1/ZAdzVAnyepg/lxdG5B9CfHj+hOFogwk0bhMqw9 gBo0pipC9ePKpg8l9svElL0AsXdBSrQkM8Uclxa0HNKOD0HoWyx5DaMJOxVrLlz7+H9cFM5q3vf LoF8LzDyJtgzin6HpfpwXGsZjPJJ6Ce/CJrdhONGyezvggTrtT1KG3TBhQM/OMBIi70z64Bu9p8 KN/hON6Je5PaBuPSo8G78F+R0I X-Received: by 2002:a17:90b:3d92:b0:3ac:7842:bd50 with SMTP id 98e67ed59e1d1-3b41c8dd1a2mr31943992a91.15.1796021846776; Sun, 29 Nov 2026 22:57:26 -0800 (PST) X-Received: by 2002:a17:90b:3d92:b0:3ac:7842:bd50 with SMTP id 98e67ed59e1d1-3b41c8dd1a2mr31943976a91.15.1796021846323; Sun, 29 Nov 2026 22:57:26 -0800 (PST) Received: from YUANJIEY2.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5639e13f7sm8537270a91.12.2026.11.29.22.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 22:57:26 -0800 (PST) From: Yuanjie Yang To: robin.clark@oss.qualcomm.com, lumag@kernel.org, abhinav.kumar@linux.dev, jesszhan0024@gmail.com, sean@poorly.run, marijn.suijten@somainline.org, airlied@gmail.com, simona@ffwll.ch, quic_kalyant@quicinc.com, quic_vpolimer@quicinc.com, quic_khsieh@quicinc.com, jordan@cosmicpenguin.net, konradybcio@kernel.org, akhilpo@oss.qualcomm.com, antomani103@gmail.com, smasetty@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, yuanjie.yang@oss.qualcomm.com, tingwei.zhang@oss.qualcomm.com, stable@vger.kernel.org Subject: [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy Date: Mon, 30 Nov 2026 14:55:09 +0800 Message-ID: <20261130-dpu_unbind_rebind_display-v1-6-c335387de1bb@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com> References: <20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDAyNyBTYWx0ZWRfX+FpASB0ckEvT cphM8SiGwX8Tx1RwI14Anv9eSMK5X65SX7ljNIO+zbgHV9s9SnJJqQM9E41zrXEaQuQ3Uhz8dFj Kqin20RBVuLp4VhX1+3WBvKkaUxsdUUncA+4DjFQ1Qbu05r1sDcOM3ijHKVrm1bLWqAXcsyQXax ZT6EbYTT/Yytunc0xHVBRDImxm4MASuU7lLwHkGJ4HA8NWcR9lsahc4mFBp/s1dLSnfhL28OYxl yMnyF6P9FPPxGEDP3yiQyjzHUEj2xisqwIbq6biqzWn51qX7s+AOFZ4e/qxC7bUG8GymUYcIR6u X690Nf/gXEYm+HFR5x0G3yZIYu5eE2opUPP/uwHtiQdtH3tSZJxadjegIm7i3pFMQgyhSsDy/M5 30P7WnERsHu6h2TnPN8oyBD8e4JuuEvrJIdYBh8NTUURkRwqPp2bUW05DHm/JNdOcnuARRYXXA7 G6OG5hvjpw08imq5vWA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDAyNyBTYWx0ZWRfX2Rdm6h9lyQAe A7Y7mqQ705LMkXBybZdpBGNw+Dldvy0IzvtFRZ6aq1gd76kmHnBRPr3PgaruY7rZeRmH+5puEaP CK+eVEKV6aaZPEPUAnLxCFcRMX1O/bU= X-Proofpoint-ORIG-GUID: GEHdBHRBPCCMUsSmpasGb03askHovBsS X-Proofpoint-GUID: GEHdBHRBPCCMUsSmpasGb03askHovBsS X-Authority-Analysis: v=2.4 cv=Ie4Symqa c=1 sm=1 tr=0 ts=6b0d1e57 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=A4DmiWHL-z87m8xw7acA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_02,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 clxscore=1015 impostorscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300027 a6xx_destroy() never calls a6xx_preempt_fini(), which itself only frees preempt_bo[], and it never frees pwrup_reglist_bo either. Each leaked BO stays mapped in gpu->vm and holds references to it, so the GPU VM, its IOMMU domain and the SMMU context bank 0 reserved for the GPU are never released, and the next bind of the GPU fails: msm_dpu ae01000.display-controller: failed to bind 3d00000.gpu (...): -28 On x1e80100 the final drm_gpuvm_put() in msm_gpu_cleanup() still sees 21 references: the VM's own one plus two for each of the 10 leaked BOs. Free all the preemption buffers in a6xx_preempt_fini(), clearing the pointers since the a6xx_preempt_init() error path calls it as well, and call it from a6xx_destroy() together with freeing pwrup_reglist_bo. Fixes: e7ae83da4a28 ("drm/msm/a6xx: Implement preemption for a7xx targets") Fixes: 50117cad0c50 ("drm/msm/a6xx: Use posamble to reset counters on preemption") Cc: stable@vger.kernel.org Signed-off-by: Yuanjie Yang --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ drivers/gpu/drm/msm/adreno/a6xx_preempt.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index da1202474dee..c07fc8822ff1 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2327,6 +2327,10 @@ static void a6xx_destroy(struct msm_gpu *gpu) msm_gem_kernel_put(a6xx_gpu->shadow_bo, gpu->vm); + msm_gem_kernel_put(a6xx_gpu->pwrup_reglist_bo, gpu->vm); + + a6xx_preempt_fini(gpu); + a6xx_llc_slices_destroy(a6xx_gpu); a6xx_gmu_remove(a6xx_gpu); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c index df8d4f3e8d4c..821c04bfed00 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c @@ -354,8 +354,15 @@ void a6xx_preempt_fini(struct msm_gpu *gpu) struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); int i; - for (i = 0; i < gpu->nr_rings; i++) + for (i = 0; i < gpu->nr_rings; i++) { msm_gem_kernel_put(a6xx_gpu->preempt_bo[i], gpu->vm); + a6xx_gpu->preempt_bo[i] = NULL; + msm_gem_kernel_put(a6xx_gpu->preempt_smmu_bo[i], gpu->vm); + a6xx_gpu->preempt_smmu_bo[i] = NULL; + } + + msm_gem_kernel_put(a6xx_gpu->preempt_postamble_bo, gpu->vm); + a6xx_gpu->preempt_postamble_bo = NULL; } void a6xx_preempt_init(struct msm_gpu *gpu) -- 2.43.0