* [PATCH 0/2] Fix the warnings in the 32-bit platform
@ 2024-03-05 12:04 Ben Zong-You Xie
2024-03-05 12:05 ` [PATCH 1/2] perf daemon: Fix the warning about time_t Ben Zong-You Xie
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ben Zong-You Xie @ 2024-03-05 12:04 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, paul.walmsley, palmer, aou,
linux-perf-users, linux-kernel, linux-riscv
Cc: dylan, tim609, Ben Zong-You Xie
This series fix two incompatible type warnings when building perf in the
32-bit platform.
Ben Zong-You Xie (2):
perf daemon: Fix the warning about time_t
perf riscv: Fix the warning due to the incompatible type
tools/perf/arch/riscv/util/header.c | 2 +-
tools/perf/builtin-daemon.c | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] perf daemon: Fix the warning about time_t
2024-03-05 12:04 [PATCH 0/2] Fix the warnings in the 32-bit platform Ben Zong-You Xie
@ 2024-03-05 12:05 ` Ben Zong-You Xie
2024-04-26 17:28 ` Palmer Dabbelt
2024-03-05 12:05 ` [PATCH 2/2] perf riscv: Fix the warning due to the incompatible type Ben Zong-You Xie
2024-04-02 9:41 ` [PATCH 0/2] Fix the warnings in the 32-bit platform Alexandre Ghiti
2 siblings, 1 reply; 5+ messages in thread
From: Ben Zong-You Xie @ 2024-03-05 12:05 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, paul.walmsley, palmer, aou,
linux-perf-users, linux-kernel, linux-riscv
Cc: dylan, tim609, Ben Zong-You Xie
In the 32-bit platform, the size of time_t is still 64 bits. Thus, use
PRIu64 to resolve the format problem.
Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
---
tools/perf/builtin-daemon.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
index 83954af36753..0b6ffd51c475 100644
--- a/tools/perf/builtin-daemon.c
+++ b/tools/perf/builtin-daemon.c
@@ -23,6 +23,7 @@
#include <sys/signalfd.h>
#include <sys/wait.h>
#include <poll.h>
+#include <inttypes.h>
#include "builtin.h"
#include "perf.h"
#include "debug.h"
@@ -688,7 +689,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
/* lock */
csv_sep, daemon->base, "lock");
- fprintf(out, "%c%lu",
+ fprintf(out, "%c%" PRIu64 "",
/* session up time */
csv_sep, (curr - daemon->start) / 60);
@@ -700,7 +701,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
daemon->base, SESSION_OUTPUT);
fprintf(out, " lock: %s/lock\n",
daemon->base);
- fprintf(out, " up: %lu minutes\n",
+ fprintf(out, " up: %" PRIu64 " minutes\n",
(curr - daemon->start) / 60);
}
}
@@ -727,7 +728,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
/* session ack */
csv_sep, session->base, SESSION_ACK);
- fprintf(out, "%c%lu",
+ fprintf(out, "%c%" PRIu64 "",
/* session up time */
csv_sep, (curr - session->start) / 60);
@@ -745,7 +746,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
session->base, SESSION_CONTROL);
fprintf(out, " ack: %s/%s\n",
session->base, SESSION_ACK);
- fprintf(out, " up: %lu minutes\n",
+ fprintf(out, " up: %" PRIu64 " minutes\n",
(curr - session->start) / 60);
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] perf riscv: Fix the warning due to the incompatible type
2024-03-05 12:04 [PATCH 0/2] Fix the warnings in the 32-bit platform Ben Zong-You Xie
2024-03-05 12:05 ` [PATCH 1/2] perf daemon: Fix the warning about time_t Ben Zong-You Xie
@ 2024-03-05 12:05 ` Ben Zong-You Xie
2024-04-02 9:41 ` [PATCH 0/2] Fix the warnings in the 32-bit platform Alexandre Ghiti
2 siblings, 0 replies; 5+ messages in thread
From: Ben Zong-You Xie @ 2024-03-05 12:05 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, paul.walmsley, palmer, aou,
linux-perf-users, linux-kernel, linux-riscv
Cc: dylan, tim609, Ben Zong-You Xie
In the 32-bit platform, the second argument of getline is expectd to be
'size_t *'(aka 'unsigned int *'), but line_sz is of type
'unsigned long *'. Therefore, declare line_sz as size_t.
Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
---
tools/perf/arch/riscv/util/header.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/riscv/util/header.c b/tools/perf/arch/riscv/util/header.c
index 4a41856938a8..1b29030021ee 100644
--- a/tools/perf/arch/riscv/util/header.c
+++ b/tools/perf/arch/riscv/util/header.c
@@ -41,7 +41,7 @@ static char *_get_cpuid(void)
char *mimpid = NULL;
char *cpuid = NULL;
int read;
- unsigned long line_sz;
+ size_t line_sz;
FILE *cpuinfo;
cpuinfo = fopen(CPUINFO, "r");
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Fix the warnings in the 32-bit platform
2024-03-05 12:04 [PATCH 0/2] Fix the warnings in the 32-bit platform Ben Zong-You Xie
2024-03-05 12:05 ` [PATCH 1/2] perf daemon: Fix the warning about time_t Ben Zong-You Xie
2024-03-05 12:05 ` [PATCH 2/2] perf riscv: Fix the warning due to the incompatible type Ben Zong-You Xie
@ 2024-04-02 9:41 ` Alexandre Ghiti
2 siblings, 0 replies; 5+ messages in thread
From: Alexandre Ghiti @ 2024-04-02 9:41 UTC (permalink / raw)
To: Ben Zong-You Xie, peterz, mingo, acme, namhyung, mark.rutland,
alexander.shishkin, jolsa, irogers, adrian.hunter, paul.walmsley,
palmer, aou, linux-perf-users, linux-kernel, linux-riscv
Cc: dylan, tim609
Hi Ben,
On 05/03/2024 13:04, Ben Zong-You Xie wrote:
> This series fix two incompatible type warnings when building perf in the
> 32-bit platform.
>
> Ben Zong-You Xie (2):
> perf daemon: Fix the warning about time_t
> perf riscv: Fix the warning due to the incompatible type
>
> tools/perf/arch/riscv/util/header.c | 2 +-
> tools/perf/builtin-daemon.c | 9 +++++----
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
For the series, you can add:
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
To me this should go into -fixes, but which tree? perf or riscv?
Thanks,
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] perf daemon: Fix the warning about time_t
2024-03-05 12:05 ` [PATCH 1/2] perf daemon: Fix the warning about time_t Ben Zong-You Xie
@ 2024-04-26 17:28 ` Palmer Dabbelt
0 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2024-04-26 17:28 UTC (permalink / raw)
To: ben717
Cc: peterz, mingo, acme, namhyung, Mark Rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, Paul Walmsley, aou,
linux-perf-users, linux-kernel, linux-riscv, dylan, tim609,
ben717
On Tue, 05 Mar 2024 04:05:00 PST (-0800), ben717@andestech.com wrote:
> In the 32-bit platform, the size of time_t is still 64 bits. Thus, use
> PRIu64 to resolve the format problem.
>
> Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
> ---
> tools/perf/builtin-daemon.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
> index 83954af36753..0b6ffd51c475 100644
> --- a/tools/perf/builtin-daemon.c
> +++ b/tools/perf/builtin-daemon.c
> @@ -23,6 +23,7 @@
> #include <sys/signalfd.h>
> #include <sys/wait.h>
> #include <poll.h>
> +#include <inttypes.h>
> #include "builtin.h"
> #include "perf.h"
> #include "debug.h"
> @@ -688,7 +689,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
> /* lock */
> csv_sep, daemon->base, "lock");
>
> - fprintf(out, "%c%lu",
> + fprintf(out, "%c%" PRIu64 "",
> /* session up time */
> csv_sep, (curr - daemon->start) / 60);
>
> @@ -700,7 +701,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
> daemon->base, SESSION_OUTPUT);
> fprintf(out, " lock: %s/lock\n",
> daemon->base);
> - fprintf(out, " up: %lu minutes\n",
> + fprintf(out, " up: %" PRIu64 " minutes\n",
> (curr - daemon->start) / 60);
> }
> }
> @@ -727,7 +728,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
> /* session ack */
> csv_sep, session->base, SESSION_ACK);
>
> - fprintf(out, "%c%lu",
> + fprintf(out, "%c%" PRIu64 "",
> /* session up time */
> csv_sep, (curr - session->start) / 60);
>
> @@ -745,7 +746,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
> session->base, SESSION_CONTROL);
> fprintf(out, " ack: %s/%s\n",
> session->base, SESSION_ACK);
> - fprintf(out, " up: %lu minutes\n",
> + fprintf(out, " up: %" PRIu64 " minutes\n",
> (curr - session->start) / 60);
> }
> }
Sorry I missed this earlier, but IIUC this one is actually incorrect: on
most 32-bit platforms time_t is 32 bits, it was later extended to 64
bits. RISC-V is special because the work to make time_t 64-bit had
started when we submitted the port, so we just jumped straight to the
legacy-free uABI (after some headaches).
So IIUC this would introduce a warning for some other targets. Either
way I shouldn't have picked it up as it's not a RISC-V patch (this is a
generic perf file), so I'm going to drop it from fixes.
Sorry for the confusion!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-26 17:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 12:04 [PATCH 0/2] Fix the warnings in the 32-bit platform Ben Zong-You Xie
2024-03-05 12:05 ` [PATCH 1/2] perf daemon: Fix the warning about time_t Ben Zong-You Xie
2024-04-26 17:28 ` Palmer Dabbelt
2024-03-05 12:05 ` [PATCH 2/2] perf riscv: Fix the warning due to the incompatible type Ben Zong-You Xie
2024-04-02 9:41 ` [PATCH 0/2] Fix the warnings in the 32-bit platform Alexandre Ghiti
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).