From: Peter Maydell <peter.maydell@linaro.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Berkus Decker <berkus@gmail.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Fix for crashes and non-responsive UI on macOS Mojave
Date: Sun, 25 Nov 2018 20:43:48 +0000 [thread overview]
Message-ID: <CAFEAcA-NAbimZZ8=URgUb5hFe7LG72DRM05SwecARtJUcWL1zA@mail.gmail.com> (raw)
In-Reply-To: <20181122073202.zafys4gyewgjpgko@sirius.home.kraxel.org>
On Thu, 22 Nov 2018 at 07:32, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Hi,
>
> > Something somewhere in this call chain should have taken
> > the iothread lock, I assume, but I'm not sure where.
> >
> > Gerd -- what are the rules of the UI subsystem regarding
> > multiple threads, and what threads are allowed to call
> > UI functions like qemu_input_event_send_key_qcode(),
> > from which threads, and whether they need to eg hold
> > the iothread lock when they do so? There's no
> > documentation on these functions in include/ui/input.h.
>
> UI event handling code typically runs in iothread context. So, yes,
> when calling qemu_input_* the UI code holds the iothread lock.
>
> > (To fix a problem on OSX Mojave this patchset has moved
> > which thread the UI executes on, so it is now always
> > the main thread and not the thread which calls
> > the QemuDisplay 'init' callback. That seems to break
> > an implicit assumption in the UI layer.)
>
> Hmm, I guess the options are (a) grab the iothread lock before calling
> input layer functions, or (b) queue the event and schedule a bottom half
> which processes the queue (which will then be called from iothread
> context, with the lock already taken).
I was thinking about this today, and I realized that if
we just make the OSX UI thread code grab the iothread lock,
then there is a potential deadlock with the changes (also
in this patchset) which defer the DisplayChangeListener
update/switch/refresh operations to the UI thread. The
current patchset has those be synchronous deferrals, so
you could get a deadlock if the UI thread is waiting
for the iothread lock, but the code in the UI midlayer
is holding the iothread lock and waiting for a DCL
operation to be run on the main thread.
What are the required semantics for update/switch/refresh?
These don't seem to be documented. Can we validly make
those be asychronous, or does the midlayer require that
the operation has completed and been reflected onscreen
before the update/switch/refresh callback returns ?
If those have to be synchronous, then we'll need to do
something more complicated (eg the queuing of events
that you suggest), which I'd prefer it if we can avoid,
because that implies memory allocation or a fixed
length queue (plus some fairly significant restructuring
of the cocoa frontend).
thanks
-- PMM
next prev parent reply other threads:[~2018-11-25 20:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 21:24 [Qemu-devel] [PATCH] Fix for crashes and non-responsive UI on macOS Mojave Berkus Decker
2018-11-20 12:59 ` Peter Maydell
2018-11-21 15:12 ` Peter Maydell
2018-11-22 7:32 ` Gerd Hoffmann
2018-11-25 20:43 ` Peter Maydell [this message]
2018-11-26 8:28 ` Gerd Hoffmann
[not found] <mailman.21030.1541972152.1282.qemu-devel@nongnu.org>
2018-11-13 12:12 ` Programmingkid
2018-11-20 13:09 ` Peter Maydell
2018-11-20 13:13 ` Daniel P. Berrangé
2018-11-14 0:53 ` Programmingkid
2018-11-14 10:15 ` Berkus Decker
[not found] <mailman.23054.1542721275.1282.qemu-devel@nongnu.org>
2018-11-21 10:53 ` Programmingkid
2018-11-21 11:05 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFEAcA-NAbimZZ8=URgUb5hFe7LG72DRM05SwecARtJUcWL1zA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=berkus@gmail.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).