Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3387843pxb; Thu, 10 Feb 2022 20:54:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKqhaxu++CJWr9JpLVs8TFVT5xEexhja8HP8GxBNVQyAXdLNri8BjFJxG+APe5hLlKqe/+ X-Received: by 2002:a17:906:9f14:: with SMTP id fy20mr9080874ejc.406.1644555290201; Thu, 10 Feb 2022 20:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644555290; cv=none; d=google.com; s=arc-20160816; b=CzngTH8Gl8W2wHHCoGZolHTD+5b76oSieJ2v5koZ1S0bAANbriFOIbFuk3tq7o8EWM A8fK1vEWzEmcp+PeHTt5tfLxctSeHeMYO0w0z0BbR/hPQZb46s5woj5M07KkzrHz4eM2 Xa7NXQeoMh6Pf+W0clhdzwAVM9Y23P/UTGLvb4TQK4uMheG0aqaQUGjnjUeqqyxpfLJ/ vvlKxnADWlWOfY1hHMI8dySwKw9H1ve3eK0MUvXG3H5P2q4NRJhmvy3WCmoQyQOh2pMl cViHJB5FFvpDThfWH7ruM63YXTi5BmNU5dKCNyp4dKQ7gezj01gHCZskOuR8PiQ/o0me zUsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TxAJqE5WJajnAuPErLPKzgrLaHz0AyrlTK9/kEQ6TPo=; b=Tk/5WaQgiSyGZJyJxTp0u6xaZbCxBxboez5vz0vjUACUpahWjwuLASkXaPxed9Pcq8 gvA/8AuCAU1rKr7zcSqyX3FeBXeQN3RmOzD7az6FwYnWjx7gkUCGl4bvoRa1+kzotLZJ YQncPS5lkx8r3AQeKbtjxDq2r/N8wpOGXuZ8ErCgxJY7izEXOESViGk89kHA/a4L8fhs Jk3aNjUgOD96Yzv6hUxB7OEY9I7wM+t8yKeiVJPQ23si7UuPa+zVWCetmiYs5RuurYcU uQ9u0JaeiCYvmNiRXYn0bZ4HLrGMK5v6sIENZuUhdId8ur952/CKvO+v3tArd6R3t20N g7xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12si15162784ejy.969.2022.02.10.20.54.21; Thu, 10 Feb 2022 20:54:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344070AbiBJUGg (ORCPT + 99 others); Thu, 10 Feb 2022 15:06:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239246AbiBJUGf (ORCPT ); Thu, 10 Feb 2022 15:06:35 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C4DBE5595; Thu, 10 Feb 2022 12:06:33 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 62BE3D6E; Thu, 10 Feb 2022 12:06:33 -0800 (PST) Received: from e121896.arm.com (unknown [10.57.18.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0E2F23F70D; Thu, 10 Feb 2022 12:06:29 -0800 (PST) From: James Clark To: acme@kernel.org, linux-perf-users@vger.kernel.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org Cc: James Clark , Mike Leach , Leo Yan , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] perf: cs-etm: No-op refactor of synth opt usage Date: Thu, 10 Feb 2022 20:06:19 +0000 Message-Id: <20220210200620.1227232-1-james.clark@arm.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sample_branches and sample_instructions are already saved in the synth_opts struct. Other usages like synth_opts.last_branch don't save a value, so make this more consistent by always going through synth_opts and not saving duplicate values. Signed-off-by: James Clark --- tools/perf/util/cs-etm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 4f672f7d008c..796a065a500e 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -50,8 +50,6 @@ struct cs_etm_auxtrace { u8 timeless_decoding; u8 snapshot_mode; u8 data_queued; - u8 sample_branches; - u8 sample_instructions; int num_cpu; u64 latest_kernel_timestamp; @@ -410,8 +408,8 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, { struct cs_etm_packet *tmp; - if (etm->sample_branches || etm->synth_opts.last_branch || - etm->sample_instructions) { + if (etm->synth_opts.branches || etm->synth_opts.last_branch || + etm->synth_opts.instructions) { /* * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for * the next incoming packet. @@ -1365,7 +1363,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, err = cs_etm__synth_event(session, &attr, id); if (err) return err; - etm->sample_branches = true; etm->branches_sample_type = attr.sample_type; etm->branches_id = id; id += 1; @@ -1389,7 +1386,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, err = cs_etm__synth_event(session, &attr, id); if (err) return err; - etm->sample_instructions = true; etm->instructions_sample_type = attr.sample_type; etm->instructions_id = id; id += 1; @@ -1420,7 +1416,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, tidq->prev_packet->last_instr_taken_branch) cs_etm__update_last_branch_rb(etmq, tidq); - if (etm->sample_instructions && + if (etm->synth_opts.instructions && tidq->period_instructions >= etm->instructions_sample_period) { /* * Emit instruction sample periodically @@ -1503,7 +1499,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, } } - if (etm->sample_branches) { + if (etm->synth_opts.branches) { bool generate_sample = false; /* Generate sample for tracing on packet */ @@ -1582,7 +1578,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, } - if (etm->sample_branches && + if (etm->synth_opts.branches && tidq->prev_packet->sample_type == CS_ETM_RANGE) { err = cs_etm__synth_branch_sample(etmq, tidq); if (err) -- 2.28.0