Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Matthew Brost" <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	"Abhinav Kumar" <abhinav.kumar@linux.dev>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Anna Maniscalco" <anna.maniscalco2000@gmail.com>,
	"Antonino Maniscalco" <antomani103@gmail.com>,
	"Boris Brezillon" <boris.brezillon@collabora.com>,
	"David Airlie" <airlied@gmail.com>,
	"Dmitry Baryshkov" <lumag@kernel.org>,
	"Jessica Zhang" <jesszhan0024@gmail.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Rob Clark" <robin.clark@oss.qualcomm.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Sean Paul" <sean@poorly.run>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Steven Price" <steven.price@arm.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: Re: [PATCH v3 7/8] drm/nouveau: use DRM_GPUVM_RESV_PROTECTED
Date: Thu, 22 Oct 2026 11:26:51 +0200	[thread overview]
Message-ID: <DMB9D3I91CP4.QAGAM8GT7MA0@kernel.org> (raw)
In-Reply-To: <atQhrkC+F5xgn4A5@gsse-cloud1.jf.intel.com>

On Sun Oct 18, 2026 at 3:32 AM CEST, Matthew Brost wrote:
> On Sat, Oct 17, 2026 at 06:02:26PM -0700, Matthew Brost wrote:
>> On Sat, Oct 17, 2026 at 11:31:06PM +0200, Danilo Krummrich wrote:
>> > 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;
>> > >  }
>> > >  
>> > > +/*
>> > > + * Lock the VM's common dma-resv together with the one of @obj, as needed 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 = drm_exec_lock_obj(exec, drm_gpuvm_resv_obj(&uvmm->base));
>> > > +		if (!ret)
>> > > +			ret = drm_exec_lock_obj(exec, obj);
>> > 
>> > What happens if we reach this with ENOMEM? In such a case we may return without
>> 
>> Right, valid issue. Sashiko flagged this too.
>> 
>> Originally, I thought we would need to open-code the WW transaction, but
>> instead I ended up fixing drm_exec [1].
>> 
>> So I think we should merge [1] and run the MSM and Nouveau work in a
>> no-failure mode.
>> 
>> One thing I'd add is an assert(!ret) if Nouveau has support for that
>> (see xe_assert.h for what we do in Xe so our CI can catch things we
>> believe are impossible). I suppose the open-coded version would be a
>> WARN_ON() or WARN_ON_ONCE().
>> 
>> Also likey a BUILD_BUG_ON(2 <= DRM_EXEC_INLINE_OBJECTS).
>> 
>
> Ugh, logic inversion.
>
> Rather:
>
> BUILD_BUG_ON(2 > DRM_EXEC_INLINE_OBJECTS)
>
> Matt
>
>> Let me know if you want me to respin with these changes.

That'd be great, thanks!

Please prefer BUILD_BUG_ON(), I'd like to avoid the need for any WARN_ON() in
this code path.

>> 
>> Matt 
>> 
>> [1] https://patchwork.freedesktop.org/series/175390/
>> 
>> > 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 picked all
>> > other patches.)
>> > 
>> > > +		drm_exec_retry_on_contention(exec);
>> > > +		if (drm_WARN_ON(uvmm->base.drm, ret))
>> > > +			break;
>> > > +	}
>> > > +}


  reply	other threads:[~2026-10-22  9:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 22:06 [PATCH v3 0/8] drm/gpuvm: two pass locking for exec Matthew Brost
2026-10-01 22:06 ` [PATCH v3 1/8] drm/gpuvm: allow locking external objects in two passes Matthew Brost
2026-10-04 19:56   ` Anna Maniscalco
2026-10-01 22:06 ` [PATCH v3 2/8] drm/xe: lock the resident BOs of an exec last Matthew Brost
2026-10-01 22:06 ` [PATCH v3 3/8] drm/panthor: lock the resident BOs of a submit last Matthew Brost
2026-10-05  9:39   ` Boris Brezillon
2026-10-01 22:06 ` [PATCH v3 4/8] drm/msm: reject a submit_bo table on VM_BIND contexts Matthew Brost
2026-10-01 22:06 ` [PATCH v3 5/8] drm/msm: use DRM_GPUVM_RESV_PROTECTED for VM_BIND VMs Matthew Brost
2026-10-01 22:06 ` [PATCH v3 6/8] drm/msm: lock the resident BOs of a VM_BIND submit last Matthew Brost
2026-10-04 20:29   ` Anna Maniscalco
2026-10-01 22:06 ` [PATCH v3 7/8] drm/nouveau: use DRM_GPUVM_RESV_PROTECTED Matthew Brost
2026-10-02  0:06   ` Matthew Brost
2026-10-02 20:17     ` Matthew Brost
2026-10-02  9:13   ` sashiko-bot
2026-10-06 16:50   ` Liviu Dudau
2026-10-12 14:11     ` Matthew Brost
2026-10-12 14:16       ` Danilo Krummrich
2026-10-12 14:22         ` Matthew Brost
2026-10-17 21:31   ` Danilo Krummrich
2026-10-18  1:02     ` Matthew Brost
2026-10-18  1:32       ` Matthew Brost
2026-10-22  9:26         ` Danilo Krummrich [this message]
2026-10-01 22:06 ` [PATCH v3 8/8] drm/nouveau: lock the resident BOs of an exec last Matthew Brost
2026-10-01 22:29 ` ✓ CI.KUnit: success for drm/gpuvm: two pass locking for exec (rev3) Patchwork
2026-10-17 21:23 ` (subset) [PATCH v3 0/8] drm/gpuvm: two pass locking for exec Danilo Krummrich
2026-10-18  0:47   ` Matthew Brost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DMB9D3I91CP4.QAGAM8GT7MA0@kernel.org \
    --to=dakr@kernel.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=anna.maniscalco2000@gmail.com \
    --cc=antomani103@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lumag@kernel.org \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=skhan@linuxfoundation.org \
    --cc=steven.price@arm.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox