[Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage

Emilio G. Cota posted 1 patch 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1529689531-4024-1-git-send-email-cota@braap.org
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x passed
accel/stubs/tcg-stub.c | 4 ----
cpus.c                 | 4 ++++
exec.c                 | 3 +++
3 files changed, 7 insertions(+), 4 deletions(-)
[Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
Posted by Emilio G. Cota 5 years, 10 months ago
Fix the --disable-tcg breakage introduced by tb_lock's removal by
relying on the fact that tcg_enabled() is set to 0 at
compile-time under --disable-tcg.

While at it, add further asserts to fix builds that enable both
--disable-tcg and --enable-debug, which were broken even before
tb_lock's removal.

Tested to build x86_64-softmmu and i386-softmmu targets.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 accel/stubs/tcg-stub.c | 4 ----
 cpus.c                 | 4 ++++
 exec.c                 | 3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index ee575a8..76ae461 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -21,10 +21,6 @@ void tb_flush(CPUState *cpu)
 {
 }
 
-void tb_unlock(void)
-{
-}
-
 void tlb_set_dirty(CPUState *cpu, target_ulong vaddr)
 {
 }
diff --git a/cpus.c b/cpus.c
index d1f1629..8cd552e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1355,6 +1355,7 @@ static int tcg_cpu_exec(CPUState *cpu)
     int64_t ti;
 #endif
 
+    assert(tcg_enabled());
 #ifdef CONFIG_PROFILER
     ti = profile_getclock();
 #endif
@@ -1397,6 +1398,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
 {
     CPUState *cpu = arg;
 
+    assert(tcg_enabled());
     rcu_register_thread();
     tcg_register_thread();
 
@@ -1631,6 +1633,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
 {
     CPUState *cpu = arg;
 
+    assert(tcg_enabled());
     g_assert(!use_icount);
 
     rcu_register_thread();
@@ -1854,6 +1857,7 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
     static QemuThread *single_tcg_cpu_thread;
     static int tcg_region_inited;
 
+    assert(tcg_enabled());
     /*
      * Initialize TCG regions--once. Now is a good time, because:
      * (1) TCG's init context, prologue and target globals have been set up.
diff --git a/exec.c b/exec.c
index 28f9bdc..88edb59 100644
--- a/exec.c
+++ b/exec.c
@@ -1323,6 +1323,7 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)
     RAMBlock *block;
     ram_addr_t end;
 
+    assert(tcg_enabled());
     end = TARGET_PAGE_ALIGN(start + length);
     start &= TARGET_PAGE_MASK;
 
@@ -2655,6 +2656,7 @@ void memory_notdirty_write_prepare(NotDirtyInfo *ndi,
 void memory_notdirty_write_complete(NotDirtyInfo *ndi)
 {
     if (ndi->pages) {
+        assert(tcg_enabled());
         page_collection_unlock(ndi->pages);
         ndi->pages = NULL;
     }
@@ -3046,6 +3048,7 @@ static void tcg_commit(MemoryListener *listener)
     CPUAddressSpace *cpuas;
     AddressSpaceDispatch *d;
 
+    assert(tcg_enabled());
     /* since each CPU stores ram addresses in its TLB cache, we must
        reset the modified entries */
     cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener);
-- 
2.7.4


Re: [Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
Posted by Richard Henderson 5 years, 10 months ago
On 06/22/2018 10:45 AM, Emilio G. Cota wrote:
> Fix the --disable-tcg breakage introduced by tb_lock's removal by
> relying on the fact that tcg_enabled() is set to 0 at
> compile-time under --disable-tcg.
> 
> While at it, add further asserts to fix builds that enable both
> --disable-tcg and --enable-debug, which were broken even before
> tb_lock's removal.
> 
> Tested to build x86_64-softmmu and i386-softmmu targets.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  accel/stubs/tcg-stub.c | 4 ----
>  cpus.c                 | 4 ++++
>  exec.c                 | 3 +++
>  3 files changed, 7 insertions(+), 4 deletions(-)

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

Peter, I'm assuming you'll take this directly to master as a build fix.


r~

Re: [Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
Posted by Peter Maydell 5 years, 10 months ago
On 22 June 2018 at 18:45, Emilio G. Cota <cota@braap.org> wrote:
> Fix the --disable-tcg breakage introduced by tb_lock's removal by
> relying on the fact that tcg_enabled() is set to 0 at
> compile-time under --disable-tcg.
>
> While at it, add further asserts to fix builds that enable both
> --disable-tcg and --enable-debug, which were broken even before
> tb_lock's removal.
>
> Tested to build x86_64-softmmu and i386-softmmu targets.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

Applied to master as a fix for the travis builds; thanks.

-- PMM