From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Michael Petlan <mpetlan@redhat.com>
Subject: Re: [PATCH 00/12] libperf: Add events to perf/event.h
Date: Mon, 26 Aug 2019 19:41:36 -0300 [thread overview]
Message-ID: <20190826224136.GD21761@kernel.org> (raw)
In-Reply-To: <20190826221419.GC21761@kernel.org>
Em Mon, Aug 26, 2019 at 07:14:19PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
> > On Mon, Aug 26, 2019 at 01:18:49PM -0300, Arnaldo Carvalho de Melo wrote:
> >
> > SNIP
> >
> > > [perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > [perfbuilder@490c2c7bdaab ~]$
> > >
> > > And if we do this on a fedora:30 x86_64:
> > >
> > > $ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i
> > > [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > printf("lost %" "l"
> > > # 2646 "builtin-sched.c" 3 4
> > > "l" "u"
> > > # 2646 "builtin-sched.c"
> > > " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > [acme@quaco perf]$
> > >
> > > I.e. on 32-bit arches we shouldn't add that extra "l", right?
> >
> > hum, I guess we could #ifdef it 64/32 bits
>
> I tried to figure out how to fix this better, but the int-ll64.h versus
> int-l64.h versus how __u64 is defined got me confused and I ended up
> with:
>
> #if __WORDSIZE == 64
Make that:
#ifdef __LP64__ to build on Alpine/musl libc.
- Arnaldo
> /*
> * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
> * __u64 as long long unsigned int, and then -Werror=format= kicks in and
> * complains of the mismatched types, so use these two special extra PRI
> * macros to overcome that.
> */
> #define PRI_lu64 "l" PRIu64
> #define PRI_lx64 "l" PRIx64
> #else
> #define PRI_lu64 PRIu64
> #define PRI_lx64 PRIx64
> #endif
>
> Builds in all the containers I have, 32-bit, 64-bit, old gccs/clangs,
> new ones, uclibc, musl libc, glibc, etc
>
> > >
> > > I bet the build for the mips/mipsel will fail too, lemme see... Yeah,
> > > both failed:
> > >
> > >
> >> [root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:
> > > /usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@quaco ~]#
> > >
> > > [root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:
> > > /usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@quaco ~]#
> > >
> > > And also on a uclibc ARC arch container:
> > >
> > > [root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc
> > > builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
> > > printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > ^~~~~~~~
> > > In file included from builtin-sched.c:31:0:
> > > /arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here
> > > # define __PRI64_PREFIX "ll"
> > > ^
> > > [root@quaco ~]#
> > >
> > > The _fix_ will come after lunch :)
> >
> > thanks ;-)
> >
> > jirka
>
> --
>
> - Arnaldo
--
- Arnaldo
next prev parent reply other threads:[~2019-08-26 22:41 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-25 18:17 [PATCH 00/12] libperf: Add events to perf/event.h Jiri Olsa
2019-08-25 18:17 ` [PATCH 01/12] libperf: Add mmap_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_MMAP 'struct mmap_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 02/12] libperf: Add mmap2_event " Jiri Olsa
2019-08-25 18:17 ` [PATCH 03/12] libperf: Add comm_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_COMM 'struct comm_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 04/12] libperf: Add namespaces_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_NAMESPACES 'struct namespaces_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 05/12] libperf: Add fork_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_FORK 'struct fork_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 06/12] libperf: Add lost_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_LOST 'struct lost_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 07/12] libperf: Add lost_samples_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_LOST_SAMPLES 'struct lost_samples_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 08/12] libperf: Add read_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_READ 'struct read_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 09/12] libperf: Add throttle_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_THROTTLE 'struct throttle_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 10/12] libperf: Add ksymbol_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_KSYMBOL 'struct ksymbol_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 11/12] libperf: Add bpf_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_BPF_EVENT 'struct bpf_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 12/12] libperf: Add sample_event " Jiri Olsa
2019-08-27 8:26 ` [tip: perf/core] libperf: Add PERF_RECORD_SAMPLE 'struct sample_event' " tip-bot2 for Jiri Olsa
2019-08-26 15:41 ` [PATCH 00/12] libperf: Add events " Arnaldo Carvalho de Melo
2019-08-26 16:47 ` Jiri Olsa
2019-08-26 22:08 ` Arnaldo Carvalho de Melo
2019-08-26 16:06 ` Arnaldo Carvalho de Melo
2019-08-26 16:18 ` Arnaldo Carvalho de Melo
2019-08-26 16:58 ` Jiri Olsa
2019-08-26 22:14 ` Arnaldo Carvalho de Melo
2019-08-26 22:41 ` Arnaldo Carvalho de Melo [this message]
2019-08-27 7:41 ` Jiri Olsa
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=20190826224136.GD21761@kernel.org \
--to=arnaldo.melo@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.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).