Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] powercap: idle_inject: Create threads on demand
@ 2026-11-18 10:33 Daniel Lezcano
  2026-11-18 10:33 ` [PATCH v2 1/2] smpboot: Allow restricting per-CPU threads to a CPU mask Daniel Lezcano
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Daniel Lezcano @ 2026-11-18 10:33 UTC (permalink / raw)
  To: rafael, tglx
  Cc: Andrew Morton, Peter Ziljstra, Bradley Morgan, Heiko Stuebner,
	moderated list:ARM/Rockchip SoC support,
	open list:ARM/Rockchip SoC support

Idle injection currently registers per-CPU kernel threads during early
initialization, including on CPUs for which no idle injection device
will be registered.

This series makes thread creation follow the lifetime and CPU mask of
each idle injection device.

The first patch adds an optional CPU mask to smpboot thread descriptors.
The mask restricts thread creation, CPU hotplug handling and teardown,
while preserving the existing behavior for descriptors without a mask.
Registrations sharing task storage are checked for overlapping CPU
masks under smpboot_threads_lock before any threads are created.

The second patch uses this support to register idle injection threads
when a device registers and destroy them when it unregisters. CPU
ownership claims, registration rollback and thread teardown are
serialized to prevent overlapping registrations from sharing threads.

The series was tested on Rockchip RK3588. The updated smpboot code and
idle injection code also build with W=1. Concurrent registration and
CPU hotplug runtime testing remains outstanding.

Changes in v2:
- Reject overlapping smpboot registrations sharing per-CPU task storage
  with WARN_ON_ONCE() and -EBUSY, as suggested by Thomas Gleixner.
- Default a NULL CPU mask to cpu_possible_mask at registration and
  remove redundant NULL-mask checks from the lifecycle helpers.
- Use scoped guards for the smpboot registration locks.
- Document the overlap restriction and registration return values, and
  update the core commit explanation.
- Add Bradley Morgan's Reviewed-by tag to the idle injection patch.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Bradley Morgan <brads@mainlining.org>

Daniel Lezcano (2):
  smpboot: Allow restricting per-CPU threads to a CPU mask
  powercap: idle_inject: Create per-CPU threads on registration

 drivers/powercap/idle_inject.c | 69 +++++++++++++++++++++-------------
 include/linux/smpboot.h        |  6 +++
 kernel/smpboot.c               | 45 +++++++++++++++++-----
 3 files changed, 83 insertions(+), 37 deletions(-)


base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-18 16:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 10:33 [PATCH v2 0/2] powercap: idle_inject: Create threads on demand Daniel Lezcano
2026-11-18 10:33 ` [PATCH v2 1/2] smpboot: Allow restricting per-CPU threads to a CPU mask Daniel Lezcano
2026-11-18 16:00   ` Bradley Morgan
2026-11-18 16:15   ` [PATCH RESEND " Daniel Lezcano
2026-11-18 10:33 ` [PATCH v2 2/2] powercap: idle_inject: Create per-CPU threads on registration Daniel Lezcano
2026-11-18 16:15   ` [PATCH RESEND " Daniel Lezcano
2026-11-18 15:57 ` [PATCH v2 0/2] powercap: idle_inject: Create threads on demand Rafael J. Wysocki (Intel)
2026-11-18 16:15 ` [PATCH RESEND " Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox