linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: wang xiaolei <xiaolei.wang@windriver.com>
To: Vlastimil Babka <vbabka@suse.cz>,
	catalin.marinas@arm.com, akpm@linux-foundation.org,
	glider@google.com, andreyknvl@gmail.com,
	zhaoyang.huang@unisoc.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] lib/stackdepot: Bail out in __stack_depot_save() if the stack_table is not allocated
Date: Fri, 11 Aug 2023 13:02:39 +1100	[thread overview]
Message-ID: <0651ed3c-7239-0235-ac14-b0379fe06297@windriver.com> (raw)
In-Reply-To: <08dd143e-3eb4-1854-eddd-508f997dd810@suse.cz>


On 8/10/23 8:53 PM, Vlastimil Babka wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On 8/10/23 09:47, Xiaolei Wang wrote:
>> The __stack_depot_save() may be used by some subsystems even before
>> the stack depot is initialized.
> Does that currently happen, or only after patch 2/2 it starts happening via
> kmemleak?
Yes, currently it happens after patch 2/2 it starts happening via kmemleak,

The reason why I take it as the first patch is because I think this can 
avoid

exceptions when there is only patch2, such as when we use git bisect to 
debug

>
>> So add a check of stack_table in
>> __stack_depot_save() to make sure no oops in this case.
>>
>> Fixes: 56a61617dd22 ("mm: use stack_depot for recording kmemleak's backtrace")
> In case it's only after 2/2 I don't think this is truly "Fixes"?

Yes, it is indeed for patch2 at present, it is to fix the situation that 
kmemleak

has no backtrace in the boot phase, and at the same time, it can also 
prevent

patch2 from entering the stable kernel and causing panic

thanks

xiaolei

>
>> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
>> ---
>>   lib/stackdepot.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/stackdepot.c b/lib/stackdepot.c
>> index 2f5aa851834e..a0651d013a0d 100644
>> --- a/lib/stackdepot.c
>> +++ b/lib/stackdepot.c
>> @@ -376,7 +376,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries,
>>         */
>>        nr_entries = filter_irq_stacks(entries, nr_entries);
>>
>> -     if (unlikely(nr_entries == 0) || stack_depot_disabled)
>> +     if (unlikely(nr_entries == 0) || stack_depot_disabled || unlikely(!stack_table))
>>                goto fast_exit;
>>
>>        hash = hash_stack(entries, nr_entries);


  reply	other threads:[~2023-08-11  2:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  7:47 [PATCH 0/2] Bail out in __stack_depot_save() if the stack_table is not allocated and delete the kmemleak_initialized judgment in set_track_prepare() Xiaolei Wang
2023-08-10  7:47 ` [PATCH 1/2] lib/stackdepot: Bail out in __stack_depot_save() if the stack_table is not allocated Xiaolei Wang
2023-08-10  9:53   ` Vlastimil Babka
2023-08-11  2:02     ` wang xiaolei [this message]
2023-08-10  7:47 ` [PATCH 2/2] mm/kmemleak: No need to check kmemleak_initialized in set_track_prepare() Xiaolei Wang
2023-08-10 10:03   ` Vlastimil Babka
2023-08-10 10:16     ` Vlastimil Babka
2023-08-11  2:03       ` wang xiaolei
2023-08-11  8:09         ` Vlastimil Babka
2023-08-14 16:20           ` Catalin Marinas
2023-08-15  2:27             ` wangxiaolei

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=0651ed3c-7239-0235-ac14-b0379fe06297@windriver.com \
    --to=xiaolei.wang@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=glider@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --cc=zhaoyang.huang@unisoc.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