Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252524 > unrolled thread

[PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

Started byroy.qing.li@gmail.com
First post2015-10-21 10:00 +0200
Last post2015-10-28 04:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity roy.qing.li@gmail.com - 2015-10-21 10:00 +0200
    Re: [PATCH] ARM: perf: ensure the cpu is available to scheduler when  set irq affinity Will Deacon <will.deacon@arm.com> - 2015-10-27 17:50 +0100
      Re: [PATCH] ARM: perf: ensure the cpu is available to scheduler when  set irq affinity Li RongQing <roy.qing.li@gmail.com> - 2015-10-28 04:30 +0100

#1252524 — [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

Fromroy.qing.li@gmail.com
Date2015-10-21 10:00 +0200
Subject[PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity
Message-ID<qlWts-51P-13@gated-at.bofh.it>
From: Li RongQing <roy.qing.li@gmail.com> 

when there are 4 cpus, but only one is available to schedule, the warning
will be generated when run the below command:
    # perf record -g -e cpu-clock -- find / -name "*.ko"
    CPU PMU: unable to set irq affinity (irq=28, cpu=1)
    CPU PMU: unable to set irq affinity (irq=29, cpu=2)
    CPU PMU: unable to set irq affinity (irq=30, cpu=3)

so ensure the cpu is available to scheduler when set irq affinity

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 drivers/perf/arm_pmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2365a32..9401aa8 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -619,6 +619,9 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
 			if (cpu_pmu->irq_affinity)
 				cpu = cpu_pmu->irq_affinity[i];
 
+			if (!cpu_online(cpu))
+				continue;
+
 			if (!cpumask_test_and_clear_cpu(cpu, &cpu_pmu->active_irqs))
 				continue;
 			irq = platform_get_irq(pmu_device, i);
@@ -665,6 +668,9 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
 			if (cpu_pmu->irq_affinity)
 				cpu = cpu_pmu->irq_affinity[i];
 
+			if (!cpu_online(cpu))
+				continue;
+
 			/*
 			 * If we have a single PMU interrupt that we can't shift,
 			 * assume that we're running on a uniprocessor machine and
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1256945 — Re: [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

FromWill Deacon <will.deacon@arm.com>
Date2015-10-27 17:50 +0100
SubjectRe: [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity
Message-ID<qofBF-7xc-51@gated-at.bofh.it>
In reply to#1252524
On Wed, Oct 21, 2015 at 03:56:02PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com> 
> 
> when there are 4 cpus, but only one is available to schedule, the warning
> will be generated when run the below command:
>     # perf record -g -e cpu-clock -- find / -name "*.ko"
>     CPU PMU: unable to set irq affinity (irq=28, cpu=1)
>     CPU PMU: unable to set irq affinity (irq=29, cpu=2)
>     CPU PMU: unable to set irq affinity (irq=30, cpu=3)
> 
> so ensure the cpu is available to scheduler when set irq affinity
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  drivers/perf/arm_pmu.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 2365a32..9401aa8 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -619,6 +619,9 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
>  			if (cpu_pmu->irq_affinity)
>  				cpu = cpu_pmu->irq_affinity[i];
>  
> +			if (!cpu_online(cpu))
> +				continue;
> +
>  			if (!cpumask_test_and_clear_cpu(cpu, &cpu_pmu->active_irqs))
>  				continue;
>  			irq = platform_get_irq(pmu_device, i);
> @@ -665,6 +668,9 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
>  			if (cpu_pmu->irq_affinity)
>  				cpu = cpu_pmu->irq_affinity[i];
>  
> +			if (!cpu_online(cpu))
> +				continue;
> +

Isn't this all racy against concurrent hotplug events? We're probably
better off requesting the IRQs at PMU probe time, since we no longer have
to worry about sharing the IRQ lines with other subsystems such as oprofile,
which is why it was designed this way originally.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1257632 — Re: [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity

FromLi RongQing <roy.qing.li@gmail.com>
Date2015-10-28 04:30 +0100
SubjectRe: [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity
Message-ID<qopAZ-5Ed-7@gated-at.bofh.it>
In reply to#1256945
On Wed, Oct 28, 2015 at 12:47 AM, Will Deacon <will.deacon@arm.com> wrote:
>> +                             continue;
>> +
>
> Isn't this all racy against concurrent hotplug events? We're probably
> better off requesting the IRQs at PMU probe time, since we no longer have
> to worry about sharing the IRQ lines with other subsystems such as oprofile,
> which is why it was designed this way originally.


Could you write a patch?
Thanks

-Roy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web