public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa@csail.mit.edu>
To: Costa Shulyupin <costa.shul@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Yury Norov <yury.norov@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Valentin Schneider <vschneid@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
	linux-kernel@vger.kernel.org, Waiman Long <longman@redhat.com>,
	x86@kernel.org, paulmck@kernel.org
Subject: Re: [RFC PATCH v1] stop_machine: Add stop_housekeeping_cpuslocked()
Date: Sun, 5 Jan 2025 00:07:12 +0530	[thread overview]
Message-ID: <Z3l_2CiDgmDmAktE@csail.mit.edu> (raw)
In-Reply-To: <20241218171531.2217275-1-costa.shul@redhat.com>

Hi Costa,

On Wed, Dec 18, 2024 at 07:15:31PM +0200, Costa Shulyupin wrote:
> CPU hotplug interferes with CPU isolation and introduces latency to
> real-time tasks.
> 
> The test:
> 
>   rtla timerlat hist -c 1 -a 500 &
>   echo 0 > /sys/devices/system/cpu/cpu2/online
> 
> The RTLA tool reveals the following blocking thread stack trace:
> 
>                -> multi_cpu_stop
>                -> cpu_stopper_thread
>                -> smpboot_thread_fn
> 
> This happens because multi_cpu_stop() disables interrupts for EACH online
> CPU since takedown_cpu() indirectly invokes take_cpu_down() through
> stop_machine_cpuslocked(). I'm omitting the detailed description of the
> call chain.
> 

I had explored removing stop-machine from the CPU hotplug offline path
a very long time ago:

https://lore.kernel.org/all/20130218123714.26245.61816.stgit@srivatsabhat.in.ibm.com/

Towards the tail end of that patchset is the actual change that
replaces the call to __stop_machine() with stop_one_cpus():

https://lore.kernel.org/all/20130218124431.26245.10956.stgit@srivatsabhat.in.ibm.com/

But before that, there were ~45 odd patches in the series to make sure
that all the existing CPU hotplug callbacks (at the time, in that
kernel version) relying on any implicit assumptions related to the
guarantees provided by stop_machine() were adequately addressed with
an alternative scheme before switching over to stop_one_cpu() for CPU
offlining.

> Proposal: Limit the stop operation to housekeeping CPUs.
> 
> take_cpu_down() invokes with cpuhp_invoke_callback_range_nofail:
>  - tick_cpu_dying()
>  - hrtimers_cpu_dying()
>  - smpcfd_dying_cpu()
>  - x86_pmu_dying_cpu()
>  - rcutree_dying_cpu()
>  - sched_cpu_dying()
>  - cache_ap_offline()
> 
> Which synchronizations do these functions require instead of stop_machine?
> 

I'd recommend taking a look at one such prior attempt to remove
stop_machine from CPU hotplug (shared above) for reference, as you
begin your analysis for the current kernel.

Regards,
Srivatsa
Microsoft Linux Systems Group

      parent reply	other threads:[~2025-01-04 19:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 17:15 [RFC PATCH v1] stop_machine: Add stop_housekeeping_cpuslocked() Costa Shulyupin
2024-12-18 17:27 ` Peter Zijlstra
2024-12-18 17:32   ` Frederic Weisbecker
2025-01-06 13:08     ` Costa Shulyupin
2025-01-06 21:24       ` Frederic Weisbecker
2025-01-07 14:40         ` Costa Shulyupin
2024-12-19 21:38 ` Thomas Gleixner
2025-01-04 18:37 ` Srivatsa S. Bhat [this message]

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=Z3l_2CiDgmDmAktE@csail.mit.edu \
    --to=srivatsa@csail.mit.edu \
    --cc=akpm@linux-foundation.org \
    --cc=costa.shul@redhat.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vschneid@redhat.com \
    --cc=x86@kernel.org \
    --cc=yury.norov@gmail.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