All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Akash Goel <akash.goel@arm.com>
Cc: "Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	dri-devel@lists.freedesktop.org, kernel@collabora.com,
	nd@arm.com
Subject: Re: [PATCH v1 3/3] drm/panthor: Unlock the locked region before disabling an AS
Date: Tue, 2 Dec 2025 17:21:53 +0100	[thread overview]
Message-ID: <20251202172153.64d3d129@fedora> (raw)
In-Reply-To: <1bf563a8-0670-4167-b909-310220e4b57a@arm.com>

On Tue, 2 Dec 2025 15:09:42 +0000
Akash Goel <akash.goel@arm.com> wrote:

> Hi Boris,
> 
> 
> On 12/2/25 13:35, Boris Brezillon wrote:
> > An AS can be disabled in the middle of a VM operation (VM being
> > evicted from an AS slot, for instance). In that case, we need the
> > locked section to be unlocked before releasing the slot.
> > 
> > Fixes: 6e2d3b3e8589 ("drm/panthor: Add support for atomic page table updates")
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >   drivers/gpu/drm/panthor/panthor_mmu.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> > index 3644af1a8e56..4ed28bd1b8ec 100644
> > --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> > @@ -588,6 +588,7 @@ static int panthor_mmu_as_enable(struct panthor_device *ptdev, u32 as_nr,
> >   static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr,
> >   				  bool recycle_slot)
> >   {
> > +	struct panthor_vm *vm = ptdev->mmu->as.slots[as_nr].vm;
> >   	int ret;
> >     
> 
> Thanks for the fix.
> 
> Please can you consider adding a lockdep_assert_held for 
> mmu->as.slots_lock. That would in a way make it explicit that it is safe 
> to de-reference vm pointer here.

Sure, I can do that.

> 
> Best regards
> Akash
> 
> 
> >   	/* Flush+invalidate RW caches, invalidate RO ones. */
> > @@ -596,6 +597,16 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr,
> >   	if (ret)
> >   		return ret;
> >   
> > +	if (vm && vm->locked_region.size) {
> > +		/* Unlock the region if there a lock pending. */
> > +		ret = as_send_cmd_and_wait(ptdev, vm->as.id, AS_COMMAND_UNLOCK);
> > +		if (ret)
> > +			return ret;
> > +
> > +		vm->locked_region.start = 0;
> > +		vm->locked_region.size = 0;
> > +	}
> > +
> >   	/* If the slot is going to be used immediately, don't bother changing
> >   	 * the config.
> >   	 */  


  reply	other threads:[~2025-12-02 16:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 13:35 [PATCH v1 0/3] drm/panthor: Fix regressions introduced recently Boris Brezillon
2025-12-02 13:35 ` [PATCH v1 1/3] drm/panthor: Drop a WARN_ON() in group_free_queue() Boris Brezillon
2025-12-02 14:20   ` Liviu Dudau
2025-12-02 13:35 ` [PATCH v1 2/3] drm/panthor: Make sure caches are flushed/invalidated when an AS is recycled Boris Brezillon
2025-12-02 14:21   ` Liviu Dudau
2025-12-02 13:35 ` [PATCH v1 3/3] drm/panthor: Unlock the locked region before disabling an AS Boris Brezillon
2025-12-02 14:28   ` Liviu Dudau
2025-12-02 15:09   ` Akash Goel
2025-12-02 16:21     ` Boris Brezillon [this message]
2025-12-02 23:30 ` [PATCH v1 0/3] drm/panthor: Fix regressions introduced recently Chia-I Wu

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=20251202172153.64d3d129@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=akash.goel@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=liviu.dudau@arm.com \
    --cc=nd@arm.com \
    --cc=steven.price@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.