mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/i915: Replace custom intel runtime_pm tracker with ref_tracker library
Beside reusing existing code, the main advantage of ref_tracker is tracking per instance of wakeref. It allows also to catch double put. On the other side we lose information about the first acquire and the last release, but the advantages outweigh it. Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231030-ref_tracker_i915-v1-1-006fe6b96421@intel.com
This commit is contained in:
@@ -191,3 +191,31 @@ void intel_wakeref_auto_fini(struct intel_wakeref_auto *wf)
|
||||
intel_wakeref_auto(wf, 0);
|
||||
INTEL_WAKEREF_BUG_ON(wf->wakeref);
|
||||
}
|
||||
|
||||
void intel_ref_tracker_show(struct ref_tracker_dir *dir,
|
||||
struct drm_printer *p)
|
||||
{
|
||||
const size_t buf_size = PAGE_SIZE;
|
||||
char *buf, *sb, *se;
|
||||
size_t count;
|
||||
|
||||
buf = kmalloc(buf_size, GFP_NOWAIT);
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
count = ref_tracker_dir_snprint(dir, buf, buf_size);
|
||||
if (!count)
|
||||
goto free;
|
||||
/* printk does not like big buffers, so we split it */
|
||||
for (sb = buf; *sb; sb = se + 1) {
|
||||
se = strchrnul(sb, '\n');
|
||||
drm_printf(p, "%.*s", (int)(se - sb + 1), sb);
|
||||
if (!*se)
|
||||
break;
|
||||
}
|
||||
if (count >= buf_size)
|
||||
drm_printf(p, "\n...dropped %zd extra bytes of leak report.\n",
|
||||
count + 1 - buf_size);
|
||||
free:
|
||||
kfree(buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user