[PATCH] drm/i915/huc: fix leak of debug object in huc load fence on driver unload
Ceraolo Spurio, Daniele
daniele.ceraolospurio at intel.com
Thu Nov 17 15:57:01 UTC 2022
On 11/16/2022 5:29 PM, Brian Norris wrote:
> Hi Daniele,
>
> On Thu, Nov 10, 2022 at 04:56:51PM -0800, Daniele Ceraolo Spurio wrote:
>> The fence is always initialized in huc_init_early, but the cleanup in
>> huc_fini is only being run if HuC is enabled. This causes a leaking of
>> the debug object when HuC is disabled/not supported, which can in turn
>> trigger a warning if we try to register a new debug offset at the same
>> address on driver reload.
>>
>> To fix the issue, make sure to always run the cleanup code.
>>
>> Reported-by: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
>> Reported-by: Brian Norris <briannorris at chromium.org>
>> Fixes: 27536e03271d ("drm/i915/huc: track delayed HuC load with a fence")
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
>> Cc: Brian Norris <briannorris at chromium.org>
>> Cc: Alan Previn <alan.previn.teres.alexis at intel.com>
>> Cc: John Harrison <John.C.Harrison at Intel.com>
>> ---
>>
>> Note: I didn't manage to repro the reported warning, but I did confirm
>> that we weren't correctly calling i915_sw_fence_fini and that this patch
>> fixes that.
> I *did* reproduce, and with this patch, I no longer reproduce. So:
>
> Tested-by: Brian Norris <briannorris at chromium.org>
>
> I see this differs very slightly from the draft version (which didn't
> work for me):
>
> https://lore.kernel.org/all/ac5fde11-c17d-8574-c938-c2278d53cf95@intel.com/
>
> so presumably that diff is the fix.
The extra diff makes the driver call the cleanup function even if HuC is
disabled, while the draft version just fixed the cleanup function
without making sure it was being called.
>
> Thanks a bunch!
Thanks for testing!
Daniele
>
> Brian
>
>> drivers/gpu/drm/i915/gt/uc/intel_huc.c | 12 +++++++-----
>> drivers/gpu/drm/i915/gt/uc/intel_uc.c | 1 +
>> 2 files changed, 8 insertions(+), 5 deletions(-)
More information about the dri-devel
mailing list