All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, david.emett@broadcom.com,
	thomas.spurden@broadcom.com, Rob Herring <robh@kernel.org>
Subject: Re: [PATCH] drm/v3d: Use the new shmem helpers to reduce driver boilerplate.
Date: Thu, 14 Mar 2019 09:47:36 -0700	[thread overview]
Message-ID: <87k1h1csif.fsf@anholt.net> (raw)
In-Reply-To: <20190314163451.13431-1-eric@anholt.net>

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

Eric Anholt <eric@anholt.net> writes:

> The new shmem helpers from Noralf and Rob abstract out a bunch of our
> BO creation and mapping code.
>
> v2: Use the new sgt getter, and flag pages as dirty before freeing.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>

> @@ -185,83 +33,120 @@ void v3d_free_object(struct drm_gem_object *obj)
>  	struct v3d_dev *v3d = to_v3d_dev(obj->dev);
>  	struct v3d_bo *bo = to_v3d_bo(obj);
>  
> +	v3d_mmu_remove_ptes(bo);
> +
>  	mutex_lock(&v3d->bo_lock);
>  	v3d->bo_stats.num_allocated--;
>  	v3d->bo_stats.pages_allocated -= obj->size >> PAGE_SHIFT;
>  	mutex_unlock(&v3d->bo_lock);
>  
> -	v3d_bo_put_pages(bo);
> -
> -	if (obj->import_attach)
> -		drm_prime_gem_destroy(obj, bo->sgt);
> -
> -	v3d_mmu_remove_ptes(bo);
>  	spin_lock(&v3d->mm_lock);
>  	drm_mm_remove_node(&bo->node);
>  	spin_unlock(&v3d->mm_lock);
>  
> -	mutex_destroy(&bo->lock);
> +	drm_gem_shmem_put_pages(&bo->base);

This put_pages() should be dropped -- it generated a WARN because the
shared helpers already do a put_pages after freeing the sgt.  The CTS
had passed, so I missed it until after I'd sent the patch.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2019-03-14 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  0:43 [PATCH v8] drm: Add library for shmem backed GEM objects Rob Herring
2019-03-13 20:56 ` Eric Anholt
2019-03-14 16:50   ` Rob Herring
2019-03-14 19:06     ` anholt
2019-03-14 16:34 ` [PATCH] drm/v3d: Use the new shmem helpers to reduce driver boilerplate Eric Anholt
2019-03-14 16:34   ` Eric Anholt
2019-03-14 16:47   ` Eric Anholt [this message]
2019-03-14 18:15   ` Rob Herring
2019-03-14 18:15     ` Rob Herring
2019-03-14 19:11     ` Eric Anholt
2019-03-14 19:11       ` Eric Anholt

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=87k1h1csif.fsf@anholt.net \
    --to=eric@anholt.net \
    --cc=david.emett@broadcom.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=thomas.spurden@broadcom.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.