From patchwork Fri Jun 21 17:38:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 11010453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BFE8112C for ; Fri, 21 Jun 2019 17:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AD5128B0F for ; Fri, 21 Jun 2019 17:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EBFB28B52; Fri, 21 Jun 2019 17:39:33 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3AF128B0F for ; Fri, 21 Jun 2019 17:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kuqEsJVkwHeI5ItxoPmcUC8kOWf5z09vyfNpgR041vE=; b=BMoKNw4iQCCPUw NPpX5nqd9I1vYKrzQkhqkJ8VgdfmEIC7A0OGu0ZvNsEmI/bYQS70cWOyKR2AT/ibRHnLrKvY2V0Il XGMXRMWSYvGI9j0SGN41ecP/mj8LuaOz8yzIFrKPsrDV8mET3fIyUzKvG5IVQOQIBGHML6lHsctKp o0fP4yO5NoYxiQySYzyDUIyLWm1+c/DGdc1jVsdQUcEQZLJy3SNHb9jE2P0ulPQyRlPMbG717LHxS 2GfWJ7vZHm5t5nQXCmWicmTLxaDo+q2Z95MAtX0Aed90vRNsYHqmSsYEH2BUFvcnkjHFy/IHIIwSa AnmRyP/gZBlJjynQ3V6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1heNVb-0002Dw-Pm; Fri, 21 Jun 2019 17:39:31 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1heNVQ-00026R-8e for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2019 17:39:22 +0000 Received: from quaco.ghostprotocols.net (187-26-104-93.3g.claro.net.br [187.26.104.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B1BE208C3; Fri, 21 Jun 2019 17:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561138759; bh=2kxp3/bcwqJVmLgmI64IVChx4CMr6A8dbEmgkS81CBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9sDrNvg+15Apxl6l3KYfm3Ufbz7bmVu+J+3I+mvAcPYZhfymvr0E0qMTnl5yN8f6 a76g+xfaW3LQoy2a6VEjYEdDldp8M3B1n6XSi5arEtO8j6CFFpQjt/GZk+0H0j/0UN 7UCJC0meFb/uO+7OhYuV3A7eyX2chYQvTdwGdJWA= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Subject: [PATCH 02/25] perf: cs-etm: Optimize option setup for CPU-wide sessions Date: Fri, 21 Jun 2019 14:38:08 -0300 Message-Id: <20190621173831.13780-3-acme@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190621173831.13780-1-acme@kernel.org> References: <20190621173831.13780-1-acme@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190621_103920_411382_8CD331B4 X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Jiri Olsa , Namhyung Kim , Jiri Olsa , linux-arm-kernel@lists.infradead.org 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 From: Mathieu Poirier Call function cs_etm_set_option() once with all relevant options set rather than multiple times to avoid going through the list of CPU more than once. Suggested-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190611204528.20093-1-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/arm/util/cs-etm.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 279c69caef91..c6f1ab5499b5 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -162,20 +162,19 @@ static int cs_etm_set_option(struct auxtrace_record *itr, !cpu_map__has(online_cpus, i)) continue; - switch (option) { - case ETM_OPT_CTXTID: + if (option & ETM_OPT_CTXTID) { err = cs_etm_set_context_id(itr, evsel, i); if (err) goto out; - break; - case ETM_OPT_TS: + } + if (option & ETM_OPT_TS) { err = cs_etm_set_timestamp(itr, evsel, i); if (err) goto out; - break; - default: - goto out; } + if (option & ~(ETM_OPT_CTXTID | ETM_OPT_TS)) + /* Nothing else is currently supported */ + goto out; } err = 0; @@ -398,11 +397,8 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, if (!cpu_map__empty(cpus)) { perf_evsel__set_sample_bit(cs_etm_evsel, CPU); - err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_CTXTID); - if (err) - goto out; - - err = cs_etm_set_option(itr, cs_etm_evsel, ETM_OPT_TS); + err = cs_etm_set_option(itr, cs_etm_evsel, + ETM_OPT_CTXTID | ETM_OPT_TS); if (err) goto out; }