[Intel-gfx] [RFC 1/4] drm/i915/pmu: Make more struct i915_pmu centric
Chris Wilson
chris at chris-wilson.co.uk
Thu Aug 1 10:53:31 UTC 2019
Quoting Michal Wajdeczko (2019-08-01 11:46:06)
> On Thu, 01 Aug 2019 12:18:22 +0200, Tvrtko Ursulin
> <tvrtko.ursulin at linux.intel.com> wrote:
>
> > From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >
> > Just tidy the code a bit by removing a sea of overly verbose i915->pmu.*.
> >
> > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_pmu.c | 194 +++++++++++++++++---------------
> > 1 file changed, 104 insertions(+), 90 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_pmu.c
> > b/drivers/gpu/drm/i915/i915_pmu.c
> > index eff86483bec0..12008966b00e 100644
> > --- a/drivers/gpu/drm/i915/i915_pmu.c
> > +++ b/drivers/gpu/drm/i915/i915_pmu.c
> > @@ -74,8 +74,9 @@ static unsigned int event_enabled_bit(struct
> > perf_event *event)
> > return config_enabled_bit(event->attr.config);
> > }
> > -static bool pmu_needs_timer(struct drm_i915_private *i915, bool
> > gpu_active)
> > +static bool pmu_needs_timer(struct i915_pmu *pmu, bool gpu_active)
> > {
> > + struct drm_i915_private *i915 = container_of(pmu, typeof(*i915), pmu);
>
> maybe this can be promoted to pmu_to_i915() ?
>
> > u64 enable;
> > /*
> > @@ -83,7 +84,7 @@ static bool pmu_needs_timer(struct drm_i915_private
> > *i915, bool gpu_active)
> > *
> > * We start with a bitmask of all currently enabled events.
> > */
> > - enable = i915->pmu.enable;
> > + enable = pmu->enable;
> > /*
> > * Mask out all the ones which do not need the timer, or in
> > @@ -114,24 +115,26 @@ static bool pmu_needs_timer(struct
> > drm_i915_private *i915, bool gpu_active)
> > void i915_pmu_gt_parked(struct drm_i915_private *i915)
>
> you should be more consistent and change this one too
This is definitely not the final form, so I'm not bothered. I foresee
there being a mix of device-level pmu and gt-level pmu, with this being
part of the latter.
-Chris
More information about the Intel-gfx
mailing list