[PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out

Philippe Mathieu-Daudé posted 39 patches 5 months, 2 weeks ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, Paul Durrant <paul@xen.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Alex Bennée" <alex.bennee@linaro.org>, "Dr. David Alan Gilbert" <dave@treblig.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, Alexander Graf <agraf@csgraf.de>, Peter Maydell <peter.maydell@linaro.org>
[PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out
Posted by Philippe Mathieu-Daudé 5 months, 2 weeks ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/monitor.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
index 344ec500473..6d9cc11d94c 100644
--- a/accel/tcg/monitor.c
+++ b/accel/tcg/monitor.c
@@ -141,11 +141,26 @@ static void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide)
     *pelide = elide;
 }
 
+static void tcg_dump_flush_info(GString *buf)
+{
+    size_t flush_full, flush_part, flush_elide;
+
+    g_string_append_printf(buf, "TB flush count      %u\n",
+                           qatomic_read(&tb_ctx.tb_flush_count));
+    g_string_append_printf(buf, "TB invalidate count %u\n",
+                           qatomic_read(&tb_ctx.tb_phys_invalidate_count));
+
+    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
+    g_string_append_printf(buf, "TLB full flushes    %zu\n", flush_full);
+    g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part);
+    g_string_append_printf(buf, "TLB elided flushes  %zu\n", flush_elide);
+}
+
 static void dump_exec_info(GString *buf)
 {
     struct tb_tree_stats tst = {};
     struct qht_stats hst;
-    size_t nb_tbs, flush_full, flush_part, flush_elide;
+    size_t nb_tbs;
 
     tcg_tb_foreach(tb_tree_stats_iter, &tst);
     nb_tbs = tst.nb_tbs;
@@ -182,15 +197,7 @@ static void dump_exec_info(GString *buf)
     qht_statistics_destroy(&hst);
 
     g_string_append_printf(buf, "\nStatistics:\n");
-    g_string_append_printf(buf, "TB flush count      %u\n",
-                           qatomic_read(&tb_ctx.tb_flush_count));
-    g_string_append_printf(buf, "TB invalidate count %u\n",
-                           qatomic_read(&tb_ctx.tb_phys_invalidate_count));
-
-    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
-    g_string_append_printf(buf, "TLB full flushes    %zu\n", flush_full);
-    g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part);
-    g_string_append_printf(buf, "TLB elided flushes  %zu\n", flush_elide);
+    tcg_dump_flush_info(buf);
 }
 
 HumanReadableText *qmp_x_query_jit(Error **errp)
-- 
2.49.0


Re: [PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out
Posted by Zhao Liu 5 months, 2 weeks ago
On Thu, Jul 03, 2025 at 07:32:15PM +0200, Philippe Mathieu-Daudé wrote:
> Date: Thu,  3 Jul 2025 19:32:15 +0200
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out
> X-Mailer: git-send-email 2.49.0
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  accel/tcg/monitor.c | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Re: [PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out
Posted by Xiaoyao Li 5 months, 2 weeks ago
On 7/4/2025 1:32 AM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   accel/tcg/monitor.c | 27 +++++++++++++++++----------
>   1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
> index 344ec500473..6d9cc11d94c 100644
> --- a/accel/tcg/monitor.c
> +++ b/accel/tcg/monitor.c
> @@ -141,11 +141,26 @@ static void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide)
>       *pelide = elide;
>   }
>   
> +static void tcg_dump_flush_info(GString *buf)
> +{
> +    size_t flush_full, flush_part, flush_elide;
> +
> +    g_string_append_printf(buf, "TB flush count      %u\n",
> +                           qatomic_read(&tb_ctx.tb_flush_count));
> +    g_string_append_printf(buf, "TB invalidate count %u\n",
> +                           qatomic_read(&tb_ctx.tb_phys_invalidate_count));
> +
> +    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
> +    g_string_append_printf(buf, "TLB full flushes    %zu\n", flush_full);
> +    g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part);
> +    g_string_append_printf(buf, "TLB elided flushes  %zu\n", flush_elide);
> +}
> +
>   static void dump_exec_info(GString *buf)
>   {
>       struct tb_tree_stats tst = {};
>       struct qht_stats hst;
> -    size_t nb_tbs, flush_full, flush_part, flush_elide;
> +    size_t nb_tbs;
>   
>       tcg_tb_foreach(tb_tree_stats_iter, &tst);
>       nb_tbs = tst.nb_tbs;
> @@ -182,15 +197,7 @@ static void dump_exec_info(GString *buf)
>       qht_statistics_destroy(&hst);
>   
>       g_string_append_printf(buf, "\nStatistics:\n");
> -    g_string_append_printf(buf, "TB flush count      %u\n",

side topic,

is the "TB" an typo of "TLB"?

> -                           qatomic_read(&tb_ctx.tb_flush_count));
> -    g_string_append_printf(buf, "TB invalidate count %u\n",
> -                           qatomic_read(&tb_ctx.tb_phys_invalidate_count));
> -
> -    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
> -    g_string_append_printf(buf, "TLB full flushes    %zu\n", flush_full);
> -    g_string_append_printf(buf, "TLB partial flushes %zu\n", flush_part);
> -    g_string_append_printf(buf, "TLB elided flushes  %zu\n", flush_elide);
> +    tcg_dump_flush_info(buf);
>   }
>   
>   HumanReadableText *qmp_x_query_jit(Error **errp)


Re: [PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out
Posted by Xiaoyao Li 5 months, 2 weeks ago
On 7/4/2025 12:27 PM, Xiaoyao Li wrote:
> On 7/4/2025 1:32 AM, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> 
>> ---
>>   accel/tcg/monitor.c | 27 +++++++++++++++++----------
>>   1 file changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
>> index 344ec500473..6d9cc11d94c 100644
>> --- a/accel/tcg/monitor.c
>> +++ b/accel/tcg/monitor.c
>> @@ -141,11 +141,26 @@ static void tlb_flush_counts(size_t *pfull, 
>> size_t *ppart, size_t *pelide)
>>       *pelide = elide;
>>   }
>> +static void tcg_dump_flush_info(GString *buf)
>> +{
>> +    size_t flush_full, flush_part, flush_elide;
>> +
>> +    g_string_append_printf(buf, "TB flush count      %u\n",
>> +                           qatomic_read(&tb_ctx.tb_flush_count));
>> +    g_string_append_printf(buf, "TB invalidate count %u\n",
>> +                           
>> qatomic_read(&tb_ctx.tb_phys_invalidate_count));
>> +
>> +    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
>> +    g_string_append_printf(buf, "TLB full flushes    %zu\n", 
>> flush_full);
>> +    g_string_append_printf(buf, "TLB partial flushes %zu\n", 
>> flush_part);
>> +    g_string_append_printf(buf, "TLB elided flushes  %zu\n", 
>> flush_elide);
>> +}
>> +
>>   static void dump_exec_info(GString *buf)
>>   {
>>       struct tb_tree_stats tst = {};
>>       struct qht_stats hst;
>> -    size_t nb_tbs, flush_full, flush_part, flush_elide;
>> +    size_t nb_tbs;
>>       tcg_tb_foreach(tb_tree_stats_iter, &tst);
>>       nb_tbs = tst.nb_tbs;
>> @@ -182,15 +197,7 @@ static void dump_exec_info(GString *buf)
>>       qht_statistics_destroy(&hst);
>>       g_string_append_printf(buf, "\nStatistics:\n");
>> -    g_string_append_printf(buf, "TB flush count      %u\n",
> 
> side topic,
> 
> is the "TB" an typo of "TLB"?

Please ignore my silly question. It's TranslationBlock of tcg.

>> -                           qatomic_read(&tb_ctx.tb_flush_count));
>> -    g_string_append_printf(buf, "TB invalidate count %u\n",
>> -                           
>> qatomic_read(&tb_ctx.tb_phys_invalidate_count));
>> -
>> -    tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
>> -    g_string_append_printf(buf, "TLB full flushes    %zu\n", 
>> flush_full);
>> -    g_string_append_printf(buf, "TLB partial flushes %zu\n", 
>> flush_part);
>> -    g_string_append_printf(buf, "TLB elided flushes  %zu\n", 
>> flush_elide);
>> +    tcg_dump_flush_info(buf);
>>   }
>>   HumanReadableText *qmp_x_query_jit(Error **errp)
>