From: Mike Galbraith <efault@gmx.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [rt-patch 1/3 v2] arm64/acpi/perf: move pmu allocation to an early CPU up hook
Date: Thu, 02 Aug 2018 15:45:13 +0200 [thread overview]
Message-ID: <1533217513.11791.19.camel@gmx.de> (raw)
In-Reply-To: <1532769235.5926.0.camel@gmx.de>
(bah, make a clean The End to adventures in arm-land)
RT cannot allocate while irqs are disabled.
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
in_atomic(): 0, irqs_disabled(): 128, pid: 25, name: cpuhp/0
CPU: 0 PID: 25 Comm: cpuhp/0 Not tainted 4.16.18-rt10-rt #2
Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.32 08/22/2017
Call trace:
dump_backtrace+0x0/0x188
show_stack+0x24/0x30
dump_stack+0x9c/0xd0
___might_sleep+0x124/0x188
rt_spin_lock+0x40/0x80
pcpu_alloc+0x104/0x7a0
__alloc_percpu_gfp+0x38/0x48
__armpmu_alloc+0x44/0x168
armpmu_alloc_atomic+0x1c/0x28
arm_pmu_acpi_cpu_starting+0x1cc/0x210
cpuhp_invoke_callback+0xb8/0x820
cpuhp_thread_fun+0xc0/0x1e0
smpboot_thread_fn+0x1ac/0x2c8
kthread+0x134/0x138
ret_from_fork+0x10/0x18
Do the allocation and other preparation for probe along with the other
CPUHP_PERF_{ARCH}_PREPARE stages, where we'll be preemptible, thus no
longer requiring a GFP_ATOMIC allocation either.
Signed-off-by: Mike Galbraith <efault@gmx.de>
---
drivers/perf/arm_pmu_acpi.c | 12 ++++++------
include/linux/cpuhotplug.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
--- a/drivers/perf/arm_pmu_acpi.c
+++ b/drivers/perf/arm_pmu_acpi.c
@@ -135,10 +135,10 @@ static struct arm_pmu *arm_pmu_acpi_find
return pmu;
}
- pmu = armpmu_alloc_atomic();
+ pmu = armpmu_alloc();
if (!pmu) {
pr_warn("Unable to allocate PMU for CPU%d\n",
- smp_processor_id());
+ raw_smp_processor_id());
return NULL;
}
@@ -185,7 +185,7 @@ static bool pmu_irq_matches(struct arm_p
* coming up. The perf core won't open events while a hotplug event is in
* progress.
*/
-static int arm_pmu_acpi_cpu_starting(unsigned int cpu)
+static int arm_pmu_acpi_cpu_prepare(unsigned int cpu)
{
struct arm_pmu *pmu;
struct pmu_hw_events __percpu *hw_events;
@@ -283,9 +283,9 @@ static int arm_pmu_acpi_init(void)
if (ret)
return ret;
- ret = cpuhp_setup_state(CPUHP_AP_PERF_ARM_ACPI_STARTING,
- "perf/arm/pmu_acpi:starting",
- arm_pmu_acpi_cpu_starting, NULL);
+ ret = cpuhp_setup_state(CPUHP_PERF_ARM_PMU_ACPI_PREPARE,
+ "perf/arm/pmu_acpi:prepare",
+ arm_pmu_acpi_cpu_prepare, NULL);
return ret;
}
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -29,6 +29,7 @@ enum cpuhp_state {
CPUHP_PERF_PREPARE,
CPUHP_PERF_X86_PREPARE,
CPUHP_PERF_X86_AMD_UNCORE_PREP,
+ CPUHP_PERF_ARM_PMU_ACPI_PREPARE,
CPUHP_PERF_BFIN,
CPUHP_PERF_POWER,
CPUHP_PERF_SUPERH,
@@ -114,7 +115,6 @@ enum cpuhp_state {
CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
- CPUHP_AP_PERF_ARM_ACPI_STARTING,
CPUHP_AP_PERF_ARM_STARTING,
CPUHP_AP_ARM_L2X0_STARTING,
CPUHP_AP_ARM_ARCH_TIMER_STARTING,
next prev parent reply other threads:[~2018-08-02 13:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-27 21:57 [ANNOUNCE] v4.16.18-rt11 Sebastian Andrzej Siewior
2018-07-28 9:07 ` candidates for @devel-rt localversion-rt++ Mike Galbraith
2018-07-28 9:13 ` [rt-patch 1/3] arm64/acpi/perf: move pmu allocation to an early CPU up hook Mike Galbraith
2018-08-02 13:45 ` Mike Galbraith [this message]
2018-07-29 6:55 ` candidates for @devel-rt localversion-rt++ Mike Galbraith
2018-07-29 11:47 ` Mike Galbraith
2018-07-30 16:24 ` Mike Galbraith
2018-07-31 18:28 ` bisected - arm64 kvm unit test failures Mike Galbraith
2018-08-01 5:35 ` Marc Zyngier
2018-08-01 6:02 ` Mike Galbraith
2018-08-01 7:22 ` Marc Zyngier
2018-08-01 7:48 ` Mike Galbraith
2018-08-01 9:20 ` Mike Galbraith
2018-08-21 15:34 ` Marc Zyngier
2018-08-22 13:38 ` Mike Galbraith
2018-08-22 13:50 ` Marc Zyngier
2018-08-22 13:57 ` Mike Galbraith
[not found] ` <1532764179.9882.14.camel@gmx.de>
2018-07-28 9:07 ` [rt-patch 2/3] sched: Introduce raw_cond_resched_lock() Mike Galbraith
2018-07-28 9:07 ` [rt-patch 3/3] arm, KVM: convert vgic_irq.irq_lock to raw_spinlock_t Mike Galbraith
2018-07-30 9:27 ` Peter Zijlstra
2018-07-30 13:34 ` Mike Galbraith
2018-08-02 6:56 ` [rt-patch 4/3] arm,KVM: Move phys_timer handling to hard irq context Mike Galbraith
2018-08-02 16:31 ` Steven Rostedt
2018-08-02 16:50 ` Mike Galbraith
2018-08-02 17:43 ` Mike Galbraith
2018-08-04 12:25 ` Mike Galbraith
2018-08-05 4:52 ` Mike Galbraith
2018-08-07 14:46 ` Sebastian Andrzej Siewior
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=1533217513.11791.19.camel@gmx.de \
--to=efault@gmx.de \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).