Quoting Tvrtko Ursulin (2020-11-27 10:01:09) > From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > Adding any kinds of "last" abi markers is usually a mistake which I > repeated when implementing the PMU because it felt convenient at the time. > > This patch marks I915_PMU_LAST as deprecated and stops the internal > implementation using it for sizing the event status bitmask and array. > > New way of sizing the fields is a bit less elegant, but it omits reserving > slots for tracking events we are not interested in, and as such saves some > runtime space. Adding sampling events is likely to be a special event and > the new plumbing needed will be easily detected in testing. Existing > asserts against the bitfield and array sizes are keeping the code safe. > > First event which gets the new treatment in this new scheme are the > interrupts - which neither needs any tracking in i915 pmu nor needs > waking up the GPU to read it. > > v2: > * Streamline helper names. (Chris) > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_pmu.c | 80 ++++++++++++++++++++++++--------- > drivers/gpu/drm/i915/i915_pmu.h | 35 ++++++++++----- > include/uapi/drm/i915_drm.h | 2 +- > 3 files changed, 83 insertions(+), 34 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c > index cd786ad12be7..06dc63bf84d7 100644 > --- a/drivers/gpu/drm/i915/i915_pmu.c > +++ b/drivers/gpu/drm/i915/i915_pmu.c > @@ -27,8 +27,6 @@ > BIT(I915_SAMPLE_WAIT) | \ > BIT(I915_SAMPLE_SEMA)) > > -#define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS) > - > static cpumask_t i915_pmu_cpumask; > static unsigned int i915_pmu_target_cpu = -1; > > @@ -57,17 +55,38 @@ static bool is_engine_config(u64 config) > return config < __I915_PMU_OTHER(0); > } > > -static unsigned int config_enabled_bit(u64 config) > +static unsigned int other_bit(const u64 config) > +{ > + unsigned int val; > + > + switch (config) { > + case I915_PMU_ACTUAL_FREQUENCY: > + val = __I915_PMU_ACTUAL_FREQUENCY_ENABLED; > + break; > + case I915_PMU_REQUESTED_FREQUENCY: > + val = __I915_PMU_REQUESTED_FREQUENCY_ENABLED; > + break; > + case I915_PMU_RC6_RESIDENCY: > + val = __I915_PMU_RC6_RESIDENCY_ENABLED; > + break; > + default: Should we explicitly list the untracked events? At least we should put a comment here to remind ourselves what takes the default path. /* Anything that doesn't require event tracking can be ignored */ > + return -1; > + } > + > + return I915_ENGINE_SAMPLE_COUNT + val; > +} > + > +static unsigned int config_bit(const u64 config) > { > if (is_engine_config(config)) > return engine_config_sample(config); > else > - return ENGINE_SAMPLE_BITS + (config - __I915_PMU_OTHER(0)); > + return other_bit(config); > } Thanks, that reads so much more clearly to me, and complements it use well. Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx