linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] MIPS: perf: Mark pmu interupt IRQF_NO_THREAD
@ 2014-08-05  5:37 Wei.Yang
  2014-08-07 11:48 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Wei.Yang @ 2014-08-05  5:37 UTC (permalink / raw)
  To: ralf; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel, linux-mips,
	wei.yang

From: Yang Wei <Wei.Yang@windriver.com>

In RT kernel, I ran into the following calltrace, so PMU interrupts cannot
be threaded

in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
INFO: lockdep is turned off.
Call Trace:
[<ffffffff8088595c>] dump_stack+0x1c/0x50
[<ffffffff801a958c>] __might_sleep+0x13c/0x148
[<ffffffff80891c54>] rt_spin_lock+0x3c/0xb0
[<ffffffff801ad29c>] __wake_up+0x3c/0x80
[<ffffffff80243ba4>] perf_event_wakeup+0x8c/0xf8
[<ffffffff80243c50>] perf_pending_event+0x40/0x78
[<ffffffff8023d88c>] irq_work_run+0x74/0xc0
[<ffffffff80152640>] mipsxx_pmu_handle_shared_irq+0x110/0x228
[<ffffffff8015276c>] mipsxx_pmu_handle_irq+0x14/0x30
[<ffffffff801ffda4>] handle_irq_event_percpu+0xbc/0x470
[<ffffffff80204478>] handle_percpu_irq+0x98/0xc8
[<ffffffff801ff284>] generic_handle_irq+0x4c/0x68
[<ffffffff8089748c>] do_IRQ+0x2c/0x48
[<ffffffff80105864>] plat_irq_dispatch+0x64/0xd0 


Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
---
 arch/mips/kernel/perf_event_mipsxx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 811084f..fd16763 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -550,7 +550,7 @@ static int mipspmu_get_irq(void)
 	if (mipspmu.irq >= 0) {
 		/* Request my own irq handler. */
 		err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq,
-			IRQF_PERCPU | IRQF_NOBALANCING,
+			IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD,
 			"mips_perf_pmu", NULL);
 		if (err) {
 			pr_warning("Unable to request IRQ%d for MIPS "
-- 
1.7.9.5


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

* Re: [PATCH v1] MIPS: perf: Mark pmu interupt IRQF_NO_THREAD
  2014-08-05  5:37 [PATCH v1] MIPS: perf: Mark pmu interupt IRQF_NO_THREAD Wei.Yang
@ 2014-08-07 11:48 ` Ralf Baechle
  2014-08-07 17:33   ` David Daney
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2014-08-07 11:48 UTC (permalink / raw)
  To: Wei.Yang; +Cc: a.p.zijlstra, paulus, mingo, acme, linux-kernel, linux-mips

On Tue, Aug 05, 2014 at 01:37:47PM +0800, Wei.Yang@windriver.com wrote:

> From: Yang Wei <Wei.Yang@windriver.com>
> 
> In RT kernel, I ran into the following calltrace, so PMU interrupts cannot
> be threaded
> 
> in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
> INFO: lockdep is turned off.
> Call Trace:
> [<ffffffff8088595c>] dump_stack+0x1c/0x50
> [<ffffffff801a958c>] __might_sleep+0x13c/0x148
> [<ffffffff80891c54>] rt_spin_lock+0x3c/0xb0
> [<ffffffff801ad29c>] __wake_up+0x3c/0x80
> [<ffffffff80243ba4>] perf_event_wakeup+0x8c/0xf8
> [<ffffffff80243c50>] perf_pending_event+0x40/0x78
> [<ffffffff8023d88c>] irq_work_run+0x74/0xc0
> [<ffffffff80152640>] mipsxx_pmu_handle_shared_irq+0x110/0x228
> [<ffffffff8015276c>] mipsxx_pmu_handle_irq+0x14/0x30
> [<ffffffff801ffda4>] handle_irq_event_percpu+0xbc/0x470
> [<ffffffff80204478>] handle_percpu_irq+0x98/0xc8
> [<ffffffff801ff284>] generic_handle_irq+0x4c/0x68
> [<ffffffff8089748c>] do_IRQ+0x2c/0x48
> [<ffffffff80105864>] plat_irq_dispatch+0x64/0xd0 

Hm...  I don't see why based on this backtrace you concluce the
handler needs to be marked IRQF_NO_THREAD.  However there's another
reason to mark it IRQF_NO_THREAD.  IRQ threads may be rescheduled to
other CPUs but this handler is fiddling with per-CPU resources.

See https://patchwork.linux-mips.org/patch/2818/ for a similar
scenario a few years ago.

  Ralf

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

* Re: [PATCH v1] MIPS: perf: Mark pmu interupt IRQF_NO_THREAD
  2014-08-07 11:48 ` Ralf Baechle
@ 2014-08-07 17:33   ` David Daney
  0 siblings, 0 replies; 3+ messages in thread
From: David Daney @ 2014-08-07 17:33 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Wei.Yang, a.p.zijlstra, paulus, mingo, acme, linux-kernel,
	linux-mips

On 08/07/2014 04:48 AM, Ralf Baechle wrote:
> On Tue, Aug 05, 2014 at 01:37:47PM +0800, Wei.Yang@windriver.com wrote:
>
>> From: Yang Wei <Wei.Yang@windriver.com>
>>
>> In RT kernel, I ran into the following calltrace, so PMU interrupts cannot
>> be threaded
>>
>> in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
>> INFO: lockdep is turned off.
>> Call Trace:
>> [<ffffffff8088595c>] dump_stack+0x1c/0x50
>> [<ffffffff801a958c>] __might_sleep+0x13c/0x148
>> [<ffffffff80891c54>] rt_spin_lock+0x3c/0xb0
>> [<ffffffff801ad29c>] __wake_up+0x3c/0x80
>> [<ffffffff80243ba4>] perf_event_wakeup+0x8c/0xf8
>> [<ffffffff80243c50>] perf_pending_event+0x40/0x78
>> [<ffffffff8023d88c>] irq_work_run+0x74/0xc0
>> [<ffffffff80152640>] mipsxx_pmu_handle_shared_irq+0x110/0x228
>> [<ffffffff8015276c>] mipsxx_pmu_handle_irq+0x14/0x30
>> [<ffffffff801ffda4>] handle_irq_event_percpu+0xbc/0x470
>> [<ffffffff80204478>] handle_percpu_irq+0x98/0xc8
>> [<ffffffff801ff284>] generic_handle_irq+0x4c/0x68
>> [<ffffffff8089748c>] do_IRQ+0x2c/0x48
>> [<ffffffff80105864>] plat_irq_dispatch+0x64/0xd0
>
> Hm...  I don't see why based on this backtrace you concluce the
> handler needs to be marked IRQF_NO_THREAD.  However there's another
> reason to mark it IRQF_NO_THREAD.  IRQ threads may be rescheduled to
> other CPUs but this handler is fiddling with per-CPU resources.
>

Also by its nature, the profiling code needs synchronous access to the 
register state of the interrupted code.  If you are running on a 
different thread, then I don't think this would be available.

> See https://patchwork.linux-mips.org/patch/2818/ for a similar
> scenario a few years ago.
>
>    Ralf
>
>


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

end of thread, other threads:[~2014-08-07 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05  5:37 [PATCH v1] MIPS: perf: Mark pmu interupt IRQF_NO_THREAD Wei.Yang
2014-08-07 11:48 ` Ralf Baechle
2014-08-07 17:33   ` David Daney

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).