public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Vincent Donnefort <vincent.donnefort@arm.com>,
	Steven Price <steven.price@arm.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Baokun Li <libaokun1@huawei.com>,
	Dongli Zhang <dongli.zhang@oracle.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Yuan ZhaoXiong <yuanzhaoxiong@baidu.com>,
	YueHaibing <yuehaibing@huawei.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>
Subject: Re: [PATCH v2] cpu/hotplug: Set st->cpu earlier
Date: Tue, 22 Mar 2022 23:58:09 +0100	[thread overview]
Message-ID: <87wngla932.ffs@tglx> (raw)
In-Reply-To: <bc66bee6-7c99-b289-f5e9-ccaf03d5605d@arm.com>

On Tue, Mar 22 2022 at 15:59, Vincent Donnefort wrote:
> On 22/03/2022 15:31, Thomas Gleixner wrote:
>> On Wed, Mar 16 2022 at 15:36, Steven Price wrote:
>>> Setting the 'cpu' member of struct cpuhp_cpu_state in cpuhp_create() is
>>> too late as other callbacks can be made before that point.
>> 
>> What?
>> 
>>          CPUHP_OFFLINE = 0,
>>          CPUHP_CREATE_THREADS,
>> 
>> The create threads callback is the very first callback which is invoked
>> for a to be plugged CPU on the control CPU. So which earlier callback
>> can be invoked and fail?
>> 
>> Thanks,
>> 
>>          tglx
>
>
> CPUHP_CREATE_THREADS itself can fail, before st->cpu is set.

Sure. But that does not explain the problem.

> Also, that value is used outside of the callbacks (cpuhp_set_state()
> in _cpu_up()).

And why on earth is this not spelled out in the changelog?

> But indeed this description could be refined a bit.

Indeed. But the description is not the only problem here:

It's completely uncomprehensible from the code in _cpu_up() _WHY_ this

     st->cpu = cpu;
     
assignment has to be there.

It's non-sensical if you really think about it, right?

That said, I'm pretty sure you can come up with:

 - a proper one time initialization of @st which solves your problem

 - a proper changelog which explains it

Thanks,

        tglx

  reply	other threads:[~2022-03-22 22:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:36 [PATCH v2] cpu/hotplug: Set st->cpu earlier Steven Price
2022-03-22 11:38 ` Vincent Donnefort
2022-03-22 15:31 ` Thomas Gleixner
2022-03-22 15:59   ` Vincent Donnefort
2022-03-22 22:58     ` Thomas Gleixner [this message]
2022-03-23 10:10       ` Steven Price
2022-03-23 10:11         ` [PATCH] cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state Steven Price
2022-03-23 11:21         ` [PATCH v2] cpu/hotplug: Set st->cpu earlier Thomas Gleixner
2022-03-28 15:19           ` Steven Price

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=87wngla932.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=dietmar.eggemann@arm.com \
    --cc=dongli.zhang@oracle.com \
    --cc=libaokun1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=steven.price@arm.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.donnefort@arm.com \
    --cc=yuanzhaoxiong@baidu.com \
    --cc=yuehaibing@huawei.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