All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	patchwork-lst@pengutronix.de, kernel@pengutronix.de,
	Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH 1/4] drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem
Date: Thu, 31 Mar 2022 12:50:54 +0200	[thread overview]
Message-ID: <YkWHjsMFAu/lWFUU@qwark.sigxcpu.org> (raw)
In-Reply-To: <20220323160825.3858619-1-l.stach@pengutronix.de>

Hi Lucas,
On Wed, Mar 23, 2022 at 05:08:22PM +0100, Lucas Stach wrote:
> When the mapping is already reaped the unmap must be a no-op, as we
> would otherwise try to remove the mapping twice, corrupting the involved
> data structures.
> 
> Cc: stable@vger.kernel.org # 5.4
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Whole series

Tested-by: Guido Günther <agx@sigxcpu.org>
Acked-by: Guido Günther <agx@sigxcpu.org>

The code changes look good to me too but I got some details wrong too many times
for a `Reviewed-by:`

Cheers,
 -- Guido

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> index 9fb1a2aadbcb..aabb997a74eb 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> @@ -286,6 +286,12 @@ void etnaviv_iommu_unmap_gem(struct etnaviv_iommu_context *context,
>  
>  	mutex_lock(&context->lock);
>  
> +	/* Bail if the mapping has been reaped by another thread */
> +	if (!mapping->context) {
> +		mutex_unlock(&context->lock);
> +		return;
> +	}
> +
>  	/* If the vram node is on the mm, unmap and remove the node */
>  	if (mapping->vram_node.mm == &context->mm)
>  		etnaviv_iommu_remove_mapping(context, mapping);
> -- 
> 2.30.2
> 

      parent reply	other threads:[~2022-03-31 10:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 16:08 [PATCH 1/4] drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem Lucas Stach
2022-03-23 16:08 ` [PATCH 2/4] drm/etnaviv: move MMU context ref/unref into map/unmap_gem Lucas Stach
2022-03-24 15:39   ` Philipp Zabel
2022-03-23 16:08 ` [PATCH 3/4] drm/etnaviv: move flush_seq increment into etnaviv_iommu_map/unmap Lucas Stach
2022-03-24 15:39   ` Philipp Zabel
2022-03-23 16:08 ` [PATCH 4/4] drm/etnaviv: reap idle softpin mappings when necessary Lucas Stach
2022-03-24 15:39 ` [PATCH 1/4] drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem Philipp Zabel
2022-03-31 10:50 ` Guido Günther [this message]

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=YkWHjsMFAu/lWFUU@qwark.sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=patchwork-lst@pengutronix.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 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.