From patchwork Fri Jun 3 21:03:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Leeder X-Patchwork-Id: 9154065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 576D960751 for ; Fri, 3 Jun 2016 21:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488DE28338 for ; Fri, 3 Jun 2016 21:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D2862833A; Fri, 3 Jun 2016 21:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C622F28338 for ; Fri, 3 Jun 2016 21:05:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8wGK-0000zL-SX; Fri, 03 Jun 2016 21:04:12 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8wGE-0000pt-EN for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2016 21:04:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2D4FF613F9; Fri, 3 Jun 2016 21:03:50 +0000 (UTC) Received: from codeaurora.org (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nleeder@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2E9A361384; Fri, 3 Jun 2016 21:03:48 +0000 (UTC) From: Neil Leeder To: Catalin Marinas , WillDeacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Subject: [PATCH 1/2] perf: allow add to change event state Date: Fri, 3 Jun 2016 17:03:31 -0400 Message-Id: <1464987812-14360-2-git-send-email-nleeder@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464987812-14360-1-git-send-email-nleeder@codeaurora.org> References: <1464987812-14360-1-git-send-email-nleeder@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160603_140406_544085_E454DDD3 X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Langsdorf , linux-arm-msm@vger.kernel.org, Timur Tabi , Mark Salter , linux-kernel@vger.kernel.org, cov@codeaurora.org, Jon Masters , Neil Leeder , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When the platform-specific pmu->add function returns an error, it may have also changed the event's state. If so, do not override that new state. Signed-off-by: Neil Leeder --- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index c0ded24..95c4cf3d3 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1952,7 +1952,8 @@ event_sched_in(struct perf_event *event, perf_log_itrace_start(event); if (event->pmu->add(event, PERF_EF_START)) { - event->state = PERF_EVENT_STATE_INACTIVE; + if (event->state == PERF_EVENT_STATE_ACTIVE) + event->state = PERF_EVENT_STATE_INACTIVE; event->oncpu = -1; ret = -EAGAIN; goto out;