qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
@ 2017-03-22 17:26 Brendan Shanks
  2017-03-23  9:46 ` Peter Maydell
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Brendan Shanks @ 2017-03-22 17:26 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
graphic updates don't race with TCG vCPUs") causes the graphic update to
run on a non-main thread, which Cocoa is not happy with. It crashes
immediately after startup.

$ i386-softmmu/qemu-system-i386 
2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

System: macOS 10.12.3, Xcode 8.2.1

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1675108

Title:
  Cocoa UI always crashes on startup

Status in QEMU:
  New

Bug description:
  Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
  graphic updates don't race with TCG vCPUs") causes the graphic update
  to run on a non-main thread, which Cocoa is not happy with. It crashes
  immediately after startup.

  $ i386-softmmu/qemu-system-i386 
  2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
  *** First throw call stack:
  (
  	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
  	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
  	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
  	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
  	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
  	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
  	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
  	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
  	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  Abort trap: 6

  System: macOS 10.12.3, Xcode 8.2.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1675108/+subscriptions

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
@ 2017-03-23  9:46 ` Peter Maydell
  2017-03-23 11:13   ` Alex Bennée
  2017-03-24  6:29 ` [Qemu-devel] [Bug 1675108] " Brendan Shanks
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2017-03-23  9:46 UTC (permalink / raw)
  To: Bug 1675108; +Cc: QEMU Developers, Alex Bennée

On 22 March 2017 at 17:26, Brendan Shanks <brendan@bslabs.net> wrote:
> Public bug reported:
>
> Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
> graphic updates don't race with TCG vCPUs") causes the graphic update to
> run on a non-main thread, which Cocoa is not happy with. It crashes
> immediately after startup.

Oops. Alex, we can't just run UI code on random threads like this.
Any ideas?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-23  9:46 ` Peter Maydell
@ 2017-03-23 11:13   ` Alex Bennée
  2017-03-23 11:16     ` Peter Maydell
  0 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2017-03-23 11:13 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Bug 1675108, QEMU Developers, Gerd Hoffmann


Peter Maydell <peter.maydell@linaro.org> writes:

> On 22 March 2017 at 17:26, Brendan Shanks <brendan@bslabs.net> wrote:
>> Public bug reported:
>>
>> Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
>> graphic updates don't race with TCG vCPUs") causes the graphic update to
>> run on a non-main thread, which Cocoa is not happy with. It crashes
>> immediately after startup.
>
> Oops. Alex, we can't just run UI code on random threads like this.

Technically its not a random thread its the vCPU context (which ensures
the vCPU isn't updating while the display is being updated). But I guess
the Cocoa is limited to not being able to update from an arbitrary
thread?

There was a patch posted yesterday to ensure the BQL is held during the
deferred work but this doesn't look like that.

> Any ideas?

Hmm a quick Google seems to imply Cocoa is inflexible in its
requirements. You can try this ugly but untested patch (I don't have any
Macs handy):

modified   ui/console.c
@@ -1598,8 +1598,16 @@ static void dpy_refresh(DisplayState *s)
     QLIST_FOREACH(dcl, &s->listeners, next) {
         if (dcl->ops->dpy_refresh) {
             if (tcg_enabled()) {
+#ifdef CONFIG_COCOA
+                qemu_mutex_unlock_iothread();
+                start_exclusive();
+                do_safe_dpy_refresh(first_cpu, RUN_ON_CPU_HOST_PTR(dcl));
+                end_exclusive();
+                qemu_mutex_lock_iothread();
+#else
                 async_safe_run_on_cpu(first_cpu, do_safe_dpy_refresh,
                                       RUN_ON_CPU_HOST_PTR(dcl));
+#endif
             } else {
                 dcl->ops->dpy_refresh(dcl);
             }


Other than that I guess we need to bring forward the plans to "fixed the dirty tracking
races in display adapters"

>
> thanks
> -- PMM


--
Alex Bennée

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-23 11:13   ` Alex Bennée
@ 2017-03-23 11:16     ` Peter Maydell
  2017-03-23 11:31       ` Alex Bennée
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2017-03-23 11:16 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Bug 1675108, QEMU Developers, Gerd Hoffmann

On 23 March 2017 at 11:13, Alex Bennée <alex.bennee@linaro.org> wrote:
> Technically its not a random thread its the vCPU context (which ensures
> the vCPU isn't updating while the display is being updated). But I guess
> the Cocoa is limited to not being able to update from an arbitrary
> thread?

Yes. It's very common for windowing libraries to mandate that you
do all windowing operations from one specific thread.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-23 11:16     ` Peter Maydell
@ 2017-03-23 11:31       ` Alex Bennée
  2017-03-27 13:29         ` Gerd Hoffmann
  0 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2017-03-23 11:31 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Bug 1675108, QEMU Developers, Gerd Hoffmann


Peter Maydell <peter.maydell@linaro.org> writes:

> On 23 March 2017 at 11:13, Alex Bennée <alex.bennee@linaro.org> wrote:
>> Technically its not a random thread its the vCPU context (which ensures
>> the vCPU isn't updating while the display is being updated). But I guess
>> the Cocoa is limited to not being able to update from an arbitrary
>> thread?
>
> Yes. It's very common for windowing libraries to mandate that you
> do all windowing operations from one specific thread.

Fair enough. Well let me know if that works OK on MacOS and I'll fold it
in to the other console patches. In fact I might as well do the
start/end_exclusive dance for all OSes and it will achieve the same thing.

--
Alex Bennée

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
       [not found] <mailman.60832.1490268929.22740.qemu-devel@nongnu.org>
@ 2017-03-24  1:53 ` Programmingkid
  0 siblings, 0 replies; 15+ messages in thread
From: Programmingkid @ 2017-03-24  1:53 UTC (permalink / raw)
  To: Alex Benn?e, Peter Maydell
  Cc: Bug 1675108, qemu-devel qemu-devel, Gerd Hoffmann


On Mar 23, 2017, at 7:35 AM, qemu-devel-request@nongnu.org wrote:

> Message: 15
> Date: Thu, 23 Mar 2017 11:13:02 +0000
> From: Alex Benn?e <alex.bennee@linaro.org>
> To: Peter Maydell <peter.maydell@linaro.org>
> Cc: Bug 1675108 <1675108@bugs.launchpad.net>,	QEMU Developers
> 	<qemu-devel@nongnu.org>, Gerd Hoffmann <kraxel@redhat.com>
> Subject: Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes
> 	on startup
> Message-ID: <87d1d8xn41.fsf@linaro.org>
> Content-Type: text/plain; charset=utf-8
> 
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On 22 March 2017 at 17:26, Brendan Shanks <brendan@bslabs.net> wrote:
>>> Public bug reported:
>>> 
>>> Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
>>> graphic updates don't race with TCG vCPUs") causes the graphic update to
>>> run on a non-main thread, which Cocoa is not happy with. It crashes
>>> immediately after startup.
>> 
>> Oops. Alex, we can't just run UI code on random threads like this.
> 
> Technically its not a random thread its the vCPU context (which ensures
> the vCPU isn't updating while the display is being updated). But I guess
> the Cocoa is limited to not being able to update from an arbitrary
> thread?
> 
> There was a patch posted yesterday to ensure the BQL is held during the
> deferred work but this doesn't look like that.
> 
>> Any ideas?
> 
> Hmm a quick Google seems to imply Cocoa is inflexible in its
> requirements. You can try this ugly but untested patch (I don't have any
> Macs handy):
> 
> modified   ui/console.c
> @@ -1598,8 +1598,16 @@ static void dpy_refresh(DisplayState *s)
>     QLIST_FOREACH(dcl, &s->listeners, next) {
>         if (dcl->ops->dpy_refresh) {
>             if (tcg_enabled()) {
> +#ifdef CONFIG_COCOA
> +                qemu_mutex_unlock_iothread();
> +                start_exclusive();
> +                do_safe_dpy_refresh(first_cpu, RUN_ON_CPU_HOST_PTR(dcl));
> +                end_exclusive();
> +                qemu_mutex_lock_iothread();
> +#else
>                 async_safe_run_on_cpu(first_cpu, do_safe_dpy_refresh,
>                                       RUN_ON_CPU_HOST_PTR(dcl));
> +#endif
>             } else {
>                 dcl->ops->dpy_refresh(dcl);
>             }
> 
> 
> Other than that I guess we need to bring forward the plans to "fixed the dirty tracking
> races in display adapters"
> 
>> 
>> thanks
>> -- PMM
> 
> 
> --
> Alex Benn?e

Your patch does work. I tested it on Mac OS 10.6.8 using qemu-sytem-ppc. 

Has anyone checked on the GTK front-end yet to see if it is having similar problems?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
  2017-03-23  9:46 ` Peter Maydell
@ 2017-03-24  6:29 ` Brendan Shanks
  2017-03-24  7:52   ` Alex Bennée
  2017-03-24  6:38 ` Brendan Shanks
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Brendan Shanks @ 2017-03-24  6:29 UTC (permalink / raw)
  To: qemu-devel

Tested on 10.12.3, it doesn't crash immediately (like before) but
crashes reliably once I send some keyboard input to qemu:

$ i386-softmmu/qemu-system-i386 
**
ERROR:/Users/pip/no_backup/qemu/translate-common.c:34:tcg_handle_interrupt: assertion failed: (qemu_mutex_iothread_locked())
Abort trap: 6


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fffa746edd6 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fffa755a787 pthread_kill + 90
2   libsystem_c.dylib             	0x00007fffa73d4420 abort + 129
3   libglib-2.0.0.dylib           	0x00000001076aec86 g_assertion_message + 388
4   libglib-2.0.0.dylib           	0x00000001076aece4 g_assertion_message_expr + 94
5   qemu-system-i386              	0x00000001066bb1ec tcg_handle_interrupt + 156 (translate-common.c:50)
6   qemu-system-i386              	0x0000000106740dfc pic_irq_request + 156 (pc.c:187)
7   qemu-system-i386              	0x000000010673e5e4 gsi_handler + 36 (pc.c:115)
8   qemu-system-i386              	0x000000010685e97a kbd_update_kbd_irq + 138 (pckbd.c:180)
9   qemu-system-i386              	0x000000010694164a qemu_input_event_send_impl + 938 (input.c:328)
10  qemu-system-i386              	0x000000010694188f qemu_input_event_send_key + 239 (input.c:359)
11  qemu-system-i386              	0x0000000106946a00 cocoa_refresh + 272 (cocoa.m:1402)
12  qemu-system-i386              	0x000000010693f6a8 gui_update + 104 (console.c:1603)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1675108

Title:
  Cocoa UI always crashes on startup

Status in QEMU:
  New

Bug description:
  Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
  graphic updates don't race with TCG vCPUs") causes the graphic update
  to run on a non-main thread, which Cocoa is not happy with. It crashes
  immediately after startup.

  $ i386-softmmu/qemu-system-i386 
  2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
  *** First throw call stack:
  (
  	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
  	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
  	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
  	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
  	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
  	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
  	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
  	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
  	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  Abort trap: 6

  System: macOS 10.12.3, Xcode 8.2.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1675108/+subscriptions

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
  2017-03-23  9:46 ` Peter Maydell
  2017-03-24  6:29 ` [Qemu-devel] [Bug 1675108] " Brendan Shanks
@ 2017-03-24  6:38 ` Brendan Shanks
  2017-03-27 18:52 ` Brendan Shanks
  2017-03-29 17:50 ` Brendan Shanks
  4 siblings, 0 replies; 15+ messages in thread
From: Brendan Shanks @ 2017-03-24  6:38 UTC (permalink / raw)
  To: qemu-devel

The keyboard input issue looks the same as #1675549, and that's on
Linux/SDL. So not specific to this fix or Cocoa.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1675108

Title:
  Cocoa UI always crashes on startup

Status in QEMU:
  New

Bug description:
  Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
  graphic updates don't race with TCG vCPUs") causes the graphic update
  to run on a non-main thread, which Cocoa is not happy with. It crashes
  immediately after startup.

  $ i386-softmmu/qemu-system-i386 
  2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
  *** First throw call stack:
  (
  	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
  	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
  	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
  	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
  	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
  	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
  	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
  	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
  	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  Abort trap: 6

  System: macOS 10.12.3, Xcode 8.2.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1675108/+subscriptions

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-24  6:29 ` [Qemu-devel] [Bug 1675108] " Brendan Shanks
@ 2017-03-24  7:52   ` Alex Bennée
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2017-03-24  7:52 UTC (permalink / raw)
  To: Bug 1675108; +Cc: qemu-devel


Brendan Shanks <brendan@bslabs.net> writes:

> Tested on 10.12.3, it doesn't crash immediately (like before) but
> crashes reliably once I send some keyboard input to qemu:
>
> $ i386-softmmu/qemu-system-i386
> **
> ERROR:/Users/pip/no_backup/qemu/translate-common.c:34:tcg_handle_interrupt: assertion failed: (qemu_mutex_iothread_locked())
> Abort trap: 6

Can you test with the suggested patch I posted yesterday? If we keep the
update under BQL this shouldn't fail.

>
>
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libsystem_kernel.dylib        	0x00007fffa746edd6 __pthread_kill + 10
> 1   libsystem_pthread.dylib       	0x00007fffa755a787 pthread_kill + 90
> 2   libsystem_c.dylib             	0x00007fffa73d4420 abort + 129
> 3   libglib-2.0.0.dylib           	0x00000001076aec86 g_assertion_message + 388
> 4   libglib-2.0.0.dylib           	0x00000001076aece4 g_assertion_message_expr + 94
> 5   qemu-system-i386              	0x00000001066bb1ec tcg_handle_interrupt + 156 (translate-common.c:50)
> 6   qemu-system-i386              	0x0000000106740dfc pic_irq_request + 156 (pc.c:187)
> 7   qemu-system-i386              	0x000000010673e5e4 gsi_handler + 36 (pc.c:115)
> 8   qemu-system-i386              	0x000000010685e97a kbd_update_kbd_irq + 138 (pckbd.c:180)
> 9   qemu-system-i386              	0x000000010694164a qemu_input_event_send_impl + 938 (input.c:328)
> 10  qemu-system-i386              	0x000000010694188f qemu_input_event_send_key + 239 (input.c:359)
> 11  qemu-system-i386              	0x0000000106946a00 cocoa_refresh + 272 (cocoa.m:1402)
> 12  qemu-system-i386              	0x000000010693f6a8 gui_update + 104 (console.c:1603)


--
Alex Bennée

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-23 11:31       ` Alex Bennée
@ 2017-03-27 13:29         ` Gerd Hoffmann
  2017-03-27 15:18           ` Alex Bennée
  0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2017-03-27 13:29 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Peter Maydell, Bug 1675108, QEMU Developers

On Do, 2017-03-23 at 11:31 +0000, Alex Bennée wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
> > On 23 March 2017 at 11:13, Alex Bennée <alex.bennee@linaro.org> wrote:
> >> Technically its not a random thread its the vCPU context (which ensures
> >> the vCPU isn't updating while the display is being updated). But I guess
> >> the Cocoa is limited to not being able to update from an arbitrary
> >> thread?
> >
> > Yes. It's very common for windowing libraries to mandate that you
> > do all windowing operations from one specific thread.
> 
> Fair enough. Well let me know if that works OK on MacOS and I'll fold it
> in to the other console patches. In fact I might as well do the
> start/end_exclusive dance for all OSes and it will achieve the same thing.

Where do we stand with this one?

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-27 13:29         ` Gerd Hoffmann
@ 2017-03-27 15:18           ` Alex Bennée
  2017-03-27 15:19             ` Peter Maydell
  0 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2017-03-27 15:18 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Peter Maydell, Bug 1675108, QEMU Developers


Gerd Hoffmann <kraxel@redhat.com> writes:

> On Do, 2017-03-23 at 11:31 +0000, Alex Bennée wrote:
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>> > On 23 March 2017 at 11:13, Alex Bennée <alex.bennee@linaro.org> wrote:
>> >> Technically its not a random thread its the vCPU context (which ensures
>> >> the vCPU isn't updating while the display is being updated). But I guess
>> >> the Cocoa is limited to not being able to update from an arbitrary
>> >> thread?
>> >
>> > Yes. It's very common for windowing libraries to mandate that you
>> > do all windowing operations from one specific thread.
>>
>> Fair enough. Well let me know if that works OK on MacOS and I'll fold it
>> in to the other console patches. In fact I might as well do the
>> start/end_exclusive dance for all OSes and it will achieve the same thing.
>
> Where do we stand with this one?

I've got two patches in my tree at the moment. I was holding off posting
the series to see if I could make more progress with the record/replay
bug. I'll post the series tomorrow morning but if you want to grab them
ahead of that see:

  https://github.com/stsquad/qemu/commit/6c0ddfc5752f311b4c5a2956de25821cc2cd3fd6
  https://github.com/stsquad/qemu/commit/15d2b05a20879017f20370b71d5d144947b693fe

--
Alex Bennée

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup
  2017-03-27 15:18           ` Alex Bennée
@ 2017-03-27 15:19             ` Peter Maydell
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2017-03-27 15:19 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Gerd Hoffmann, Bug 1675108, QEMU Developers

On 27 March 2017 at 16:18, Alex Bennée <alex.bennee@linaro.org> wrote:
> I've got two patches in my tree at the moment. I was holding off posting
> the series to see if I could make more progress with the record/replay
> bug.

rc candidates are cut on Tuesdays, so it's better in general not
to sit on a fix for rc bugs if it causes them to miss going into
the next rc tag.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
                   ` (2 preceding siblings ...)
  2017-03-24  6:38 ` Brendan Shanks
@ 2017-03-27 18:52 ` Brendan Shanks
  2017-03-27 19:25   ` Alex Bennée
  2017-03-29 17:50 ` Brendan Shanks
  4 siblings, 1 reply; 15+ messages in thread
From: Brendan Shanks @ 2017-03-27 18:52 UTC (permalink / raw)
  To: qemu-devel

I just did a quick test on 10.12.3 with those two patches and didn't get
any crashes

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1675108

Title:
  Cocoa UI always crashes on startup

Status in QEMU:
  New

Bug description:
  Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
  graphic updates don't race with TCG vCPUs") causes the graphic update
  to run on a non-main thread, which Cocoa is not happy with. It crashes
  immediately after startup.

  $ i386-softmmu/qemu-system-i386 
  2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
  *** First throw call stack:
  (
  	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
  	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
  	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
  	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
  	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
  	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
  	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
  	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
  	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  Abort trap: 6

  System: macOS 10.12.3, Xcode 8.2.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1675108/+subscriptions

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-27 18:52 ` Brendan Shanks
@ 2017-03-27 19:25   ` Alex Bennée
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2017-03-27 19:25 UTC (permalink / raw)
  To: Bug 1675108; +Cc: qemu-devel


Brendan Shanks <brendan@bslabs.net> writes:

> I just did a quick test on 10.12.3 with those two patches and didn't get
> any crashes

Awesome. I'm rolling the series now. I assume will pickup the patches in
due course.

--
Alex Bennée

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [Bug 1675108] Re: Cocoa UI always crashes on startup
  2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
                   ` (3 preceding siblings ...)
  2017-03-27 18:52 ` Brendan Shanks
@ 2017-03-29 17:50 ` Brendan Shanks
  4 siblings, 0 replies; 15+ messages in thread
From: Brendan Shanks @ 2017-03-29 17:50 UTC (permalink / raw)
  To: qemu-devel

Fixed in -rc2, closing.

** Changed in: qemu
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1675108

Title:
  Cocoa UI always crashes on startup

Status in QEMU:
  Fix Released

Bug description:
  Commit 8bb93c6f99a42c2e0943bc904b283cd622d302c5 ("ui/console: ensure
  graphic updates don't race with TCG vCPUs") causes the graphic update
  to run on a non-main thread, which Cocoa is not happy with. It crashes
  immediately after startup.

  $ i386-softmmu/qemu-system-i386 
  2017-03-22 10:09:25.113 qemu-system-i386[15968:9538245] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
  *** First throw call stack:
  (
  	0   CoreFoundation                      0x00007fff91e72e7b __exceptionPreprocess + 171
  	1   libobjc.A.dylib                     0x00007fffa6a5ccad objc_exception_throw + 48
  	2   AppKit                              0x00007fff900953fd -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4471
  	3   qemu-system-i386                    0x0000000104f75a49 cocoa_refresh + 233
  	4   qemu-system-i386                    0x0000000104e0312c process_queued_cpu_work + 140
  	5   qemu-system-i386                    0x0000000104d1a73c qemu_tcg_rr_cpu_thread_fn + 284
  	6   libsystem_pthread.dylib             0x00007fffa7557aab _pthread_body + 180
  	7   libsystem_pthread.dylib             0x00007fffa75579f7 _pthread_body + 0
  	8   libsystem_pthread.dylib             0x00007fffa75571fd thread_start + 13
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  Abort trap: 6

  System: macOS 10.12.3, Xcode 8.2.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1675108/+subscriptions

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-03-29 18:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-22 17:26 [Qemu-devel] [Bug 1675108] [NEW] Cocoa UI always crashes on startup Brendan Shanks
2017-03-23  9:46 ` Peter Maydell
2017-03-23 11:13   ` Alex Bennée
2017-03-23 11:16     ` Peter Maydell
2017-03-23 11:31       ` Alex Bennée
2017-03-27 13:29         ` Gerd Hoffmann
2017-03-27 15:18           ` Alex Bennée
2017-03-27 15:19             ` Peter Maydell
2017-03-24  6:29 ` [Qemu-devel] [Bug 1675108] " Brendan Shanks
2017-03-24  7:52   ` Alex Bennée
2017-03-24  6:38 ` Brendan Shanks
2017-03-27 18:52 ` Brendan Shanks
2017-03-27 19:25   ` Alex Bennée
2017-03-29 17:50 ` Brendan Shanks
     [not found] <mailman.60832.1490268929.22740.qemu-devel@nongnu.org>
2017-03-24  1:53 ` [Qemu-devel] [Bug 1675108] [NEW] " Programmingkid

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).