From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86084CCF2C9 for ; Sat, 17 Oct 2026 21:31:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 38E3410E00A; Sat, 17 Oct 2026 21:31:20 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8997B10E00A; Sat, 17 Oct 2026 21:31:14 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 4209C417AE; Sat, 17 Oct 2026 21:31:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E4A61F000C4; Sat, 17 Oct 2026 21:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792272674; bh=JCM777W62X35EsMgX76DsM7ri9s3eX3wfzZra9xZqz4=; h=Date:From:Subject:Cc:To:References:In-Reply-To; b=H6ZFjKDc66Ox3D9m8kZhiCmc8zjvAULT8ZHHXueuaoCx1nxUK/ehey8Exxwaq/l8Y iwYoJxm4DT8KcoWF9UmjMoh7n5ahOQKPWc+ZyHz7tVTQ6AN7ad3AeG3Z9nNaeCN/Fd Mk7RS/GeLJJe4Tn1Ak/iNONr2plItn5Jed29b2mRkiyz/To090ZMcj0xUtEsSPqFZV PiGhGjR6fK62a9NIfJxaUYZiURFL9egvFM919DhKDDNOvY3Rz/s4oiWZnNTmX0Eai9 qx5jV4twmLnXV+KAvusCU/odAH6pLlLSCJRRpOFIIpAa0/uh75gILG5JEiYUKPDnTg CUCW9TmpD6Wxw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sat, 17 Oct 2026 23:31:06 +0200 Message-Id: From: "Danilo Krummrich" Subject: Re: [PATCH v3 7/8] drm/nouveau: use DRM_GPUVM_RESV_PROTECTED Cc: , , , , "Abhinav Kumar" , "Alice Ryhl" , "Anna Maniscalco" , "Antonino Maniscalco" , "Boris Brezillon" , "David Airlie" , "Dmitry Baryshkov" , "Jessica Zhang" , "Jonathan Corbet" , "Liviu Dudau" , "Lyude Paul" , "Maarten Lankhorst" , "Marijn Suijten" , "Maxime Ripard" , "Randy Dunlap" , "Rob Clark" , "Rodrigo Vivi" , "Sean Paul" , "Shuah Khan" , "Simona Vetter" , "Steven Price" , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , "Thomas Zimmermann" To: "Matthew Brost" References: <20261001220632.3190896-1-matthew.brost@intel.com> <20261001220632.3190896-8-matthew.brost@intel.com> In-Reply-To: <20261001220632.3190896-8-matthew.brost@intel.com> X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Fri Oct 2, 2026 at 12:06 AM CEST, Matthew Brost wrote: > @@ -1187,6 +1187,27 @@ bind_validate_region(struct nouveau_job *job) > return 0; > } > =20 > +/* > + * Lock the VM's common dma-resv together with the one of @obj, as neede= d to > + * drop what may be the last reference of a &drm_gpuvm_bo. > + */ > +static void > +nouveau_uvmm_lock_vm_and_obj(struct nouveau_uvmm *uvmm, struct drm_exec = *exec, > + struct drm_gem_object *obj) > +{ > + int ret; > + > + drm_exec_init(exec, DRM_EXEC_IGNORE_DUPLICATES, 2); > + drm_exec_until_all_locked(exec) { > + ret =3D drm_exec_lock_obj(exec, drm_gpuvm_resv_obj(&uvmm->base)); > + if (!ret) > + ret =3D drm_exec_lock_obj(exec, obj); What happens if we reach this with ENOMEM? In such a case we may return wit= hout any locks being held and nouveau would just continue calling into function = that expect locks to be held and hence produced UB, right? (I think there is a similar case in MSM, but it was pre-existing, so I pick= ed all other patches.) > + drm_exec_retry_on_contention(exec); > + if (drm_WARN_ON(uvmm->base.drm, ret)) > + break; > + } > +}