[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b1efced-605e-1088-946f-06a4c1a27260@intel.com>
Date: Mon, 20 Mar 2023 19:24:50 +0100
From: Andrzej Hajda <andrzej.hajda@...el.com>
To: Andi Shyti <andi.shyti@...ux.intel.com>
Cc: Chris Wilson <chris.p.wilson@...el.com>, netdev@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Chris Wilson <chris@...is-wilson.co.uk>,
Eric Dumazet <edumazet@...gle.com>,
dri-devel@...ts.freedesktop.org, Daniel Vetter <daniel@...ll.ch>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Jakub Kicinski <kuba@...nel.org>,
David Airlie <airlied@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [Intel-gfx] [PATCH v4 03/10] lib/ref_tracker: add printing to
memory buffer
On 20.03.2023 00:18, Andi Shyti wrote:
> Hi Andrzej,
>
> This looks also good, just few questions.
>
> On Mon, Mar 06, 2023 at 05:31:59PM +0100, Andrzej Hajda wrote:
>> In case one wants to show stats via debugfs.
>
> shall I say it? I'll say it... you can do better with the log
> here. It's not a typo fix :)
>
>> Signed-off-by: Andrzej Hajda <andrzej.hajda@...el.com>
>
> [...]
>
>> +void __ref_tracker_dir_print(struct ref_tracker_dir *dir,
>> + unsigned int display_limit)
>> +{
>> + struct ostream os = {};
>> +
>> + __ref_tracker_dir_pr_ostream(dir, display_limit, &os);
>> +}
>> EXPORT_SYMBOL(__ref_tracker_dir_print);
>>
>> void ref_tracker_dir_print(struct ref_tracker_dir *dir,
>> @@ -114,6 +141,19 @@ void ref_tracker_dir_print(struct ref_tracker_dir *dir,
>> }
>> EXPORT_SYMBOL(ref_tracker_dir_print);
>>
>> +int ref_tracker_dir_snprint(struct ref_tracker_dir *dir, char *buf, size_t size)
>
> nit: snprintf is normally referred to its variable parameter
> counterpart... I would choose a different name... how about
> ref_tracker_dir_fetch_print()?
Hmm, original ref_tracker_dir_print prints the stats to dmesg,
ref_tracker_dir_snprint prints to memory buffer, like:
- stack_depot_print and stack_depot_snprint,
- stack_trace_print and stack_trace_snprint.
>
>> +{
>> + struct ostream os = { .buf = buf, .size = size };
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&dir->lock, flags);
>> + __ref_tracker_dir_pr_ostream(dir, 16, &os);
>> + spin_unlock_irqrestore(&dir->lock, flags);
>
> What are you trying to protect with this spinlock? what if
> the caller has already locked here? do we need a _locked()
> version?
spinlock is to serialize access to dir,
at the moment _locked version is not necessary, but it can be easily
added if needed.
Regards
Andrzej
>
> Thanks,
> Andi
>
>> + return os.used;
>> +}
>> +EXPORT_SYMBOL(ref_tracker_dir_snprint);
>> +
>> void ref_tracker_dir_exit(struct ref_tracker_dir *dir)
>> {
>> struct ref_tracker *tracker, *n;
>>
>> --
>> 2.34.1
Powered by blists - more mailing lists