linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the perf tree
@ 2024-10-10 23:23 Stephen Rothwell
  2024-10-10 23:57 ` [PATCH] perf tools: Fix build failures on ppc64le Namhyung Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2024-10-10 23:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim
  Cc: Ian Rogers, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 6638 bytes --]

Hi all,

After merging the perf tree, today's linux-next build (native perf)
failed like this:

util/evsel.c: In function 'store_event':
util/evsel.c:138:50: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  138 |         snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
      |                                               ~~~^
      |                                                  |
      |                                                  long long unsigned int
      |                                               %lu
  139 |                  attr->type, attr->config, fd);
      |                              ~~~~~~~~~~~~         
      |                                  |
      |                                  __u64 {aka long unsigned int}
util/evsel.c:147:41: error: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  147 |         if (fprintf(file, "[event-%d-%llu-%d]\n",
      |                                      ~~~^
      |                                         |
      |                                         long long unsigned int
      |                                      %lu
  148 |                     attr->type, attr->config, fd) < 0) {
      |                                 ~~~~~~~~~~~~
      |                                     |
      |                                     __u64 {aka long unsigned int}
util/evsel.c:164:33: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  164 |         WRITE_ASS(config,  "llu");
      |                                 ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:164:9: note: in expansion of macro 'WRITE_ASS'
  164 |         WRITE_ASS(config,  "llu");
      |         ^~~~~~~~~
util/evsel.c:165:39: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  165 |         WRITE_ASS(sample_period, "llu");
      |                                       ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:165:9: note: in expansion of macro 'WRITE_ASS'
  165 |         WRITE_ASS(sample_period, "llu");
      |         ^~~~~~~~~
util/evsel.c:166:39: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  166 |         WRITE_ASS(sample_type,   "llu");
      |                                       ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:166:9: note: in expansion of macro 'WRITE_ASS'
  166 |         WRITE_ASS(sample_type,   "llu");
      |         ^~~~~~~~~
util/evsel.c:167:39: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  167 |         WRITE_ASS(read_format,   "llu");
      |                                       ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:167:9: note: in expansion of macro 'WRITE_ASS'
  167 |         WRITE_ASS(read_format,   "llu");
      |         ^~~~~~~~~
util/evsel.c:198:33: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  198 |         WRITE_ASS(config1, "llu");
      |                                 ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:198:9: note: in expansion of macro 'WRITE_ASS'
  198 |         WRITE_ASS(config1, "llu");
      |         ^~~~~~~~~
util/evsel.c:199:33: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  199 |         WRITE_ASS(config2, "llu");
      |                                 ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:199:9: note: in expansion of macro 'WRITE_ASS'
  199 |         WRITE_ASS(config2, "llu");
      |         ^~~~~~~~~
util/evsel.c:200:44: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  200 |         WRITE_ASS(branch_sample_type, "llu");
      |                                            ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:200:9: note: in expansion of macro 'WRITE_ASS'
  200 |         WRITE_ASS(branch_sample_type, "llu");
      |         ^~~~~~~~~
util/evsel.c:201:44: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
  201 |         WRITE_ASS(sample_regs_user,   "llu");
      |                                            ^
util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
  122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
      |                            ^~~
util/evsel.c:201:9: note: in expansion of macro 'WRITE_ASS'
  201 |         WRITE_ASS(sample_regs_user,   "llu");
      |         ^~~~~~~~~
cc1: all warnings being treated as errors

Caused by commit

  f90a29144887 ("perf test: Remove C test wrapper for attr.py")

This is a native build of perf on ppc64le using

  make -C tools/perf -f Makefile.perf NO_BPF_SKEL=1

I have merged the perf tree from next-20241010 for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] perf tools: Fix build failures on ppc64le
  2024-10-10 23:23 linux-next: build failure after merge of the perf tree Stephen Rothwell
@ 2024-10-10 23:57 ` Namhyung Kim
  2024-10-11  0:48   ` Stephen Rothwell
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2024-10-10 23:57 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Arnaldo Carvalho de Melo, Ian Rogers, LKML, linux-next

  util/evsel.c: In function 'store_event':
  util/evsel.c:138:50: error: format '%llu' expects argument of type 'long long unsigned int',
                       but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
    138 |         snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
        |                                               ~~~^
        |                                                  |
        |                                                  long long unsigned int
        |                                               %lu
    139 |                  attr->type, attr->config, fd);
        |                              ~~~~~~~~~~~~
        |                                  |
        |                                  __u64 {aka long unsigned int}
  util/evsel.c:147:41: error: format '%llu' expects argument of type 'long long unsigned int',
                       but argument 4 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
    147 |         if (fprintf(file, "[event-%d-%llu-%d]\n",
        |                                      ~~~^
        |                                         |
        |                                         long long unsigned int
        |                                      %lu
    148 |                     attr->type, attr->config, fd) < 0) {
        |                                 ~~~~~~~~~~~~
        |                                     |
        |                                     __u64 {aka long unsigned int}
  util/evsel.c:164:33: error: format '%llu' expects argument of type 'long long unsigned int',
                       but argument 3 has type '__u64' {aka 'long unsigned int'} [-Werror=format=]
    164 |         WRITE_ASS(config,  "llu");
        |                                 ^
  util/evsel.c:122:28: note: in definition of macro '__WRITE_ASS'
    122 |         if (fprintf(file, #str "=%"fmt "\n", data) < 0) {               \
        |                            ^~~
  util/evsel.c:164:9: note: in expansion of macro 'WRITE_ASS'
    164 |         WRITE_ASS(config,  "llu");
        |         ^~~~~~~~~
  ...
    cc1: all warnings being treated as errors

Fixes: f90a291448877ab45 ("perf test: Remove C test wrapper for attr.py")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
Hi Stephen, can you please test if this patch fixes it?

Thanks,
Namhyung

 tools/perf/util/evsel.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 37c338b0f8b2bb04..88e98c0b10528a63 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -108,7 +108,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, struct perf_cpu
 	char path[PATH_MAX];
 	char *dir = getenv("PERF_TEST_ATTR");
 
-	snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
+	snprintf(path, PATH_MAX, "%s/event-%d-%"PRI_lu64"-%d", dir,
 		 attr->type, attr->config, fd);
 
 	file = fopen(path, "w+");
@@ -117,7 +117,7 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, struct perf_cpu
 		return -1;
 	}
 
-	if (fprintf(file, "[event-%d-%llu-%d]\n",
+	if (fprintf(file, "[event-%d-%"PRI_lu64"-%d]\n",
 		    attr->type, attr->config, fd) < 0) {
 		perror("test attr - failed to write event file");
 		fclose(file);
@@ -134,10 +134,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, struct perf_cpu
 	/* struct perf_event_attr */
 	WRITE_ASS(type,   PRIu32);
 	WRITE_ASS(size,   PRIu32);
-	WRITE_ASS(config,  "llu");
-	WRITE_ASS(sample_period, "llu");
-	WRITE_ASS(sample_type,   "llu");
-	WRITE_ASS(read_format,   "llu");
+	WRITE_ASS(config,  PRI_lu64);
+	WRITE_ASS(sample_period, PRI_lu64);
+	WRITE_ASS(sample_type,   PRI_lu64);
+	WRITE_ASS(read_format,   PRI_lu64);
 	WRITE_ASS(disabled,       "d");
 	WRITE_ASS(inherit,        "d");
 	WRITE_ASS(pinned,         "d");
@@ -168,10 +168,10 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, struct perf_cpu
 	WRITE_ASS(use_clockid,    "d");
 	WRITE_ASS(wakeup_events, PRIu32);
 	WRITE_ASS(bp_type, PRIu32);
-	WRITE_ASS(config1, "llu");
-	WRITE_ASS(config2, "llu");
-	WRITE_ASS(branch_sample_type, "llu");
-	WRITE_ASS(sample_regs_user,   "llu");
+	WRITE_ASS(config1, PRI_lu64);
+	WRITE_ASS(config2, PRI_lu64);
+	WRITE_ASS(branch_sample_type, PRI_lu64);
+	WRITE_ASS(sample_regs_user,   PRI_lu64);
 	WRITE_ASS(sample_stack_user,  PRIu32);
 
 	fclose(file);
-- 
2.47.0.rc1.288.g06298d1525-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix build failures on ppc64le
  2024-10-10 23:57 ` [PATCH] perf tools: Fix build failures on ppc64le Namhyung Kim
@ 2024-10-11  0:48   ` Stephen Rothwell
  2024-10-11  6:34     ` Namhyung Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Rothwell @ 2024-10-11  0:48 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Arnaldo Carvalho de Melo, Ian Rogers, LKML, linux-next

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Hi Namhyung,

On Thu, 10 Oct 2024 16:57:43 -0700 Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hi Stephen, can you please test if this patch fixes it?

Sorry, I still get the same errors.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix build failures on ppc64le
  2024-10-11  0:48   ` Stephen Rothwell
@ 2024-10-11  6:34     ` Namhyung Kim
  2024-10-11  7:05       ` Ian Rogers
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2024-10-11  6:34 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Arnaldo Carvalho de Melo, Ian Rogers, LKML, linux-next

On Fri, Oct 11, 2024 at 11:48:58AM +1100, Stephen Rothwell wrote:
> Hi Namhyung,
> 
> On Thu, 10 Oct 2024 16:57:43 -0700 Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hi Stephen, can you please test if this patch fixes it?
> 
> Sorry, I still get the same errors.

Ok, thanks for the test.  I'll drop the series and rebase the branch.

Thanks,
Namhyung


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix build failures on ppc64le
  2024-10-11  6:34     ` Namhyung Kim
@ 2024-10-11  7:05       ` Ian Rogers
  2024-10-13  9:29         ` Stephen Rothwell
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2024-10-11  7:05 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Stephen Rothwell, Arnaldo Carvalho de Melo, LKML, linux-next

On Thu, Oct 10, 2024 at 11:34 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Fri, Oct 11, 2024 at 11:48:58AM +1100, Stephen Rothwell wrote:
> > Hi Namhyung,
> >
> > On Thu, 10 Oct 2024 16:57:43 -0700 Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > Hi Stephen, can you please test if this patch fixes it?
> >
> > Sorry, I still get the same errors.
>
> Ok, thanks for the test.  I'll drop the series and rebase the branch.

Is this a define issue? I dislike that PPC has a #define
__SANE_USERSPACE_TYPES__, we might be trying to fix something
inherently insane.

The failure at:
```
    138 |         snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
        |                                               ~~~^
        |                                                  |
        |                                                  long long
unsigned int
        |                                               %lu
    139 |                  attr->type, attr->config, fd);
        |                              ~~~~~~~~~~~~
        |                                  |
        |                                  __u64 {aka long unsigned int}
  util/evsel.c:147:41: error: format '%llu' expects argument of type
'long long unsigned int',
                       but argument 4 has type '__u64' {aka 'long
unsigned int'} [-Werror=format=]
```
is for code moved from here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/tests/attr.c#n77
```
snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
attr->type, attr->config, fd);
```
ie the code is identical, so why does it compile in one file and not in another?

Elsewhere for PPC we carry:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/tests/bp_account.c#n3
```
/*
 * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
 * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
 */
#define __SANE_USERSPACE_TYPES__
```
Given the comment I suspect we need to do similar to fix this.
Stephen, could you test?

Thanks,
Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Fix build failures on ppc64le
  2024-10-11  7:05       ` Ian Rogers
@ 2024-10-13  9:29         ` Stephen Rothwell
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2024-10-13  9:29 UTC (permalink / raw)
  To: Ian Rogers; +Cc: Namhyung Kim, Arnaldo Carvalho de Melo, LKML, linux-next

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

Hi Ian,

On Fri, 11 Oct 2024 00:05:21 -0700 Ian Rogers <irogers@google.com> wrote:
>
> Elsewhere for PPC we carry:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/tests/bp_account.c#n3
> ```
> /*
>  * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
>  * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
>  */
> #define __SANE_USERSPACE_TYPES__
> ```
> Given the comment I suspect we need to do similar to fix this.
> Stephen, could you test?

I added that to the start of tools/perf/util/evsel.c and it builds fine.

Thanks
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-13  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 23:23 linux-next: build failure after merge of the perf tree Stephen Rothwell
2024-10-10 23:57 ` [PATCH] perf tools: Fix build failures on ppc64le Namhyung Kim
2024-10-11  0:48   ` Stephen Rothwell
2024-10-11  6:34     ` Namhyung Kim
2024-10-11  7:05       ` Ian Rogers
2024-10-13  9:29         ` Stephen Rothwell

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).