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: 9154057 X-Patchwork-Delegate: agross@codeaurora.org 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 9EF1260751 for ; Fri, 3 Jun 2016 21:04:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FFE5282E8 for ; Fri, 3 Jun 2016 21:04:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84D6E28337; Fri, 3 Jun 2016 21:04:06 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26D6D282E8 for ; Fri, 3 Jun 2016 21:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752936AbcFCVDz (ORCPT ); Fri, 3 Jun 2016 17:03:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45334 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752887AbcFCVDw (ORCPT ); Fri, 3 Jun 2016 17:03:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 66112613F8; Fri, 3 Jun 2016 21:03:51 +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 Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Langsdorf , Mark Salter , Jon Masters , Timur Tabi , cov@codeaurora.org, Neil Leeder 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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;