Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Christian König" <christian.koenig@amd.com>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"John Stultz" <john.stultz@linaro.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>
Subject: Re: [Intel-gfx] [PATCH v2 4/4] drm/vgem: use shmem helpers
Date: Thu, 3 Jun 2021 21:42:00 +0300	[thread overview]
Message-ID: <YLkieISPHgzmUnD4@intel.intel> (raw)
In-Reply-To: <20210603150326.1326658-5-daniel.vetter@ffwll.ch>

Hi Daniel,

> +/*
> + * This just sets wc mode for shmem helpers. vgem doesn't have any begin/end cpu
> + * access ioctls, there must use coherent memory or dma-buf sharing just wont
> + * work.
> + */
> +static struct drm_gem_object *vgem_gem_create_object(struct drm_device *dev, size_t size)
>  {
> -	struct drm_vgem_gem_object *obj;
> -	int npages;
> +	struct drm_gem_shmem_object *obj;
>  
> -	obj = __vgem_gem_create(dev, attach->dmabuf->size);
> -	if (IS_ERR(obj))
> -		return ERR_CAST(obj);
> -
> -	npages = PAGE_ALIGN(attach->dmabuf->size) / PAGE_SIZE;
> +	obj = kzalloc(sizeof(*obj), GFP_KERNEL);
> +	if (!obj)
> +		return NULL;
>  
> -	obj->table = sg;
> -	obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
> -	if (!obj->pages) {
> -		__vgem_gem_destroy(obj);
> -		return ERR_PTR(-ENOMEM);
> -	}
> +	obj->base.funcs = &drm_gem_shmem_funcs;
> +	obj->map_wc = true;
>  
> -	obj->pages_pin_count++; /* perma-pinned */
> -	drm_prime_sg_to_page_array(obj->table, obj->pages, npages);
>  	return &obj->base;

here you are allocating a bigger object than what you are
returning, in size. How does it get freed?

Andi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-06-03 18:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 15:03 [Intel-gfx] [PATCH v2 0/4] shmem helpers for igt Daniel Vetter
2021-06-03 15:03 ` [Intel-gfx] [PATCH v2 1/4] drm/gem-shmem-helper: Export drm_gem_shmem_funcs Daniel Vetter
2021-06-03 15:54   ` Thomas Zimmermann
2021-06-03 15:03 ` [Intel-gfx] [PATCH v2 2/4] drm/shmem-helper: Switch to vmf_insert_pfn Daniel Vetter
2021-06-03 20:42   ` kernel test robot
2021-06-03 15:03 ` [Intel-gfx] [PATCH v2 3/4] drm/shmem-helper: Align to page size in dumb_create Daniel Vetter
2021-06-03 18:59   ` Thomas Zimmermann
2021-06-03 15:03 ` [Intel-gfx] [PATCH v2 4/4] drm/vgem: use shmem helpers Daniel Vetter
2021-06-03 18:42   ` Andi Shyti [this message]
2021-06-03 18:54     ` Daniel Vetter
2021-06-03 15:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for shmem helpers for igt Patchwork
2021-06-03 16:29 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

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=YLkieISPHgzmUnD4@intel.intel \
    --to=andi.shyti@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=melissa.srw@gmail.com \
    --cc=sumit.semwal@linaro.org \
    --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