linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: imran.f.khan@oracle.com
To: Vlastimil Babka <vbabka@suse.cz>,
	geert@linux-m68k.org, akpm@linux-foundation.org,
	ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com,
	dvyukov@google.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
	daniel@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/1] lib, stackdepot: Add helper to print stack entries into buffer.
Date: Tue, 14 Sep 2021 14:26:42 +1000	[thread overview]
Message-ID: <ba2f09de-1de7-3a72-1c1e-fe048c50b8e0@oracle.com> (raw)
In-Reply-To: <464d76e2-37f0-87f3-a9d5-2101367a8ca3@suse.cz>



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@oracle.com>
>> Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> 
> Acked-by: Vlastimil Babka <vbabka@suse.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

  reply	other threads:[~2021-09-14  4:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 14:10 [PATCH 0/1] lib, stackdepot: Add helper to print stack entries into buffer Imran Khan
2021-09-10 14:10 ` [PATCH 1/1] " Imran Khan
2021-09-13  8:51   ` Vlastimil Babka
2021-09-14  4:26     ` imran.f.khan [this message]
2021-09-15 10:06   ` Jani Nikula
2021-09-14  9:03 ` [PATCH 0/1] " Vlastimil Babka
2021-09-15  3:33   ` imran.f.khan

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=ba2f09de-1de7-3a72-1c1e-fe048c50b8e0@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dvyukov@google.com \
    --cc=geert@linux-m68k.org \
    --cc=glider@google.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).