From: tip-bot for Paul Mackerras <paulus@samba.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, a.p.zijlstra@chello.nl, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:perfcounters/core] perf_counter: Fix lockup with interrupting counters
Date: Fri, 5 Jun 2009 06:24:45 GMT [thread overview]
Message-ID: <tip-6dc5f2a41759987e35e757ef00192e7b424563bb@git.kernel.org> (raw)
In-Reply-To: <18984.33964.21541.743096@cargo.ozlabs.ibm.com>
Commit-ID: 6dc5f2a41759987e35e757ef00192e7b424563bb
Gitweb: http://git.kernel.org/tip/6dc5f2a41759987e35e757ef00192e7b424563bb
Author: Paul Mackerras <paulus@samba.org>
AuthorDate: Fri, 5 Jun 2009 12:36:28 +1000
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 5 Jun 2009 08:22:26 +0200
perf_counter: Fix lockup with interrupting counters
Commit 8e3747c1 ("perf_counter: Change data head from u32 to u64")
changed the type of 'head' in struct perf_mmap_data from atomic_t
to atomic_long_t, but missed converting one use of atomic_read on
it to atomic_long_read. The effect of using atomic_read rather than
atomic_long_read on powerpc (and other big-endian architectures) is
that we get the high half of the 64-bit quantity, resulting in the
cmpxchg retry loop in perf_output_begin spinning forever as soon as
data->head becomes non-zero. On little-endian architectures such as
x86 we would get the low half, resulting in a lockup once data->head
becomes greater than 4G.
This fixes it by using atomic_long_read rather than atomic_read.
[ Impact: fix perfcounter lockup on PowerPC / big-endian systems ]
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <18984.33964.21541.743096@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/perf_counter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 195712e..a5d3e2a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2234,7 +2234,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
perf_output_lock(handle);
do {
- offset = head = atomic_read(&data->head);
+ offset = head = atomic_long_read(&data->head);
head += size;
} while (atomic_long_cmpxchg(&data->head, offset, head) != offset);
prev parent reply other threads:[~2009-06-05 6:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-05 2:36 [PATCH] perf_counter: Fix lockup with interrupting counters Paul Mackerras
2009-06-05 6:24 ` tip-bot for Paul Mackerras [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=tip-6dc5f2a41759987e35e757ef00192e7b424563bb@git.kernel.org \
--to=paulus@samba.org \
--cc=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