From patchwork Tue Jun 11 20:45:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 166492 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2815212ilk; Tue, 11 Jun 2019 13:45:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqygTgKnFzal7VtyM1nQNrrvltY4dfs835jNrIjg6VpeQ6kdWMj43vzHEJcxHVNNvytoRkoZ X-Received: by 2002:a17:902:4906:: with SMTP id u6mr78779789pld.220.1560285932068; Tue, 11 Jun 2019 13:45:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560285932; cv=none; d=google.com; s=arc-20160816; b=IuJF9Q3KPJDKrZUUuWjxt5c+YY01CtYmEu27MXUyDzv6UNUv/bah5ZQqDLaOFjSc+S tc42xHVjIxwe16MlZD3JdgKDwnNtN962ycPY9N2iVao+2F+PoQ3gNf8aq2QCfCBRgQ9c CdaxpFvhEeECNZNXXFvLf2VCOn2T2hENs77GCa8QGi8rRQRw8ZjOE7+A9TyhHZ4KTFNQ 00ynFd14kkFo+/NT9Dz+99on141Waptl3vwTsoGLi4UywhIcruWaGMMyKPFJdIo7siqc 6MwYIKa1J7ODME6INDo9f8/NTyp+Md2NSL7EMzDE4e1g5/+rgdveQNuNDdvP/T+V+3NZ rOqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=dF0WnaGr98RkhLcmLgoIGl3DfMfT3YTnuXvqgzRmPU0=; b=XCr6PANnWxNfyac7KRrkJgEHjqw8NWOtdcTaUcSYAMdHfcV+njCig6rV4ieLOPhlO/ d8/poK4lC9/X5hpbkWX3trlQbj2YFhfbyazYWLE7669lxVAHaU5d3tTm7+lSew9epe1l cE/scJGHSpknY/ggEV4QUzRUKAse1G4dsVaa0lC0KxCcqAnmW6bmvCmeh0hwPPa6YLOP vsybPewblvWIxbUjIPAkf+rQlF/IZvqaIVOTDETG2HZ5qfQqT7KBHwY1PSUoJlxcEfc+ dAOiBiYB00LWFAzJJlAxiAytrR4JkZENKYyPtBDrOjyBXjdYSTof1U+30POtS3G1d2et nc5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=br92qJdR; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si13993245pfe.21.2019.06.11.13.45.31; Tue, 11 Jun 2019 13:45:32 -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=@linaro.org header.s=google header.b=br92qJdR; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436531AbfFKUpa (ORCPT + 30 others); Tue, 11 Jun 2019 16:45:30 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:44154 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436506AbfFKUpa (ORCPT ); Tue, 11 Jun 2019 16:45:30 -0400 Received: by mail-pf1-f194.google.com with SMTP id t16so8152798pfe.11 for ; Tue, 11 Jun 2019 13:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dF0WnaGr98RkhLcmLgoIGl3DfMfT3YTnuXvqgzRmPU0=; b=br92qJdRfDtRJUO37iHSmLbRXiDvajUeTM2tW0f2IxX0hCoBDt7Q0J7/dVIrEb91Ww UB67hQTp9W9hra48minpZIvZbVUniezaBw8jzEPVJTfPs00fOSIt1AXDJwErRb+WbGfZ uzsl/dexSkVOSYbRvNfJwkQKk4YvysvZnyv9S9xOBgTJHbW44q4QwZ8rFykTBMUoLt8I 6zZtSj8xZ9AiRUkAe1Ddx6ScyUOZcctM0cGEM2zAGf+udiyJLzoBLHm4i5RApqpQDW2b dfnk7K9/N3nEb6uK6E2umLqKDcchvGTlSC/U7OZG4jNpw4zOjLTu+REzhYujD4fg4cXo 4OWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dF0WnaGr98RkhLcmLgoIGl3DfMfT3YTnuXvqgzRmPU0=; b=QNPJy7gBpPoHlj+eMLPw71z9PO3f/PKWyud5G0m4Wc0wVqP52N7y99YvwuD1KfORHA KlE+WVHYVOBv4tiOHcWlEjUzhSGzuaoVSpp7vHAqJWaV7vYuFMZajeOHelxfRbhsZgds eybJ5IgKsO26Hvo7OzurQ7jzViFK1hjMWXtcqI+AyEwFhoI+rWQniLQhAsevrhFFIIcY c+NlWHjfKi/an9fk3R005RuAhakMnWfhOg2tAEF4zjcYScVzohPFTvtok9Lfg3CXB5ry wcVPp/JFEn6yrmUPLTPvWDH4dMalyBwhNFrcr4+hkYibwNjXJIa5sAcsMCZbRSJwWTZN 3Dvw== X-Gm-Message-State: APjAAAWVlLpVpesaH5gkEtbdlEaVcSOc0V+PNK8YURpTiskl4WfmEHR+ VRQ/2yLJfH/FP7IERbwjaZDxtg== X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr28760708pjr.94.1560285929914; Tue, 11 Jun 2019 13:45:29 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f186sm20391683pfb.5.2019.06.11.13.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 13:45:29 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org Cc: suzuki.poulose@arm.com, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf: cs-etm: Optimize option setup for CPU-wide sessions Date: Tue, 11 Jun 2019 14:45:28 -0600 Message-Id: <20190611204528.20093-1-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/perf/arch/arm/util/cs-etm.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) -- 2.11.0 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; }