All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-gvt-dev@lists.freedesktop.org, Pengyuan <pengyuan.jiao@intel.com>
Subject: Re: [RFC PATCH 1/2] drm/i915: Add perf property support for context HW id
Date: Tue, 18 Jul 2017 12:34:31 +0100	[thread overview]
Message-ID: <150037767152.3224.4871679448412563788@mail.alporthouse.com> (raw)
In-Reply-To: <eeefdb4e-8cd9-af73-618c-592e3985be77@intel.com>

Quoting Lionel Landwerlin (2017-07-18 12:30:10)
> Looks fine to me, down there a couple of suggestions.
> 
> Cheers,
> 
> -
> Lionel
> 
> On 18/07/17 08:51, Zhenyu Wang wrote:
> > In order to support profiling for special context e.g vGPU context,
> > we can expose vGPU context hw id and enable i915 perf property to
> > get target context for profiling. This adds new perf property to
> > assign target context with hw id.
> >
> > Jiao Pengyuan has helped to fix context reference bug in original code.
> >
> > Cc: Jiao, Pengyuan <pengyuan.jiao@intel.com>
> > Cc: Niu, Bing <bing.niu@intel.com>
> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> > Cc: intel-gvt-dev@lists.freedesktop.org
> > Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> > ---
> >   drivers/gpu/drm/i915/i915_perf.c | 37 +++++++++++++++++++++++++++++++++++++
> >   include/uapi/drm/i915_drm.h      |  5 +++++
> >   2 files changed, 42 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> > index d9f77a4d85db..350fd259b2d0 100644
> > --- a/drivers/gpu/drm/i915/i915_perf.c
> > +++ b/drivers/gpu/drm/i915/i915_perf.c
> > @@ -348,7 +348,9 @@ struct perf_open_properties {
> >       u32 sample_flags;
> >   
> >       u64 single_context:1;
> > +     u64 single_context_hw:1;
> >       u64 ctx_handle;
> > +     u64 ctx_hw_id;
> >   
> >       /* OA sampling state */
> >       int metrics_set;
> > @@ -2555,6 +2557,28 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
> >               }
> >       }
> >   
> > +     if (props->single_context_hw) {
> > +             struct i915_gem_context *ctx;
> > +
> > +             mutex_lock(&dev_priv->drm.struct_mutex);
> 
> Maybe use i915_mutex_lock_interruptible() ?
> 
> > +             list_for_each_entry(ctx, &dev_priv->contexts.list, link) {
> > +                     if (!i915_gem_context_is_default(ctx))
> > +                             continue;
> > +
> > +                     if (ctx->hw_id == props->ctx_hw_id) {
> > +                             specific_ctx = ctx;
> > +                             i915_gem_context_get(specific_ctx);
> > +                             break;
> > +                     }
> > +             }
> > +             mutex_unlock(&dev_priv->drm.struct_mutex);
> 
> Maybe you could put the logic above into a function?

Please, please make sure this guarded by extreme paranoia. This indeed
has the opposite effect and allows any user to snoop on another.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-07-18 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  7:51 [RFC PATCH 0/2] Enable OA perf for vGPU Zhenyu Wang
2017-07-18  7:51 ` [RFC PATCH 1/2] drm/i915: Add perf property support for context HW id Zhenyu Wang
2017-07-18 11:30   ` Lionel Landwerlin
2017-07-18 11:34     ` Chris Wilson [this message]
2017-07-18 11:43       ` Lionel Landwerlin
2017-07-18 11:33   ` Lionel Landwerlin
2017-07-18 11:43   ` Lionel Landwerlin
2017-07-18  7:51 ` [RFC PATCH 2/2] drm/i915/gvt: expose vGPU context hw id Zhenyu Wang
2017-07-18  7:58 ` ✗ Fi.CI.BAT: failure for Enable OA perf for vGPU 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=150037767152.3224.4871679448412563788@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=lionel.g.landwerlin@intel.com \
    --cc=pengyuan.jiao@intel.com \
    --cc=zhenyuw@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.