[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 08/12] cpus: always call seqlock_write in cpu
Re: [Qemu-devel] [PATCH v2 08/12] cpus: always call seqlock_write in cpu_update_icount
Wed, 26 Sep 2018 10:23:25 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
On 24/09/2018 20:46, Emilio G. Cota wrote:
> Applying this on my local tree is deadlocking icount, since
> cpu_update_icount is called from cpu_get_icount_raw_locked:
> #6 cpu_update_icount (cpu=<optimized out>) at /data/src/qemu/cpus.c:257
> #7 0x000055a6fbc7ae5c in cpu_get_icount_raw_locked () at
> #8 0x000055a6fbc7ae99 in cpu_get_icount_locked () at
> #9 0x000055a6fbc7b3ac in cpu_get_icount () at /data/src/qemu/cpus.c:302
> #10 0x000055a6fc0f3a05 in qemu_clock_get_ns (address@hidden) at
> I am however not sure what Paolo's queued tree looks like, so I
> might be missing something.
No, you're not missing anything.
Looking at other callers of cpu_update_icount, this should be the fix:
diff --git a/cpus.c b/cpus.c
index b429b5a9e0..551076fb98 100644
@@ -245,15 +245,25 @@ static int64_t cpu_get_icount_executed(CPUState *cpu)
* account executed instructions. This is done by the TCG vCPU
* thread so the main-loop can see time has moved forward.
-void cpu_update_icount(CPUState *cpu)
+static void cpu_update_icount_locked(CPUState *cpu)
int64_t executed = cpu_get_icount_executed(cpu);
cpu->icount_budget -= executed;
timers_state.qemu_icount + executed);
+ * Update the global shared timer_state.qemu_icount to take into
+ * account executed instructions. This is done by the TCG vCPU
+ * thread so the main-loop can see time has moved forward.
+void cpu_update_icount(CPUState *cpu)
@@ -268,7 +278,7 @@ static int64_t cpu_get_icount_raw_locked(void)
/* Take into account what has run */
/* The read is protected by the seqlock, but needs atomic64 to avoid UB */
> Paolo: is that tree available anywhere?
Nope, unfortunately some patches I've queued broke on 32-bit and stuff so I
couldn't send out the pull request before leaving for Kernel Recipes...
- Re: [Qemu-devel] [PATCH v2 06/12] atomic: fix comment s/x64_64/x86_64/, (continued)
- [Qemu-devel] [PATCH v2 05/12] test-rcu-list: access n_reclaims and n_nodes_removed with atomic64, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 07/12] cpus: initialize timers_state.vm_clock_lock, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 04/12] qsp: use atomic64 accessors, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 03/12] tests: add atomic64-bench, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 08/12] cpus: always call seqlock_write in cpu_update_icount, Emilio G. Cota, 2018/09/10
- Re: [Qemu-devel] [PATCH v2 00/12] i386 + x86_64 mttcg, Paolo Bonzini, 2018/09/11