Re: [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack entries.

From: Vlastimil Babka
Date: Thu Sep 02 2021 - 04:00:07 EST


On 9/2/21 02:11, imran.f.khan@xxxxxxxxxx wrote:
> Hi Vlastimil,
>
> On 1/9/21 7:07 pm, Vlastimil Babka wrote:
>> On 9/1/21 07:19, Imran Khan wrote:
>>> To print a stack entries, users of stackdepot, first
>>> use stack_depot_fetch to get a list of stack entries
>>> and then use stack_trace_print to print this list.
>>> Provide a helper in stackdepot to print stack entries
>>> based on stackdepot handle.
>>>
>>> Signed-off-by: Imran Khan <imran.f.khan@xxxxxxxxxx>
>>> Suggested-by: Vlastimil Babka <vbabka@xxxxxxx>
>>
>> You should convert existing users together with the patch that introduces
>> the helper. I think print_stack() in mm/kasan/report.c, and
>> __dump_page_owner() could use this.
>>
>
> Okay. I have done this in v2 of the patch set. BTW I also see some users
> (one place in page owner, rest all in some gpu drivers) of stack_depot_fetch
> + stack_trace_snprintf. Could you please let me know if it would be okay to
> add a helper corresponding to stack_trace_snprintf as well.

Yeah looks like that would make sense too, i915 even has this as
__print_depot_stack(). Thanks.