From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Vishal Chourasia <vishalc@linux.ibm.com>
Cc: boqun.feng@gmail.com, frederic@kernel.org, joelagnelf@nvidia.com,
josh@joshtriplett.org, linux-kernel@vger.kernel.org,
neeraj.upadhyay@kernel.org, paulmck@kernel.org,
rcu@vger.kernel.org, rostedt@goodmis.org, srikar@linux.ibm.com,
tglx@linutronix.de, urezki@gmail.com, samir@linux.ibm.com,
aboorvad@linux.ibm.com, peterz@infradead.org
Subject: Re: [PATCH v2 1/2] cpuhp: Optimize SMT switch operation by batching lock acquisition
Date: Mon, 16 Feb 2026 18:58:02 +0530 [thread overview]
Message-ID: <8a13e96a-101e-42bd-97d3-dd1682d40a3a@linux.ibm.com> (raw)
In-Reply-To: <e90f73b8-744f-4522-a9b5-55b924671072@linux.ibm.com>
On 2/16/26 6:27 PM, Shrikanth Hegde wrote:
>
>> */
>> if (ctrlval == CPU_SMT_ENABLED && cpu_smt_thread_allowed(cpu))
>> continue;
>> - ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
>
> If you see comment in cpu_down_maps_locked, It says.
>
> * Ensure that the control task does not run on the to be offlined
> * CPU to prevent a deadlock against cfs_b->period_timer.
> * Also keep at least one housekeeping cpu onlined to avoid
> generating
> * an empty sched_domain span
>
> Now, instead of running on the online_CPU you are now doing the _cpu_down
> functionality in the cpu which is going offline.
>
> How are you preventing that deadlock?
Ok. I should have looked at updated code. My bad.
This is no longer true after below commit.
de715325cc47 cpu: Revert "cpu/hotplug: Prevent self deadlock on CPU hot-unplug"
>
>> + ret = cpu_down_locked(cpu, 0, CPUHP_OFFLINE);
>> if (ret)
>> break;
>> /*
>> @@ -2688,6 +2714,9 @@ int cpuhp_smt_disable(enum cpuhp_smt_control
>> ctrlval)
>> }
>> if (!ret)
>> cpu_smt_control = ctrlval;
>> + cpus_write_unlock();
>> + arch_smt_update();
>> +out:
>> cpu_maps_update_done();
>> return ret;
>> }
>> @@ -2705,6 +2734,8 @@ int cpuhp_smt_enable(void)
>> int cpu, ret = 0;
>> cpu_maps_update_begin();
>> + /* Hold cpus_write_lock() for entire batch operation. */
>> + cpus_write_lock();
>> cpu_smt_control = CPU_SMT_ENABLED;
>> for_each_present_cpu(cpu) {
>> /* Skip online CPUs and CPUs on offline nodes */
>> @@ -2712,12 +2743,14 @@ int cpuhp_smt_enable(void)
>> continue;
>> if (!cpu_smt_thread_allowed(cpu) || !
>> topology_is_core_online(cpu))
>> continue;
>> - ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
>> + ret = cpu_up_locked(cpu, 0, CPUHP_ONLINE);
>> if (ret)
>> break;
>> /* See comment in cpuhp_smt_disable() */
>> cpuhp_online_cpu_device(cpu);
>> }
>> + cpus_write_unlock();
>> + arch_smt_update();
>> cpu_maps_update_done();
>> return ret;
>> }
>
next prev parent reply other threads:[~2026-02-16 13:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 12:19 [PATCH v2 0/2] cpuhp: Improve SMT switch time via lock batching and RCU expedition Vishal Chourasia
2026-02-16 12:19 ` [PATCH v2 1/2] cpuhp: Optimize SMT switch operation by batching lock acquisition Vishal Chourasia
2026-02-16 12:48 ` Vishal Chourasia
2026-02-16 12:57 ` Shrikanth Hegde
2026-02-16 13:28 ` Shrikanth Hegde [this message]
2026-02-16 12:19 ` [PATCH v2 2/2] cpuhp: Expedite RCU grace periods during SMT operations Vishal Chourasia
2026-02-16 16:05 ` kernel test robot
2026-02-16 16:38 ` kernel test robot
2026-02-16 17:10 ` Shrikanth Hegde
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=8a13e96a-101e-42bd-97d3-dd1682d40a3a@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=aboorvad@linux.ibm.com \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=samir@linux.ibm.com \
--cc=srikar@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=urezki@gmail.com \
--cc=vishalc@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.