[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240206111939.kmw4u4p47l6ed74k@M910t>
Date: Tue, 6 Feb 2024 19:19:39 +0800
From: Changbin Du <changbin.du@...wei.com>
To: Adrian Hunter <adrian.hunter@...el.com>
CC: Changbin Du <changbin.du@...wei.com>, Peter Zijlstra
<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de
Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>, Alexander
Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Ian Rogers <irogers@...gle.com>,
<linux-kernel@...r.kernel.org>, <linux-perf-users@...r.kernel.org>, Andi
Kleen <ak@...ux.intel.com>, Thomas Richter <tmricht@...ux.ibm.com>,
<changbin.du@...il.com>
Subject: Re: [PATCH v6 2/5] perf: util: use capstone disasm engine to show
assembly instructions
On Tue, Feb 06, 2024 at 01:17:05PM +0200, Adrian Hunter wrote:
> On 6/02/24 13:11, Changbin Du wrote:
> > On Tue, Feb 06, 2024 at 12:33:10PM +0200, Adrian Hunter wrote:
> >> On 6/02/24 04:14, Changbin Du wrote:
> >>> +size_t sample__fprintf_insn(struct perf_sample *sample, struct thread *thread __maybe_unused,
> >>> + struct machine *machine __maybe_unused, FILE *fp)
> >>> +{
> >>> + pr_warning_once("perf needs to be built with libcapstone support to disassemble instructions\n");
> >>> + return sample__fprintf_insn_raw(sample, fp);
> >>
> >> The validation stops this being called so could just leave
> >> out the 2 lines above, and add __maybe_unused as necessary.
> >>
> > I expect this being a generic api and could be invoked by other functions which
> > may not require the validation (raw code is acceptable).
>
> kernel-style is not to add code if it isn't being used,
> but it seems likely another user of the API would probably
> need to check for libcapstone first, just like perf script,
> so the code would still not be used.
>
okay, so let me just return 0 since nothing printed.
--
Cheers,
Changbin Du
Powered by blists - more mailing lists