mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, ak@linux.intel.com,
	acme@redhat.com, jolsa@redhat.com, zheng.z.yan@intel.com,
	bp@alien8.de, maria.n.dimakopoulou@gmail.com
Subject: Re: [PATCH v5 3/4] perf,x86: add Intel RAPL PMU support
Date: Wed, 6 Nov 2013 11:50:03 +0100	[thread overview]
Message-ID: <20131106105003.GG10651@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1383670886-30827-4-git-send-email-eranian@google.com>

On Tue, Nov 05, 2013 at 06:01:25PM +0100, Stephane Eranian wrote:
> +static DEFINE_SPINLOCK(rapl_hotplug_lock);

> +static void rapl_exit_cpu(int cpu)
> +{
> +	int i, phys_id = topology_physical_package_id(cpu);
> +
> +	spin_lock(&rapl_hotplug_lock);

> +	spin_unlock(&rapl_hotplug_lock);
> +}
> +
> +static void rapl_init_cpu(int cpu)
> +{
> +	int i, phys_id = topology_physical_package_id(cpu);
> +
> +	spin_lock(&rapl_hotplug_lock);

> +	spin_unlock(&rapl_hotplug_lock);
> +}

> +static int rapl_cpu_starting(int cpu)
> +{
> +	struct rapl_pmu *pmu2;
> +	struct rapl_pmu *pmu1 = per_cpu(rapl_pmu, cpu);
> +	int i, phys_id = topology_physical_package_id(cpu);
> +
> +	if (pmu1)
> +		return 0;
> +
> +	spin_lock(&rapl_hotplug_lock);

> +	spin_unlock(&rapl_hotplug_lock);
> +	return 0;
> +}
> +
> +static int rapl_cpu_dying(int cpu)
> +{
> +	struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu);
> +	struct perf_event *event, *tmp;
> +
> +	if (!pmu)
> +		return 0;
> +
> +	spin_lock(&rapl_hotplug_lock);

> +	spin_unlock(&rapl_hotplug_lock);
> +	return 0;
> +}
> +
> +static int rapl_cpu_notifier(struct notifier_block *self,
> +			     unsigned long action, void *hcpu)
> +{
> +	unsigned int cpu = (long)hcpu;
> +
> +	/* allocate/free data structure for uncore box */
> +	switch (action & ~CPU_TASKS_FROZEN) {
> +	case CPU_UP_PREPARE:
> +		rapl_cpu_prepare(cpu);
> +		break;
> +	case CPU_STARTING:
> +		rapl_cpu_starting(cpu);
> +		break;
> +	case CPU_UP_CANCELED:
> +	case CPU_DYING:
> +		rapl_cpu_dying(cpu);
> +		break;
> +	case CPU_ONLINE:
> +		kfree(per_cpu(rapl_pmu_kfree, cpu));
> +		per_cpu(rapl_pmu_kfree, cpu) = NULL;
> +		break;
> +	case CPU_DEAD:
> +		per_cpu(rapl_pmu, cpu) = NULL;
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	/* select the cpu that collects uncore events */
> +	switch (action & ~CPU_TASKS_FROZEN) {
> +	case CPU_DOWN_FAILED:
> +	case CPU_STARTING:
> +		rapl_init_cpu(cpu);
> +		break;
> +	case CPU_DOWN_PREPARE:
> +		rapl_exit_cpu(cpu);
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return NOTIFY_OK;
> +}

What's the point of that rapl_hotplug_lock? It appears all methods its
used from are called from hotplug notifiers and those are fully
serialized by cpu_add_remove_lock.



  parent reply	other threads:[~2013-11-06 10:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 17:01 [PATCH v5 0/4] perf/x86: " Stephane Eranian
2013-11-05 17:01 ` [PATCH v5 1/4] perf: add active_entry list head to struct perf_event Stephane Eranian
2013-11-05 17:01 ` [PATCH v5 2/4] perf stat: add event unit and scale support Stephane Eranian
2013-11-05 17:01 ` [PATCH v5 3/4] perf,x86: add Intel RAPL PMU support Stephane Eranian
2013-11-06 10:42   ` Peter Zijlstra
2013-11-06 10:50   ` Peter Zijlstra [this message]
2013-11-06 10:52   ` Peter Zijlstra
2013-11-07 17:24     ` Stephane Eranian
2013-11-05 17:01 ` [PATCH v5 4/4] perf,x86: add RAPL hrtimer support Stephane Eranian

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=20131106105003.GG10651@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maria.n.dimakopoulou@gmail.com \
    --cc=mingo@elte.hu \
    --cc=zheng.z.yan@intel.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

all inboxes | Powered by JetHome®