public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel•org>
To: Stephen Rothwell <sfr@canb•auug.org.au>
Cc: Arnaldo Carvalho de Melo <acme@kernel•org>,
	Ian Rogers <irogers@google•com>,
	LKML <linux-kernel@vger•kernel.org>,
	linux-next@vger•kernel.org
Subject: [PATCH] perf tools: Fix build failures on ppc64le
Date: Thu, 10 Oct 2024 16:57:43 -0700	[thread overview]
Message-ID: <20241010235743.1356168-1-namhyung@kernel.org> (raw)
In-Reply-To: <20241011102330.02bece12@canb.auug.org.au>

  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


  reply	other threads:[~2024-10-10 23:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 23:23 linux-next: build failure after merge of the perf tree Stephen Rothwell
2024-10-10 23:57 ` Namhyung Kim [this message]
2024-10-11  0:48   ` [PATCH] perf tools: Fix build failures on ppc64le Stephen Rothwell
2024-10-11  6:34     ` Namhyung Kim
2024-10-11  7:05       ` Ian Rogers
2024-10-13  9:29         ` Stephen Rothwell

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=20241010235743.1356168-1-namhyung@kernel.org \
    --to=namhyung@kernel$(echo .)org \
    --cc=acme@kernel$(echo .)org \
    --cc=irogers@google$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=sfr@canb$(echo .)auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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