From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Leo Yan <leo.yan@linaro.org>,
Kan Liang <kan.liang@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH v2 2/4] perf util: Add host_is_bigendian to util.h
Date: Mon, 5 Dec 2022 10:16:39 -0300 [thread overview]
Message-ID: <Y43vN2cxlSERMh2/@kernel.org> (raw)
In-Reply-To: <CAM9d7cg1pmkMTFEoK7tNxQTmux7obr7KPr-5SPNDrB=S5Xp=vw@mail.gmail.com>
Em Wed, Nov 30, 2022 at 10:52:35AM -0800, Namhyung Kim escreveu:
> On Tue, Nov 29, 2022 at 10:30 PM Ian Rogers <irogers@google.com> wrote:
> >
> > Avoid libtraceevent dependency for tep_is_bigendian or trace-event.h
> > dependency for bigendian. Add a new host_is_bigendian to util.h, using
> > the compiler defined __BYTE_ORDER__ when available.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> A nit below...
>
> > ---
> [SNIP]
> > diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> > index 63cdab0e5314..87d418cb6792 100644
> > --- a/tools/perf/util/util.h
> > +++ b/tools/perf/util/util.h
> > @@ -94,4 +94,23 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x,
> > 0; \
> > })
> >
> > +static inline bool host_is_bigendian(void)
> > +{
> > +#ifdef __BYTE_ORDER__
> > +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> > + return false;
> > +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> > + return true;
> > +#else
> > +#error "Unrecognized __BYTE_ORDER__"
> > +#endif
> > +#else
>
> It'd be nice if we could have a comment at least there's a nested
> ifdef condition. Like below?
>
> #else /* !__BYTE_ORDER__ */
Reasonable, added it and applied the first two patches in this series,
with your Acked-by, thanks.
- Arnaldo
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 87d418cb67929576..a06c54ab85ee4506 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -104,7 +104,7 @@ static inline bool host_is_bigendian(void)
#else
#error "Unrecognized __BYTE_ORDER__"
#endif
-#else
+#else /* !__BYTE_ORDER__ */
unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0};
unsigned int *ptr;
next prev parent reply other threads:[~2022-12-05 13:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 6:29 [PATCH v2 0/4] perf use system libtraceevent Ian Rogers
2022-11-30 6:29 ` [PATCH v2 1/4] perf util: Make header guard consistent with tool Ian Rogers
2022-11-30 18:47 ` Namhyung Kim
2022-11-30 6:29 ` [PATCH v2 2/4] perf util: Add host_is_bigendian to util.h Ian Rogers
2022-11-30 18:52 ` Namhyung Kim
2022-12-05 13:16 ` Arnaldo Carvalho de Melo [this message]
2022-11-30 6:29 ` [PATCH v2 3/4] perf build: Use libtraceevent from the system Ian Rogers
2022-11-30 19:05 ` Namhyung Kim
2022-11-30 20:13 ` Ian Rogers
2022-12-02 18:08 ` Namhyung Kim
2022-12-02 18:29 ` Arnaldo Carvalho de Melo
2022-12-02 19:45 ` Ian Rogers
2022-12-02 23:36 ` Namhyung Kim
2022-12-05 13:01 ` [PATCH v2 0/4] perf use system libtraceevent Arnaldo Carvalho de Melo
[not found] ` <20221130062935.2219247-5-irogers@google.com>
[not found] ` <Y5eGj4CuQKjr2I6h@kernel.org>
2022-12-12 20:10 ` [PATCH v2 4/4] tools lib traceevent: Remove libtraceevent Arnaldo Carvalho de Melo
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=Y43vN2cxlSERMh2/@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).