LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] powerpc: fix preempt_count imbalances in perf and kexec paths
@ 2026-06-03  6:27 Aboorva Devarajan
  2026-06-03  6:27 ` [PATCH 1/3] powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del Aboorva Devarajan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Aboorva Devarajan @ 2026-06-03  6:27 UTC (permalink / raw)
  To: Madhavan Srinivasan, linuxppc-dev
  Cc: Athira Rajeev, Aboorva Devarajan, Christophe Leroy, linux-kernel,
	Sourabh Jain, Ritesh Harjani, Shrikanth Hegde

Hi all,

This patch series fixes some minor preempt_count bookkeeping issues in
arch/powerpc/ found during a preemption leak audit prompted by the
lazy/full preemption model changes. These are get_cpu/put_cpu and
get_cpu_var/put_cpu_var pairing errors that leave preempt_count
incorrectly elevated or underflowed.

v1: https://lore.kernel.org/all/20260518050855.1147242-1-aboorvad@linux.ibm.com/

v1 -> v2:
 - Patch 1 (fsl_emb_pmu_del): no functional change; picked up
   Shrikanth's Reviewed-by.
 - Patch 2 (pnv_kexec_wait_secondaries_down): per Shrikanth's review,
   use smp_processor_id() instead of raw_smp_processor_id(). The kexec/
   crash teardown path runs with IRQs disabled so it is safe.
 - Patch 3 (kexec_prepare_cpus): per Shrikanth's review, dropped the
   approach of passing the cpu id through kexec_prepare_cpus_wait() as
   a parameter. kexec_prepare_cpus() already runs local_irq_disable()/
   hard_irq_disable() before the wait, so get_cpu()/put_cpu() is
   unnecessary: just read the cpu id in kexec_prepare_cpus_wait() and
   drop the trailing put_cpu(). This keeps the function signature
   unchanged. smp_processor_id() is used here too, consistent with patch 2.

Testing:
 - Patch 1: compile-tested only (ppc64e_defconfig + CONFIG_FSL_EMB_PERFMON);
   no e500/fsl_emb hardware to runtime-test so far.
 - Patches 2 and 3: kexec boot-tested on PowerNV (powernv_defconfig)
   and pseries (pseries_defconfig).

Please let me know your comments.

Thanks,
Aboorva

Aboorva Devarajan (3):
  powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del
  powerpc/powernv: fix preempt count leak in
    pnv_kexec_wait_secondaries_down
  powerpc/kexec: fix double get_cpu() imbalance in kexec_prepare_cpus

 arch/powerpc/kexec/core_64.c           | 4 +---
 arch/powerpc/perf/core-fsl-emb.c       | 3 ++-
 arch/powerpc/platforms/powernv/setup.c | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.54.0



^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/3] powerpc: fix preempt_count imbalances in perf and kexec paths
@ 2026-05-18  5:08 Aboorva Devarajan
  2026-05-18  5:08 ` [PATCH 1/3] powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del Aboorva Devarajan
  0 siblings, 1 reply; 7+ messages in thread
From: Aboorva Devarajan @ 2026-05-18  5:08 UTC (permalink / raw)
  To: Madhavan Srinivasan, linuxppc-dev
  Cc: Athira Rajeev, Aboorva Devarajan, Christophe Leroy, linux-kernel,
	Sourabh Jain, Ritesh Harjani, Shrikanth Hegde

Hi all,

This patch series fixes some minor preempt_count bookkeeping issues in
arch/powerpc/ found during a preemption leak audit prompted by the
lazy/full preemption model changes. These are get_cpu/put_cpu and
get_cpu_var/put_cpu_var pairing errors that leave preempt_count
incorrectly elevated or underflowed.

Please let me know your comments.

Thanks,
Aboorva

Aboorva Devarajan (3):
  powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del
  powerpc/powernv: fix preempt count leak in
    pnv_kexec_wait_secondaries_down
  powerpc/kexec: fix double get_cpu() imbalance in kexec_prepare_cpus

 arch/powerpc/kexec/core_64.c           | 15 ++++++++-------
 arch/powerpc/perf/core-fsl-emb.c       |  3 ++-
 arch/powerpc/platforms/powernv/setup.c |  2 +-
 3 files changed, 11 insertions(+), 9 deletions(-)

-- 
2.54.0



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

end of thread, other threads:[~2026-06-03  6:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03  6:27 [PATCH v2 0/3] powerpc: fix preempt_count imbalances in perf and kexec paths Aboorva Devarajan
2026-06-03  6:27 ` [PATCH 1/3] powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del Aboorva Devarajan
2026-06-03  6:27 ` [PATCH 2/3] powerpc/powernv: fix preempt count leak in pnv_kexec_wait_secondaries_down Aboorva Devarajan
2026-06-03  6:27 ` [PATCH 3/3] powerpc/kexec: fix double get_cpu() imbalance in kexec_prepare_cpus Aboorva Devarajan
  -- strict thread matches above, loose matches on Subject: below --
2026-05-18  5:08 [PATCH 0/3] powerpc: fix preempt_count imbalances in perf and kexec paths Aboorva Devarajan
2026-05-18  5:08 ` [PATCH 1/3] powerpc/perf: fix preempt count underflow in fsl_emb_pmu_del Aboorva Devarajan
2026-05-18  6:13   ` Shrikanth Hegde
2026-06-03  5:59     ` Aboorva Devarajan

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