linux-mips
[Top] [All Lists]

[PATCH 3/5] MIPS/Perf-events: Check event state in validate_event()

To: ralf@linux-mips.org, a.p.zijlstra@chello.nl, fweisbec@gmail.com, will.deacon@arm.com
Subject: [PATCH 3/5] MIPS/Perf-events: Check event state in validate_event()
From: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Date: Thu, 18 Nov 2010 14:56:39 +0800
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, wuzhangjin@gmail.com, paulus@samba.org, mingo@elte.hu, acme@redhat.com, dengcheng.zhu@gmail.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=zeFJ/G7Zo4m6FcSjcQ1z2PiISXw/VUK5Czf4Fr/d1/M=; b=n/IO6gPcdACUY/XnXqTYa3D78AyalnReRPWxczb6cQLU7jE5kJCaKQmMzZAHUMCP1U bZsP7Z9vaQkD4HtqkuZ6ulyZ33NeNE8YxFBkU/0s0Jpi0ajCaocYtmMLD2mYHQ+OVEFC KtKTCIpcx7nHGOCIlyvDJGoR5i7MKvT03yds0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=AWj0KK4qaI847m0nXW8lWlwSxpJSHe3g1JwdNDtOI5/s2mykmyUh2+NCzhMs8Pvim7 1lLGXVr5O32fAxmeQXtXkkDNeqJD8y9dDitzN7jR0q8+s2GTvu30XtZREDRM14/CYSqL a/sYjeU4OBd8DS/vIVsCZCx40SHWMI1QsbjrQ=
In-reply-to: <1290063401-25440-1-git-send-email-dengcheng.zhu@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1290063401-25440-1-git-send-email-dengcheng.zhu@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Ignore events that are not for this PMU or are in off/error state.

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
---
 arch/mips/kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
index 1ee44a3..9c6442a 100644
--- a/arch/mips/kernel/perf_event.c
+++ b/arch/mips/kernel/perf_event.c
@@ -486,7 +486,7 @@ static int validate_event(struct cpu_hw_events *cpuc,
 {
        struct hw_perf_event fake_hwc = event->hw;
 
-       if (event->pmu && event->pmu != &pmu)
+       if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
                return 0;
 
        return mipspmu->alloc_counter(cpuc, &fake_hwc) >= 0;
-- 
1.7.1


<Prev in Thread] Current Thread [Next in Thread>