All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf: cast some printf() arguments to fix x32 build
@ 2016-10-06 14:34 Vincent Stehlé
  2016-10-06 14:34 ` [PATCH 2/2] perf x86: fix compilation of push/pop for x32 Vincent Stehlé
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Stehlé @ 2016-10-06 14:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vincent Stehlé,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa,
	Adrian Hunter

Fix a few printf() format warnings regarding struct timeval fields on x32
(a.k.a AMD64 ILP32). As those warnings are treated as errors, they break
the build.

This fixes this kind of build warning:

  bench/sched-pipe.c:160:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type '__time_t {aka long long int}' [-Werror=format=]
     printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
                      ^

Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/bench/sched-messaging.c | 4 ++--
 tools/perf/bench/sched-pipe.c      | 4 ++--
 tools/perf/builtin-kvm.c           | 2 +-
 tools/perf/builtin-stat.c          | 3 ++-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index 6a111e77..7ad91c1 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -312,11 +312,11 @@ int bench_sched_messaging(int argc, const char **argv,
 		       num_groups, num_groups * 2 * num_fds,
 		       thread_mode ? "threads" : "processes");
 		printf(" %14s: %lu.%03lu [sec]\n", "Total time",
-		       diff.tv_sec,
+		       (unsigned long) diff.tv_sec,
 		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 	case BENCH_FORMAT_SIMPLE:
-		printf("%lu.%03lu\n", diff.tv_sec,
+		printf("%lu.%03lu\n", (unsigned long) diff.tv_sec,
 		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 	default:
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 2243f01..62277fb 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -158,7 +158,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 		result_usec += diff.tv_usec;
 
 		printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
-		       diff.tv_sec,
+		       (unsigned long) diff.tv_sec,
 		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 
 		printf(" %14lf usecs/op\n",
@@ -170,7 +170,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 
 	case BENCH_FORMAT_SIMPLE:
 		printf("%lu.%03lu\n",
-		       diff.tv_sec,
+		       (unsigned long) diff.tv_sec,
 		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 08fa88f..9a6489f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -566,7 +566,7 @@ static void show_timeofday(void)
 	gettimeofday(&tv, NULL);
 	if (localtime_r(&tv.tv_sec, &ltime)) {
 		strftime(date, sizeof(date), "%H:%M:%S", &ltime);
-		pr_info("%s.%06ld", date, tv.tv_usec);
+		pr_info("%s.%06ld", date, (long) tv.tv_usec);
 	} else
 		pr_info("00:00:00.000000");
 
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 688dea7..ab86bc6 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1393,7 +1393,8 @@ static void print_interval(char *prefix, struct timespec *ts)
 	FILE *output = stat_config.output;
 	static int num_print_interval;
 
-	sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep);
+	sprintf(prefix, "%6lu.%09lu%s", (unsigned long) ts->tv_sec,
+		(unsigned long) ts->tv_nsec, csv_sep);
 
 	if (num_print_interval == 0 && !csv_output) {
 		switch (stat_config.aggr_mode) {
-- 
2.9.3

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

* [PATCH 2/2] perf x86: fix compilation of push/pop for x32
  2016-10-06 14:34 [PATCH 1/2] perf: cast some printf() arguments to fix x32 build Vincent Stehlé
@ 2016-10-06 14:34 ` Vincent Stehlé
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Stehlé @ 2016-10-06 14:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vincent Stehlé,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa,
	Adrian Hunter

The x32 ABI (a.k.a AMD64 ILP32) necessitates to push or pop a 64-bit
register even though ILP32 uses 32-bit integers, longs and pointers.

This fixes the following build errors:

  arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
  arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'

Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/arch/x86/tests/regs_load.S | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 60875d5..4fa7943 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -62,14 +62,22 @@ ENTRY(perf_regs_load)
 ENDPROC(perf_regs_load)
 #else
 ENTRY(perf_regs_load)
+#if defined(__x86_64__) && defined(__ILP32__)
+	pushq %rdi
+#else
 	push %edi
+#endif
 	movl 8(%esp), %edi
 	movl %eax, AX(%edi)
 	movl %ebx, BX(%edi)
 	movl %ecx, CX(%edi)
 	movl %edx, DX(%edi)
 	movl %esi, SI(%edi)
+#if defined(__x86_64__) && defined(__ILP32__)
+	popq %rax
+#else
 	pop %eax
+#endif
 	movl %eax, DI(%edi)
 	movl %ebp, BP(%edi)
 
-- 
2.9.3

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

end of thread, other threads:[~2016-10-06 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 14:34 [PATCH 1/2] perf: cast some printf() arguments to fix x32 build Vincent Stehlé
2016-10-06 14:34 ` [PATCH 2/2] perf x86: fix compilation of push/pop for x32 Vincent Stehlé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.