mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Zhongjin <chenzhongjin@huawei.com>
To: <paulmck@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arch@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<stable@vger.kernel.org>, <peterz@infradead.org>,
	<tglx@linutronix.de>, <namit@vmware.com>, <gor@linux.ibm.com>,
	<rdunlap@infradead.org>, <mingo@kernel.org>, <jgross@suse.com>,
	<gregkh@linuxfoundation.org>, <mpe@ellerman.id.au>
Subject: Re: [PATCH v4] locking/csd_lock: change csdlock_debug from early_param to __setup
Date: Fri, 27 May 2022 14:49:03 +0800	[thread overview]
Message-ID: <fd69f464-4cc9-859e-d38d-bda85e6b33a6@huawei.com> (raw)
In-Reply-To: <20220518011101.GK1790663@paulmck-ThinkPad-P17-Gen-1>

Hi,

On 2022/5/18 9:11, Paul E. McKenney wrote:
> On Tue, May 17, 2022 at 11:22:04AM +0800, Chen Zhongjin wrote:
>> On 2022/5/10 17:46, Chen Zhongjin wrote:
>>> csdlock_debug uses early_param and static_branch_enable() to enable
>>> csd_lock_wait feature, which triggers a panic on arm64 with config:
>>> CONFIG_SPARSEMEM=y
>>> CONFIG_SPARSEMEM_VMEMMAP=n
>>>
>>> With CONFIG_SPARSEMEM_VMEMMAP=n, __nr_to_section is called in
>>> static_key_enable() and returns NULL which makes NULL dereference
>>> because mem_section is initialized in sparse_init() which is later
>>> than parse_early_param() stage.
>>>
>>> For powerpc this is also broken, because early_param stage is
>>> earlier than jump_label_init() so static_key_enable won't work.
>>> powerpc throws an warning: "static key 'xxx' used before call
>>> to jump_label_init()".
>>>
>>> Thus, early_param is too early for csd_lock_wait to run
>>> static_branch_enable(), so changes it to __setup to fix these.
>>>
>>> Fixes: 8d0968cc6b8f ("locking/csd_lock: Add boot parameter for controlling CSD lock debugging")
>>> Cc: stable@vger.kernel.org
>>> Reported-by: Chen jingwen <chenjingwen6@huawei.com>
>>> Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
>>> ---
>>> Change v3 -> v4:
>>> Fix title and description because this fix is also applied
>>> to powerpc.
>>> For more detailed arm64 bug report see:
>>> https://lore.kernel.org/linux-arm-kernel/e8715911-f835-059d-27f8-cc5f5ad30a07@huawei.com/t/
>>>
>>> Change v2 -> v3:
>>> Add module name in title
>>>
>>> Change v1 -> v2:
>>> Fix return 1 for __setup
>>> ---
>>>  kernel/smp.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/smp.c b/kernel/smp.c
>>> index 65a630f62363..381eb15cd28f 100644
>>> --- a/kernel/smp.c
>>> +++ b/kernel/smp.c
>>> @@ -174,9 +174,9 @@ static int __init csdlock_debug(char *str)
>>>  	if (val)
>>>  		static_branch_enable(&csdlock_debug_enabled);
>>>  
>>> -	return 0;
>>> +	return 1;
>>>  }
>>> -early_param("csdlock_debug", csdlock_debug);
>>> +__setup("csdlock_debug=", csdlock_debug);
>>>  
>>>  static DEFINE_PER_CPU(call_single_data_t *, cur_csd);
>>>  static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func);
>>
>> Ping for review. Thanks!
> 
> I have pulled it into -rcu for testing and further review.  It might
> well need to go through some other path, though.
>> 								Thanx, Paul
> .

So did it have any result? Do we have any idea to fix that except delaying the
set timing? I guess that maybe not using static_branch can work for this, but it
still needs to be evaluated for performance influence of not enabled situation.

Best,
Chen


  reply	other threads:[~2022-05-27  6:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  9:46 Chen Zhongjin
2022-05-17  3:22 ` Chen Zhongjin
2022-05-18  1:11   ` Paul E. McKenney
2022-05-27  6:49     ` Chen Zhongjin [this message]
2022-05-27 14:35       ` Paul E. McKenney

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=fd69f464-4cc9-859e-d38d-bda85e6b33a6@huawei.com \
    --to=chenzhongjin@huawei.com \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgross@suse.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=namit@vmware.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®