From: Ian Rogers <irogers@google.com>
To: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>, 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>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Yang Jihong <yangjihong1@huawei.com>,
Huacai Chen <chenhuacai@kernel.org>,
Ming Wang <wangming01@loongson.cn>,
Kan Liang <kan.liang@linux.intel.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH v3 00/18] clang-tools support in tools
Date: Mon, 9 Oct 2023 11:39:01 -0700 [thread overview]
Message-ID: <20231009183920.200859-1-irogers@google.com> (raw)
Allow the clang-tools scripts to work with builds in tools such as
tools/perf and tools/lib/perf. An example use looks like:
```
$ cd tools/perf
$ make CC=clang CXX=clang++
$ ../../scripts/clang-tools/gen_compile_commands.py
$ ../../scripts/clang-tools/run-clang-tools.py clang-tidy compile_commands.json -checks=-*,readability-named-parameter
Skipping non-C file: 'tools/perf/bench/mem-memcpy-x86-64-asm.S'
Skipping non-C file: 'tools/perf/bench/mem-memset-x86-64-asm.S'
Skipping non-C file: 'tools/perf/arch/x86/tests/regs_load.S'
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
tools/perf/util/parse-events-flex.c:546:27: warning: all parameters should be named in a function [readability-named-parameter]
void *yyalloc ( yy_size_t , yyscan_t yyscanner );
^
/*size*/
...
```
Fix a number of the more serious low-hanging issues in perf found by
clang-tidy.
This support isn't complete, in particular it doesn't support output
directories properly and so fails for tools/lib/bpf, tools/bpf/bpftool
and if an output directory is used.
v3. Add Nick Desaulniers reviewed-by to patch 3. For Namhyung, drop
"perf hisi-ptt: Fix potential memory leak", split lock change out
of "perf svghelper: Avoid memory leak" and address comments in
"perf header: Fix various error path memory leaks".
v2: Address comments by Nick Desaulniers in patch 3, and add their
Reviewed-by to patches 1 and 2.
Ian Rogers (18):
gen_compile_commands: Allow the line prefix to still be cmd_
gen_compile_commands: Sort output compile commands by file name
run-clang-tools: Add pass through checks and header-filter arguments
perf bench uprobe: Fix potential use of memory after free
perf buildid-cache: Fix use of uninitialized value
perf env: Remove unnecessary NULL tests
perf jitdump: Avoid memory leak
perf mem-events: Avoid uninitialized read
perf dlfilter: Be defensive against potential NULL dereference
perf hists browser: Reorder variables to reduce padding
perf hists browser: Avoid potential NULL dereference
perf svghelper: Avoid memory leak
perf lock: Fix a memory leak on an error path
perf parse-events: Fix unlikely memory leak when cloning terms
tools api: Avoid potential double free
perf trace-event-info: Avoid passing NULL value to closedir
perf header: Fix various error path memory leaks
perf bpf_counter: Fix a few memory leaks
scripts/clang-tools/gen_compile_commands.py | 8 +--
scripts/clang-tools/run-clang-tools.py | 32 ++++++++---
tools/lib/api/io.h | 1 +
tools/perf/bench/uprobe.c | 1 +
tools/perf/builtin-buildid-cache.c | 6 ++-
tools/perf/builtin-lock.c | 1 +
tools/perf/ui/browsers/hists.c | 6 +--
tools/perf/util/bpf_counter.c | 5 +-
tools/perf/util/dlfilter.c | 4 +-
tools/perf/util/env.c | 6 +--
tools/perf/util/header.c | 60 ++++++++++++---------
tools/perf/util/jitdump.c | 1 +
tools/perf/util/mem-events.c | 3 +-
tools/perf/util/parse-events.c | 4 +-
tools/perf/util/svghelper.c | 5 +-
tools/perf/util/trace-event-info.c | 3 +-
16 files changed, 94 insertions(+), 52 deletions(-)
--
2.42.0.609.gbb76f46606-goog
next reply other threads:[~2023-10-09 18:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 18:39 Ian Rogers [this message]
2023-10-09 18:39 ` [PATCH v3 01/18] gen_compile_commands: Allow the line prefix to still be cmd_ Ian Rogers
2023-10-09 18:39 ` [PATCH v3 02/18] gen_compile_commands: Sort output compile commands by file name Ian Rogers
2023-10-09 18:39 ` [PATCH v3 03/18] run-clang-tools: Add pass through checks and and header-filter arguments Ian Rogers
2023-10-09 18:39 ` [PATCH v3 03/18] run-clang-tools: Add pass through checks " Ian Rogers
2023-10-09 18:39 ` [PATCH v3 04/18] perf bench uprobe: Fix potential use of memory after free Ian Rogers
2023-10-09 18:39 ` [PATCH v3 05/18] perf buildid-cache: Fix use of uninitialized value Ian Rogers
2023-10-09 18:39 ` [PATCH v3 06/18] perf env: Remove unnecessary NULL tests Ian Rogers
2023-10-09 18:39 ` [PATCH v3 07/18] perf jitdump: Avoid memory leak Ian Rogers
2023-10-09 18:39 ` [PATCH v3 08/18] perf mem-events: Avoid uninitialized read Ian Rogers
2023-10-09 18:39 ` [PATCH v3 09/18] perf dlfilter: Be defensive against potential NULL dereference Ian Rogers
2023-10-09 18:39 ` [PATCH v3 10/18] perf hists browser: Reorder variables to reduce padding Ian Rogers
2023-10-09 18:39 ` [PATCH v3 11/18] perf hists browser: Avoid potential NULL dereference Ian Rogers
2023-10-09 18:39 ` [PATCH v3 12/18] perf svghelper: Avoid memory leak Ian Rogers
2023-10-09 18:39 ` [PATCH v3 13/18] perf lock: Fix a memory leak on an error path Ian Rogers
2023-10-09 18:39 ` [PATCH v3 14/18] perf parse-events: Fix unlikely memory leak when cloning terms Ian Rogers
2023-10-09 18:39 ` [PATCH v3 15/18] tools api: Avoid potential double free Ian Rogers
2023-10-09 18:39 ` [PATCH v3 16/18] perf trace-event-info: Avoid passing NULL value to closedir Ian Rogers
2023-10-09 18:39 ` [PATCH v3 17/18] perf header: Fix various error path memory leaks Ian Rogers
2023-10-09 18:39 ` [PATCH v3 18/18] perf bpf_counter: Fix a few " Ian Rogers
2023-10-10 5:31 ` [PATCH v3 00/18] clang-tools support in tools Namhyung Kim
2023-10-12 17:23 ` Namhyung Kim
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=20231009183920.200859-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bpf@vger.kernel.org \
--cc=chenhuacai@kernel.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=trix@redhat.com \
--cc=wangming01@loongson.cn \
--cc=yangjihong1@huawei.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