All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Thomas Hellstrom <thellstrom@vmware.com>
Cc: dri-devel@lists.freedesktop.org,
	Jerome Glisse <jglisse@redhat.com>,
	linux-graphics-maintainer@vmware.com, stable@vger.kernel.org,
	airlied@redhat.com
Subject: Re: [PATCH -fixes] drm/ttm: Fix buffer object metadata accounting regression v2
Date: Tue, 12 Jun 2012 08:50:37 -0400	[thread overview]
Message-ID: <20120612125037.GD559@phenom.dumpdata.com> (raw)
In-Reply-To: <1339500522-5392-1-git-send-email-thellstrom@vmware.com>

On Tue, Jun 12, 2012 at 01:28:42PM +0200, Thomas Hellstrom wrote:
> A regression was introduced in the 3.3 rc series, commit
> "drm/ttm: simplify memory accounting for ttm user v2",
> causing the metadata of buffer objects created using the ttm_bo_create()
> function to be accounted twice.
> That causes massive leaks with the vmwgfx driver running for example
> SpecViewperf Catia-03 test 2, eventually killing the app.
> 
> Furthermore, the same commit introduces a regression where
> metadata accounting is leaked if a buffer object is
> initialized with an illegal size. This is also fixed with this commit.
> 
> v2: Fixed an error path and removed an unused variable.
> 
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Jerome Glisse <jglisse@redhat.com>
> Cc: stable@vger.kernel.org

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo.c |   13 +++----------
>  1 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index b67cfca..36f4b28 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1204,6 +1204,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
>  			(*destroy)(bo);
>  		else
>  			kfree(bo);
> +		ttm_mem_global_free(mem_glob, acc_size);
>  		return -EINVAL;
>  	}
>  	bo->destroy = destroy;
> @@ -1307,22 +1308,14 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
>  			struct ttm_buffer_object **p_bo)
>  {
>  	struct ttm_buffer_object *bo;
> -	struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
>  	size_t acc_size;
>  	int ret;
>  
> -	acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
> -	ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
> -	if (unlikely(ret != 0))
> -		return ret;
> -
>  	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
> -
> -	if (unlikely(bo == NULL)) {
> -		ttm_mem_global_free(mem_glob, acc_size);
> +	if (unlikely(bo == NULL))
>  		return -ENOMEM;
> -	}
>  
> +	acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
>  	ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
>  				buffer_start, interruptible,
>  			  persistent_swap_storage, acc_size, NULL, NULL);
> -- 
> 1.7.7.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2012-06-12 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 11:28 [PATCH -fixes] drm/ttm: Fix buffer object metadata accounting regression v2 Thomas Hellstrom
2012-06-12 12:50 ` Konrad Rzeszutek Wilk [this message]
2012-06-12 15:50   ` Jerome Glisse

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=20120612125037.GD559@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=stable@vger.kernel.org \
    --cc=thellstrom@vmware.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.