[RFC PATCH] includes: move tb_flush into its own header

Alex Bennée posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221215140933.2337853-1-alex.bennee@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, "Alex Bennée" <alex.bennee@linaro.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Laurent Vivier <laurent@vivier.eu>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>
include/exec/exec-all.h     | 1 -
linux-user/user-internals.h | 1 +
accel/tcg/tb-maint.c        | 1 +
accel/tcg/translate-all.c   | 1 +
cpu.c                       | 1 +
gdbstub/gdbstub.c           | 1 +
hw/ppc/spapr_hcall.c        | 1 +
plugins/core.c              | 1 +
plugins/loader.c            | 2 +-
target/alpha/sys_helper.c   | 1 +
target/riscv/csr.c          | 1 +
11 files changed, 10 insertions(+), 2 deletions(-)
[RFC PATCH] includes: move tb_flush into its own header
Posted by Alex Bennée 1 year, 4 months ago
This aids subsystems (like gdbstub) that want to trigger a flush
without pulling target specific headers.

[AJB: RFC because this is part of a larger gdbstub series but I wanted
to post for feedback in case anyone wants to suggest better naming].

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/exec/exec-all.h     | 1 -
 linux-user/user-internals.h | 1 +
 accel/tcg/tb-maint.c        | 1 +
 accel/tcg/translate-all.c   | 1 +
 cpu.c                       | 1 +
 gdbstub/gdbstub.c           | 1 +
 hw/ppc/spapr_hcall.c        | 1 +
 plugins/core.c              | 1 +
 plugins/loader.c            | 2 +-
 target/alpha/sys_helper.c   | 1 +
 target/riscv/csr.c          | 1 +
 11 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 9b7bfbf09a..6be541a85f 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -648,7 +648,6 @@ void tb_invalidate_phys_addr(target_ulong addr);
 #else
 void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
 #endif
-void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end);
 void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
index 0280e76add..5ae5e47ff1 100644
--- a/linux-user/user-internals.h
+++ b/linux-user/user-internals.h
@@ -20,6 +20,7 @@
 
 #include "exec/user/thunk.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "qemu/log.h"
 
 extern char *exec_path;
diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
index 0cdb35548c..c665626bc5 100644
--- a/accel/tcg/tb-maint.c
+++ b/accel/tcg/tb-maint.c
@@ -21,6 +21,7 @@
 #include "exec/cputlb.h"
 #include "exec/log.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "exec/translate-all.h"
 #include "sysemu/tcg.h"
 #include "tcg/tcg.h"
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ac3ee3740c..081889cc79 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -47,6 +47,7 @@
 #include "exec/cputlb.h"
 #include "exec/translate-all.h"
 #include "exec/translator.h"
+#include "exec/tb-common.h"
 #include "qemu/bitmap.h"
 #include "qemu/qemu-print.h"
 #include "qemu/timer.h"
diff --git a/cpu.c b/cpu.c
index 4a7d865427..66d64cdb79 100644
--- a/cpu.c
+++ b/cpu.c
@@ -36,6 +36,7 @@
 #include "sysemu/replay.h"
 #include "exec/cpu-common.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "exec/translate-all.h"
 #include "exec/log.h"
 #include "hw/core/accel-cpu.h"
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index bc43aaf825..6e65497a74 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -46,6 +46,7 @@
 #include "sysemu/runstate.h"
 #include "semihosting/semihost.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "exec/hwaddr.h"
 #include "sysemu/replay.h"
 
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 925ff523cc..7c75660d7b 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -8,6 +8,7 @@
 #include "qemu/module.h"
 #include "qemu/error-report.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "helper_regs.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/spapr.h"
diff --git a/plugins/core.c b/plugins/core.c
index ccb770a485..1c4c9bc31e 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -24,6 +24,7 @@
 #include "exec/cpu-common.h"
 
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "exec/helper-proto.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg-op.h"
diff --git a/plugins/loader.c b/plugins/loader.c
index 88c30bde2d..86d5bd3b22 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -29,7 +29,7 @@
 #include "qemu/plugin.h"
 #include "qemu/memalign.h"
 #include "hw/core/cpu.h"
-#include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #ifndef CONFIG_USER_ONLY
 #include "hw/boards.h"
 #endif
diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c
index 25f6cb8894..40a5f76c85 100644
--- a/target/alpha/sys_helper.c
+++ b/target/alpha/sys_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "exec/helper-proto.h"
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 5c9a7ee287..b2c1b59689 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -25,6 +25,7 @@
 #include "time_helper.h"
 #include "qemu/main-loop.h"
 #include "exec/exec-all.h"
+#include "exec/tb-common.h"
 #include "sysemu/cpu-timers.h"
 #include "qemu/guest-random.h"
 #include "qapi/error.h"
-- 
2.34.1


Re: [RFC PATCH] includes: move tb_flush into its own header
Posted by Philippe Mathieu-Daudé 1 year, 4 months ago
On 15/12/22 15:09, Alex Bennée wrote:
> This aids subsystems (like gdbstub) that want to trigger a flush
> without pulling target specific headers.
> 
> [AJB: RFC because this is part of a larger gdbstub series but I wanted
> to post for feedback in case anyone wants to suggest better naming].
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   include/exec/exec-all.h     | 1 -
>   linux-user/user-internals.h | 1 +
>   accel/tcg/tb-maint.c        | 1 +
>   accel/tcg/translate-all.c   | 1 +
>   cpu.c                       | 1 +
>   gdbstub/gdbstub.c           | 1 +
>   hw/ppc/spapr_hcall.c        | 1 +
>   plugins/core.c              | 1 +
>   plugins/loader.c            | 2 +-
>   target/alpha/sys_helper.c   | 1 +
>   target/riscv/csr.c          | 1 +
>   11 files changed, 10 insertions(+), 2 deletions(-)

While playing there you might want to review a companion series:
https://lore.kernel.org/qemu-devel/20221209093649.43738-1-philmd@linaro.org/
"Restrict page_collection structure to system TB maintainance"

Re: [RFC PATCH] includes: move tb_flush into its own header
Posted by Richard Henderson 1 year, 4 months ago
On 12/15/22 06:09, Alex Bennée wrote:
> This aids subsystems (like gdbstub) that want to trigger a flush
> without pulling target specific headers.
> 
> [AJB: RFC because this is part of a larger gdbstub series but I wanted
> to post for feedback in case anyone wants to suggest better naming].
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   include/exec/exec-all.h     | 1 -
>   linux-user/user-internals.h | 1 +
>   accel/tcg/tb-maint.c        | 1 +
>   accel/tcg/translate-all.c   | 1 +
>   cpu.c                       | 1 +
>   gdbstub/gdbstub.c           | 1 +
>   hw/ppc/spapr_hcall.c        | 1 +
>   plugins/core.c              | 1 +
>   plugins/loader.c            | 2 +-
>   target/alpha/sys_helper.c   | 1 +
>   target/riscv/csr.c          | 1 +
>   11 files changed, 10 insertions(+), 2 deletions(-)

It appears as if you forgot to add tb-common.h.
That said, if this is intended to have exactly one thing, tb-flush.h might be better.


r~

Re: [RFC PATCH] includes: move tb_flush into its own header
Posted by Alex Bennée 1 year, 4 months ago
Richard Henderson <richard.henderson@linaro.org> writes:

> On 12/15/22 06:09, Alex Bennée wrote:
>> This aids subsystems (like gdbstub) that want to trigger a flush
>> without pulling target specific headers.
>> [AJB: RFC because this is part of a larger gdbstub series but I
>> wanted
>> to post for feedback in case anyone wants to suggest better naming].
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   include/exec/exec-all.h     | 1 -
>>   linux-user/user-internals.h | 1 +
>>   accel/tcg/tb-maint.c        | 1 +
>>   accel/tcg/translate-all.c   | 1 +
>>   cpu.c                       | 1 +
>>   gdbstub/gdbstub.c           | 1 +
>>   hw/ppc/spapr_hcall.c        | 1 +
>>   plugins/core.c              | 1 +
>>   plugins/loader.c            | 2 +-
>>   target/alpha/sys_helper.c   | 1 +
>>   target/riscv/csr.c          | 1 +
>>   11 files changed, 10 insertions(+), 2 deletions(-)
>
> It appears as if you forgot to add tb-common.h.
> That said, if this is intended to have exactly one thing, tb-flush.h
> might be better.

I'll rename and include when I send the gdbstub stuff. I don't know how
far you want to go to eliminate target specific handling from the rest
of TB maintenance - indeed I'm not sure anything else is possible? 

>
>
> r~


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [RFC PATCH] includes: move tb_flush into its own header
Posted by Richard Henderson 1 year, 4 months ago
On 12/15/22 08:46, Alex Bennée wrote:
> I'll rename and include when I send the gdbstub stuff. I don't know how
> far you want to go to eliminate target specific handling from the rest
> of TB maintenance - indeed I'm not sure anything else is possible?

I can't think that anything else is possible.


r~