[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba2f09de-1de7-3a72-1c1e-fe048c50b8e0@oracle.com>
Date: Tue, 14 Sep 2021 14:26:42 +1000
From: imran.f.khan@...cle.com
To: Vlastimil Babka <vbabka@...e.cz>, geert@...ux-m68k.org,
akpm@...ux-foundation.org, ryabinin.a.a@...il.com,
glider@...gle.com, andreyknvl@...il.com, dvyukov@...gle.com,
maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...ux.ie, daniel@...ll.ch
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, linux-mm@...ck.org
Subject: Re: [PATCH 1/1] lib, stackdepot: Add helper to print stack entries
into buffer.
On 13/9/21 6:51 pm, Vlastimil Babka wrote:
> On 9/10/21 16:10, Imran Khan wrote:
>> To print stack entries into a buffer, users of stackdepot,
>> first get a list of stack entries using stack_depot_fetch
>> and then print this list into a buffer using stack_trace_snprint.
>> Provide a helper in stackdepot for this purpose.
>> Also change above mentioned users to use this helper.
>>
>> Signed-off-by: Imran Khan <imran.f.khan@...cle.com>
>> Suggested-by: Vlastimil Babka <vbabka@...e.cz>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>
>
Thanks for the review.
A comment below:
>
>> --- a/lib/stackdepot.c
>> +++ b/lib/stackdepot.c
>> @@ -214,6 +214,29 @@ static inline struct stack_record *find_stack(struct stack_record *bucket,
>> return NULL;
>> }
[...]
>> + */
>> +int stack_depot_snprint(depot_stack_handle_t handle, char *buf, size_t size,
>> + int spaces)
>> +{
>> + unsigned long *entries;
>> + unsigned int nr_entries;
>> +
>> + nr_entries = stack_depot_fetch(handle, &entries);
>> + return stack_trace_snprint(buf, size, entries, nr_entries, 0);
>
> stack_trace_snprint() has a WARN_ON(!entries).
> So maybe we should not call it if nr_entries is 0 (because e.g. handle was
> 0) as the warnings are not useful in that case.
>
Agree. I have addressed this feedback in v2 of patch.
Thanks
-- Imran
Powered by blists - more mailing lists