qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] contrib/plugins: Build fixes for Darwin
@ 2023-09-07 10:49 Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 1/5] contrib/plugins/cache: Fix string format Philippe Mathieu-Daudé
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

Trivial:
- Fix string formats
- Link with GLib

Alex, Thomas: FWIW, plugins aren't build on CI.

Based-on: <20230907101811.469236-1-pbonzini@redhat.com>

Philippe Mathieu-Daudé (5):
  contrib/plugins/cache: Fix string format
  contrib/plugins/drcov: Fix string format
  contrib/plugins/howvec: Fix string format
  contrib/plugins/lockstep: Fix string format
  contrib/plugins: Link with GLib

 contrib/plugins/cache.c    | 19 ++++++++++---------
 contrib/plugins/drcov.c    |  2 +-
 contrib/plugins/howvec.c   |  6 ++++--
 contrib/plugins/lockstep.c | 11 ++++++++---
 contrib/plugins/Makefile   |  1 +
 5 files changed, 24 insertions(+), 15 deletions(-)

-- 
2.41.0



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

* [PATCH 1/5] contrib/plugins/cache: Fix string format
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
@ 2023-09-07 10:50 ` Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 2/5] contrib/plugins/drcov: " Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

This fixes on Darwin:

  plugins/cache.c:550:28: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                             l1_daccess,
                             ^~~~~~~~~~
  plugins/cache.c:551:28: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                             l1_dmisses,
                             ^~~~~~~~~~
  plugins/cache.c:553:28: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                             l1_iaccess,
                             ^~~~~~~~~~
  plugins/cache.c:554:28: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                             l1_imisses,
                             ^~~~~~~~~~
  plugins/cache.c:560:32: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                 l2_access,
                                 ^~~~~~~~~
  plugins/cache.c:561:32: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                 l2_misses,
                                 ^~~~~~~~~
  plugins/cache.c:665:52: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
          g_string_append_printf(rep, ", %ld, %s\n", insn->l1_dmisses,
                                         ~~~         ^~~~~~~~~~~~~~~~
                                         %llu
  plugins/cache.c:678:52: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
          g_string_append_printf(rep, ", %ld, %s\n", insn->l1_imisses,
                                         ~~~         ^~~~~~~~~~~~~~~~
                                         %llu
  plugins/cache.c:695:52: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
          g_string_append_printf(rep, ", %ld, %s\n", insn->l2_misses,
                                         ~~~         ^~~~~~~~~~~~~~~
                                         %llu

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 contrib/plugins/cache.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index dea4a56c8d..4fca3edd07 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -545,8 +545,8 @@ static void append_stats_line(GString *line, uint64_t l1_daccess,
     l1_dmiss_rate = ((double) l1_dmisses) / (l1_daccess) * 100.0;
     l1_imiss_rate = ((double) l1_imisses) / (l1_iaccess) * 100.0;
 
-    g_string_append_printf(line, "%-14lu %-12lu %9.4lf%%  %-14lu %-12lu"
-                           " %9.4lf%%",
+    g_string_append_printf(line, "%-14" PRIu64 " %-12" PRIu64 " %9.4lf%%"
+                           "  %-14" PRIu64 " %-12" PRIu64 " %9.4lf%%",
                            l1_daccess,
                            l1_dmisses,
                            l1_daccess ? l1_dmiss_rate : 0.0,
@@ -556,7 +556,8 @@ static void append_stats_line(GString *line, uint64_t l1_daccess,
 
     if (use_l2) {
         l2_miss_rate =  ((double) l2_misses) / (l2_access) * 100.0;
-        g_string_append_printf(line, "  %-12lu %-11lu %10.4lf%%",
+        g_string_append_printf(line,
+                               "  %-12" PRIu64 " %-11" PRIu64 " %10.4lf%%",
                                l2_access,
                                l2_misses,
                                l2_access ? l2_miss_rate : 0.0);
@@ -662,8 +663,8 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l1_dmisses,
-                               insn->disas_str);
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n",
+                               insn->l1_dmisses, insn->disas_str);
     }
 
     miss_insns = g_list_sort(miss_insns, icmp);
@@ -675,8 +676,8 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l1_imisses,
-                               insn->disas_str);
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n",
+                               insn->l1_imisses, insn->disas_str);
     }
 
     if (!use_l2) {
@@ -692,8 +693,8 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l2_misses,
-                               insn->disas_str);
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n",
+                               insn->l2_misses, insn->disas_str);
     }
 
 finish:
-- 
2.41.0



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

* [PATCH 2/5] contrib/plugins/drcov: Fix string format
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 1/5] contrib/plugins/cache: Fix string format Philippe Mathieu-Daudé
@ 2023-09-07 10:50 ` Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 3/5] contrib/plugins/howvec: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

This fixes on Darwin:

  plugins/drcov.c:52:13: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
              start_code, end_code, entry, path);
              ^~~~~~~~~~
  plugins/drcov.c:52:25: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
              start_code, end_code, entry, path);
                          ^~~~~~~~
  plugins/drcov.c:52:35: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
              start_code, end_code, entry, path);
                                    ^~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 contrib/plugins/drcov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/drcov.c b/contrib/plugins/drcov.c
index 686ae0a537..5edc94dcaf 100644
--- a/contrib/plugins/drcov.c
+++ b/contrib/plugins/drcov.c
@@ -48,7 +48,7 @@ static void printf_header(unsigned long count)
     uint64_t start_code = qemu_plugin_start_code();
     uint64_t end_code = qemu_plugin_end_code();
     uint64_t entry = qemu_plugin_entry_code();
-    fprintf(fp, "0, 0x%lx, 0x%lx, 0x%lx, %s\n",
+    fprintf(fp, "0, 0x%" PRIx64 ", 0x%" PRIx64 ", 0x%" PRIx64 ", %s\n",
             start_code, end_code, entry, path);
     fprintf(fp, "BB Table: %ld bbs\n", count);
 }
-- 
2.41.0



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

* [PATCH 3/5] contrib/plugins/howvec: Fix string format
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 1/5] contrib/plugins/cache: Fix string format Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 2/5] contrib/plugins/drcov: " Philippe Mathieu-Daudé
@ 2023-09-07 10:50 ` Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 4/5] contrib/plugins/lockstep: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

This fixes on Darwin:

  plugins/howvec.c:186:40: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                         class->count);
                                         ^~~~~~~~~~~~
  plugins/howvec.c:213:36: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                     rec->count,
                                     ^~~~~~~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 contrib/plugins/howvec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
index 0ed01ea931..644a7856bb 100644
--- a/contrib/plugins/howvec.c
+++ b/contrib/plugins/howvec.c
@@ -181,7 +181,8 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
         switch (class->what) {
         case COUNT_CLASS:
             if (class->count || verbose) {
-                g_string_append_printf(report, "Class: %-24s\t(%ld hits)\n",
+                g_string_append_printf(report,
+                                       "Class: %-24s\t(%" PRId64 " hits)\n",
                                        class->class,
                                        class->count);
             }
@@ -208,7 +209,8 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
              i++, counts = g_list_next(counts)) {
             InsnExecCount *rec = (InsnExecCount *) counts->data;
             g_string_append_printf(report,
-                                   "Instr: %-24s\t(%ld hits)\t(op=0x%08x/%s)\n",
+                                   "Instr: %-24s\t(%" PRId64 " hits)"
+                                   "\t(op=0x%08x/%s)\n",
                                    rec->insn,
                                    rec->count,
                                    rec->opcode,
-- 
2.41.0



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

* [PATCH 4/5] contrib/plugins/lockstep: Fix string format
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-09-07 10:50 ` [PATCH 3/5] contrib/plugins/howvec: " Philippe Mathieu-Daudé
@ 2023-09-07 10:50 ` Philippe Mathieu-Daudé
  2023-09-07 10:50 ` [PATCH 5/5] contrib/plugins: Link with GLib Philippe Mathieu-Daudé
  2023-09-07 10:57 ` [PATCH 0/5] contrib/plugins: Build fixes for Darwin Paolo Bonzini
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

This fixes on Darwin:

  plugins/lockstep.c:138:25: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                          us->pc, them->pc, g_slist_length(divergence_log),
                          ^~~~~~
  plugins/lockstep.c:138:33: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                          us->pc, them->pc, g_slist_length(divergence_log),
                                  ^~~~~~~~
  plugins/lockstep.c:148:25: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                          us->pc, us->insn_count, them->pc, them->insn_count);
                          ^~~~~~
  plugins/lockstep.c:148:49: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                          us->pc, us->insn_count, them->pc, them->insn_count);
                                                  ^~~~~~~~
  plugins/lockstep.c:156:36: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                     prev->block->pc, prev->block->insns,
                                     ^~~~~~~~~~~~~~~
  plugins/lockstep.c:156:53: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                                     prev->block->pc, prev->block->insns,
                                                      ^~~~~~~~~~~~~~~~~~

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 contrib/plugins/lockstep.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
index 850f7b2941..682b11feb2 100644
--- a/contrib/plugins/lockstep.c
+++ b/contrib/plugins/lockstep.c
@@ -134,7 +134,9 @@ static void report_divergance(ExecState *us, ExecState *them)
 
     /* Output short log entry of going out of sync... */
     if (verbose || divrec.distance == 1 || diverged) {
-        g_string_printf(out, "@ 0x%016lx vs 0x%016lx (%d/%d since last)\n",
+        g_string_printf(out,
+                        "@ 0x%016" PRIx64 " vs 0x%016" PRIx64
+                        " (%d/%d since last)\n",
                         us->pc, them->pc, g_slist_length(divergence_log),
                         divrec.distance);
         qemu_plugin_outs(out->str);
@@ -144,7 +146,9 @@ static void report_divergance(ExecState *us, ExecState *them)
         int i;
         GSList *entry;
 
-        g_string_printf(out, "Δ insn_count @ 0x%016lx (%ld) vs 0x%016lx (%ld)\n",
+        g_string_printf(out,
+                        "Δ insn_count @ 0x%016" PRIx64
+                        " (%ld) vs 0x%016" PRIx64 " (%ld)\n",
                         us->pc, us->insn_count, them->pc, them->insn_count);
 
         for (entry = log, i = 0;
@@ -152,7 +156,8 @@ static void report_divergance(ExecState *us, ExecState *them)
              entry = g_slist_next(entry), i++) {
             ExecInfo *prev = (ExecInfo *) entry->data;
             g_string_append_printf(out,
-                                   "  previously @ 0x%016lx/%ld (%ld insns)\n",
+                                   "  previously @ 0x%016" PRIx64 "/%" PRId64
+                                   " (%ld insns)\n",
                                    prev->block->pc, prev->block->insns,
                                    prev->insn_count);
         }
-- 
2.41.0



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

* [PATCH 5/5] contrib/plugins: Link with GLib
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2023-09-07 10:50 ` [PATCH 4/5] contrib/plugins/lockstep: " Philippe Mathieu-Daudé
@ 2023-09-07 10:50 ` Philippe Mathieu-Daudé
  2023-09-07 10:57 ` [PATCH 0/5] contrib/plugins: Build fixes for Darwin Paolo Bonzini
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 10:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexandre Iooss, Paolo Bonzini, Mahmoud Mandour, Thomas Huth,
	Alex Bennée, Philippe Mathieu-Daudé

This fixes on Darwin:

  ld: symbol(s) not found for architecture arm64
    "_g_string_append_printf", referenced from:
        _log_stats in cache.o
        _log_top_insns in cache.o
        _append_stats_line in cache.o
  ld: symbol(s) not found for architecture arm64
    "_g_string_free", referenced from:
        _g_autoptr_cleanup_gstring_free in cache.o
    "_g_string_insert_len", referenced from:
        _log_stats in cache.o
        _append_stats_line in cache.o
  ld: symbol(s) not found for architecture arm64
    "_g_string_new", referenced from:
        _log_stats in cache.o
        _log_top_insns in cache.o
    "_g_strsplit", referenced from:
        _qemu_plugin_install in cache.o
    ...

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Note LIBS was unused.
---
 contrib/plugins/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index b2b9db9f51..e9173972eb 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -26,6 +26,7 @@ SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
 
 # The main QEMU uses Glib extensively so it's perfectly fine to use it
 # in plugins (which many example do).
+LDLIBS += $(shell $(PKG_CONFIG) --libs glib-2.0)
 CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
 CFLAGS += -fPIC -Wall
 CFLAGS += $(if $(CONFIG_DEBUG_TCG), -ggdb -O0)
-- 
2.41.0



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

* Re: [PATCH 0/5] contrib/plugins: Build fixes for Darwin
  2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2023-09-07 10:50 ` [PATCH 5/5] contrib/plugins: Link with GLib Philippe Mathieu-Daudé
@ 2023-09-07 10:57 ` Paolo Bonzini
  2023-09-07 11:24   ` Philippe Mathieu-Daudé
  5 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2023-09-07 10:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Alexandre Iooss, Mahmoud Mandour, Thomas Huth, Alex Bennée

On 9/7/23 12:49, Philippe Mathieu-Daudé wrote:
> - Fix string formats
> - Link with GLib
> 
> Alex, Thomas: FWIW, plugins aren't build on CI.

They become tested with my patch "configure: unify recursion into 
sub-Makefiles", which is how I got into this business.  So I'll queue 
these patches and include them in my next pull request.

Paolo

> Based-on:<20230907101811.469236-1-pbonzini@redhat.com>



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

* Re: [PATCH 0/5] contrib/plugins: Build fixes for Darwin
  2023-09-07 10:57 ` [PATCH 0/5] contrib/plugins: Build fixes for Darwin Paolo Bonzini
@ 2023-09-07 11:24   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-07 11:24 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel
  Cc: Alexandre Iooss, Mahmoud Mandour, Thomas Huth, Alex Bennée

On 7/9/23 12:57, Paolo Bonzini wrote:
> On 9/7/23 12:49, Philippe Mathieu-Daudé wrote:
>> - Fix string formats
>> - Link with GLib
>>
>> Alex, Thomas: FWIW, plugins aren't build on CI.
> 
> They become tested with my patch "configure: unify recursion into 
> sub-Makefiles", which is how I got into this business.  So I'll queue 
> these patches and include them in my next pull request.

Thanks!



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

end of thread, other threads:[~2023-09-07 11:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 10:49 [PATCH 0/5] contrib/plugins: Build fixes for Darwin Philippe Mathieu-Daudé
2023-09-07 10:50 ` [PATCH 1/5] contrib/plugins/cache: Fix string format Philippe Mathieu-Daudé
2023-09-07 10:50 ` [PATCH 2/5] contrib/plugins/drcov: " Philippe Mathieu-Daudé
2023-09-07 10:50 ` [PATCH 3/5] contrib/plugins/howvec: " Philippe Mathieu-Daudé
2023-09-07 10:50 ` [PATCH 4/5] contrib/plugins/lockstep: " Philippe Mathieu-Daudé
2023-09-07 10:50 ` [PATCH 5/5] contrib/plugins: Link with GLib Philippe Mathieu-Daudé
2023-09-07 10:57 ` [PATCH 0/5] contrib/plugins: Build fixes for Darwin Paolo Bonzini
2023-09-07 11:24   ` Philippe Mathieu-Daudé

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