Skip to content

Commit

Permalink
drm/i915/perf: replace idr_init() by idr_init_base()
Browse files Browse the repository at this point in the history
idr_init() uses base 0 which is an invalid identifier. The new function
idr_init_base allows IDR to set the ID lookup from base 1. This avoids
all lookups that otherwise starts from 0 since 0 is always unused.

References: commit 6ce711f ("idr: Make 1-based IDRs more efficient")

Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20201104150339.GA68663@localhost
  • Loading branch information
Deepak R Varma authored and Chris Wilson committed Nov 28, 2020
1 parent a9d71f7 commit 8d989f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4367,7 +4367,7 @@ void i915_perf_init(struct drm_i915_private *i915)
RUNTIME_INFO(i915)->cs_timestamp_frequency_hz / 2;

mutex_init(&perf->metrics_lock);
idr_init(&perf->metrics_idr);
idr_init_base(&perf->metrics_idr, 1);

/* We set up some ratelimit state to potentially throttle any
* _NOTES about spurious, invalid OA reports which we don't
Expand Down

0 comments on commit 8d989f4

Please sign in to comment.