public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris.p.wilson@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 4/6] drm/i915/gt: Refactor _wa_add to reuse wa_index and wa_list_grow
Date: Fri, 13 Nov 2020 10:40:07 +0000	[thread overview]
Message-ID: <f7469401-8537-964d-5c9a-8647b0ed060a@linux.intel.com> (raw)
In-Reply-To: <160521027215.25046.10810273417498100458@build.alporthouse.com>


On 12/11/2020 19:44, Chris Wilson wrote:
> Quoting Umesh Nerlige Ramappa (2020-10-10 01:21:03)
>> Switch the search and grow code of the _wa_add to use _wa_index and
>> _wa_list_grow.
>>
>> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>> ---
>>   drivers/gpu/drm/i915/gt/intel_workarounds.c | 54 +++++++--------------
>>   1 file changed, 17 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
>> index 801fcb60f46b..e49283bffa33 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
>> @@ -174,53 +174,33 @@ static void _wa_remove(struct i915_wa_list *wal, i915_reg_t reg, u32 flags)
>>   
>>   static void _wa_add(struct i915_wa_list *wal, const struct i915_wa *wa)
>>   {
>> -       unsigned int addr = i915_mmio_reg_offset(wa->reg);
>> -       unsigned int start = 0, end = wal->count;
>> +       int index;
>>          const unsigned int grow = WA_LIST_CHUNK;
>>          struct i915_wa *wa_;
>>   
>>          GEM_BUG_ON(!is_power_of_2(grow));
>>   
>> -       if (IS_ALIGNED(wal->count, grow)) { /* Either uninitialized or full. */
>> -               struct i915_wa *list;
>> -
>> -               list = kmalloc_array(ALIGN(wal->count + 1, grow), sizeof(*wa),
>> -                                    GFP_KERNEL);
>> -               if (!list) {
>> -                       DRM_ERROR("No space for workaround init!\n");
>> +       if (IS_ALIGNED(wal->count, grow)) /* Either uninitialized or full. */
>> +               if (_wa_list_grow(wal, wal->count) < 0)
>>                          return;
>> -               }
>> -
>> -               if (wal->list)
>> -                       memcpy(list, wal->list, sizeof(*wa) * wal->count);
>>   
>> -               wal->list = list;
> 
> An inherited problem, but I'm a little unnerved by the apparent leak of
> wa->list here.
> 
> Paging Tvrtko to see if he can remember if there's a hidden trick.

I don't see any tricks, just a memory leak for all lists with more than 
16 unique registers on the wa list. :(

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-11-13 10:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10  0:20 [Intel-gfx] [PATCH 0/6] Allow privileged user to map the OA buffer Umesh Nerlige Ramappa
2020-10-10  0:21 ` [Intel-gfx] [PATCH 1/6] drm/i915/perf: Ensure observation logic is not clock gated Umesh Nerlige Ramappa
2020-10-10  0:21 ` [Intel-gfx] [PATCH 2/6] drm/i915/gt: Lock intel_engine_apply_whitelist with uncore->lock Umesh Nerlige Ramappa
2020-11-12 19:37   ` Chris Wilson
2020-10-10  0:21 ` [Intel-gfx] [PATCH 3/6] drm/i915/perf: Whitelist OA report trigger registers Umesh Nerlige Ramappa
2020-10-10  0:21 ` [Intel-gfx] [PATCH 4/6] drm/i915/gt: Refactor _wa_add to reuse wa_index and wa_list_grow Umesh Nerlige Ramappa
2020-11-12 19:44   ` Chris Wilson
2020-11-13 10:40     ` Tvrtko Ursulin [this message]
2020-11-13 11:02       ` Chris Wilson
2020-10-10  0:21 ` [Intel-gfx] [PATCH 5/6] drm/i915/perf: Whitelist OA counter and buffer registers Umesh Nerlige Ramappa
2020-10-10  0:21 ` [Intel-gfx] [PATCH 6/6] drm/i915/perf: Map OA buffer to user space for gen12 performance query Umesh Nerlige Ramappa
2020-10-10  0:53 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for Allow privileged user to map the OA buffer Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2020-10-02 23:27 [Intel-gfx] [PATCH 0/6] " Umesh Nerlige Ramappa
2020-10-02 23:27 ` [Intel-gfx] [PATCH 4/6] drm/i915/gt: Refactor _wa_add to reuse wa_index and wa_list_grow Umesh Nerlige Ramappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7469401-8537-964d-5c9a-8647b0ed060a@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox