linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off
@ 2017-05-24 14:36 Wei Huang
  2017-05-25 15:28 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Huang @ 2017-05-24 14:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arm-kernel, will.deacon, mark.rutland

We saw perf IRQ init failures when running Linux kernel in an ACPI
guest without PMU (i.e. pmu=off). This is because perf IRQ is not
present when pmu=off, but arm_pmu_acpi still tries to register
or unregister GSI. This patch addresses the problem by checking
gicc->performance_interrupt. If it is 0, which is the value set
by qemu when pmu=off, we skip the IRQ register/unregister process.

[    4.069470] bc00: 0000000000040b00 ffff0000089db190
[    4.070267] [<ffff000008134f80>] enable_percpu_irq+0xdc/0xe4
[    4.071192] [<ffff000008667cc4>] arm_perf_starting_cpu+0x108/0x10c
[    4.072200] [<ffff0000080cbdd4>] cpuhp_invoke_callback+0x14c/0x4ac
[    4.073210] [<ffff0000080ccd3c>] cpuhp_thread_fun+0xd4/0x11c
[    4.074132] [<ffff0000080f1394>] smpboot_thread_fn+0x1b4/0x1c4
[    4.075081] [<ffff0000080ec90c>] kthread+0x10c/0x138
[    4.075921] [<ffff0000080833c0>] ret_from_fork+0x10/0x50
[    4.076947] genirq: Setting trigger mode 4 for irq 43 failed
(gic_set_type+0x0/0x74)

Signed-off-by: Wei Huang <wei@redhat.com>
---
 drivers/perf/arm_pmu_acpi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
index 34c862f..d6bb75d 100644
--- a/drivers/perf/arm_pmu_acpi.c
+++ b/drivers/perf/arm_pmu_acpi.c
@@ -29,6 +29,9 @@ static int arm_pmu_acpi_register_irq(int cpu)
 		return -EINVAL;
 
 	gsi = gicc->performance_interrupt;
+	if (!gsi)
+		return 0;
+
 	if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
 		trigger = ACPI_EDGE_SENSITIVE;
 	else
@@ -58,7 +61,8 @@ static void arm_pmu_acpi_unregister_irq(int cpu)
 		return;
 
 	gsi = gicc->performance_interrupt;
-	acpi_unregister_gsi(gsi);
+	if (gsi)
+		acpi_unregister_gsi(gsi);
 }
 
 static int arm_pmu_acpi_parse_irqs(void)
-- 
2.7.4

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

* Re: [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off
  2017-05-24 14:36 [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off Wei Huang
@ 2017-05-25 15:28 ` Will Deacon
  2017-05-25 15:49   ` Wei Huang
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2017-05-25 15:28 UTC (permalink / raw)
  To: Wei Huang; +Cc: linux-kernel, linux-arm-kernel, mark.rutland

Hi Wei,

On Wed, May 24, 2017 at 09:36:41AM -0500, Wei Huang wrote:
> We saw perf IRQ init failures when running Linux kernel in an ACPI
> guest without PMU (i.e. pmu=off). This is because perf IRQ is not
> present when pmu=off, but arm_pmu_acpi still tries to register
> or unregister GSI. This patch addresses the problem by checking
> gicc->performance_interrupt. If it is 0, which is the value set
> by qemu when pmu=off, we skip the IRQ register/unregister process.
> 
> [    4.069470] bc00: 0000000000040b00 ffff0000089db190
> [    4.070267] [<ffff000008134f80>] enable_percpu_irq+0xdc/0xe4
> [    4.071192] [<ffff000008667cc4>] arm_perf_starting_cpu+0x108/0x10c
> [    4.072200] [<ffff0000080cbdd4>] cpuhp_invoke_callback+0x14c/0x4ac
> [    4.073210] [<ffff0000080ccd3c>] cpuhp_thread_fun+0xd4/0x11c
> [    4.074132] [<ffff0000080f1394>] smpboot_thread_fn+0x1b4/0x1c4
> [    4.075081] [<ffff0000080ec90c>] kthread+0x10c/0x138
> [    4.075921] [<ffff0000080833c0>] ret_from_fork+0x10/0x50
> [    4.076947] genirq: Setting trigger mode 4 for irq 43 failed
> (gic_set_type+0x0/0x74)
> 
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  drivers/perf/arm_pmu_acpi.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> index 34c862f..d6bb75d 100644
> --- a/drivers/perf/arm_pmu_acpi.c
> +++ b/drivers/perf/arm_pmu_acpi.c
> @@ -29,6 +29,9 @@ static int arm_pmu_acpi_register_irq(int cpu)
>  		return -EINVAL;
>  
>  	gsi = gicc->performance_interrupt;
> +	if (!gsi)
> +		return 0;

So a GSI of zero means we return an IRQ of zero, which correctly gets
treated as "No ACPI PMU"...

>  	if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
>  		trigger = ACPI_EDGE_SENSITIVE;
>  	else
> @@ -58,7 +61,8 @@ static void arm_pmu_acpi_unregister_irq(int cpu)
>  		return;
>  
>  	gsi = gicc->performance_interrupt;
> -	acpi_unregister_gsi(gsi);
> +	if (gsi)
> +		acpi_unregister_gsi(gsi);

... but then I don't see how we can get here, so I'll drop this hunk.

Will

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

* Re: [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off
  2017-05-25 15:28 ` Will Deacon
@ 2017-05-25 15:49   ` Wei Huang
  2017-05-25 15:50     ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Huang @ 2017-05-25 15:49 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-kernel, linux-arm-kernel, mark.rutland



On 05/25/2017 10:28 AM, Will Deacon wrote:
> Hi Wei,
> 
> On Wed, May 24, 2017 at 09:36:41AM -0500, Wei Huang wrote:
>> We saw perf IRQ init failures when running Linux kernel in an ACPI
>> guest without PMU (i.e. pmu=off). This is because perf IRQ is not
>> present when pmu=off, but arm_pmu_acpi still tries to register
>> or unregister GSI. This patch addresses the problem by checking
>> gicc->performance_interrupt. If it is 0, which is the value set
>> by qemu when pmu=off, we skip the IRQ register/unregister process.
>>
>> [    4.069470] bc00: 0000000000040b00 ffff0000089db190
>> [    4.070267] [<ffff000008134f80>] enable_percpu_irq+0xdc/0xe4
>> [    4.071192] [<ffff000008667cc4>] arm_perf_starting_cpu+0x108/0x10c
>> [    4.072200] [<ffff0000080cbdd4>] cpuhp_invoke_callback+0x14c/0x4ac
>> [    4.073210] [<ffff0000080ccd3c>] cpuhp_thread_fun+0xd4/0x11c
>> [    4.074132] [<ffff0000080f1394>] smpboot_thread_fn+0x1b4/0x1c4
>> [    4.075081] [<ffff0000080ec90c>] kthread+0x10c/0x138
>> [    4.075921] [<ffff0000080833c0>] ret_from_fork+0x10/0x50
>> [    4.076947] genirq: Setting trigger mode 4 for irq 43 failed
>> (gic_set_type+0x0/0x74)
>>
>> Signed-off-by: Wei Huang <wei@redhat.com>
>> ---
>>  drivers/perf/arm_pmu_acpi.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
>> index 34c862f..d6bb75d 100644
>> --- a/drivers/perf/arm_pmu_acpi.c
>> +++ b/drivers/perf/arm_pmu_acpi.c
>> @@ -29,6 +29,9 @@ static int arm_pmu_acpi_register_irq(int cpu)
>>  		return -EINVAL;
>>  
>>  	gsi = gicc->performance_interrupt;
>> +	if (!gsi)
>> +		return 0;
> 
> So a GSI of zero means we return an IRQ of zero, which correctly gets
> treated as "No ACPI PMU"...

Yes, returning 0 here and dmesg prints out "No ACPI PMU IRQ for CPU" is
acceptable.

> 
>>  	if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
>>  		trigger = ACPI_EDGE_SENSITIVE;
>>  	else
>> @@ -58,7 +61,8 @@ static void arm_pmu_acpi_unregister_irq(int cpu)
>>  		return;
>>  
>>  	gsi = gicc->performance_interrupt;
>> -	acpi_unregister_gsi(gsi);
>> +	if (gsi)
>> +		acpi_unregister_gsi(gsi);
> 
> ... but then I don't see how we can get here, so I'll drop this hunk.

I am OK to drop it. It was added just to be cautious... Do you need
another version from me or you will remove this hunk?

> 
> Will
> 

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

* Re: [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off
  2017-05-25 15:49   ` Wei Huang
@ 2017-05-25 15:50     ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2017-05-25 15:50 UTC (permalink / raw)
  To: Wei Huang; +Cc: linux-kernel, linux-arm-kernel, mark.rutland

On Thu, May 25, 2017 at 10:49:49AM -0500, Wei Huang wrote:
> On 05/25/2017 10:28 AM, Will Deacon wrote:
> > On Wed, May 24, 2017 at 09:36:41AM -0500, Wei Huang wrote:
> >>  	if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
> >>  		trigger = ACPI_EDGE_SENSITIVE;
> >>  	else
> >> @@ -58,7 +61,8 @@ static void arm_pmu_acpi_unregister_irq(int cpu)
> >>  		return;
> >>  
> >>  	gsi = gicc->performance_interrupt;
> >> -	acpi_unregister_gsi(gsi);
> >> +	if (gsi)
> >> +		acpi_unregister_gsi(gsi);
> > 
> > ... but then I don't see how we can get here, so I'll drop this hunk.
> 
> I am OK to drop it. It was added just to be cautious... Do you need
> another version from me or you will remove this hunk?

I can drop this hunk, no need to repost.

Thanks,

Will

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

end of thread, other threads:[~2017-05-25 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 14:36 [PATCH 1/1] drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off Wei Huang
2017-05-25 15:28 ` Will Deacon
2017-05-25 15:49   ` Wei Huang
2017-05-25 15:50     ` Will Deacon

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