[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/6] ui/console: use exclusive mechanism directly
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 4/6] ui/console: use exclusive mechanism directly |
Date: |
Tue, 28 Mar 2017 12:09:34 +0100 |
The previous commit (8bb93c6f99) using async_safe_run_on_cpu() doesn't
work on graphics sub-system which restrict which threads can do GUI
updates. Rather the special casing MacOS we just directly call the
helper and move all the exclusive handling into do_dafe_dpy_refresh().
The unfortunate bouncing of the BQL is to ensure there is no deadlock
as vCPUs waiting on the BQL are kicked into their quiescent state.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Gerd Hoffmann <address@hidden>
---
ui/console.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index dd27c9501b..419b098c11 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1576,19 +1576,22 @@ bool dpy_gfx_check_format(QemuConsole *con,
}
/*
- * Safe DPY refresh for TCG guests. This runs when the TCG vCPUs are
- * quiescent so we can avoid races between dirty page tracking for
- * direct frame-buffer access by the guest.
+ * Safe DPY refresh for TCG guests. We use the exclusive mechanism to
+ * ensure the TCG vCPUs are quiescent so we can avoid races between
+ * dirty page tracking for direct frame-buffer access by the guest.
*
* This is a temporary stopgap until we've fixed the dirty tracking
* races in display adapters.
*/
-static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque)
+static void do_safe_dpy_refresh(DisplayChangeListener *dcl)
{
- DisplayChangeListener *dcl = opaque.host_ptr;
+ qemu_mutex_unlock_iothread();
+ start_exclusive();
qemu_mutex_lock_iothread();
dcl->ops->dpy_refresh(dcl);
qemu_mutex_unlock_iothread();
+ end_exclusive();
+ qemu_mutex_lock_iothread();
}
static void dpy_refresh(DisplayState *s)
@@ -1598,8 +1601,7 @@ static void dpy_refresh(DisplayState *s)
QLIST_FOREACH(dcl, &s->listeners, next) {
if (dcl->ops->dpy_refresh) {
if (tcg_enabled()) {
- async_safe_run_on_cpu(first_cpu, do_safe_dpy_refresh,
- RUN_ON_CPU_HOST_PTR(dcl));
+ do_safe_dpy_refresh(dcl);
} else {
dcl->ops->dpy_refresh(dcl);
}
--
2.11.0
- [Qemu-devel] [PULL 0/6] MTTCG fixes for rc2, Alex Bennée, 2017/03/28
- [Qemu-devel] [PULL 2/6] bsd-user: align use of mmap_lock to that of linux-user, Alex Bennée, 2017/03/28
- [Qemu-devel] [PULL 5/6] tcg: Add a new line after incompatibility warning, Alex Bennée, 2017/03/28
- [Qemu-devel] [PULL 4/6] ui/console: use exclusive mechanism directly,
Alex Bennée <=
- [Qemu-devel] [PULL 3/6] ui/console: ensure do_safe_dpy_refresh holds BQL, Alex Bennée, 2017/03/28
- [Qemu-devel] [PULL 1/6] user-exec: handle synchronous signals from QEMU gracefully, Alex Bennée, 2017/03/28
- [Qemu-devel] [PULL 6/6] replay/replay.c: bump REPLAY_VERSION, Alex Bennée, 2017/03/28
- Re: [Qemu-devel] [PULL 0/6] MTTCG fixes for rc2, Peter Maydell, 2017/03/28