* [PATCH] perf arm pmu: fix build error on MUSL libc
@ 2020-12-06 14:45 Chanho Park
2020-12-07 10:53 ` Will Deacon
0 siblings, 1 reply; 6+ messages in thread
From: Chanho Park @ 2020-12-06 14:45 UTC (permalink / raw)
To: mathieu.poirier, suzuki.poulose
Cc: coresight, linux-arm-kernel, linux-kernel, Chanho Park,
Mike Leach, Leo Yan, John Garry, Will Deacon, Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Jiri Olsa,
Namhyung Kim, Khem Raj
__always_inline can cause build error on musl libc. The fix patch has
submitted but not merged yet[1]. To build perf tool with musl libc,
<linux/stddef.h> inclusion is necessary and it should be included before
perf_event.h.
from /usr/include/linux/byteorder/little_endian.h:13,
from /usr/include/asm/byteorder.h:23,
from tools/include/uapi/linux/perf_event.h:20,
from arch/arm64/util/../../arm/util/pmu.c:9:
/usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
171 | static __always_inline __u16 __swab16p(const __u16 *p)
| ^~~~~~~~~~~~~~~
[1]: https://lkml.org/lkml/2018/9/13/78
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
tools/perf/arch/arm/util/pmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c
index bbc297a7e2e3..4c0357e8c0ab 100644
--- a/tools/perf/arch/arm/util/pmu.c
+++ b/tools/perf/arch/arm/util/pmu.c
@@ -6,6 +6,9 @@
#include <string.h>
#include <linux/coresight-pmu.h>
+#if !defined(__GLIBC__)
+#include <linux/stddef.h>
+#endif
#include <linux/perf_event.h>
#include <linux/string.h>
--
2.23.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] perf arm pmu: fix build error on MUSL libc
2020-12-06 14:45 [PATCH] perf arm pmu: fix build error on MUSL libc Chanho Park
@ 2020-12-07 10:53 ` Will Deacon
2020-12-07 11:58 ` Chanho Park
0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2020-12-07 10:53 UTC (permalink / raw)
To: Chanho Park
Cc: mathieu.poirier, suzuki.poulose, coresight, linux-arm-kernel,
linux-kernel, Chanho Park, Mike Leach, Leo Yan, John Garry,
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Jiri Olsa, Namhyung Kim, Khem Raj
On Sun, Dec 06, 2020 at 11:45:27PM +0900, Chanho Park wrote:
> __always_inline can cause build error on musl libc. The fix patch has
> submitted but not merged yet[1]. To build perf tool with musl libc,
> <linux/stddef.h> inclusion is necessary and it should be included before
> perf_event.h.
>
> from /usr/include/linux/byteorder/little_endian.h:13,
> from /usr/include/asm/byteorder.h:23,
> from tools/include/uapi/linux/perf_event.h:20,
> from arch/arm64/util/../../arm/util/pmu.c:9:
>
> /usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
> 171 | static __always_inline __u16 __swab16p(const __u16 *p)
> | ^~~~~~~~~~~~~~~
>
> [1]: https://lkml.org/lkml/2018/9/13/78
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: John Garry <john.garry@huawei.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Khem Raj <raj.khem@gmail.com>
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---
> tools/perf/arch/arm/util/pmu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c
> index bbc297a7e2e3..4c0357e8c0ab 100644
> --- a/tools/perf/arch/arm/util/pmu.c
> +++ b/tools/perf/arch/arm/util/pmu.c
> @@ -6,6 +6,9 @@
>
> #include <string.h>
> #include <linux/coresight-pmu.h>
> +#if !defined(__GLIBC__)
> +#include <linux/stddef.h>
> +#endif
Looks like other files just include this unconditionally, but have a comment
explaining why. See util/branch.h and util/event.h. Maybe we should do the
same for util/pmu.h, which is already included here?
Will
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] perf arm pmu: fix build error on MUSL libc
2020-12-07 10:53 ` Will Deacon
@ 2020-12-07 11:58 ` Chanho Park
2020-12-07 12:31 ` Namhyung Kim
0 siblings, 1 reply; 6+ messages in thread
From: Chanho Park @ 2020-12-07 11:58 UTC (permalink / raw)
To: 'Will Deacon', 'Chanho Park'
Cc: mathieu.poirier, suzuki.poulose, coresight, linux-arm-kernel,
linux-kernel, 'Mike Leach', 'Leo Yan',
'John Garry', 'Peter Zijlstra',
'Ingo Molnar', 'Arnaldo Carvalho de Melo',
'Mark Rutland', 'Jiri Olsa',
'Namhyung Kim', 'Khem Raj'
Hi Will,
> Looks like other files just include this unconditionally, but have a
> comment explaining why. See util/branch.h and util/event.h. Maybe we
> should do the same for util/pmu.h, which is already included here?
I found below files which perf includes <linux/perf_event.h>. Instead of
doing same for all, we'd better put this only for
tools/include/uapi/linux/perf_event.h.
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -17,6 +17,9 @@
#include <linux/types.h>
#include <linux/ioctl.h>
+#if !defined(__GLIBC__)
+#include <linux/stddef.h>
+#endif
#include <asm/byteorder.h>
/*
tools/perf/arch/arm/util/pmu.c:#include <linux/perf_event.h>
tools/perf/arch/x86/util/pmu.c:#include <linux/perf_event.h>
tools/perf/arch/x86/util/tsc.c:#include <linux/perf_event.h>
tools/perf/lib/include/internal/evsel.h:#include <linux/perf_event.h>
tools/perf/lib/include/perf/event.h:#include <linux/perf_event.h>
tools/perf/lib/tests/test-evlist.c:#include <linux/perf_event.h>
tools/perf/lib/tests/test-evsel.c:#include <linux/perf_event.h>
tools/perf/tests/hists_common.c:#include <linux/perf_event.h>
tools/perf/util/auxtrace.c:#include <linux/perf_event.h>
tools/perf/util/auxtrace.h:#include <linux/perf_event.h>
tools/perf/util/branch.h:#include <linux/perf_event.h>
tools/perf/util/event.c:#include <linux/perf_event.h>
tools/perf/util/evsel.c:#include <linux/perf_event.h>
tools/perf/util/evsel.h:#include <linux/perf_event.h>
tools/perf/util/header.h:#include <linux/perf_event.h>
tools/perf/util/mem-events.h:#include <linux/perf_event.h>
tools/perf/util/namespaces.h:#include <linux/perf_event.h>
tools/perf/util/record.h:#include <linux/perf_event.h>
tools/perf/util/session.h:#include <linux/perf_event.h>
tools/perf/util/pmu.h:#include <linux/perf_event.h>
tools/perf/util/synthetic-events.c:#include <linux/perf_event.h>
tools/perf/util/parse-events.h:#include <linux/perf_event.h>
tools/perf/util/perf_event_attr_fprintf.c:#include <linux/perf_event.h>
Best Regards,
Chanho Park
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf arm pmu: fix build error on MUSL libc
2020-12-07 11:58 ` Chanho Park
@ 2020-12-07 12:31 ` Namhyung Kim
2020-12-07 13:28 ` Jiri Olsa
0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2020-12-07 12:31 UTC (permalink / raw)
To: Chanho Park
Cc: Will Deacon, Chanho Park, mathieu.poirier, suzuki.poulose,
coresight, linux-arm-kernel, linux-kernel, Mike Leach, Leo Yan,
John Garry, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Jiri Olsa, Khem Raj
Hi Chanho,
On Mon, Dec 7, 2020 at 8:58 PM Chanho Park <chanho61.park@samsung.com> wrote:
>
> Hi Will,
>
> > Looks like other files just include this unconditionally, but have a
> > comment explaining why. See util/branch.h and util/event.h. Maybe we
> > should do the same for util/pmu.h, which is already included here?
>
> I found below files which perf includes <linux/perf_event.h>. Instead of
> doing same for all, we'd better put this only for
> tools/include/uapi/linux/perf_event.h.
It's a copy of the kernel header, I'm not sure we want to add something there.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf arm pmu: fix build error on MUSL libc
2020-12-07 12:31 ` Namhyung Kim
@ 2020-12-07 13:28 ` Jiri Olsa
2020-12-08 9:54 ` Chanho Park
0 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2020-12-07 13:28 UTC (permalink / raw)
To: Namhyung Kim
Cc: Chanho Park, Will Deacon, Chanho Park, mathieu.poirier,
suzuki.poulose, coresight, linux-arm-kernel, linux-kernel,
Mike Leach, Leo Yan, John Garry, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Khem Raj
On Mon, Dec 07, 2020 at 09:31:06PM +0900, Namhyung Kim wrote:
> Hi Chanho,
>
> On Mon, Dec 7, 2020 at 8:58 PM Chanho Park <chanho61.park@samsung.com> wrote:
> >
> > Hi Will,
> >
> > > Looks like other files just include this unconditionally, but have a
> > > comment explaining why. See util/branch.h and util/event.h. Maybe we
> > > should do the same for util/pmu.h, which is already included here?
> >
> > I found below files which perf includes <linux/perf_event.h>. Instead of
> > doing same for all, we'd better put this only for
> > tools/include/uapi/linux/perf_event.h.
>
> It's a copy of the kernel header, I'm not sure we want to add something there.
right, we want to copy that directly from kernel uapi
so let's not do any changes in here
jirka
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] perf arm pmu: fix build error on MUSL libc
2020-12-07 13:28 ` Jiri Olsa
@ 2020-12-08 9:54 ` Chanho Park
0 siblings, 0 replies; 6+ messages in thread
From: Chanho Park @ 2020-12-08 9:54 UTC (permalink / raw)
To: 'Jiri Olsa', 'Namhyung Kim'
Cc: 'Will Deacon', 'Chanho Park', mathieu.poirier,
suzuki.poulose, coresight, linux-arm-kernel,
'linux-kernel', 'Mike Leach', 'Leo Yan',
'John Garry', 'Peter Zijlstra',
'Ingo Molnar', 'Arnaldo Carvalho de Melo',
'Mark Rutland', 'Khem Raj'
Hi Namhyung and Jiri,
> -----Original Message-----
> From: Jiri Olsa <jolsa@redhat.com>
> Sent: Monday, December 7, 2020 10:29 PM
> To: Namhyung Kim <namhyung@kernel.org>
> Cc: Chanho Park <chanho61.park@samsung.com>; Will Deacon
<will@kernel.org>;
> Chanho Park <parkch98@gmail.com>; mathieu.poirier@linaro.org;
> suzuki.poulose@arm.com; coresight@lists.linaro.org; linux-arm-
> kernel@lists.infradead.org; linux-kernel <linux-kernel@vger.kernel.org>;
> Mike Leach <mike.leach@linaro.org>; Leo Yan <leo.yan@linaro.org>; John
> Garry <john.garry@huawei.com>; Peter Zijlstra <peterz@infradead.org>; Ingo
> Molnar <mingo@redhat.com>; Arnaldo Carvalho de Melo <acme@kernel.org>;
> Mark Rutland <mark.rutland@arm.com>; Khem Raj <raj.khem@gmail.com>
> Subject: Re: [PATCH] perf arm pmu: fix build error on MUSL libc
>
> On Mon, Dec 07, 2020 at 09:31:06PM +0900, Namhyung Kim wrote:
> > Hi Chanho,
> >
> > On Mon, Dec 7, 2020 at 8:58 PM Chanho Park <chanho61.park@samsung.com>
> wrote:
> > >
> > > Hi Will,
> > >
> > > > Looks like other files just include this unconditionally, but have
> > > > a comment explaining why. See util/branch.h and util/event.h.
> > > > Maybe we should do the same for util/pmu.h, which is already
> included here?
> > >
> > > I found below files which perf includes <linux/perf_event.h>.
> > > Instead of doing same for all, we'd better put this only for
> > > tools/include/uapi/linux/perf_event.h.
> >
> > It's a copy of the kernel header, I'm not sure we want to add something
> there.
>
> right, we want to copy that directly from kernel uapi so let's not do any
> changes in here
>
I tried to modify it from include/uapi/linux/perf_event.h but it didn't
work. And then, I found perf tool tried to refer the header from
tools/include/ directory. I should go include/uapi first and sync the change
to tools/ directory. I'll re-spin this patch.
Best Regard,
Chanho Park
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-08 9:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-06 14:45 [PATCH] perf arm pmu: fix build error on MUSL libc Chanho Park
2020-12-07 10:53 ` Will Deacon
2020-12-07 11:58 ` Chanho Park
2020-12-07 12:31 ` Namhyung Kim
2020-12-07 13:28 ` Jiri Olsa
2020-12-08 9:54 ` Chanho Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox