From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751811AbcGONIg (ORCPT ); Fri, 15 Jul 2016 09:08:36 -0400 Received: from foss.arm.com ([217.140.101.70]:49393 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbcGONIe (ORCPT ); Fri, 15 Jul 2016 09:08:34 -0400 Date: Fri, 15 Jul 2016 14:08:18 +0100 From: Mark Rutland To: Anna-Maria Gleixner Cc: LKML , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , rt@linutronix.de, Sebastian Andrzej Siewior , Linus Torvalds , Will Deacon Subject: Re: [patch V2 35/67] arm/perf: Convert to hotplug state machine Message-ID: <20160715130818.GA19840@leverpostej> References: <20160713153219.128052238@linutronix.de> <20160713153335.794097159@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160713153335.794097159@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jul 13, 2016 at 05:16:36PM +0000, Anna-Maria Gleixner wrote: > From: Thomas Gleixner > > Straight forward conversion w/o bells and whistles. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Sebastian Andrzej Siewior > Cc: Linus Torvalds > Cc: Mark Rutland > Cc: Peter Zijlstra > Cc: Will Deacon > Signed-off-by: Anna-Maria Gleixner > --- > drivers/perf/arm_pmu.c | 36 +++++++++++++++--------------------- > include/linux/cpuhotplug.h | 1 + > include/linux/perf/arm_pmu.h | 1 - > 3 files changed, 16 insertions(+), 22 deletions(-) > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c > index 140436a..ae9fc6c 100644 > --- a/drivers/perf/arm_pmu.c > +++ b/drivers/perf/arm_pmu.c > @@ -691,24 +691,15 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) > * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading > * junk values out of them. > */ > -static int cpu_pmu_notify(struct notifier_block *b, unsigned long action, > - void *hcpu) > +static int arm_perf_starting_cpu(unsigned int cpu) > { > - int cpu = (unsigned long)hcpu; > - struct arm_pmu *pmu = container_of(b, struct arm_pmu, hotplug_nb); > - > - if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING) > - return NOTIFY_DONE; > - > - if (!cpumask_test_cpu(cpu, &pmu->supported_cpus)) > - return NOTIFY_DONE; > - > - if (pmu->reset) > - pmu->reset(pmu); > - else > - return NOTIFY_DONE; > - > - return NOTIFY_OK; > + if (!__oprofile_cpu_pmu) > + return 0; > + if (!cpumask_test_cpu(cpu, &__oprofile_cpu_pmu->supported_cpus)) > + return 0; > + if (__oprofile_cpu_pmu->reset) > + __oprofile_cpu_pmu->reset(__oprofile_cpu_pmu); > + return 0; > } We may have multiple PMUs (e.g. two in big.LITTLE systems), and __oprofile_cpu_pmu only contains one of these. So this conversion is not correct. We were relying on the notifier list implicitly containing a list of those PMUs. It seems like we need an explicit list here. We keep __oprofile_cpu_pmu around for legacy 32-bit users of OProfile (on non-hetereogeneous systems), and that's all that the variable should be used for. Thanks, Mark.