linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] bus: arm-ccn: Handle correctly no-more-cpus case
Date: Thu, 14 May 2015 12:26:09 +0100	[thread overview]
Message-ID: <20150514112608.GC494@leverpostej> (raw)
In-Reply-To: <20150514110428.GA494@leverpostej>

On Thu, May 14, 2015 at 12:04:28PM +0100, Mark Rutland wrote:
> On Thu, May 14, 2015 at 11:50:24AM +0100, Pawel Moll wrote:
> > When migrating events the driver picks another cpu using
> > cpumask_any_but() function, which returns value >= nr_cpu_ids
> > when there is none available, not a negative value as the code
> > assumed. Fixed now.
> 
> The fix looks good to me:
> 
> Acked-by: Mark Rutland <mark.rutland@arm.com>
> 
> Does this need to be CC'd to stable? What does perf_pmu_migrate_context
> do when passed a target >= nr_cpus?

Never mind, it looks like we can never encounter that case anyway. In
the case of kexec or reset we won't notify CPU_DOWN_PREPARE on the final
CPU, and we can't hotplug the final CPU.

Which means that the target check is irrelevant as we should always get
a valid cpu back from cpumask_any_but in the cases we'll call it. So we
could just delete it entirely, assuming I haven't missed a
CPU_DOWN_PREPARE notification path...

Mark.

> > diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
> > index 7d9879e..cc322fb 100644
> > --- a/drivers/bus/arm-ccn.c
> > +++ b/drivers/bus/arm-ccn.c
> > @@ -1184,7 +1184,7 @@ static int arm_ccn_pmu_cpu_notifier(struct notifier_block *nb,
> >  		if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
> >  			break;
> >  		target = cpumask_any_but(cpu_online_mask, cpu);
> > -		if (target < 0)
> > +		if (target >= nr_cpu_ids)
> >  			break;
> >  		perf_pmu_migrate_context(&dt->pmu, cpu, target);
> >  		cpumask_set_cpu(target, &dt->cpu);
> > -- 
> > 2.1.0
> > 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

      reply	other threads:[~2015-05-14 11:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150514101344.GA20531@mwanda>
2015-05-14 10:50 ` [PATCH] bus: arm-ccn: Handle correctly no-more-cpus case Pawel Moll
2015-05-14 11:04   ` Mark Rutland
2015-05-14 11:26     ` Mark Rutland [this message]

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=20150514112608.GC494@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).