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: 167402 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1028299ilk; Fri, 21 Jun 2019 10:39:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+AWP8dUfVYIsgGzSKpdbNjqtjI5ejtPT7stm/MdZXoKIuvRZa8iTjJcMXRQXz40LAcl36 X-Received: by 2002:a17:902:d20f:: with SMTP id t15mr62885478ply.11.1561138766742; Fri, 21 Jun 2019 10:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561138766; cv=none; d=google.com; s=arc-20160816; b=MCyLRWpEb2PupjVlxQFmFK+hLCzdp+PUFfSiiWIi5y1XeU1uipnYmRdT0dgcvV0H/E CdH3+FZ5tiWU4byeQIG0fwDyszDrJgzWXsxR0thy8eRx5vi5SnN9zL/vb/ZORA70abLU U+sN5ApF9W1dpGWz3YaifTp6fU2eUxJg8/9VpvRwUimLWCro8V/yb1uqaspF/y7/9ooN 5uwcUmrO+vUxu6qw+RqjdlMCzGYKEuEYxuTYejptlsdrdPEbGhKfHUeIzZzk9ANhU9e9 iGkDrFgNpRFfBe4oieszKY/ay/XS7MIyulL/RdLOSKKQKGi1DiGfanBNfHJu7P27CkG6 xegg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HGIkKSrPozmpRN9ljIiWiw4/F/uc1GKrEFk8e9vanTA=; b=DA+YEFAuULrlmPMwNIk353dHDg4DjWQLxIj1g1KPvh84Q0GQrr5zNjCW8NP9kcp+xI YvhY05XBZtPbHCkMLfHMkVL84dxtA5yjxZs1EfJbp+Yw7tgtSqIML3Q0uSst7HlL7Gfa SHIat9lmMnaQjbM2Ji44Nf1JK5YfeoUjRzMnOwvm6u+/xAFRmtWZX24dBVZzt3YtGs6V 9cKsGr+GcXVFz07yIibIkkqNDq+hjqVSzf/tqHKlbaHzxBf/OWxDMmiQvSXgSf2/eVnH ybBiqfi9PdiFIsU3I1t+Z26iBXAHKg2+FnU/2uZgpVs/29nvee2nQwRp6F/dUvzz7lsS sMeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F9sDrNvg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si2918650pgt.145.2019.06.21.10.39.26; Fri, 21 Jun 2019 10:39:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F9sDrNvg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726221AbfFURjV (ORCPT + 30 others); Fri, 21 Jun 2019 13:39:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:58394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfFURjU (ORCPT ); Fri, 21 Jun 2019 13:39:20 -0400 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 Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Jiri Olsa , Peter Zijlstra , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.20.1 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; }