All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
Cc: intel-gfx@lists.freedesktop.org, shashidhar.hiremath@intel.com,
	akash.goel@intel.com
Subject: Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
Date: Wed, 23 Sep 2015 11:26:04 +0200	[thread overview]
Message-ID: <20150923092604.GE3383@phenom.ffwll.local> (raw)
In-Reply-To: <1442758066.26385.52.camel@ankitprasad-desktop>

On Sun, Sep 20, 2015 at 07:37:46PM +0530, Ankitprasad Sharma wrote:
> On Tue, 2015-09-15 at 10:49 +0100, Chris Wilson wrote:
> > On Tue, Sep 15, 2015 at 02:03:25PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > >  i915_gem_create(struct drm_file *file,
> > >  		struct drm_device *dev,
> > >  		uint64_t size,
> > > +		uint32_t flags,
> > >  		uint32_t *handle_p)
> > >  {
> > >  	struct drm_i915_gem_object *obj;
> > > @@ -385,8 +386,31 @@ i915_gem_create(struct drm_file *file,
> > >  	if (size == 0)
> > >  		return -EINVAL;
> > >  
> > > +	if (flags & __I915_CREATE_UNKNOWN_FLAGS)
> > > +		return -EINVAL;
> > > +
> > >  	/* Allocate the new object */
> > > -	obj = i915_gem_alloc_object(dev, size);
> > > +	if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> > > +		mutex_lock(&dev->struct_mutex);
> > > +		obj = i915_gem_object_create_stolen(dev, size);
> > > +		if (!obj) {
> > > +			mutex_unlock(&dev->struct_mutex);
> > > +			return -ENOMEM;
> > 
> > Note that you should change the i915_gem_object_create_stolen() to
> > report the precise error, as with the eviction support we may trigger
> > EINTR. Also ENOSPC will be preferrable for requesting a larger stolen
> > object than the available space (to help distinguish between true oom).
> > -Chris
> I would prefer to do this as a separate patch, as this might require a
> restructuring of the gem_stolen.c to some extent, something like this:

Yeah makes sense to have that split out, but I agree with Chris that we'll
need that error reporting. Follow-up patch on top of your series if fine
with me.
-Daniel

> 
> @@ -465,29 +467,29 @@ i915_gem_object_create_stolen(struct drm_device
> *dev, u64 size)
>  	int ret;
>  
>  	if (!drm_mm_initialized(&dev_priv->mm.stolen))
> -		return NULL;
> +		return ERR_PTR(-EINVAL);
>  
>  	DRM_DEBUG_KMS("creating stolen object: size=%llx\n", size);
>  	if (size == 0)
> -		return NULL;
> +		return ERR_PTR(-EINVAL);
>  
>  	stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
>  	if (!stolen)
> -		return NULL;
> +		return ERR_PTR(-ENOMEM);
>  
>  	ret = i915_gem_stolen_insert_node(dev_priv, stolen, size, 4096);
>  	if (ret) {
>  		kfree(stolen);
> -		return NULL;
> +		return ERR_PTR(-ENOSPC);
>  	}
>  
>  	obj = _i915_gem_object_create_stolen(dev, stolen);
> -	if (obj)
> +	if (!IS_ERR(obj))
>  		return obj;
>  
>  	i915_gem_stolen_remove_node(dev_priv, stolen);
>  	kfree(stolen);
> -	return NULL;
> +	return obj;
>  }
>  
> 
> Thanks,
> Ankit
> 
> 
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-09-23  9:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  8:33 [PATCH v6 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-09-15  8:33 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-09-15 14:00   ` Tvrtko Ursulin
2015-09-15  8:33 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-09-15  9:49   ` Chris Wilson
2015-09-20 14:07     ` Ankitprasad Sharma
2015-09-23  9:26       ` Daniel Vetter [this message]
2015-09-15 14:11   ` Tvrtko Ursulin
2015-09-15  8:33 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-09-15  9:37   ` Chris Wilson
2015-09-15 15:14   ` Tvrtko Ursulin
2015-09-16  9:01     ` Ankitprasad Sharma
2015-09-23  9:28       ` Daniel Vetter
2015-09-23  9:30         ` Tvrtko Ursulin
2015-09-23 12:12           ` Daniel Vetter
2015-09-15  8:33 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-09-15  9:54   ` Chris Wilson
2015-09-15 10:35     ` Ankitprasad Sharma
2015-09-23 14:35 ` [PATCH v6 0/4] Support for creating/using Stolen memory " Chris Wilson
2015-09-30 10:35   ` Ankitprasad Sharma
  -- strict thread matches above, loose matches on Subject: below --
2015-07-22 13:51 [PATCH v5 " ankitprasad.r.sharma
2015-07-22 13:51 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma
2015-07-22 15:14   ` Tvrtko Ursulin
2015-07-22 15:27     ` Chris Wilson
2015-07-01  9:25 [PATCH v4 0/4] Support for creating/using " ankitprasad.r.sharma
2015-07-01  9:25 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma
2015-07-01 15:06   ` Tvrtko Ursulin
2015-07-01 16:19     ` Chris Wilson
2015-07-02  9:37       ` Tvrtko Ursulin
2015-07-02  9:43         ` Chris Wilson
2015-07-01 16:20   ` Tvrtko Ursulin
2015-05-06 10:15 [PATCH v3 0/4] Support for creating/using " ankitprasad.r.sharma
2015-05-06 10:16 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma

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=20150923092604.GE3383@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashidhar.hiremath@intel.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.