linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: roy.qing.li@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity
Date: Tue, 27 Oct 2015 16:47:20 +0000	[thread overview]
Message-ID: <20151027164720.GH20208@arm.com> (raw)
In-Reply-To: <1445414162-12414-1-git-send-email-roy.qing.li@gmail.com>

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

  reply	other threads:[~2015-10-27 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  7:56 [PATCH] ARM: perf: ensure the cpu is available to scheduler when set irq affinity roy.qing.li
2015-10-27 16:47 ` Will Deacon [this message]
2015-10-28  3:22   ` Li RongQing

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=20151027164720.GH20208@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roy.qing.li@gmail.com \
    /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).