linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Suzuki K Poulouse <suzuki.poulose@arm.com>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Leo Yan <leo.yan@linaro.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Robert Walker <robert.walker@arm.com>,
	Jiri Olsa <jolsa@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	Mike Leach <mike.leach@linaro.org>
Subject: [PATCH 07/11] perf cs-etm: Don't check cs_etm_queue::prev_packet validity
Date: Thu,  2 May 2019 20:25:29 -0400	[thread overview]
Message-ID: <20190503002533.29359-8-acme@kernel.org> (raw)
In-Reply-To: <20190503002533.29359-1-acme@kernel.org>

From: Leo Yan <leo.yan@linaro.org>

Since cs_etm_queue::prev_packet is allocated for all cases, it will
never be NULL pointer; now validity checking prev_packet is pointless,
remove all of them.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Robert Walker <robert.walker@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki K Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190428083228.20246-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cs-etm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 110804936fc3..7777cfc1ad8c 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -981,7 +981,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
 	 * PREV_PACKET is a branch.
 	 */
 	if (etm->synth_opts.last_branch &&
-	    etmq->prev_packet &&
 	    etmq->prev_packet->sample_type == CS_ETM_RANGE &&
 	    etmq->prev_packet->last_instr_taken_branch)
 		cs_etm__update_last_branch_rb(etmq);
@@ -1014,7 +1013,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
 		etmq->period_instructions = instrs_over;
 	}
 
-	if (etm->sample_branches && etmq->prev_packet) {
+	if (etm->sample_branches) {
 		bool generate_sample = false;
 
 		/* Generate sample for tracing on packet */
@@ -1071,9 +1070,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq)
 	struct cs_etm_auxtrace *etm = etmq->etm;
 	struct cs_etm_packet *tmp;
 
-	if (!etmq->prev_packet)
-		return 0;
-
 	/* Handle start tracing packet */
 	if (etmq->prev_packet->sample_type == CS_ETM_EMPTY)
 		goto swap_packet;
-- 
2.20.1

  parent reply	other threads:[~2019-05-03  0:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03  0:25 [GIT PULL 00/11] perf/urgent fixes Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 01/11] perf bpf: Return value with unlocking in perf_env__find_btf() Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 02/11] tools uapi x86: Sync vmx.h with the kernel Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 03/11] perf annotate: Fix build on 32 bit for BPF annotation Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 04/11] tools lib traceevent: Change tag string for error Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 05/11] perf bench numa: Add define for RUSAGE_THREAD if not present Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 06/11] perf report: Report OOM in status line in the GTK UI Arnaldo Carvalho de Melo
2019-05-03  0:25 ` Arnaldo Carvalho de Melo [this message]
2019-05-03  0:25 ` [PATCH 08/11] perf cs-etm: Always allocate memory for cs_etm_queue::prev_packet Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 09/11] tools build: Add -ldl to the disassembler-four-args feature test Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 10/11] tools arch uapi: Copy missing unistd.h headers for arc, hexagon and riscv Arnaldo Carvalho de Melo
2019-05-03  0:25 ` [PATCH 11/11] perf tools: Remove needless asm/unistd.h include fixing build in some places Arnaldo Carvalho de Melo
2019-05-03  5:49 ` [GIT PULL 00/11] perf/urgent fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190503002533.29359-8-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=robert.walker@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).