All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] stop collection of instruction usage statistics
@ 2021-05-26 20:20 Bruno Larsen (billionai)
  2021-05-26 20:21 ` [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set Bruno Larsen (billionai)
                   ` (5 more replies)
  0 siblings, 6 replies; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: farosas, richard.henderson, luis.pires, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

Based-on: <20210525115355.8254-1-bruno.larsen@eldorado.org.br>

The functionality of counting how many instructions were being executed and
being able to show it through the monitor, although neat, was only
supported by ppc, and now that it is migrating to use decodetree (at
least partially), those statistics won't be used anymore. Therefore,
this patch removes that functinality completely.

This series was suggested by Richard Henderson

Bruno Larsen (billionai) (5):
  target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
  target/ppc: remove ppc_cpu_dump_statistics
  target/ppc: removed mentions to DO_PPC_STATISTICS
  monitor: removed cpustats command
  hw/core/cpu: removed cpu_dump_statistics function

 hmp-commands-info.hx   | 13 --------
 hw/core/cpu.c          |  9 ------
 include/hw/core/cpu.h  | 12 --------
 monitor/misc.c         | 11 -------
 target/ppc/cpu.h       |  1 -
 target/ppc/cpu_init.c  |  3 --
 target/ppc/translate.c | 69 +++---------------------------------------
 7 files changed, 5 insertions(+), 113 deletions(-)

-- 
2.17.1



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

* [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
@ 2021-05-26 20:21 ` Bruno Larsen (billionai)
  2021-05-26 21:13   ` Luis Fernando Fujita Pires
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: farosas, richard.henderson, luis.pires, Greg Kurz, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

Before this patch, when PPC_DUMP_CPU is set, oname is added to
opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
was set as well.

This patch changes it so those changes would happen when PPC_DUMP_CPU is
set, but not statistics, because the latter is being removed.

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index ea200f9637..6c0f424d81 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -1345,7 +1345,7 @@ typedef struct opcode_t {
 /*****************************************************************************/
 /* PowerPC instructions table                                                */
 
-#if defined(DO_PPC_STATISTICS)
+#if defined(PPC_DUMP_CPU)
 #define GEN_OPCODE(name, op1, op2, op3, invl, _typ, _typ2)                    \
 {                                                                             \
     .opc1 = op1,                                                              \
-- 
2.17.1



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

* [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
  2021-05-26 20:21 ` [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set Bruno Larsen (billionai)
@ 2021-05-26 20:21 ` Bruno Larsen (billionai)
  2021-05-26 21:25   ` Richard Henderson
                     ` (3 more replies)
  2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
                   ` (3 subsequent siblings)
  5 siblings, 4 replies; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: farosas, richard.henderson, luis.pires, Greg Kurz, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

This function requires surce code modification to be useful, which means
it probably is not used often, and the move to using decodetree means
the statistics won't even be collected anymore.

Also removed setting dump_statistics in ppc_cpu_realize, since it was
only useful when in conjunction with ppc_cpu_dump_statistics.

Suggested-by: Richard Henderson<richard.henderson@linaro.org>
Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/cpu.h       |  1 -
 target/ppc/cpu_init.c  |  3 ---
 target/ppc/translate.c | 51 ------------------------------------------
 3 files changed, 55 deletions(-)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 203f07e48e..c3d1b492e4 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
 void ppc_cpu_do_interrupt(CPUState *cpu);
 bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
 void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
-void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
 hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index f5ae2f150d..bd05f53fa4 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
     cc->class_by_name = ppc_cpu_class_by_name;
     cc->has_work = ppc_cpu_has_work;
     cc->dump_state = ppc_cpu_dump_state;
-#ifdef CONFIG_TCG
-    cc->dump_statistics = ppc_cpu_dump_statistics;
-#endif
     cc->set_pc = ppc_cpu_set_pc;
     cc->gdb_read_register = ppc_cpu_gdb_read_register;
     cc->gdb_write_register = ppc_cpu_gdb_write_register;
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 6c0f424d81..fc9fd790ca 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -8881,57 +8881,6 @@ int ppc_fixup_cpu(PowerPCCPU *cpu)
     return 0;
 }
 
-
-void ppc_cpu_dump_statistics(CPUState *cs, int flags)
-{
-#if defined(DO_PPC_STATISTICS)
-    PowerPCCPU *cpu = POWERPC_CPU(cs);
-    opc_handler_t **t1, **t2, **t3, *handler;
-    int op1, op2, op3;
-
-    t1 = cpu->env.opcodes;
-    for (op1 = 0; op1 < 64; op1++) {
-        handler = t1[op1];
-        if (is_indirect_opcode(handler)) {
-            t2 = ind_table(handler);
-            for (op2 = 0; op2 < 32; op2++) {
-                handler = t2[op2];
-                if (is_indirect_opcode(handler)) {
-                    t3 = ind_table(handler);
-                    for (op3 = 0; op3 < 32; op3++) {
-                        handler = t3[op3];
-                        if (handler->count == 0) {
-                            continue;
-                        }
-                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
-                                    "%016" PRIx64 " %" PRId64 "\n",
-                                    op1, op2, op3, op1, (op3 << 5) | op2,
-                                    handler->oname,
-                                    handler->count, handler->count);
-                    }
-                } else {
-                    if (handler->count == 0) {
-                        continue;
-                    }
-                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
-                                "%016" PRIx64 " %" PRId64 "\n",
-                                op1, op2, op1, op2, handler->oname,
-                                handler->count, handler->count);
-                }
-            }
-        } else {
-            if (handler->count == 0) {
-                continue;
-            }
-            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
-                        " %" PRId64 "\n",
-                        op1, op1, handler->oname,
-                        handler->count, handler->count);
-        }
-    }
-#endif
-}
-
 static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
 {
     opc_handler_t **table, *handler;
-- 
2.17.1



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

* [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
  2021-05-26 20:21 ` [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set Bruno Larsen (billionai)
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
@ 2021-05-26 20:21 ` Bruno Larsen (billionai)
  2021-05-26 21:26   ` Richard Henderson
                     ` (2 more replies)
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: farosas, richard.henderson, luis.pires, Greg Kurz, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

Removed the commented out definition and all ifdefs relating to
PPC_DUMP_STATISTICS, as it's hardly ever used.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/translate.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index fc9fd790ca..0525e1939f 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -47,7 +47,6 @@
 
 /* Include definitions for instructions classes and implementations flags */
 /* #define PPC_DEBUG_DISAS */
-/* #define DO_PPC_STATISTICS */
 
 #ifdef PPC_DEBUG_DISAS
 #  define LOG_DISAS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
@@ -217,12 +216,9 @@ struct opc_handler_t {
     uint64_t type2;
     /* handler */
     void (*handler)(DisasContext *ctx);
-#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
+#if defined(PPC_DUMP_CPU)
     const char *oname;
 #endif
-#if defined(DO_PPC_STATISTICS)
-    uint64_t count;
-#endif
 };
 
 /* SPR load/store helpers */
@@ -8546,7 +8542,7 @@ static int register_direct_insn(opc_handler_t **ppc_opcodes,
     if (insert_in_table(ppc_opcodes, idx, handler) < 0) {
         printf("*** ERROR: opcode %02x already assigned in main "
                "opcode table\n", idx);
-#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
+#if defined(PPC_DUMP_CPU)
         printf("           Registered handler '%s' - new handler '%s'\n",
                ppc_opcodes[idx]->oname, handler->oname);
 #endif
@@ -8570,7 +8566,7 @@ static int register_ind_in_table(opc_handler_t **table,
         if (!is_indirect_opcode(table[idx1])) {
             printf("*** ERROR: idx %02x already assigned to a direct "
                    "opcode\n", idx1);
-#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
+#if defined(PPC_DUMP_CPU)
             printf("           Registered handler '%s' - new handler '%s'\n",
                    ind_table(table[idx1])[idx2]->oname, handler->oname);
 #endif
@@ -8581,7 +8577,7 @@ static int register_ind_in_table(opc_handler_t **table,
         insert_in_table(ind_table(table[idx1]), idx2, handler) < 0) {
         printf("*** ERROR: opcode %02x already assigned in "
                "opcode table %02x\n", idx2, idx1);
-#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
+#if defined(PPC_DUMP_CPU)
         printf("           Registered handler '%s' - new handler '%s'\n",
                ind_table(table[idx1])[idx2]->oname, handler->oname);
 #endif
@@ -9036,10 +9032,6 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
         gen_invalid(ctx);
     }
 
-#if defined(DO_PPC_STATISTICS)
-    handler->count++;
-#endif
-
     translator_loop_temp_check(&ctx->base);
 }
 
-- 
2.17.1



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

* [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
                   ` (2 preceding siblings ...)
  2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
@ 2021-05-26 20:21 ` Bruno Larsen (billionai)
  2021-05-26 21:28   ` Richard Henderson
                     ` (3 more replies)
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
  2021-05-27 13:57 ` [PATCH 0/5] stop collection of instruction usage statistics Alex Bennée
  5 siblings, 4 replies; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: farosas, Markus Armbruster, richard.henderson, luis.pires,
	Dr. David Alan Gilbert, lucas.araujo, fernando.valle, qemu-ppc,
	matheus.ferst, david

Since ppc was the last architecture to collect these statistics and
it is currently phasing this collection out, the command that would query
this information is being removed.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 hmp-commands-info.hx | 13 -------------
 monitor/misc.c       | 11 -----------
 2 files changed, 24 deletions(-)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index ab0c7aa5ee..b2347a6aea 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -500,19 +500,6 @@ SRST
     Show the current VM UUID.
 ERST
 
-    {
-        .name       = "cpustats",
-        .args_type  = "",
-        .params     = "",
-        .help       = "show CPU statistics",
-        .cmd        = hmp_info_cpustats,
-    },
-
-SRST
-  ``info cpustats``
-    Show CPU statistics.
-ERST
-
 #if defined(CONFIG_SLIRP)
     {
         .name       = "usernet",
diff --git a/monitor/misc.c b/monitor/misc.c
index f3a393ea59..1539e18557 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
     }
 }
 
-static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
-{
-    CPUState *cs = mon_get_cpu(mon);
-
-    if (!cs) {
-        monitor_printf(mon, "No CPU available\n");
-        return;
-    }
-    cpu_dump_statistics(cs, 0);
-}
-
 static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
 {
     const char *name = qdict_get_try_str(qdict, "name");
-- 
2.17.1



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

* [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
                   ` (3 preceding siblings ...)
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
@ 2021-05-26 20:21 ` Bruno Larsen (billionai)
  2021-05-26 21:29   ` Richard Henderson
                     ` (3 more replies)
  2021-05-27 13:57 ` [PATCH 0/5] stop collection of instruction usage statistics Alex Bennée
  5 siblings, 4 replies; 42+ messages in thread
From: Bruno Larsen (billionai) @ 2021-05-26 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, farosas, richard.henderson, luis.pires,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst, david

No more architectures set the pointer to dump_statistics, so there's no
point in keeping it, or the related cpu_dump_statistics function.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 hw/core/cpu.c         |  9 ---------
 include/hw/core/cpu.h | 12 ------------
 2 files changed, 21 deletions(-)

diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index 00330ba07d..b700d884ad 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -218,15 +218,6 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
     }
 }
 
-void cpu_dump_statistics(CPUState *cpu, int flags)
-{
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-
-    if (cc->dump_statistics) {
-        cc->dump_statistics(cpu, flags);
-    }
-}
-
 void cpu_reset(CPUState *cpu)
 {
     device_cold_reset(DEVICE(cpu));
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index d45f78290e..6d14923206 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -93,7 +93,6 @@ struct AccelCPUClass;
  * not be used by any callers other than the pre-1.0 virtio devices.
  * @memory_rw_debug: Callback for GDB memory access.
  * @dump_state: Callback for dumping state.
- * @dump_statistics: Callback for dumping statistics.
  * @get_arch_id: Callback for getting architecture-dependent CPU ID.
  * @get_paging_enabled: Callback for inquiring whether paging is enabled.
  * @get_memory_mapping: Callback for obtaining the memory mappings.
@@ -155,7 +154,6 @@ struct CPUClass {
                            uint8_t *buf, int len, bool is_write);
     void (*dump_state)(CPUState *cpu, FILE *, int flags);
     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
-    void (*dump_statistics)(CPUState *cpu, int flags);
     int64_t (*get_arch_id)(CPUState *cpu);
     bool (*get_paging_enabled)(const CPUState *cpu);
     void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
@@ -562,16 +560,6 @@ enum CPUDumpFlags {
  */
 void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 
-/**
- * cpu_dump_statistics:
- * @cpu: The CPU whose state is to be dumped.
- * @flags: Flags what to dump.
- *
- * Dump CPU statistics to the current monitor if we have one, else to
- * stdout.
- */
-void cpu_dump_statistics(CPUState *cpu, int flags);
-
 #ifndef CONFIG_USER_ONLY
 /**
  * cpu_get_phys_page_attrs_debug:
-- 
2.17.1



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

* RE: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
  2021-05-26 20:21 ` [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set Bruno Larsen (billionai)
@ 2021-05-26 21:13   ` Luis Fernando Fujita Pires
  2021-05-26 21:24     ` Richard Henderson
  0 siblings, 1 reply; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-26 21:13 UTC (permalink / raw)
  To: Bruno Piazera Larsen, qemu-devel
  Cc: farosas, richard.henderson, Greg Kurz,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> Before this patch, when PPC_DUMP_CPU is set, oname is added to
> opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
> was set as well.
> 
> This patch changes it so those changes would happen when PPC_DUMP_CPU is
> set, but not statistics, because the latter is being removed.
> 
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/translate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I suggest removing dump_ppc_insns() altogether and 'oname' along with it.

Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.

Luis


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

* Re: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
  2021-05-26 21:13   ` Luis Fernando Fujita Pires
@ 2021-05-26 21:24     ` Richard Henderson
  2021-05-27  1:18       ` david
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Henderson @ 2021-05-26 21:24 UTC (permalink / raw)
  To: Luis Fernando Fujita Pires, Bruno Piazera Larsen, qemu-devel
  Cc: farosas, Greg Kurz, Lucas Mateus Martins Araujo e Castro,
	Fernando Eckhardt Valle, qemu-ppc, Matheus Kowalczuk Ferst,
	david

On 5/26/21 2:13 PM, Luis Fernando Fujita Pires wrote:
> From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>> Before this patch, when PPC_DUMP_CPU is set, oname is added to
>> opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
>> was set as well.
>>
>> This patch changes it so those changes would happen when PPC_DUMP_CPU is
>> set, but not statistics, because the latter is being removed.
>>
>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>> ---
>>   target/ppc/translate.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> I suggest removing dump_ppc_insns() altogether and 'oname' along with it.
> 
> Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.

Agreed.

r~


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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
@ 2021-05-26 21:25   ` Richard Henderson
  2021-05-26 21:27   ` Luis Fernando Fujita Pires
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 42+ messages in thread
From: Richard Henderson @ 2021-05-26 21:25 UTC (permalink / raw)
  To: Bruno Larsen (billionai), qemu-devel
  Cc: farosas, luis.pires, Greg Kurz, lucas.araujo, fernando.valle,
	qemu-ppc, matheus.ferst, david

On 5/26/21 1:21 PM, Bruno Larsen (billionai) wrote:
> This function requires surce code modification to be useful, which means
> it probably is not used often, and the move to using decodetree means
> the statistics won't even be collected anymore.
> 
> Also removed setting dump_statistics in ppc_cpu_realize, since it was
> only useful when in conjunction with ppc_cpu_dump_statistics.
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai)<bruno.larsen@eldorado.org.br>
> ---
>   target/ppc/cpu.h       |  1 -
>   target/ppc/cpu_init.c  |  3 ---
>   target/ppc/translate.c | 51 ------------------------------------------
>   3 files changed, 55 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS
  2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
@ 2021-05-26 21:26   ` Richard Henderson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
  2021-05-27  4:37   ` David Gibson
  2 siblings, 0 replies; 42+ messages in thread
From: Richard Henderson @ 2021-05-26 21:26 UTC (permalink / raw)
  To: Bruno Larsen (billionai), qemu-devel
  Cc: farosas, luis.pires, Greg Kurz, lucas.araujo, fernando.valle,
	qemu-ppc, matheus.ferst, david

On 5/26/21 1:21 PM, Bruno Larsen (billionai) wrote:
> Removed the commented out definition and all ifdefs relating to
> PPC_DUMP_STATISTICS, as it's hardly ever used.
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai)<bruno.larsen@eldorado.org.br>
> ---
>   target/ppc/translate.c | 16 ++++------------
>   1 file changed, 4 insertions(+), 12 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* RE: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
  2021-05-26 21:25   ` Richard Henderson
@ 2021-05-26 21:27   ` Luis Fernando Fujita Pires
  2021-05-27  1:20   ` David Gibson
  2021-05-27  6:01   ` Greg Kurz
  3 siblings, 0 replies; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-26 21:27 UTC (permalink / raw)
  To: Bruno Piazera Larsen, qemu-devel
  Cc: farosas, richard.henderson, Greg Kurz,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

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

From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>

> This function requires surce code modification to be useful, which means it

> probably is not used often, and the move to using decodetree means the

> statistics won't even be collected anymore.

>

> Also removed setting dump_statistics in ppc_cpu_realize, since it was only useful

> when in conjunction with ppc_cpu_dump_statistics.

>

> Suggested-by: Richard Henderson<richard.henderson@linaro.org<mailto:richard.henderson@linaro.org>>

> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br<mailto:bruno.larsen@eldorado.org.br>>

> ---

>  target/ppc/cpu.h       |  1 -

>  target/ppc/cpu_init.c  |  3 ---

>  target/ppc/translate.c | 51 ------------------------------------------

>  3 files changed, 55 deletions(-)



It's not just that ppc_cpu_dump_statistics() wouldn't be useful, but it wouldn't even compile.

The change looks good.



Reviewed-by: Luis Pires <luis.pires@eldorado.org.br<mailto:luis.pires@eldorado.org.br>>


Luis Pires
Instituto de Pesquisas ELDORADO<http://www.eldorado.org.br/>
Departamento de Computação Embarcada
Aviso Legal - Disclaimer<https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 5006 bytes --]

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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
@ 2021-05-26 21:28   ` Richard Henderson
  2021-05-27  4:40     ` David Gibson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 42+ messages in thread
From: Richard Henderson @ 2021-05-26 21:28 UTC (permalink / raw)
  To: Bruno Larsen (billionai), qemu-devel
  Cc: farosas, Markus Armbruster, luis.pires, Dr. David Alan Gilbert,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst, david

On 5/26/21 1:21 PM, Bruno Larsen (billionai) wrote:
> Since ppc was the last architecture to collect these statistics and
> it is currently phasing this collection out, the command that would query
> this information is being removed.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>   hmp-commands-info.hx | 13 -------------
>   monitor/misc.c       | 11 -----------
>   2 files changed, 24 deletions(-)

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ab0c7aa5ee..b2347a6aea 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -500,19 +500,6 @@ SRST
>       Show the current VM UUID.
>   ERST
>   
> -    {
> -        .name       = "cpustats",
> -        .args_type  = "",
> -        .params     = "",
> -        .help       = "show CPU statistics",
> -        .cmd        = hmp_info_cpustats,
> -    },
> -
> -SRST
> -  ``info cpustats``
> -    Show CPU statistics.
> -ERST
> -
>   #if defined(CONFIG_SLIRP)
>       {
>           .name       = "usernet",
> diff --git a/monitor/misc.c b/monitor/misc.c
> index f3a393ea59..1539e18557 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
>       }
>   }
>   
> -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> -{
> -    CPUState *cs = mon_get_cpu(mon);
> -
> -    if (!cs) {
> -        monitor_printf(mon, "No CPU available\n");
> -        return;
> -    }
> -    cpu_dump_statistics(cs, 0);
> -}
> -
>   static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
>   {
>       const char *name = qdict_get_try_str(qdict, "name");
> 



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

* Re: [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
@ 2021-05-26 21:29   ` Richard Henderson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 42+ messages in thread
From: Richard Henderson @ 2021-05-26 21:29 UTC (permalink / raw)
  To: Bruno Larsen (billionai), qemu-devel
  Cc: Eduardo Habkost, farosas, luis.pires, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

On 5/26/21 1:21 PM, Bruno Larsen (billionai) wrote:
> No more architectures set the pointer to dump_statistics, so there's no
> point in keeping it, or the related cpu_dump_statistics function.
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai)<bruno.larsen@eldorado.org.br>
> ---
>   hw/core/cpu.c         |  9 ---------
>   include/hw/core/cpu.h | 12 ------------
>   2 files changed, 21 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* RE: [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS
  2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
  2021-05-26 21:26   ` Richard Henderson
@ 2021-05-26 21:35   ` Luis Fernando Fujita Pires
  2021-05-27  4:37   ` David Gibson
  2 siblings, 0 replies; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-26 21:35 UTC (permalink / raw)
  To: Bruno Piazera Larsen, qemu-devel
  Cc: farosas, richard.henderson, Greg Kurz,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> Removed the commented out definition and all ifdefs relating to
> PPC_DUMP_STATISTICS, as it's hardly ever used.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/translate.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

The change looks good. Just a minor note: part of the commit msg is wrong, where you mention "PPC_DUMP_STATISTICS". The #define is DO_PPC_STATISTICS, and the function was ppc_cpu_dump_statistics(). You're probably referring to the former.

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>

--
Luis Pires
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br>
Departamento de Computação Embarcada
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


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

* RE: [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
  2021-05-26 21:28   ` Richard Henderson
@ 2021-05-26 21:35   ` Luis Fernando Fujita Pires
  2021-05-27  6:40   ` Greg Kurz
  2021-05-27  8:08   ` Dr. David Alan Gilbert
  3 siblings, 0 replies; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-26 21:35 UTC (permalink / raw)
  To: Bruno Piazera Larsen, qemu-devel
  Cc: farosas, richard.henderson, Dr. David Alan Gilbert,
	Markus Armbruster, Lucas Mateus Martins Araujo e Castro,
	Fernando Eckhardt Valle, qemu-ppc, Matheus Kowalczuk Ferst,
	david

From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> Since ppc was the last architecture to collect these statistics and it is currently
> phasing this collection out, the command that would query this information is
> being removed.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  hmp-commands-info.hx | 13 -------------
>  monitor/misc.c       | 11 -----------
>  2 files changed, 24 deletions(-)

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>

--
Luis Pires
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br>
Departamento de Computação Embarcada
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


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

* RE: [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
  2021-05-26 21:29   ` Richard Henderson
@ 2021-05-26 21:35   ` Luis Fernando Fujita Pires
  2021-05-27  1:21   ` David Gibson
  2021-05-27 21:05   ` Eduardo Habkost
  3 siblings, 0 replies; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-26 21:35 UTC (permalink / raw)
  To: Bruno Piazera Larsen, qemu-devel
  Cc: Eduardo Habkost, farosas, richard.henderson,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> No more architectures set the pointer to dump_statistics, so there's no point in
> keeping it, or the related cpu_dump_statistics function.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  hw/core/cpu.c         |  9 ---------
>  include/hw/core/cpu.h | 12 ------------
>  2 files changed, 21 deletions(-)

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>

--
Luis Pires
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br>
Departamento de Computação Embarcada
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


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

* Re: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
  2021-05-26 21:24     ` Richard Henderson
@ 2021-05-27  1:18       ` david
  0 siblings, 0 replies; 42+ messages in thread
From: david @ 2021-05-27  1:18 UTC (permalink / raw)
  To: Richard Henderson
  Cc: farosas, qemu-devel, Greg Kurz,
	Lucas Mateus Martins Araujo e Castro, Luis Fernando Fujita Pires,
	Fernando Eckhardt Valle, qemu-ppc, Matheus Kowalczuk Ferst

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

On Wed, May 26, 2021 at 02:24:51PM -0700, Richard Henderson wrote:
> On 5/26/21 2:13 PM, Luis Fernando Fujita Pires wrote:
> > From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > > Before this patch, when PPC_DUMP_CPU is set, oname is added to
> > > opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
> > > was set as well.
> > > 
> > > This patch changes it so those changes would happen when PPC_DUMP_CPU is
> > > set, but not statistics, because the latter is being removed.
> > > 
> > > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > > ---
> > >   target/ppc/translate.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > I suggest removing dump_ppc_insns() altogether and 'oname' along with it.
> > 
> > Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.
> 
> Agreed.

I'll wait for a follow up doing this then.

> 
> r~
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
  2021-05-26 21:25   ` Richard Henderson
  2021-05-26 21:27   ` Luis Fernando Fujita Pires
@ 2021-05-27  1:20   ` David Gibson
  2021-05-27  4:35     ` David Gibson
  2021-05-27  6:01   ` Greg Kurz
  3 siblings, 1 reply; 42+ messages in thread
From: David Gibson @ 2021-05-27  1:20 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, qemu-devel, Greg Kurz, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires

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

On Wed, May 26, 2021 at 05:21:01PM -0300, Bruno Larsen (billionai) wrote:
> This function requires surce code modification to be useful, which means
> it probably is not used often, and the move to using decodetree means
> the statistics won't even be collected anymore.
> 
> Also removed setting dump_statistics in ppc_cpu_realize, since it was
> only useful when in conjunction with ppc_cpu_dump_statistics.
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/cpu.h       |  1 -
>  target/ppc/cpu_init.c  |  3 ---
>  target/ppc/translate.c | 51 ------------------------------------------
>  3 files changed, 55 deletions(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 203f07e48e..c3d1b492e4 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
>  void ppc_cpu_do_interrupt(CPUState *cpu);
>  bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
>  void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
>  hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
>  int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
>  int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index f5ae2f150d..bd05f53fa4 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      cc->class_by_name = ppc_cpu_class_by_name;
>      cc->has_work = ppc_cpu_has_work;
>      cc->dump_state = ppc_cpu_dump_state;
> -#ifdef CONFIG_TCG
> -    cc->dump_statistics = ppc_cpu_dump_statistics;
> -#endif

This confuses me.  The ifdefs you're removing aren't present in my
tree, and AFAICT they never existed since your own patch created
cpu_init.c.

So.. please rebase and check that.

>      cc->set_pc = ppc_cpu_set_pc;
>      cc->gdb_read_register = ppc_cpu_gdb_read_register;
>      cc->gdb_write_register = ppc_cpu_gdb_write_register;
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 6c0f424d81..fc9fd790ca 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -8881,57 +8881,6 @@ int ppc_fixup_cpu(PowerPCCPU *cpu)
>      return 0;
>  }
>  
> -
> -void ppc_cpu_dump_statistics(CPUState *cs, int flags)
> -{
> -#if defined(DO_PPC_STATISTICS)
> -    PowerPCCPU *cpu = POWERPC_CPU(cs);
> -    opc_handler_t **t1, **t2, **t3, *handler;
> -    int op1, op2, op3;
> -
> -    t1 = cpu->env.opcodes;
> -    for (op1 = 0; op1 < 64; op1++) {
> -        handler = t1[op1];
> -        if (is_indirect_opcode(handler)) {
> -            t2 = ind_table(handler);
> -            for (op2 = 0; op2 < 32; op2++) {
> -                handler = t2[op2];
> -                if (is_indirect_opcode(handler)) {
> -                    t3 = ind_table(handler);
> -                    for (op3 = 0; op3 < 32; op3++) {
> -                        handler = t3[op3];
> -                        if (handler->count == 0) {
> -                            continue;
> -                        }
> -                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
> -                                    "%016" PRIx64 " %" PRId64 "\n",
> -                                    op1, op2, op3, op1, (op3 << 5) | op2,
> -                                    handler->oname,
> -                                    handler->count, handler->count);
> -                    }
> -                } else {
> -                    if (handler->count == 0) {
> -                        continue;
> -                    }
> -                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
> -                                "%016" PRIx64 " %" PRId64 "\n",
> -                                op1, op2, op1, op2, handler->oname,
> -                                handler->count, handler->count);
> -                }
> -            }
> -        } else {
> -            if (handler->count == 0) {
> -                continue;
> -            }
> -            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
> -                        " %" PRId64 "\n",
> -                        op1, op1, handler->oname,
> -                        handler->count, handler->count);
> -        }
> -    }
> -#endif
> -}
> -
>  static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
>  {
>      opc_handler_t **table, *handler;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
  2021-05-26 21:29   ` Richard Henderson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
@ 2021-05-27  1:21   ` David Gibson
  2021-05-27 21:05   ` Eduardo Habkost
  3 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2021-05-27  1:21 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: Eduardo Habkost, farosas, richard.henderson, qemu-devel,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst,
	luis.pires

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

On Wed, May 26, 2021 at 05:21:04PM -0300, Bruno Larsen (billionai) wrote:
> No more architectures set the pointer to dump_statistics, so there's no
> point in keeping it, or the related cpu_dump_statistics function.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai)
> <bruno.larsen@eldorado.org.br>

I'm happy enough to stage this through my tree, but an ack from
Eduardo or Marcel would be good to have.

> ---
>  hw/core/cpu.c         |  9 ---------
>  include/hw/core/cpu.h | 12 ------------
>  2 files changed, 21 deletions(-)
> 
> diff --git a/hw/core/cpu.c b/hw/core/cpu.c
> index 00330ba07d..b700d884ad 100644
> --- a/hw/core/cpu.c
> +++ b/hw/core/cpu.c
> @@ -218,15 +218,6 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
>      }
>  }
>  
> -void cpu_dump_statistics(CPUState *cpu, int flags)
> -{
> -    CPUClass *cc = CPU_GET_CLASS(cpu);
> -
> -    if (cc->dump_statistics) {
> -        cc->dump_statistics(cpu, flags);
> -    }
> -}
> -
>  void cpu_reset(CPUState *cpu)
>  {
>      device_cold_reset(DEVICE(cpu));
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index d45f78290e..6d14923206 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -93,7 +93,6 @@ struct AccelCPUClass;
>   * not be used by any callers other than the pre-1.0 virtio devices.
>   * @memory_rw_debug: Callback for GDB memory access.
>   * @dump_state: Callback for dumping state.
> - * @dump_statistics: Callback for dumping statistics.
>   * @get_arch_id: Callback for getting architecture-dependent CPU ID.
>   * @get_paging_enabled: Callback for inquiring whether paging is enabled.
>   * @get_memory_mapping: Callback for obtaining the memory mappings.
> @@ -155,7 +154,6 @@ struct CPUClass {
>                             uint8_t *buf, int len, bool is_write);
>      void (*dump_state)(CPUState *cpu, FILE *, int flags);
>      GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
> -    void (*dump_statistics)(CPUState *cpu, int flags);
>      int64_t (*get_arch_id)(CPUState *cpu);
>      bool (*get_paging_enabled)(const CPUState *cpu);
>      void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
> @@ -562,16 +560,6 @@ enum CPUDumpFlags {
>   */
>  void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
>  
> -/**
> - * cpu_dump_statistics:
> - * @cpu: The CPU whose state is to be dumped.
> - * @flags: Flags what to dump.
> - *
> - * Dump CPU statistics to the current monitor if we have one, else to
> - * stdout.
> - */
> -void cpu_dump_statistics(CPUState *cpu, int flags);
> -
>  #ifndef CONFIG_USER_ONLY
>  /**
>   * cpu_get_phys_page_attrs_debug:

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-27  1:20   ` David Gibson
@ 2021-05-27  4:35     ` David Gibson
  2021-05-27 13:22       ` Bruno Piazera Larsen
  0 siblings, 1 reply; 42+ messages in thread
From: David Gibson @ 2021-05-27  4:35 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, Greg Kurz, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires

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

On Thu, May 27, 2021 at 11:20:01AM +1000, David Gibson wrote:
> On Wed, May 26, 2021 at 05:21:01PM -0300, Bruno Larsen (billionai) wrote:
> > This function requires surce code modification to be useful, which means
> > it probably is not used often, and the move to using decodetree means
> > the statistics won't even be collected anymore.
> > 
> > Also removed setting dump_statistics in ppc_cpu_realize, since it was
> > only useful when in conjunction with ppc_cpu_dump_statistics.
> > 
> > Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > ---
> >  target/ppc/cpu.h       |  1 -
> >  target/ppc/cpu_init.c  |  3 ---
> >  target/ppc/translate.c | 51 ------------------------------------------
> >  3 files changed, 55 deletions(-)
> > 
> > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > index 203f07e48e..c3d1b492e4 100644
> > --- a/target/ppc/cpu.h
> > +++ b/target/ppc/cpu.h
> > @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
> >  void ppc_cpu_do_interrupt(CPUState *cpu);
> >  bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
> >  void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> > -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
> >  hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> >  int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> >  int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> > diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> > index f5ae2f150d..bd05f53fa4 100644
> > --- a/target/ppc/cpu_init.c
> > +++ b/target/ppc/cpu_init.c
> > @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> >      cc->class_by_name = ppc_cpu_class_by_name;
> >      cc->has_work = ppc_cpu_has_work;
> >      cc->dump_state = ppc_cpu_dump_state;
> > -#ifdef CONFIG_TCG
> > -    cc->dump_statistics = ppc_cpu_dump_statistics;
> > -#endif
> 
> This confuses me.  The ifdefs you're removing aren't present in my
> tree, and AFAICT they never existed since your own patch created
> cpu_init.c.
> 
> So.. please rebase and check that.

Duh, sorry, I looked at this set out of order with your latest !tcg
patches.  Now that I've applied those, I've applied those one as well.

> 
> >      cc->set_pc = ppc_cpu_set_pc;
> >      cc->gdb_read_register = ppc_cpu_gdb_read_register;
> >      cc->gdb_write_register = ppc_cpu_gdb_write_register;
> > diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> > index 6c0f424d81..fc9fd790ca 100644
> > --- a/target/ppc/translate.c
> > +++ b/target/ppc/translate.c
> > @@ -8881,57 +8881,6 @@ int ppc_fixup_cpu(PowerPCCPU *cpu)
> >      return 0;
> >  }
> >  
> > -
> > -void ppc_cpu_dump_statistics(CPUState *cs, int flags)
> > -{
> > -#if defined(DO_PPC_STATISTICS)
> > -    PowerPCCPU *cpu = POWERPC_CPU(cs);
> > -    opc_handler_t **t1, **t2, **t3, *handler;
> > -    int op1, op2, op3;
> > -
> > -    t1 = cpu->env.opcodes;
> > -    for (op1 = 0; op1 < 64; op1++) {
> > -        handler = t1[op1];
> > -        if (is_indirect_opcode(handler)) {
> > -            t2 = ind_table(handler);
> > -            for (op2 = 0; op2 < 32; op2++) {
> > -                handler = t2[op2];
> > -                if (is_indirect_opcode(handler)) {
> > -                    t3 = ind_table(handler);
> > -                    for (op3 = 0; op3 < 32; op3++) {
> > -                        handler = t3[op3];
> > -                        if (handler->count == 0) {
> > -                            continue;
> > -                        }
> > -                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
> > -                                    "%016" PRIx64 " %" PRId64 "\n",
> > -                                    op1, op2, op3, op1, (op3 << 5) | op2,
> > -                                    handler->oname,
> > -                                    handler->count, handler->count);
> > -                    }
> > -                } else {
> > -                    if (handler->count == 0) {
> > -                        continue;
> > -                    }
> > -                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
> > -                                "%016" PRIx64 " %" PRId64 "\n",
> > -                                op1, op2, op1, op2, handler->oname,
> > -                                handler->count, handler->count);
> > -                }
> > -            }
> > -        } else {
> > -            if (handler->count == 0) {
> > -                continue;
> > -            }
> > -            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
> > -                        " %" PRId64 "\n",
> > -                        op1, op1, handler->oname,
> > -                        handler->count, handler->count);
> > -        }
> > -    }
> > -#endif
> > -}
> > -
> >  static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
> >  {
> >      opc_handler_t **table, *handler;
> 



-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS
  2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
  2021-05-26 21:26   ` Richard Henderson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
@ 2021-05-27  4:37   ` David Gibson
  2 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2021-05-27  4:37 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, qemu-devel, richard.henderson, luis.pires, Greg Kurz,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst

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

On Wed, May 26, 2021 at 05:21:02PM -0300, Bruno Larsen (billionai) wrote:
> Removed the commented out definition and all ifdefs relating to
> PPC_DUMP_STATISTICS, as it's hardly ever used.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai)
> <bruno.larsen@eldorado.org.br>

Applied to ppc-for-6.1, thanks.

> ---
>  target/ppc/translate.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index fc9fd790ca..0525e1939f 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -47,7 +47,6 @@
>  
>  /* Include definitions for instructions classes and implementations flags */
>  /* #define PPC_DEBUG_DISAS */
> -/* #define DO_PPC_STATISTICS */
>  
>  #ifdef PPC_DEBUG_DISAS
>  #  define LOG_DISAS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
> @@ -217,12 +216,9 @@ struct opc_handler_t {
>      uint64_t type2;
>      /* handler */
>      void (*handler)(DisasContext *ctx);
> -#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
> +#if defined(PPC_DUMP_CPU)
>      const char *oname;
>  #endif
> -#if defined(DO_PPC_STATISTICS)
> -    uint64_t count;
> -#endif
>  };
>  
>  /* SPR load/store helpers */
> @@ -8546,7 +8542,7 @@ static int register_direct_insn(opc_handler_t **ppc_opcodes,
>      if (insert_in_table(ppc_opcodes, idx, handler) < 0) {
>          printf("*** ERROR: opcode %02x already assigned in main "
>                 "opcode table\n", idx);
> -#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
> +#if defined(PPC_DUMP_CPU)
>          printf("           Registered handler '%s' - new handler '%s'\n",
>                 ppc_opcodes[idx]->oname, handler->oname);
>  #endif
> @@ -8570,7 +8566,7 @@ static int register_ind_in_table(opc_handler_t **table,
>          if (!is_indirect_opcode(table[idx1])) {
>              printf("*** ERROR: idx %02x already assigned to a direct "
>                     "opcode\n", idx1);
> -#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
> +#if defined(PPC_DUMP_CPU)
>              printf("           Registered handler '%s' - new handler '%s'\n",
>                     ind_table(table[idx1])[idx2]->oname, handler->oname);
>  #endif
> @@ -8581,7 +8577,7 @@ static int register_ind_in_table(opc_handler_t **table,
>          insert_in_table(ind_table(table[idx1]), idx2, handler) < 0) {
>          printf("*** ERROR: opcode %02x already assigned in "
>                 "opcode table %02x\n", idx2, idx1);
> -#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
> +#if defined(PPC_DUMP_CPU)
>          printf("           Registered handler '%s' - new handler '%s'\n",
>                 ind_table(table[idx1])[idx2]->oname, handler->oname);
>  #endif
> @@ -9036,10 +9032,6 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
>          gen_invalid(ctx);
>      }
>  
> -#if defined(DO_PPC_STATISTICS)
> -    handler->count++;
> -#endif
> -
>      translator_loop_temp_check(&ctx->base);
>  }
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 21:28   ` Richard Henderson
@ 2021-05-27  4:40     ` David Gibson
  0 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2021-05-27  4:40 UTC (permalink / raw)
  To: Richard Henderson
  Cc: farosas, Markus Armbruster, Dr. David Alan Gilbert, qemu-devel,
	lucas.araujo, luis.pires, fernando.valle, qemu-ppc,
	matheus.ferst

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

On Wed, May 26, 2021 at 02:28:48PM -0700, Richard Henderson wrote:
> On 5/26/21 1:21 PM, Bruno Larsen (billionai) wrote:
> > Since ppc was the last architecture to collect these statistics and
> > it is currently phasing this collection out, the command that would query
> > this information is being removed.
> > 
> > Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > ---
> >   hmp-commands-info.hx | 13 -------------
> >   monitor/misc.c       | 11 -----------
> >   2 files changed, 24 deletions(-)
> 
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Applied to ppc-for-6.1.  I'm staging this in my tree, but an Ack from
Dave Gilbert would be appreciated.

> 
> 
> r~
> 
> > 
> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > index ab0c7aa5ee..b2347a6aea 100644
> > --- a/hmp-commands-info.hx
> > +++ b/hmp-commands-info.hx
> > @@ -500,19 +500,6 @@ SRST
> >       Show the current VM UUID.
> >   ERST
> > -    {
> > -        .name       = "cpustats",
> > -        .args_type  = "",
> > -        .params     = "",
> > -        .help       = "show CPU statistics",
> > -        .cmd        = hmp_info_cpustats,
> > -    },
> > -
> > -SRST
> > -  ``info cpustats``
> > -    Show CPU statistics.
> > -ERST
> > -
> >   #if defined(CONFIG_SLIRP)
> >       {
> >           .name       = "usernet",
> > diff --git a/monitor/misc.c b/monitor/misc.c
> > index f3a393ea59..1539e18557 100644
> > --- a/monitor/misc.c
> > +++ b/monitor/misc.c
> > @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
> >       }
> >   }
> > -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> > -{
> > -    CPUState *cs = mon_get_cpu(mon);
> > -
> > -    if (!cs) {
> > -        monitor_printf(mon, "No CPU available\n");
> > -        return;
> > -    }
> > -    cpu_dump_statistics(cs, 0);
> > -}
> > -
> >   static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
> >   {
> >       const char *name = qdict_get_try_str(qdict, "name");
> > 
> 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
                     ` (2 preceding siblings ...)
  2021-05-27  1:20   ` David Gibson
@ 2021-05-27  6:01   ` Greg Kurz
  2021-05-29  5:47     ` David Gibson
  3 siblings, 1 reply; 42+ messages in thread
From: Greg Kurz @ 2021-05-27  6:01 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, luis.pires, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, david

On Wed, 26 May 2021 17:21:01 -0300
"Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:

> This function requires surce code modification to be useful, which means

s/surce/source

> it probably is not used often, and the move to using decodetree means
> the statistics won't even be collected anymore.
> 
> Also removed setting dump_statistics in ppc_cpu_realize, since it was

s/ppc_cpu_realize/ppc_cpu_class_init

> only useful when in conjunction with ppc_cpu_dump_statistics.
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/cpu.h       |  1 -
>  target/ppc/cpu_init.c  |  3 ---
>  target/ppc/translate.c | 51 ------------------------------------------
>  3 files changed, 55 deletions(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 203f07e48e..c3d1b492e4 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
>  void ppc_cpu_do_interrupt(CPUState *cpu);
>  bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
>  void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
>  hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
>  int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
>  int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index f5ae2f150d..bd05f53fa4 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      cc->class_by_name = ppc_cpu_class_by_name;
>      cc->has_work = ppc_cpu_has_work;
>      cc->dump_state = ppc_cpu_dump_state;
> -#ifdef CONFIG_TCG
> -    cc->dump_statistics = ppc_cpu_dump_statistics;
> -#endif
>      cc->set_pc = ppc_cpu_set_pc;
>      cc->gdb_read_register = ppc_cpu_gdb_read_register;
>      cc->gdb_write_register = ppc_cpu_gdb_write_register;
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 6c0f424d81..fc9fd790ca 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -8881,57 +8881,6 @@ int ppc_fixup_cpu(PowerPCCPU *cpu)
>      return 0;
>  }
>  
> -
> -void ppc_cpu_dump_statistics(CPUState *cs, int flags)
> -{
> -#if defined(DO_PPC_STATISTICS)
> -    PowerPCCPU *cpu = POWERPC_CPU(cs);
> -    opc_handler_t **t1, **t2, **t3, *handler;
> -    int op1, op2, op3;
> -
> -    t1 = cpu->env.opcodes;
> -    for (op1 = 0; op1 < 64; op1++) {
> -        handler = t1[op1];
> -        if (is_indirect_opcode(handler)) {
> -            t2 = ind_table(handler);
> -            for (op2 = 0; op2 < 32; op2++) {
> -                handler = t2[op2];
> -                if (is_indirect_opcode(handler)) {
> -                    t3 = ind_table(handler);
> -                    for (op3 = 0; op3 < 32; op3++) {
> -                        handler = t3[op3];
> -                        if (handler->count == 0) {
> -                            continue;
> -                        }
> -                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
> -                                    "%016" PRIx64 " %" PRId64 "\n",
> -                                    op1, op2, op3, op1, (op3 << 5) | op2,
> -                                    handler->oname,
> -                                    handler->count, handler->count);
> -                    }
> -                } else {
> -                    if (handler->count == 0) {
> -                        continue;
> -                    }
> -                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
> -                                "%016" PRIx64 " %" PRId64 "\n",
> -                                op1, op2, op1, op2, handler->oname,
> -                                handler->count, handler->count);
> -                }
> -            }
> -        } else {
> -            if (handler->count == 0) {
> -                continue;
> -            }
> -            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
> -                        " %" PRId64 "\n",
> -                        op1, op1, handler->oname,
> -                        handler->count, handler->count);
> -        }
> -    }
> -#endif
> -}
> -
>  static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
>  {
>      opc_handler_t **table, *handler;



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
  2021-05-26 21:28   ` Richard Henderson
  2021-05-26 21:35   ` Luis Fernando Fujita Pires
@ 2021-05-27  6:40   ` Greg Kurz
  2021-05-27  8:09     ` Dr. David Alan Gilbert
  2021-06-08 15:10     ` Markus Armbruster
  2021-05-27  8:08   ` Dr. David Alan Gilbert
  3 siblings, 2 replies; 42+ messages in thread
From: Greg Kurz @ 2021-05-27  6:40 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, Markus Armbruster, qemu-devel,
	lucas.araujo, luis.pires, fernando.valle, qemu-ppc,
	matheus.ferst, Dr. David Alan Gilbert, david

On Wed, 26 May 2021 17:21:03 -0300
"Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:

> Since ppc was the last architecture to collect these statistics and
> it is currently phasing this collection out, the command that would query
> this information is being removed.
> 

So this is removing an obviously user visible feature. This should be
mentioned in docs/system/removed-features.rst... but, wait, I don't
see anything for it in docs/system/deprecated.rst. This is dropping
a feature without following the usual deprecation policy, i.e.
marking the feature as deprecated and only remove it 2 QEMU versions
later. Any justification for that ?

David,

Unrelated, I saw that you already applied this to ppc-for-6.1 on gitlab
but the commit title appears to be broken:

'65;6401;1cmonitor: removed cpustats command

https://gitlab.com/dgibson/qemu/-/commit/532be563eae6b8ae834ff7e9ebb1428f53569a69

> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  hmp-commands-info.hx | 13 -------------
>  monitor/misc.c       | 11 -----------
>  2 files changed, 24 deletions(-)
> 
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ab0c7aa5ee..b2347a6aea 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -500,19 +500,6 @@ SRST
>      Show the current VM UUID.
>  ERST
>  
> -    {
> -        .name       = "cpustats",
> -        .args_type  = "",
> -        .params     = "",
> -        .help       = "show CPU statistics",
> -        .cmd        = hmp_info_cpustats,
> -    },
> -
> -SRST
> -  ``info cpustats``
> -    Show CPU statistics.
> -ERST
> -
>  #if defined(CONFIG_SLIRP)
>      {
>          .name       = "usernet",
> diff --git a/monitor/misc.c b/monitor/misc.c
> index f3a393ea59..1539e18557 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
>      }
>  }
>  
> -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> -{
> -    CPUState *cs = mon_get_cpu(mon);
> -
> -    if (!cs) {
> -        monitor_printf(mon, "No CPU available\n");
> -        return;
> -    }
> -    cpu_dump_statistics(cs, 0);
> -}
> -
>  static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
>  {
>      const char *name = qdict_get_try_str(qdict, "name");



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
                     ` (2 preceding siblings ...)
  2021-05-27  6:40   ` Greg Kurz
@ 2021-05-27  8:08   ` Dr. David Alan Gilbert
  3 siblings, 0 replies; 42+ messages in thread
From: Dr. David Alan Gilbert @ 2021-05-27  8:08 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, qemu-devel, Markus Armbruster,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst,
	luis.pires, david

* Bruno Larsen (billionai) (bruno.larsen@eldorado.org.br) wrote:
> Since ppc was the last architecture to collect these statistics and
> it is currently phasing this collection out, the command that would query
> this information is being removed.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp-commands-info.hx | 13 -------------
>  monitor/misc.c       | 11 -----------
>  2 files changed, 24 deletions(-)
> 
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ab0c7aa5ee..b2347a6aea 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -500,19 +500,6 @@ SRST
>      Show the current VM UUID.
>  ERST
>  
> -    {
> -        .name       = "cpustats",
> -        .args_type  = "",
> -        .params     = "",
> -        .help       = "show CPU statistics",
> -        .cmd        = hmp_info_cpustats,
> -    },
> -
> -SRST
> -  ``info cpustats``
> -    Show CPU statistics.
> -ERST
> -
>  #if defined(CONFIG_SLIRP)
>      {
>          .name       = "usernet",
> diff --git a/monitor/misc.c b/monitor/misc.c
> index f3a393ea59..1539e18557 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
>      }
>  }
>  
> -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> -{
> -    CPUState *cs = mon_get_cpu(mon);
> -
> -    if (!cs) {
> -        monitor_printf(mon, "No CPU available\n");
> -        return;
> -    }
> -    cpu_dump_statistics(cs, 0);
> -}
> -
>  static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
>  {
>      const char *name = qdict_get_try_str(qdict, "name");
> -- 
> 2.17.1
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-27  6:40   ` Greg Kurz
@ 2021-05-27  8:09     ` Dr. David Alan Gilbert
  2021-05-27  8:30       ` Greg Kurz
  2021-06-08 15:10     ` Markus Armbruster
  1 sibling, 1 reply; 42+ messages in thread
From: Dr. David Alan Gilbert @ 2021-05-27  8:09 UTC (permalink / raw)
  To: Greg Kurz
  Cc: farosas, richard.henderson, qemu-devel, Markus Armbruster,
	lucas.araujo, luis.pires, fernando.valle, qemu-ppc,
	matheus.ferst, david

* Greg Kurz (groug@kaod.org) wrote:
> On Wed, 26 May 2021 17:21:03 -0300
> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
> 
> > Since ppc was the last architecture to collect these statistics and
> > it is currently phasing this collection out, the command that would query
> > this information is being removed.
> > 
> 
> So this is removing an obviously user visible feature. This should be
> mentioned in docs/system/removed-features.rst... but, wait, I don't
> see anything for it in docs/system/deprecated.rst. This is dropping
> a feature without following the usual deprecation policy, i.e.
> marking the feature as deprecated and only remove it 2 QEMU versions
> later. Any justification for that ?

As long as the command really isn't useful any more, I wouldn't object
to that from an HMP point of view.

Dave

> David,
> 
> Unrelated, I saw that you already applied this to ppc-for-6.1 on gitlab
> but the commit title appears to be broken:
> 
> '65;6401;1cmonitor: removed cpustats command
> 
> https://gitlab.com/dgibson/qemu/-/commit/532be563eae6b8ae834ff7e9ebb1428f53569a69
> 
> > Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > ---
> >  hmp-commands-info.hx | 13 -------------
> >  monitor/misc.c       | 11 -----------
> >  2 files changed, 24 deletions(-)
> > 
> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > index ab0c7aa5ee..b2347a6aea 100644
> > --- a/hmp-commands-info.hx
> > +++ b/hmp-commands-info.hx
> > @@ -500,19 +500,6 @@ SRST
> >      Show the current VM UUID.
> >  ERST
> >  
> > -    {
> > -        .name       = "cpustats",
> > -        .args_type  = "",
> > -        .params     = "",
> > -        .help       = "show CPU statistics",
> > -        .cmd        = hmp_info_cpustats,
> > -    },
> > -
> > -SRST
> > -  ``info cpustats``
> > -    Show CPU statistics.
> > -ERST
> > -
> >  #if defined(CONFIG_SLIRP)
> >      {
> >          .name       = "usernet",
> > diff --git a/monitor/misc.c b/monitor/misc.c
> > index f3a393ea59..1539e18557 100644
> > --- a/monitor/misc.c
> > +++ b/monitor/misc.c
> > @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
> >      }
> >  }
> >  
> > -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> > -{
> > -    CPUState *cs = mon_get_cpu(mon);
> > -
> > -    if (!cs) {
> > -        monitor_printf(mon, "No CPU available\n");
> > -        return;
> > -    }
> > -    cpu_dump_statistics(cs, 0);
> > -}
> > -
> >  static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
> >  {
> >      const char *name = qdict_get_try_str(qdict, "name");
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-27  8:09     ` Dr. David Alan Gilbert
@ 2021-05-27  8:30       ` Greg Kurz
  2021-05-27 11:24         ` Bruno Piazera Larsen
  0 siblings, 1 reply; 42+ messages in thread
From: Greg Kurz @ 2021-05-27  8:30 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: farosas, richard.henderson, qemu-devel, Markus Armbruster,
	lucas.araujo, luis.pires, fernando.valle, qemu-ppc,
	matheus.ferst, david

On Thu, 27 May 2021 09:09:55 +0100
"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:

> * Greg Kurz (groug@kaod.org) wrote:
> > On Wed, 26 May 2021 17:21:03 -0300
> > "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
> > 
> > > Since ppc was the last architecture to collect these statistics and
> > > it is currently phasing this collection out, the command that would query
> > > this information is being removed.
> > > 
> > 
> > So this is removing an obviously user visible feature. This should be
> > mentioned in docs/system/removed-features.rst... but, wait, I don't
> > see anything for it in docs/system/deprecated.rst. This is dropping
> > a feature without following the usual deprecation policy, i.e.
> > marking the feature as deprecated and only remove it 2 QEMU versions
> > later. Any justification for that ?
> 
> As long as the command really isn't useful any more, I wouldn't object
> to that from an HMP point of view.
> 

Ok then this should be documented in docs/system/removed-features.rst at
least.

> Dave
> 
> > David,
> > 
> > Unrelated, I saw that you already applied this to ppc-for-6.1 on gitlab
> > but the commit title appears to be broken:
> > 
> > '65;6401;1cmonitor: removed cpustats command
> > 
> > https://gitlab.com/dgibson/qemu/-/commit/532be563eae6b8ae834ff7e9ebb1428f53569a69
> > 
> > > Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> > > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > > ---
> > >  hmp-commands-info.hx | 13 -------------
> > >  monitor/misc.c       | 11 -----------
> > >  2 files changed, 24 deletions(-)
> > > 
> > > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > > index ab0c7aa5ee..b2347a6aea 100644
> > > --- a/hmp-commands-info.hx
> > > +++ b/hmp-commands-info.hx
> > > @@ -500,19 +500,6 @@ SRST
> > >      Show the current VM UUID.
> > >  ERST
> > >  
> > > -    {
> > > -        .name       = "cpustats",
> > > -        .args_type  = "",
> > > -        .params     = "",
> > > -        .help       = "show CPU statistics",
> > > -        .cmd        = hmp_info_cpustats,
> > > -    },
> > > -
> > > -SRST
> > > -  ``info cpustats``
> > > -    Show CPU statistics.
> > > -ERST
> > > -
> > >  #if defined(CONFIG_SLIRP)
> > >      {
> > >          .name       = "usernet",
> > > diff --git a/monitor/misc.c b/monitor/misc.c
> > > index f3a393ea59..1539e18557 100644
> > > --- a/monitor/misc.c
> > > +++ b/monitor/misc.c
> > > @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
> > >      }
> > >  }
> > >  
> > > -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> > > -{
> > > -    CPUState *cs = mon_get_cpu(mon);
> > > -
> > > -    if (!cs) {
> > > -        monitor_printf(mon, "No CPU available\n");
> > > -        return;
> > > -    }
> > > -    cpu_dump_statistics(cs, 0);
> > > -}
> > > -
> > >  static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
> > >  {
> > >      const char *name = qdict_get_try_str(qdict, "name");
> > 



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-27  8:30       ` Greg Kurz
@ 2021-05-27 11:24         ` Bruno Piazera Larsen
  2021-05-27 14:57           ` Greg Kurz
  0 siblings, 1 reply; 42+ messages in thread
From: Bruno Piazera Larsen @ 2021-05-27 11:24 UTC (permalink / raw)
  To: Greg Kurz, Dr. David Alan Gilbert
  Cc: farosas, richard.henderson, Markus Armbruster, qemu-devel,
	lucas.araujo, luis.pires, fernando.valle, qemu-ppc,
	matheus.ferst, david

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


On 27/05/2021 05:30, Greg Kurz wrote:
> On Thu, 27 May 2021 09:09:55 +0100
> "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
>
>> * Greg Kurz (groug@kaod.org) wrote:
>>> On Wed, 26 May 2021 17:21:03 -0300
>>> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
>>>
>>>> Since ppc was the last architecture to collect these statistics and
>>>> it is currently phasing this collection out, the command that would query
>>>> this information is being removed.
>>>>
>>> So this is removing an obviously user visible feature. This should be
>>> mentioned in docs/system/removed-features.rst... but, wait, I don't
>>> see anything for it in docs/system/deprecated.rst. This is dropping
>>> a feature without following the usual deprecation policy, i.e.
>>> marking the feature as deprecated and only remove it 2 QEMU versions
>>> later. Any justification for that ?

The command called a function that ultimately called an empty callback 
unless you changed target/ppc/translate.c and removed the comments 
around #define DO_PPC_STATISTICS. And like I mentioned in the cover 
letter (which may not have been CC'ed to you, sorry) ppc was the last 
architecture to support this feature while they were using the legacy 
decode system, but as they move to decodetree, this data wouldn't even 
be collected.

That's the justification, basically.

>> As long as the command really isn't useful any more, I wouldn't object
>> to that from an HMP point of view.
>>
> Ok then this should be documented in docs/system/removed-features.rst at
> least.
Sure, will send a patch later today with the update
>
>> Dave
>>
>>> David,
>>>
>>> Unrelated, I saw that you already applied this to ppc-for-6.1 on gitlab
>>> but the commit title appears to be broken:
>>>
>>> '65;6401;1cmonitor: removed cpustats command
>>>
>>> https://gitlab.com/dgibson/qemu/-/commit/532be563eae6b8ae834ff7e9ebb1428f53569a69
>>>
>>>> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
>>>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>>>> ---
>>>>   hmp-commands-info.hx | 13 -------------
>>>>   monitor/misc.c       | 11 -----------
>>>>   2 files changed, 24 deletions(-)
>>>>
>>>> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
>>>> index ab0c7aa5ee..b2347a6aea 100644
>>>> --- a/hmp-commands-info.hx
>>>> +++ b/hmp-commands-info.hx
>>>> @@ -500,19 +500,6 @@ SRST
>>>>       Show the current VM UUID.
>>>>   ERST
>>>>   
>>>> -    {
>>>> -        .name       = "cpustats",
>>>> -        .args_type  = "",
>>>> -        .params     = "",
>>>> -        .help       = "show CPU statistics",
>>>> -        .cmd        = hmp_info_cpustats,
>>>> -    },
>>>> -
>>>> -SRST
>>>> -  ``info cpustats``
>>>> -    Show CPU statistics.
>>>> -ERST
>>>> -
>>>>   #if defined(CONFIG_SLIRP)
>>>>       {
>>>>           .name       = "usernet",
>>>> diff --git a/monitor/misc.c b/monitor/misc.c
>>>> index f3a393ea59..1539e18557 100644
>>>> --- a/monitor/misc.c
>>>> +++ b/monitor/misc.c
>>>> @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
>>>>       }
>>>>   }
>>>>   
>>>> -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
>>>> -{
>>>> -    CPUState *cs = mon_get_cpu(mon);
>>>> -
>>>> -    if (!cs) {
>>>> -        monitor_printf(mon, "No CPU available\n");
>>>> -        return;
>>>> -    }
>>>> -    cpu_dump_statistics(cs, 0);
>>>> -}
>>>> -
>>>>   static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
>>>>   {
>>>>       const char *name = qdict_get_try_str(qdict, "name");
-- 
Bruno Piazera Larsen
Instituto de Pesquisas ELDORADO 
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 5720 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-27  4:35     ` David Gibson
@ 2021-05-27 13:22       ` Bruno Piazera Larsen
  2021-05-27 14:01         ` Greg Kurz
  0 siblings, 1 reply; 42+ messages in thread
From: Bruno Piazera Larsen @ 2021-05-27 13:22 UTC (permalink / raw)
  To: David Gibson
  Cc: farosas, richard.henderson, Greg Kurz, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires

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


On 27/05/2021 01:35, David Gibson wrote:
> On Thu, May 27, 2021 at 11:20:01AM +1000, David Gibson wrote:
>> On Wed, May 26, 2021 at 05:21:01PM -0300, Bruno Larsen (billionai) wrote:
>>> This function requires surce code modification to be useful, which means
>>> it probably is not used often, and the move to using decodetree means
>>> the statistics won't even be collected anymore.
>>>
>>> Also removed setting dump_statistics in ppc_cpu_realize, since it was
>>> only useful when in conjunction with ppc_cpu_dump_statistics.
>>>
>>> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
>>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>>> ---
>>>   target/ppc/cpu.h       |  1 -
>>>   target/ppc/cpu_init.c  |  3 ---
>>>   target/ppc/translate.c | 51 ------------------------------------------
>>>   3 files changed, 55 deletions(-)
>>>
>>> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
>>> index 203f07e48e..c3d1b492e4 100644
>>> --- a/target/ppc/cpu.h
>>> +++ b/target/ppc/cpu.h
>>> @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
>>>   void ppc_cpu_do_interrupt(CPUState *cpu);
>>>   bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
>>>   void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
>>> -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
>>>   hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
>>>   int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
>>>   int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
>>> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
>>> index f5ae2f150d..bd05f53fa4 100644
>>> --- a/target/ppc/cpu_init.c
>>> +++ b/target/ppc/cpu_init.c
>>> @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>>>       cc->class_by_name = ppc_cpu_class_by_name;
>>>       cc->has_work = ppc_cpu_has_work;
>>>       cc->dump_state = ppc_cpu_dump_state;
>>> -#ifdef CONFIG_TCG
>>> -    cc->dump_statistics = ppc_cpu_dump_statistics;
>>> -#endif
>> This confuses me.  The ifdefs you're removing aren't present in my
>> tree, and AFAICT they never existed since your own patch created
>> cpu_init.c.
>>
>> So.. please rebase and check that.
> Duh, sorry, I looked at this set out of order with your latest !tcg
> patches.  Now that I've applied those, I've applied those one as well.
Let me just check, where do you keep your most updated tree? I'm 
rebasing on your github tree, but ppc-for-6.1 there seems quite outdated 
(still the same as main)
-- 
Bruno Piazera Larsen
Instituto de Pesquisas ELDORADO 
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 3670 bytes --]

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

* Re: [PATCH 0/5] stop collection of instruction usage statistics
  2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
                   ` (4 preceding siblings ...)
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
@ 2021-05-27 13:57 ` Alex Bennée
  2021-05-27 14:23   ` Bruno Piazera Larsen
  2021-05-27 14:25   ` Luis Fernando Fujita Pires
  5 siblings, 2 replies; 42+ messages in thread
From: Alex Bennée @ 2021-05-27 13:57 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, lucas.araujo, qemu-devel, luis.pires,
	fernando.valle, qemu-ppc, matheus.ferst, david


"Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> writes:

> Based-on: <20210525115355.8254-1-bruno.larsen@eldorado.org.br>
>
> The functionality of counting how many instructions were being executed and
> being able to show it through the monitor, although neat, was only
> supported by ppc, and now that it is migrating to use decodetree (at
> least partially), those statistics won't be used anymore. Therefore,
> this patch removes that functinality completely.

I have no particular comment to make about the PPC stuff but with the
common translator loop we have hooks across all converted front ends to
identify the start of each instruction. It's needed for the TCG plugin
instrumentation and we could in theory use it for more integrated stats
across the board.

Out of interest what was the main aim of this code - a view of total
executed instructions or something more detailed like a breakdown of
types and ops?

>
> This series was suggested by Richard Henderson
>
> Bruno Larsen (billionai) (5):
>   target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
>   target/ppc: remove ppc_cpu_dump_statistics
>   target/ppc: removed mentions to DO_PPC_STATISTICS
>   monitor: removed cpustats command
>   hw/core/cpu: removed cpu_dump_statistics function
>
>  hmp-commands-info.hx   | 13 --------
>  hw/core/cpu.c          |  9 ------
>  include/hw/core/cpu.h  | 12 --------
>  monitor/misc.c         | 11 -------
>  target/ppc/cpu.h       |  1 -
>  target/ppc/cpu_init.c  |  3 --
>  target/ppc/translate.c | 69 +++---------------------------------------
>  7 files changed, 5 insertions(+), 113 deletions(-)


-- 
Alex Bennée


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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-27 13:22       ` Bruno Piazera Larsen
@ 2021-05-27 14:01         ` Greg Kurz
  2021-05-29  5:46           ` David Gibson
  0 siblings, 1 reply; 42+ messages in thread
From: Greg Kurz @ 2021-05-27 14:01 UTC (permalink / raw)
  To: Bruno Piazera Larsen
  Cc: farosas, richard.henderson, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires,
	David Gibson

On Thu, 27 May 2021 10:22:50 -0300
Bruno Piazera Larsen <bruno.larsen@eldorado.org.br> wrote:

> 
> On 27/05/2021 01:35, David Gibson wrote:
> > On Thu, May 27, 2021 at 11:20:01AM +1000, David Gibson wrote:
> >> On Wed, May 26, 2021 at 05:21:01PM -0300, Bruno Larsen (billionai) wrote:
> >>> This function requires surce code modification to be useful, which means
> >>> it probably is not used often, and the move to using decodetree means
> >>> the statistics won't even be collected anymore.
> >>>
> >>> Also removed setting dump_statistics in ppc_cpu_realize, since it was
> >>> only useful when in conjunction with ppc_cpu_dump_statistics.
> >>>
> >>> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> >>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> >>> ---
> >>>   target/ppc/cpu.h       |  1 -
> >>>   target/ppc/cpu_init.c  |  3 ---
> >>>   target/ppc/translate.c | 51 ------------------------------------------
> >>>   3 files changed, 55 deletions(-)
> >>>
> >>> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> >>> index 203f07e48e..c3d1b492e4 100644
> >>> --- a/target/ppc/cpu.h
> >>> +++ b/target/ppc/cpu.h
> >>> @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
> >>>   void ppc_cpu_do_interrupt(CPUState *cpu);
> >>>   bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
> >>>   void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> >>> -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
> >>>   hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> >>>   int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> >>>   int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> >>> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> >>> index f5ae2f150d..bd05f53fa4 100644
> >>> --- a/target/ppc/cpu_init.c
> >>> +++ b/target/ppc/cpu_init.c
> >>> @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> >>>       cc->class_by_name = ppc_cpu_class_by_name;
> >>>       cc->has_work = ppc_cpu_has_work;
> >>>       cc->dump_state = ppc_cpu_dump_state;
> >>> -#ifdef CONFIG_TCG
> >>> -    cc->dump_statistics = ppc_cpu_dump_statistics;
> >>> -#endif
> >> This confuses me.  The ifdefs you're removing aren't present in my
> >> tree, and AFAICT they never existed since your own patch created
> >> cpu_init.c.
> >>
> >> So.. please rebase and check that.
> > Duh, sorry, I looked at this set out of order with your latest !tcg
> > patches.  Now that I've applied those, I've applied those one as well.
> Let me just check, where do you keep your most updated tree? I'm 
> rebasing on your github tree, but ppc-for-6.1 there seems quite outdated 
> (still the same as main)

Try here:

https://gitlab.com/dgibson/qemu/-/commits/ppc-for-6.1/

Cheers,

--
Greg



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

* Re: [PATCH 0/5] stop collection of instruction usage statistics
  2021-05-27 13:57 ` [PATCH 0/5] stop collection of instruction usage statistics Alex Bennée
@ 2021-05-27 14:23   ` Bruno Piazera Larsen
  2021-05-27 14:25   ` Luis Fernando Fujita Pires
  1 sibling, 0 replies; 42+ messages in thread
From: Bruno Piazera Larsen @ 2021-05-27 14:23 UTC (permalink / raw)
  To: Alex Bennée
  Cc: farosas, richard.henderson, lucas.araujo, qemu-devel, luis.pires,
	fernando.valle, qemu-ppc, matheus.ferst, david

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


On 27/05/2021 10:57, Alex Bennée wrote:
> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> writes:
>
>> Based-on: <20210525115355.8254-1-bruno.larsen@eldorado.org.br>
>>
>> The functionality of counting how many instructions were being executed and
>> being able to show it through the monitor, although neat, was only
>> supported by ppc, and now that it is migrating to use decodetree (at
>> least partially), those statistics won't be used anymore. Therefore,
>> this patch removes that functinality completely.
> I have no particular comment to make about the PPC stuff but with the
> common translator loop we have hooks across all converted front ends to
> identify the start of each instruction. It's needed for the TCG plugin
> instrumentation and we could in theory use it for more integrated stats
> across the board.
>
> Out of interest what was the main aim of this code - a view of total
> executed instructions or something more detailed like a breakdown of
> types and ops?

I'm pretty new to qemu, so I'm not sure what the original intent was, 
but what it did was count how many times the handler of the instruction 
was called, so you knew how many times each individual opcode was used. 
At least, that's what I think it should do, since the code doesn't even 
compile anymore for me to check

>
>> This series was suggested by Richard Henderson
>>
>> Bruno Larsen (billionai) (5):
>>    target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
>>    target/ppc: remove ppc_cpu_dump_statistics
>>    target/ppc: removed mentions to DO_PPC_STATISTICS
>>    monitor: removed cpustats command
>>    hw/core/cpu: removed cpu_dump_statistics function
>>
>>   hmp-commands-info.hx   | 13 --------
>>   hw/core/cpu.c          |  9 ------
>>   include/hw/core/cpu.h  | 12 --------
>>   monitor/misc.c         | 11 -------
>>   target/ppc/cpu.h       |  1 -
>>   target/ppc/cpu_init.c  |  3 --
>>   target/ppc/translate.c | 69 +++---------------------------------------
>>   7 files changed, 5 insertions(+), 113 deletions(-)
>
-- 
Bruno Piazera Larsen
Instituto de Pesquisas ELDORADO 
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 3365 bytes --]

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

* RE: [PATCH 0/5] stop collection of instruction usage statistics
  2021-05-27 13:57 ` [PATCH 0/5] stop collection of instruction usage statistics Alex Bennée
  2021-05-27 14:23   ` Bruno Piazera Larsen
@ 2021-05-27 14:25   ` Luis Fernando Fujita Pires
  2021-05-27 14:56     ` Alex Bennée
  1 sibling, 1 reply; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-27 14:25 UTC (permalink / raw)
  To: Alex Bennée, Bruno Piazera Larsen
  Cc: farosas, richard.henderson, qemu-devel,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

From: Alex Bennée <alex.bennee@linaro.org>
> I have no particular comment to make about the PPC stuff but with the common
> translator loop we have hooks across all converted front ends to identify the
> start of each instruction. It's needed for the TCG plugin instrumentation and we
> could in theory use it for more integrated stats across the board.
> 
> Out of interest what was the main aim of this code - a view of total executed
> instructions or something more detailed like a breakdown of types and ops?

The legacy instruction decoding logic in the PPC implementation uses a table that maps opcode patterns (based on different parts of the instructions) to handlers that actually implement each instruction. 
The code that is being removed would list how many times each specific handler was invoked, so it had more information than just the total count of executed instructions.

That being said, the code probably wasn't being used for a while now, as it didn't even compile.

--
Luis Pires
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br>
Departamento de Computação Embarcada
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


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

* Re: [PATCH 0/5] stop collection of instruction usage statistics
  2021-05-27 14:25   ` Luis Fernando Fujita Pires
@ 2021-05-27 14:56     ` Alex Bennée
  2021-05-27 15:39       ` Luis Fernando Fujita Pires
  0 siblings, 1 reply; 42+ messages in thread
From: Alex Bennée @ 2021-05-27 14:56 UTC (permalink / raw)
  To: Luis Fernando Fujita Pires
  Cc: farosas, richard.henderson, qemu-devel,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david


Luis Fernando Fujita Pires <luis.pires@eldorado.org.br> writes:

> From: Alex Bennée <alex.bennee@linaro.org>
>> I have no particular comment to make about the PPC stuff but with the common
>> translator loop we have hooks across all converted front ends to identify the
>> start of each instruction. It's needed for the TCG plugin instrumentation and we
>> could in theory use it for more integrated stats across the board.
>> 
>> Out of interest what was the main aim of this code - a view of total executed
>> instructions or something more detailed like a breakdown of types and ops?
>
> The legacy instruction decoding logic in the PPC implementation uses a
> table that maps opcode patterns (based on different parts of the
> instructions) to handlers that actually implement each instruction.
> The code that is being removed would list how many times each specific handler was invoked, so it had more information than just the total count of executed instructions.
>
> That being said, the code probably wasn't being used for a while now,
> as it didn't even compile.

Ahh OK. If you wanted to you could probably re-create that information
using the howvec plugin (see contrib/plugins/howvec) if the decode
tables where added for PPC.

-- 
Alex Bennée


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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-27 11:24         ` Bruno Piazera Larsen
@ 2021-05-27 14:57           ` Greg Kurz
  0 siblings, 0 replies; 42+ messages in thread
From: Greg Kurz @ 2021-05-27 14:57 UTC (permalink / raw)
  To: Bruno Piazera Larsen
  Cc: farosas, richard.henderson, qemu-devel, Markus Armbruster,
	lucas.araujo, fernando.valle, qemu-ppc, luis.pires,
	matheus.ferst, Dr. David Alan Gilbert, david

On Thu, 27 May 2021 08:24:40 -0300
Bruno Piazera Larsen <bruno.larsen@eldorado.org.br> wrote:

> 
> On 27/05/2021 05:30, Greg Kurz wrote:
> > On Thu, 27 May 2021 09:09:55 +0100
> > "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> >
> >> * Greg Kurz (groug@kaod.org) wrote:
> >>> On Wed, 26 May 2021 17:21:03 -0300
> >>> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
> >>>
> >>>> Since ppc was the last architecture to collect these statistics and
> >>>> it is currently phasing this collection out, the command that would query
> >>>> this information is being removed.
> >>>>
> >>> So this is removing an obviously user visible feature. This should be
> >>> mentioned in docs/system/removed-features.rst... but, wait, I don't
> >>> see anything for it in docs/system/deprecated.rst. This is dropping
> >>> a feature without following the usual deprecation policy, i.e.
> >>> marking the feature as deprecated and only remove it 2 QEMU versions
> >>> later. Any justification for that ?
> 
> The command called a function that ultimately called an empty callback 
> unless you changed target/ppc/translate.c and removed the comments 
> around #define DO_PPC_STATISTICS. And like I mentioned in the cover 
> letter (which may not have been CC'ed to you, sorry) ppc was the last 
> architecture to support this feature while they were using the legacy 
> decode system, but as they move to decodetree, this data wouldn't even 
> be collected.
> 
> That's the justification, basically.
> 

So to sum up, this HMP command doesn't produce any output with upstream
QEMU. Add a section in docs/system/removed-features.rst and just mention
that. Not worth reposting the full series just for that. This can be done
in a followup patch.

> >> As long as the command really isn't useful any more, I wouldn't object
> >> to that from an HMP point of view.
> >>
> > Ok then this should be documented in docs/system/removed-features.rst at
> > least.
> Sure, will send a patch later today with the update
> >
> >> Dave
> >>
> >>> David,
> >>>
> >>> Unrelated, I saw that you already applied this to ppc-for-6.1 on gitlab
> >>> but the commit title appears to be broken:
> >>>
> >>> '65;6401;1cmonitor: removed cpustats command
> >>>
> >>> https://gitlab.com/dgibson/qemu/-/commit/532be563eae6b8ae834ff7e9ebb1428f53569a69
> >>>
> >>>> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> >>>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> >>>> ---
> >>>>   hmp-commands-info.hx | 13 -------------
> >>>>   monitor/misc.c       | 11 -----------
> >>>>   2 files changed, 24 deletions(-)
> >>>>
> >>>> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> >>>> index ab0c7aa5ee..b2347a6aea 100644
> >>>> --- a/hmp-commands-info.hx
> >>>> +++ b/hmp-commands-info.hx
> >>>> @@ -500,19 +500,6 @@ SRST
> >>>>       Show the current VM UUID.
> >>>>   ERST
> >>>>   
> >>>> -    {
> >>>> -        .name       = "cpustats",
> >>>> -        .args_type  = "",
> >>>> -        .params     = "",
> >>>> -        .help       = "show CPU statistics",
> >>>> -        .cmd        = hmp_info_cpustats,
> >>>> -    },
> >>>> -
> >>>> -SRST
> >>>> -  ``info cpustats``
> >>>> -    Show CPU statistics.
> >>>> -ERST
> >>>> -
> >>>>   #if defined(CONFIG_SLIRP)
> >>>>       {
> >>>>           .name       = "usernet",
> >>>> diff --git a/monitor/misc.c b/monitor/misc.c
> >>>> index f3a393ea59..1539e18557 100644
> >>>> --- a/monitor/misc.c
> >>>> +++ b/monitor/misc.c
> >>>> @@ -369,17 +369,6 @@ static void hmp_info_history(Monitor *mon, const QDict *qdict)
> >>>>       }
> >>>>   }
> >>>>   
> >>>> -static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
> >>>> -{
> >>>> -    CPUState *cs = mon_get_cpu(mon);
> >>>> -
> >>>> -    if (!cs) {
> >>>> -        monitor_printf(mon, "No CPU available\n");
> >>>> -        return;
> >>>> -    }
> >>>> -    cpu_dump_statistics(cs, 0);
> >>>> -}
> >>>> -
> >>>>   static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
> >>>>   {
> >>>>       const char *name = qdict_get_try_str(qdict, "name");



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

* RE: [PATCH 0/5] stop collection of instruction usage statistics
  2021-05-27 14:56     ` Alex Bennée
@ 2021-05-27 15:39       ` Luis Fernando Fujita Pires
  0 siblings, 0 replies; 42+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-05-27 15:39 UTC (permalink / raw)
  To: Alex Bennée
  Cc: farosas, richard.henderson, qemu-devel,
	Lucas Mateus Martins Araujo e Castro, Fernando Eckhardt Valle,
	qemu-ppc, Matheus Kowalczuk Ferst, david

From: Alex Bennée <alex.bennee@linaro.org>
> Ahh OK. If you wanted to you could probably re-create that information using
> the howvec plugin (see contrib/plugins/howvec) if the decode tables where
> added for PPC.

Interesting. I hadn't looked at the plugin mechanism before. In this hypothetical case, if we wanted to get the execution count for each instruction, we could also automatically generate the instruction decoding code based on decodetree. Then it would work for any architecture that uses decodetree.

I just realized that the ppc code wasn't counting instruction executions, but translations. A slightly modified version of howvec would also take care of that by counting the instructions directly in vcpu_tb_trans(), without even registering execution callbacks. Again, all hypothetical - but neat. :)

--
Luis Pires
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br>
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


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

* Re: [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function
  2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
                     ` (2 preceding siblings ...)
  2021-05-27  1:21   ` David Gibson
@ 2021-05-27 21:05   ` Eduardo Habkost
  3 siblings, 0 replies; 42+ messages in thread
From: Eduardo Habkost @ 2021-05-27 21:05 UTC (permalink / raw)
  To: Bruno Larsen (billionai)
  Cc: farosas, richard.henderson, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires, david

On Wed, May 26, 2021 at 05:21:04PM -0300, Bruno Larsen (billionai) wrote:
> No more architectures set the pointer to dump_statistics, so there's no
> point in keeping it, or the related cpu_dump_statistics function.
> 
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>

Acked-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo



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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-27 14:01         ` Greg Kurz
@ 2021-05-29  5:46           ` David Gibson
  0 siblings, 0 replies; 42+ messages in thread
From: David Gibson @ 2021-05-29  5:46 UTC (permalink / raw)
  To: Greg Kurz
  Cc: farosas, richard.henderson, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst, luis.pires

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

On Thu, May 27, 2021 at 04:01:52PM +0200, Greg Kurz wrote:
> On Thu, 27 May 2021 10:22:50 -0300
> Bruno Piazera Larsen <bruno.larsen@eldorado.org.br> wrote:
> 
> > 
> > On 27/05/2021 01:35, David Gibson wrote:
> > > On Thu, May 27, 2021 at 11:20:01AM +1000, David Gibson wrote:
> > >> On Wed, May 26, 2021 at 05:21:01PM -0300, Bruno Larsen (billionai) wrote:
> > >>> This function requires surce code modification to be useful, which means
> > >>> it probably is not used often, and the move to using decodetree means
> > >>> the statistics won't even be collected anymore.
> > >>>
> > >>> Also removed setting dump_statistics in ppc_cpu_realize, since it was
> > >>> only useful when in conjunction with ppc_cpu_dump_statistics.
> > >>>
> > >>> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> > >>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > >>> ---
> > >>>   target/ppc/cpu.h       |  1 -
> > >>>   target/ppc/cpu_init.c  |  3 ---
> > >>>   target/ppc/translate.c | 51 ------------------------------------------
> > >>>   3 files changed, 55 deletions(-)
> > >>>
> > >>> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > >>> index 203f07e48e..c3d1b492e4 100644
> > >>> --- a/target/ppc/cpu.h
> > >>> +++ b/target/ppc/cpu.h
> > >>> @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
> > >>>   void ppc_cpu_do_interrupt(CPUState *cpu);
> > >>>   bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
> > >>>   void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> > >>> -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
> > >>>   hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> > >>>   int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> > >>>   int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> > >>> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> > >>> index f5ae2f150d..bd05f53fa4 100644
> > >>> --- a/target/ppc/cpu_init.c
> > >>> +++ b/target/ppc/cpu_init.c
> > >>> @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> > >>>       cc->class_by_name = ppc_cpu_class_by_name;
> > >>>       cc->has_work = ppc_cpu_has_work;
> > >>>       cc->dump_state = ppc_cpu_dump_state;
> > >>> -#ifdef CONFIG_TCG
> > >>> -    cc->dump_statistics = ppc_cpu_dump_statistics;
> > >>> -#endif
> > >> This confuses me.  The ifdefs you're removing aren't present in my
> > >> tree, and AFAICT they never existed since your own patch created
> > >> cpu_init.c.
> > >>
> > >> So.. please rebase and check that.
> > > Duh, sorry, I looked at this set out of order with your latest !tcg
> > > patches.  Now that I've applied those, I've applied those one as well.
> > Let me just check, where do you keep your most updated tree? I'm 
> > rebasing on your github tree, but ppc-for-6.1 there seems quite outdated 
> > (still the same as main)
> 
> Try here:
> 
> https://gitlab.com/dgibson/qemu/-/commits/ppc-for-6.1/

Right, I moved to gitlab a while back.  I sometimes push to the old
github tree as well, but I don't already remember.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-27  6:01   ` Greg Kurz
@ 2021-05-29  5:47     ` David Gibson
  2021-05-31 14:26       ` Bruno Piazera Larsen
  0 siblings, 1 reply; 42+ messages in thread
From: David Gibson @ 2021-05-29  5:47 UTC (permalink / raw)
  To: Greg Kurz
  Cc: farosas, richard.henderson, lucas.araujo, qemu-devel, luis.pires,
	fernando.valle, qemu-ppc, matheus.ferst

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

On Thu, May 27, 2021 at 08:01:56AM +0200, Greg Kurz wrote:
> On Wed, 26 May 2021 17:21:01 -0300
> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
> 
> > This function requires surce code modification to be useful, which means
> 
> s/surce/source
> 
> > it probably is not used often, and the move to using decodetree means
> > the statistics won't even be collected anymore.
> > 
> > Also removed setting dump_statistics in ppc_cpu_realize, since it was
> 
> s/ppc_cpu_realize/ppc_cpu_class_init

A rebase on main has triggered a conflict with this patch, so I've
removed it from my tree again.

> 
> > only useful when in conjunction with ppc_cpu_dump_statistics.
> > 
> > Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > ---
> >  target/ppc/cpu.h       |  1 -
> >  target/ppc/cpu_init.c  |  3 ---
> >  target/ppc/translate.c | 51 ------------------------------------------
> >  3 files changed, 55 deletions(-)
> > 
> > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > index 203f07e48e..c3d1b492e4 100644
> > --- a/target/ppc/cpu.h
> > +++ b/target/ppc/cpu.h
> > @@ -1256,7 +1256,6 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass,
> >  void ppc_cpu_do_interrupt(CPUState *cpu);
> >  bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
> >  void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
> > -void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
> >  hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
> >  int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> >  int ppc_cpu_gdb_read_register_apple(CPUState *cpu, GByteArray *buf, int reg);
> > diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> > index f5ae2f150d..bd05f53fa4 100644
> > --- a/target/ppc/cpu_init.c
> > +++ b/target/ppc/cpu_init.c
> > @@ -9250,9 +9250,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> >      cc->class_by_name = ppc_cpu_class_by_name;
> >      cc->has_work = ppc_cpu_has_work;
> >      cc->dump_state = ppc_cpu_dump_state;
> > -#ifdef CONFIG_TCG
> > -    cc->dump_statistics = ppc_cpu_dump_statistics;
> > -#endif
> >      cc->set_pc = ppc_cpu_set_pc;
> >      cc->gdb_read_register = ppc_cpu_gdb_read_register;
> >      cc->gdb_write_register = ppc_cpu_gdb_write_register;
> > diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> > index 6c0f424d81..fc9fd790ca 100644
> > --- a/target/ppc/translate.c
> > +++ b/target/ppc/translate.c
> > @@ -8881,57 +8881,6 @@ int ppc_fixup_cpu(PowerPCCPU *cpu)
> >      return 0;
> >  }
> >  
> > -
> > -void ppc_cpu_dump_statistics(CPUState *cs, int flags)
> > -{
> > -#if defined(DO_PPC_STATISTICS)
> > -    PowerPCCPU *cpu = POWERPC_CPU(cs);
> > -    opc_handler_t **t1, **t2, **t3, *handler;
> > -    int op1, op2, op3;
> > -
> > -    t1 = cpu->env.opcodes;
> > -    for (op1 = 0; op1 < 64; op1++) {
> > -        handler = t1[op1];
> > -        if (is_indirect_opcode(handler)) {
> > -            t2 = ind_table(handler);
> > -            for (op2 = 0; op2 < 32; op2++) {
> > -                handler = t2[op2];
> > -                if (is_indirect_opcode(handler)) {
> > -                    t3 = ind_table(handler);
> > -                    for (op3 = 0; op3 < 32; op3++) {
> > -                        handler = t3[op3];
> > -                        if (handler->count == 0) {
> > -                            continue;
> > -                        }
> > -                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
> > -                                    "%016" PRIx64 " %" PRId64 "\n",
> > -                                    op1, op2, op3, op1, (op3 << 5) | op2,
> > -                                    handler->oname,
> > -                                    handler->count, handler->count);
> > -                    }
> > -                } else {
> > -                    if (handler->count == 0) {
> > -                        continue;
> > -                    }
> > -                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
> > -                                "%016" PRIx64 " %" PRId64 "\n",
> > -                                op1, op2, op1, op2, handler->oname,
> > -                                handler->count, handler->count);
> > -                }
> > -            }
> > -        } else {
> > -            if (handler->count == 0) {
> > -                continue;
> > -            }
> > -            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
> > -                        " %" PRId64 "\n",
> > -                        op1, op1, handler->oname,
> > -                        handler->count, handler->count);
> > -        }
> > -    }
> > -#endif
> > -}
> > -
> >  static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
> >  {
> >      opc_handler_t **table, *handler;
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics
  2021-05-29  5:47     ` David Gibson
@ 2021-05-31 14:26       ` Bruno Piazera Larsen
  0 siblings, 0 replies; 42+ messages in thread
From: Bruno Piazera Larsen @ 2021-05-31 14:26 UTC (permalink / raw)
  To: David Gibson, Greg Kurz
  Cc: farosas, richard.henderson, luis.pires, qemu-devel, lucas.araujo,
	fernando.valle, qemu-ppc, matheus.ferst

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


On 29/05/2021 02:47, David Gibson wrote:
> On Thu, May 27, 2021 at 08:01:56AM +0200, Greg Kurz wrote:
>> On Wed, 26 May 2021 17:21:01 -0300
>> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
>>
>>> This function requires surce code modification to be useful, which means
>> s/surce/source
>>
>>> it probably is not used often, and the move to using decodetree means
>>> the statistics won't even be collected anymore.
>>>
>>> Also removed setting dump_statistics in ppc_cpu_realize, since it was
>> s/ppc_cpu_realize/ppc_cpu_class_init
> A rebase on main has triggered a conflict with this patch, so I've
> removed it from my tree again.

Did you answer to the correct patch? From what I can see, this patch is 
still in, but patch 5 is not. I fixed the rebase problem that that one 
had and will send it later, with the rest of the patch series.

-- 

Bruno Piazera Larsen
Instituto de Pesquisas ELDORADO 
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 2182 bytes --]

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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-05-27  6:40   ` Greg Kurz
  2021-05-27  8:09     ` Dr. David Alan Gilbert
@ 2021-06-08 15:10     ` Markus Armbruster
  2021-06-08 15:15       ` Greg Kurz
  1 sibling, 1 reply; 42+ messages in thread
From: Markus Armbruster @ 2021-06-08 15:10 UTC (permalink / raw)
  To: Greg Kurz
  Cc: farosas, richard.henderson, qemu-devel, Dr. David Alan Gilbert,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst,
	luis.pires, david

Greg Kurz <groug@kaod.org> writes:

> On Wed, 26 May 2021 17:21:03 -0300
> "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
>
>> Since ppc was the last architecture to collect these statistics and
>> it is currently phasing this collection out, the command that would query
>> this information is being removed.
>> 
>
> So this is removing an obviously user visible feature. This should be
> mentioned in docs/system/removed-features.rst... but, wait, I don't
> see anything for it in docs/system/deprecated.rst. This is dropping
> a feature without following the usual deprecation policy, i.e.
> marking the feature as deprecated and only remove it 2 QEMU versions
> later. Any justification for that ?

Our deprecation policy applies to stable interfaces, which HMP is not.

We don't break things there just because.  But dropping a command right
away when it is no longer useful is just fine.  No need to deprecate and
wait for the grace period.

[...]



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

* Re: [PATCH 4/5] monitor: removed cpustats command
  2021-06-08 15:10     ` Markus Armbruster
@ 2021-06-08 15:15       ` Greg Kurz
  0 siblings, 0 replies; 42+ messages in thread
From: Greg Kurz @ 2021-06-08 15:15 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: farosas, richard.henderson, qemu-devel, Dr. David Alan Gilbert,
	lucas.araujo, fernando.valle, qemu-ppc, matheus.ferst,
	luis.pires, david

On Tue, 08 Jun 2021 17:10:32 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Greg Kurz <groug@kaod.org> writes:
> 
> > On Wed, 26 May 2021 17:21:03 -0300
> > "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br> wrote:
> >
> >> Since ppc was the last architecture to collect these statistics and
> >> it is currently phasing this collection out, the command that would query
> >> this information is being removed.
> >> 
> >
> > So this is removing an obviously user visible feature. This should be
> > mentioned in docs/system/removed-features.rst... but, wait, I don't
> > see anything for it in docs/system/deprecated.rst. This is dropping
> > a feature without following the usual deprecation policy, i.e.
> > marking the feature as deprecated and only remove it 2 QEMU versions
> > later. Any justification for that ?
> 
> Our deprecation policy applies to stable interfaces, which HMP is not.
> 
> We don't break things there just because.  But dropping a command right
> away when it is no longer useful is just fine.  No need to deprecate and
> wait for the grace period.
> 
> [...]
> 

Ah, good to know.

Thanks!

--
Greg



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

end of thread, other threads:[~2021-06-08 15:17 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 20:20 [PATCH 0/5] stop collection of instruction usage statistics Bruno Larsen (billionai)
2021-05-26 20:21 ` [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set Bruno Larsen (billionai)
2021-05-26 21:13   ` Luis Fernando Fujita Pires
2021-05-26 21:24     ` Richard Henderson
2021-05-27  1:18       ` david
2021-05-26 20:21 ` [PATCH 2/5] target/ppc: remove ppc_cpu_dump_statistics Bruno Larsen (billionai)
2021-05-26 21:25   ` Richard Henderson
2021-05-26 21:27   ` Luis Fernando Fujita Pires
2021-05-27  1:20   ` David Gibson
2021-05-27  4:35     ` David Gibson
2021-05-27 13:22       ` Bruno Piazera Larsen
2021-05-27 14:01         ` Greg Kurz
2021-05-29  5:46           ` David Gibson
2021-05-27  6:01   ` Greg Kurz
2021-05-29  5:47     ` David Gibson
2021-05-31 14:26       ` Bruno Piazera Larsen
2021-05-26 20:21 ` [PATCH 3/5] target/ppc: removed mentions to DO_PPC_STATISTICS Bruno Larsen (billionai)
2021-05-26 21:26   ` Richard Henderson
2021-05-26 21:35   ` Luis Fernando Fujita Pires
2021-05-27  4:37   ` David Gibson
2021-05-26 20:21 ` [PATCH 4/5] monitor: removed cpustats command Bruno Larsen (billionai)
2021-05-26 21:28   ` Richard Henderson
2021-05-27  4:40     ` David Gibson
2021-05-26 21:35   ` Luis Fernando Fujita Pires
2021-05-27  6:40   ` Greg Kurz
2021-05-27  8:09     ` Dr. David Alan Gilbert
2021-05-27  8:30       ` Greg Kurz
2021-05-27 11:24         ` Bruno Piazera Larsen
2021-05-27 14:57           ` Greg Kurz
2021-06-08 15:10     ` Markus Armbruster
2021-06-08 15:15       ` Greg Kurz
2021-05-27  8:08   ` Dr. David Alan Gilbert
2021-05-26 20:21 ` [PATCH 5/5] hw/core/cpu: removed cpu_dump_statistics function Bruno Larsen (billionai)
2021-05-26 21:29   ` Richard Henderson
2021-05-26 21:35   ` Luis Fernando Fujita Pires
2021-05-27  1:21   ` David Gibson
2021-05-27 21:05   ` Eduardo Habkost
2021-05-27 13:57 ` [PATCH 0/5] stop collection of instruction usage statistics Alex Bennée
2021-05-27 14:23   ` Bruno Piazera Larsen
2021-05-27 14:25   ` Luis Fernando Fujita Pires
2021-05-27 14:56     ` Alex Bennée
2021-05-27 15:39       ` Luis Fernando Fujita Pires

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.