From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 0DC8D39182A for ; Sat, 22 Aug 2026 08:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787388550; cv=none; b=HJQyFkKvXogUGuJYQR8+o5CJqhTvd/NZzr7yY4oGqWVxDVnV3lMKJJl+PMDt5EotpbJkm1LKer+7ZsEmJ78Myup/e/IRSESF+XECw/fiGI7HnQcNw+2OTcY7QQ7imsXcL+OL+GhC28/hS6c+K8RplPJAKWbq5c25fkuZdJFIoQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787388550; c=relaxed/simple; bh=9sFj+2Zg93TLyhMuoQHzR96CV7efblYg21SrHIBwwDU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NuwY+T6eqYc4AIVvzC5OnlfGLVpWhm1hHQI5WJBqre+uVR/SzFXdEkL7Lpkx5Iecl5Qa33TQC15movVxTuHjvVkczYQ7oPd3z3w38xyExaINdK6h0JbSLtXwE8Abw0frR1Jdq+PHMUakrR8fAbZZ76icUssWq5qcpyn1lPPS2V8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=JGBXYW/a; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=N9mr391e; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="JGBXYW/a"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="N9mr391e" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67M7xsC43666713 for ; Sat, 22 Aug 2026 08:49:08 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= UnXKGew5QII5NxsBPl0obJnI0muW32nfd/TT4GgHu0Y=; b=JGBXYW/aLT9ANHYz kUXALbd4cYiIL74InmFCISBdcJldMY+1Z6i6HW15ZP1oE4XLeUaF+rloeQR9H/Xi +jjjb8pgAQrEvpPGKRtW4mAyXwk2DmSavlJO77/lm6muXFqbWEDlI5F2RMxJvje3 Twl0izFxXuayb4o12HRMEkFlNycdH8kyW+FZbaOUwmUTKfqS+hcUTXOIonVIbp3/ wW0ubmvcx2QKgiPwCpkd/fTcoCej9l+dh/daaqxfgxpoWfjAKfmOmpidCDN1Jx+g JsbQAPHbmIQLNe4DP4PoOZukg2y0VAwOWH9XETrtzMpqyMIzypwre9S1IEJXkyUA GRatsw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g744qrnyu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 22 Aug 2026 08:49:07 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-930b571432fso165708885a.0 for ; Sat, 22 Aug 2026 01:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787388547; x=1787993347; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UnXKGew5QII5NxsBPl0obJnI0muW32nfd/TT4GgHu0Y=; b=N9mr391eJGJnHobvRvk9pFzWBUFockkeLYhbwh6GXQKHAs0x7VnTTytKXFkXRUhXUS XkopTSG0T19fiNEWxjxT31bN25hUx4Y/y9dj/4jsHxYFxuPCKDZNw50HT4KQSB7oZb8/ 8yYi1qzoT0y7tzyh4dG0QfWXyqIBQUaewTAi3jvraD2sWkrv41bWY//MDjeUqLSuKhVD eIzerHdKYiCpN4FyHbUDaFiRnZR4D9uRlwYC18kc7KF/zQiePCGMZjnVsg29csUhmJjp 5ejht41tHzfcDUpCQ9RAr6/b2jYy5cDyo9qtsRu9ldSrxnrFisre3I+UOdik37Q8bVdI yt4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787388547; x=1787993347; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=UnXKGew5QII5NxsBPl0obJnI0muW32nfd/TT4GgHu0Y=; b=CN036BDLI26T7GLlf+4gslmLdqqQ9H2wpL7a6GYaG6W37pzBOPhNQ3LkrV1Vj2C9xv SKBpeFzDjaTQ8Qr5iKgqsCcPG5TGurbMJVTQTJnxtzU4QvIKonxLNza/VeVDQPO6+xSW GTiP+nfuRU5OtrZaxAMWV7RyZfDeS9BhbzGhaNxHZN5sohxu2zgwwWTQQkyEJP+fvw/I u1z4KXfKF7pDK2wLn/oV/u3O6J0hnapYxowv1PPUgolYxWY7LyGQOFsEJPpHjUrQEzUO ly7uAsas2/ut4aFX5tPsH83cZ6uxXMBeWBdMI08DmrQINB6R77e7sHSGylPW5zOqWT86 FhsQ== X-Forwarded-Encrypted: i=1; AHgh+RoFsBREsf6Zq1IGKggLwFYLW+d8L6vkO1WjlxyO7ZDWjlu3T5QABsS/QDryAy2T2JuSHt9Rp7Wr4XrU7wc=@vger.kernel.org X-Gm-Message-State: AFuF++k05AWn4sdwR/LxrQWu4Ojv9aYBmj2qXqiXdgAHUVt20132DBhG 43MXnqCNTrkDldIPC54Tuuy9YxLdV1MJaxSpFtM8FEYUf/eMbdsYhESL0TapF7tTRiE9qkym7lk 3/wYdGeYleGnUzB0QI63E+eye3AHpyZ4qtibshyyM9cf5uae8znMIupJ7PZ8E/yvoBdg= X-Gm-Gg: AR+sD13jKcW8JofM0dFotUzfLOmcDAexd5rNXfhNY5ZJrxIXAkH2E7UzhFjZi3Jaa79 SaJRdGtOom7vCdFIcq2nChsM+Qg86dW5Z/X8OPcG0Byw1H9B0e9vVOJ4exaq02BrkeTszRbkzrP CxOgYc/pEK434dSdYlEHtHk2mslOoY1pADCV0TRuUOFZ1BBQQ4SzEHLBBxBKuX9ulfutuFJtIFl F5Hi1N5LjybxX8vbDntipgoIyXIqxh204jYuIgTfUAt/jD85Vgsajpu0zpWeoAzpIoC6SKHFht7 dbMtsLk8w4TC86JV4FLxduPDfH26KGuAH5U9Wtim4TGaLkUryG4mvf9y1W/Namwm1XgtddZ9SqU 3VA5aDfY6K40PNb4W1NC3O3zg0jOt1Al9TBiWk1nhgswKFKRK1VEVhGLh7PtygjhBoNBqgfWDT5 IAWL9DFDyM24pi X-Received: by 2002:a05:620a:318f:b0:936:cf9c:a994 with SMTP id af79cd13be357-937398a8cf4mr998426985a.19.1787388547287; Sat, 22 Aug 2026 01:49:07 -0700 (PDT) X-Received: by 2002:a05:620a:318f:b0:936:cf9c:a994 with SMTP id af79cd13be357-937398a8cf4mr998423585a.19.1787388546825; Sat, 22 Aug 2026 01:49:06 -0700 (PDT) Received: from umbar.lan (2001-14ba-a073-af00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a073:af00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3a1c2fab887sm3066901fa.25.2026.08.22.01.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 01:49:05 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 22 Aug 2026 11:48:58 +0300 Subject: [PATCH 1/2] drm/msm: factor out a locking put_iova_spaces() wrapper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260822-msm-fix-export-v1-1-917b3cbedd43@oss.qualcomm.com> References: <20260822-msm-fix-export-v1-0-917b3cbedd43@oss.qualcomm.com> In-Reply-To: <20260822-msm-fix-export-v1-0-917b3cbedd43@oss.qualcomm.com> To: Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Konrad Dybcio , Akhil P Oommen , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Antonino Maniscalco Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4016; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=9sFj+2Zg93TLyhMuoQHzR96CV7efblYg21SrHIBwwDU=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1ZnUo0Fu+wBx0XhR23uyspMdFJIL9INYYu/rFvr8bH5T 2t8EHcnozELAyMXg6yYIotPQcvUmE3JYR92TK2HGcTKBDKFgYtTACYiEsn+32vWUY1vei+jFlzN eGGid7S6/5qxM9cHXlWXAxNY/Pt1Kx3cJ/w9EvbQK/1Zr9fJ9R1L3n4yy1xflXFz5Venz6oqui0 dPD9n28RMrPBaxyXF4NC+7394X7RR877uz+F5D7RYTZXbuH6YTGXY9jFH7vvmmXs0Z2+ducPZvi CO7Vs6R0uZgdyOFYs5t4ed37fUe0v2PZaUe8vSfv5wLZJ7ddrWyljhE9uZ87ptyofOmbrcirAzt 18VKmZy+c3PxBePpM+Jt06f92WrLHfuk5Pytv4GPjKSmg+eLpSf6/uoWMAz+HC/391Jr9a6PyxN m3mqZGa+nF/B+/1cV79XHVlYFjVRpV9V64LZbn29fRwbAA== X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-ORIG-GUID: JFFoH8ZZDAmOPbatTc3a2fLdLafKnWHv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODIyMDA3MCBTYWx0ZWRfX18GWFIAax/DJ ZQLKFLb3nDVsYFOTAT6PQvGogEFlQ0t6c3b9sKlXm7UjwqqY1uJP5E1pJ0LW+Vs7l5QY4CRc5GX eKeEYxurLVPYkB3m0OLU99BixgqXDaUfcjGzYPxvc4K4LSR9DAU3TMTxc1hmRz/qs3vzvDxQQlz W7YW6BDiCUlbQN9iKp7KUdPt0nccJWjOHbGj7IZgYARwJ2V2hmAEwu/NrRfiJlEz+yKluyukAfr H0pVmL09Vk/mCPZCuY2F7wbjqcOwM50yWMhDPNvT7sim7z4WhjUl83VW8vQDpScD3gIExXoesRc z4TSo/IqcDzkkF/DiJPIXUqdm6EIQmKz/4x9pEqB0VpATKn484TgtGe4eQCrF2NeSZyfsIrE/8B 2nwaKBbHLglJRIkVBBaNkWtBekgtpSggE5LqrdpSCzE7EC1nCl2hqy6uB5OU2D8sQ8Sx7WyksM0 r+epa1qJdi30Gvsmerg== X-Proofpoint-GUID: JFFoH8ZZDAmOPbatTc3a2fLdLafKnWHv X-Proofpoint-Spam-Info: AW1haW4tMjYwODIyMDA3MCBTYWx0ZWRfX4UsD88KVo0UH IKrELyrO0+q2EsRX29GrP0816tjPVXVRGDW5oFvAaiVezuVePO4AEsnjPAPrXr/ybHIqZj5Fx8d XwbqBQuLGGLlGTBPClyC2S79dLUSZcc= X-Authority-Analysis: v=2.4 cv=BNuDalQG c=1 sm=1 tr=0 ts=6a896283 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=s4q7lw47J6sqlY71xjgA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-22_03,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608220070 put_iova_spaces() asserts that the caller already holds the VM and object locks, but is not named accordingly. Both of the callers which do not hold those locks yet -- msm_gem_close() and msm_gem_vma_put() -- open-code the same lock, tear down, unlock sequence around it. Rename it to put_iova_spaces_locked() and give the plain name to a wrapper taking both locks, mirroring the get_and_pin_iova_range_locked() / msm_gem_get_and_pin_iova_range() pair in the same file. No functional change. Assisted-by: LLM Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_gem.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index c4cff3d53d81..f90afffe3442 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -47,13 +47,23 @@ static int msm_gem_open(struct drm_gem_object *obj, struct drm_file *file) return 0; } +static void put_iova_spaces_locked(struct drm_gem_object *obj, + struct drm_gpuvm *vm, bool close, + const char *reason); + static void put_iova_spaces(struct drm_gem_object *obj, struct drm_gpuvm *vm, - bool close, const char *reason); + bool close, const char *reason) +{ + struct drm_exec exec; + + msm_gem_lock_vm_and_obj(&exec, obj, vm); + put_iova_spaces_locked(obj, vm, close, reason); + drm_exec_fini(&exec); /* drop locks */ +} static void msm_gem_close(struct drm_gem_object *obj, struct drm_file *file) { struct msm_context *ctx = file->driver_priv; - struct drm_exec exec; update_ctx_mem(file, -obj->size); msm_gem_vma_put(obj); @@ -81,9 +91,7 @@ static void msm_gem_close(struct drm_gem_object *obj, struct drm_file *file) dma_resv_wait_timeout(obj->resv, DMA_RESV_USAGE_BOOKKEEP, false, MAX_SCHEDULE_TIMEOUT); - msm_gem_lock_vm_and_obj(&exec, obj, ctx->vm); put_iova_spaces(obj, ctx->vm, true, "close"); - drm_exec_fini(&exec); /* drop locks */ } /* @@ -106,11 +114,7 @@ void msm_gem_vma_put(struct drm_gem_object *obj) return; #ifdef CONFIG_DRM_MSM_KMS - struct drm_exec exec; - - msm_gem_lock_vm_and_obj(&exec, obj, priv->kms->vm); put_iova_spaces(obj, priv->kms->vm, true, "vma_put"); - drm_exec_fini(&exec); /* drop locks */ #endif } @@ -409,8 +413,8 @@ static struct drm_gpuva *lookup_vma(struct drm_gem_object *obj, * mapping. */ static void -put_iova_spaces(struct drm_gem_object *obj, struct drm_gpuvm *vm, - bool close, const char *reason) +put_iova_spaces_locked(struct drm_gem_object *obj, struct drm_gpuvm *vm, + bool close, const char *reason) { struct drm_gpuvm_bo *vm_bo, *tmp; @@ -669,7 +673,7 @@ void msm_gem_unpin_iova(struct drm_gem_object *obj, struct drm_gpuvm *vm) msm_gem_unpin_locked(obj); } if (!is_kms_vm(vm)) - put_iova_spaces(obj, vm, true, "close"); + put_iova_spaces_locked(obj, vm, true, "close"); drm_exec_fini(&exec); /* drop locks */ } @@ -831,7 +835,7 @@ void msm_gem_purge(struct drm_gem_object *obj) GEM_WARN_ON(!is_purgeable(msm_obj)); /* Get rid of any iommu mapping(s): */ - put_iova_spaces(obj, NULL, false, "purge"); + put_iova_spaces_locked(obj, NULL, false, "purge"); msm_gem_vunmap(obj); @@ -869,7 +873,7 @@ void msm_gem_evict(struct drm_gem_object *obj) GEM_WARN_ON(is_unevictable(msm_obj)); /* Get rid of any iommu mapping(s): */ - put_iova_spaces(obj, NULL, false, "evict"); + put_iova_spaces_locked(obj, NULL, false, "evict"); drm_vma_node_unmap(&obj->vma_node, dev->anon_inode->i_mapping); @@ -1082,7 +1086,7 @@ static void msm_gem_free_object(struct drm_gem_object *obj) drm_exec_retry_on_contention(&exec); } } - put_iova_spaces(obj, NULL, true, "free"); + put_iova_spaces_locked(obj, NULL, true, "free"); drm_exec_fini(&exec); /* drop locks */ } -- 2.47.3