public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	a.p.zijlstra@chello.nl, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/core] perf_counter: add comment to barrier
Date: Fri, 13 Mar 2009 13:06:43 GMT	[thread overview]
Message-ID: <tip-ffd25c2b454557dd5a09b23d2446d1800d497bde@git.kernel.org> (raw)
In-Reply-To: <20090313112301.384074618@chello.nl>

Commit-ID:  ffd25c2b454557dd5a09b23d2446d1800d497bde
Gitweb:     http://git.kernel.org/tip/ffd25c2b454557dd5a09b23d2446d1800d497bde
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 13 Mar 2009 12:21:30 +0100
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 13 Mar 2009 14:02:43 +0100

perf_counter: add comment to barrier

We need to ensure the enabled=0 write happens before we
start disabling the actual counters, so that a pcm_amd_enable()
will not enable one underneath us.

I think the race is impossible anyway, we always balance the
ops within any one context and perform enable() with IRQs disabled.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090313112301.384074618@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/cpu/perf_counter.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 1cedc34..a2e3b76 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -247,6 +247,10 @@ static u64 pmc_amd_save_disable_all(void)
 
 	enabled = cpuc->enabled;
 	cpuc->enabled = 0;
+	/*
+	 * ensure we write the disable before we start disabling the
+	 * counters proper, so that pcm_amd_enable() does the right thing.
+	 */
 	barrier();
 
 	for (idx = 0; idx < nr_counters_generic; idx++) {

  parent reply	other threads:[~2009-03-13 13:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 11:21 [PATCH 00/11] generic software counters -v2 Peter Zijlstra
2009-03-13 11:21 ` [PATCH 01/11] sched: remove extra call overhead for schedule() Peter Zijlstra
2009-03-13 13:00   ` [tip:core/locking] " Peter Zijlstra
2009-04-20 19:00   ` [tip:sched/core] " tip-bot for Peter Zijlstra
2009-03-13 11:21 ` [PATCH 02/11] hrtimer: fix rq->lock inversion (again) Peter Zijlstra
2009-03-13 13:00   ` [tip:core/locking] " Peter Zijlstra
2009-03-13 13:27   ` Peter Zijlstra
2009-03-13 14:57   ` Peter Zijlstra
2009-03-31 12:57   ` Peter Zijlstra
2009-04-02 19:45   ` [tip:timers/urgent] " Peter Zijlstra
2009-03-13 11:21 ` [PATCH 03/11] perf_counter: x86: fix 32bit irq_period assumption Peter Zijlstra
2009-03-13 13:00   ` [tip:perfcounters/core] perf_counter: x86: fix 32-bit " Peter Zijlstra
2009-03-13 13:06   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 04/11] perf_counter: use list_move_tail Peter Zijlstra
2009-03-13 13:00   ` [tip:perfcounters/core] perf_counter: use list_move_tail() Peter Zijlstra
2009-03-13 13:06   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 05/11] perf_counter: add comment to barrier Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:06   ` Peter Zijlstra [this message]
2009-03-13 11:21 ` [PATCH 06/11] perf_counter: x86: use ULL postfix for 64bit constants Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:06   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 07/11] perf_counter: software counter event infrastructure Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:07   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 08/11] perf_counter: provide pagefault software events Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:07   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 09/11] perf_counter: provide major/minor page fault " Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:07   ` Peter Zijlstra
2009-03-13 11:21 ` [PATCH 10/11] perf_counter: hrtimer based sampling for software time events Peter Zijlstra
2009-03-13 13:01   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:07   ` Peter Zijlstra
2009-03-13 15:43   ` [PATCH 10.5/11] perf_counter: fix hrtimer sampling Peter Zijlstra
2009-03-13 16:09     ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 11:21 ` [PATCH 11/11] perf_counter: add an event_list Peter Zijlstra
2009-03-13 13:02   ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-13 13:07   ` Peter Zijlstra
2009-03-13 13:07 ` [PATCH 00/11] generic software counters -v2 Ingo Molnar

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=tip-ffd25c2b454557dd5a09b23d2446d1800d497bde@git.kernel.org \
    --to=a.p.zijlstra@chello.nl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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