From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Intel GFX <intel-gfx@lists.freedesktop.org>,
Ben Widawsky <ben@bwidawsk.net>,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: Re: [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context
Date: Tue, 7 Jan 2014 08:51:10 +0100 [thread overview]
Message-ID: <20140107075110.GC4770@phenom.ffwll.local> (raw)
In-Reply-To: <87ppo9z2ss.fsf@gaia.fi.intel.com>
On Fri, Jan 03, 2014 at 02:07:47PM +0200, Mika Kuoppala wrote:
> Ben Widawsky <benjamin.widawsky@intel.com> writes:
>
> > It makes all the code which calls into this function way too confusing.
> >
> > v2: Fix destroy IOCTL as well
> >
> > v3: Clarify the other two callers of i915_gem_context_get() to never
> > check for NULL. (Mika)
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72903
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
>
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Neither patch subject nor the commit message mention that this fixes a
bug. Also, the Testcase: line at the bottom is missing. I've fixed this
up.
-Daniel
>
> > drivers/gpu/drm/i915/i915_gem_context.c | 12 +++++++++---
> > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++--
> > 2 files changed, 11 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> > index ebe0f67..44dddc00 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> > @@ -526,10 +526,16 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
> > struct i915_hw_context *
> > i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
> > {
> > + struct i915_hw_context *ctx;
> > +
> > if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev))
> > return file_priv->private_default_ctx;
> >
> > - return (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
> > + ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
> > + if (!ctx)
> > + return ERR_PTR(-ENOENT);
> > +
> > + return ctx;
> > }
> >
> > static inline int
> > @@ -776,9 +782,9 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
> > return ret;
> >
> > ctx = i915_gem_context_get(file_priv, args->ctx_id);
> > - if (!ctx) {
> > + if (IS_ERR(ctx)) {
> > mutex_unlock(&dev->struct_mutex);
> > - return -ENOENT;
> > + return PTR_ERR(ctx);
> > }
> >
> > idr_remove(&ctx->file_priv->context_idr, ctx->id);
> > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > index bbff8f9..c30a6ee 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > @@ -916,7 +916,7 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
> > return ERR_PTR(-EINVAL);
> >
> > ctx = i915_gem_context_get(file->driver_priv, ctx_id);
> > - if (IS_ERR_OR_NULL(ctx))
> > + if (IS_ERR(ctx))
> > return ctx;
> >
> > hs = &ctx->hang_stats;
> > @@ -1126,7 +1126,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
> > }
> >
> > ctx = i915_gem_validate_context(dev, file, ring, ctx_id);
> > - if (IS_ERR_OR_NULL(ctx)) {
> > + if (IS_ERR(ctx)) {
> > mutex_unlock(&dev->struct_mutex);
> > ret = PTR_ERR(ctx);
> > goto pre_mutex_err;
> > --
> > 1.8.5.2
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-01-07 7:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <to=1388555170-19936-1-git-send-email-benjamin.widawsky@intel.com>
2014-01-03 5:50 ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Ben Widawsky
2014-01-03 5:50 ` [PATCH 2/3] drm/i915: set ctx->initialized only after RCS Ben Widawsky
2014-01-03 5:50 ` [PATCH 3/3] drm/i915: Make file default context persistent Ben Widawsky
2014-01-03 5:50 ` [PATCH 1/5] intel: squash unused variable 'bo_gem' Ben Widawsky
2014-01-03 5:50 ` [PATCH 2/5] intel: Handle malloc fails in context create Ben Widawsky
2014-01-03 5:50 ` [PATCH 3/5] intel: Merge latest i915_drm.h Ben Widawsky
2014-01-03 5:50 ` [PATCH 4/5] intel: Intel full PPGTT param Ben Widawsky
2014-01-07 7:53 ` Daniel Vetter
2014-01-09 23:20 ` Ben Widawsky
2014-01-03 5:50 ` [PATCH 5/5] configure.ac: bump version to 2.4.51 for release Ben Widawsky
2014-01-03 5:50 ` [PATCH] i965: Use default contexts when possible Ben Widawsky
2014-02-23 20:32 ` [Intel-gfx] " Ben Widawsky
2014-01-03 12:07 ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Mika Kuoppala
2014-01-07 7:51 ` Daniel Vetter [this message]
[not found] ` <CALNAZXq8EZ4Wmq2ONz08gNFcEv4Bi-JzBasEvnAKWEfEWyf_xw@mail.gmail.com>
[not found] ` <CAKMK7uE9aai27U7jwGe0jK5AzjxKx40z8VyS1D4mr__a5x-Qeg@mail.gmail.com>
2014-01-10 23:20 ` Daniel Vetter
2013-12-22 20:55 [PATCH] " Ben Widawsky
2014-01-01 5:46 ` [PATCH] [v2] " Ben Widawsky
2014-01-02 14:34 ` Mika Kuoppala
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=20140107075110.GC4770@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=ben@bwidawsk.net \
--cc=benjamin.widawsky@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@linux.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.