From: Jiri Olsa <jolsa@redhat.com>
To: Gaurav Singh <gaurav1086@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Ian Rogers <irogers@google.com>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [perf] intel_pt_recording_options: Remove redundant intel_pt_evsel null check
Date: Wed, 24 Jun 2020 14:42:41 +0200 [thread overview]
Message-ID: <20200624124241.GA2719003@krava> (raw)
In-Reply-To: <20200623234905.18608-1-gaurav1086@gmail.com>
On Tue, Jun 23, 2020 at 07:48:50PM -0400, Gaurav Singh wrote:
> intel_pt_evsel cannot be NULL here since its already being
> dereferenced above. Remove this redundant check.
>
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
> tools/perf/arch/x86/util/intel-pt.c | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
> index 839ef52c1ac2..8cc87fd2dc6f 100644
> --- a/tools/perf/arch/x86/util/intel-pt.c
> +++ b/tools/perf/arch/x86/util/intel-pt.c
> @@ -836,19 +836,17 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
> }
> }
>
I wonder we sould put check before that above usage of intel_pt_evsel,
because there's no check for that.. but yes, if intel_pt_evsel is NULL
it will fail earlier.. Adrian?
thanks,
jirka
> - if (intel_pt_evsel) {
> - /*
> - * To obtain the auxtrace buffer file descriptor, the auxtrace
> - * event must come first.
> - */
> - perf_evlist__to_front(evlist, intel_pt_evsel);
> - /*
> - * In the case of per-cpu mmaps, we need the CPU on the
> - * AUX event.
> - */
> - if (!perf_cpu_map__empty(cpus))
> - evsel__set_sample_bit(intel_pt_evsel, CPU);
> - }
> + /*
> + * To obtain the auxtrace buffer file descriptor, the auxtrace
> + * event must come first.
> + */
> + perf_evlist__to_front(evlist, intel_pt_evsel);
> + /*
> + * In the case of per-cpu mmaps, we need the CPU on the
> + * AUX event.
> + */
> + if (!perf_cpu_map__empty(cpus))
> + evsel__set_sample_bit(intel_pt_evsel, CPU);
>
> /* Add dummy event to keep tracking */
> if (opts->full_auxtrace) {
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-06-24 12:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 23:48 [PATCH] [perf] intel_pt_recording_options: Remove redundant intel_pt_evsel null check Gaurav Singh
2020-06-24 12:42 ` Jiri Olsa [this message]
2020-06-24 16:05 ` Adrian Hunter
2020-06-24 16:04 ` Adrian Hunter
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=20200624124241.GA2719003@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=gaurav1086@gmail.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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