From nobody Sat May 18 04:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1657073793; cv=none; d=zohomail.com; s=zohoarc; b=HaJnpbadiKplRr3ETpYZWJ0w+fl87dTgm9xxQpWpQt+u5issma7YND+PwGvbafUuJMqMuYYcUO1PQvfgwhN8Wjk3e+aiI0h8NiblF0CdQZAGkSQTQbCnkZtgb2Pd0LlT9U4ObVI7mlJ12DhGjk3s6rNmtoni3V5/WHnfFjv+4t8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657073793; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=57I8FyERa6i/yFor42+hHYhubtN3rpx7pTDkosx/Qfc=; b=k7JW3uA8bIg1p44Pp2uLA/7gOb2Zl3a5RcOOWZ0gkM66Ij8hmg6p3SSLrC7suVsEZB1AXl1NUL+jeh1KVWF61QBV5ExOe6p1yItcmOQOMxAt9zU/9egF7GoghP5EDp5ZpQLL/papaRm9HeRRiUwWbrFt+wf8GoH/RW7cdnIG3x4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657073793085974.7119568079912; Tue, 5 Jul 2022 19:16:33 -0700 (PDT) Received: from localhost ([::1]:59634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8uac-0002Ef-TE for importer@patchew.org; Tue, 05 Jul 2022 22:16:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8uXn-0008TT-U7 for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:35 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:46966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8uXl-0007iK-LB for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:35 -0400 Received: by mail-pg1-x52c.google.com with SMTP id s27so12864454pga.13 for ; Tue, 05 Jul 2022 19:13:33 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id ij21-20020a170902ab5500b0016bedcced2fsm3334071plb.35.2022.07.05.19.13.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Jul 2022 19:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=57I8FyERa6i/yFor42+hHYhubtN3rpx7pTDkosx/Qfc=; b=iBdAQCVDyOUY5cYKyRuaQWrSwE3GIXXPiz8PxIlSLOzZm1bKZ1na53GCYy4+cSGsTX AukeoXtgdDm7k8C8KNnMUJGSHJkWg8zWABJ2s0USxoTWnfK52QkKuSleYStgnRcX8ycr yik4FkT6O5eP5OuCZQYCM9N+QUR7xopHGh7onKgebbmcayVInO3E/YC60y6U/gEj3Uml Ii+O+Mm1yZjwG9nqdpnI5Sc9pE854rZaNUTOqaMUpwWungHbaL11GTBJBiRY6P9n8yzg R+4oHMg8HgvOd0huUzFYknagAkDq61MV0sj1LJmwmUJuumNliK1Xh6UYf1IKTT5FG7lo 7ZAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=57I8FyERa6i/yFor42+hHYhubtN3rpx7pTDkosx/Qfc=; b=ADh5IcnNNoVEqsZqJtLZcjpnO1js5QKr8TYhFXL2JFqx31hVSNOnV6AJtgyrhNLNgc sBbbuELtovW+kdXNFGC0CdnW0hACyGlUMzlqUGDdPyiKG2Ci8ns0jTiL4sLCjRLiA+et dvOBINtqU1MxcmJUnjRKp9K9/r7ksM6LIU757DOWwC18QinBfr6R5LGrT+yRr1DFl31b 0PCwpc4KfF8q785N5ZYD383WxvZSfj17NLenthYJocFrfHCTHW/ckL8tagLkP0BGytms V47lqiO/Gwy7XxU6zD9ev0v97i8lRyqTBrbEMrgGELYjCZh7GWn8Wxf9fZ+2XAqIhwTI r+6w== X-Gm-Message-State: AJIora8+2lG0zwrJ8E21YxdUCF9Sl4rI28++IxRPOVp7czDZao7nkW2h E8w79VnIV2ir0Q2Owq63CP5g0+/UfLM= X-Google-Smtp-Source: AGRyM1u/DcrgLNKET/2vyHlUhBquE18MOjllAjPAGGMvtFwJ67ZiJIJaQAJDvgnTcknyRo4lXoCTHA== X-Received: by 2002:a05:6a00:1489:b0:525:b83f:b32f with SMTP id v9-20020a056a00148900b00525b83fb32fmr45032981pfu.25.1657073611518; Tue, 05 Jul 2022 19:13:31 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Peter Maydell , Paolo Bonzini , Gerd Hoffmann , Emanuele Giuseppe Esposito , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki Subject: [PATCH 1/3] ui/cocoa: Run qemu_init in the main thread Date: Wed, 6 Jul 2022 11:13:20 +0900 Message-Id: <20220706021322.22570-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220706021322.22570-1-akihiko.odaki@gmail.com> References: <20220706021322.22570-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52c.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1657073794675100003 Content-Type: text/plain; charset="utf-8" This work is based on: https://patchew.org/QEMU/20220317125534.38706-1-philippe.mathieu.daude@gmai= l.com/ Simplify the initialization dance by running qemu_init() in the main thread before the Cocoa event loop starts. The secondary thread only runs only qemu_main_loop() and qemu_cleanup(). This fixes a case where addRemovableDevicesMenuItems() calls qmp_query_block() while expecting the main thread to still hold the BQL. Overriding the code after calling qemu_init() is done by dynamically replacing a function pointer variable, qemu_main when initializing ui/cocoa, which unifies the static implementation of main() for builds with ui/cocoa and ones without ui/cocoa. Signed-off-by: Akihiko Odaki --- docs/devel/fuzzing.rst | 4 +- include/qemu-main.h | 3 +- include/sysemu/sysemu.h | 2 +- softmmu/main.c | 14 +-- softmmu/vl.c | 2 +- tests/qtest/fuzz/fuzz.c | 2 +- ui/cocoa.m | 185 ++++++++++++---------------------------- 7 files changed, 69 insertions(+), 143 deletions(-) diff --git a/docs/devel/fuzzing.rst b/docs/devel/fuzzing.rst index 784ecb99e66..715330c8561 100644 --- a/docs/devel/fuzzing.rst +++ b/docs/devel/fuzzing.rst @@ -287,8 +287,8 @@ select the fuzz target. Then, the qtest client is initi= alized. If the target requires qos, qgraph is set up and the QOM/LIBQOS modules are initialized. Then the QGraph is walked and the QEMU cmd_line is determined and saved. =20 -After this, the ``vl.c:qemu_main`` is called to set up the guest. There are -target-specific hooks that can be called before and after qemu_main, for +After this, the ``vl.c:main`` is called to set up the guest. There are +target-specific hooks that can be called before and after main, for additional setup(e.g. PCI setup, or VM snapshotting). =20 ``LLVMFuzzerTestOneInput``: Uses qtest/qos functions to act based on the f= uzz diff --git a/include/qemu-main.h b/include/qemu-main.h index 6a3e90d0ad5..6889375e7c2 100644 --- a/include/qemu-main.h +++ b/include/qemu-main.h @@ -5,6 +5,7 @@ #ifndef QEMU_MAIN_H #define QEMU_MAIN_H =20 -int qemu_main(int argc, char **argv, char **envp); +void qemu_default_main(void); +extern void (*qemu_main)(void); =20 #endif /* QEMU_MAIN_H */ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 812f66a31a9..254c1eabf57 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -102,7 +102,7 @@ void qemu_boot_set(const char *boot_order, Error **errp= ); =20 bool defaults_enabled(void); =20 -void qemu_init(int argc, char **argv, char **envp); +void qemu_init(int argc, char **argv); void qemu_main_loop(void); void qemu_cleanup(void); =20 diff --git a/softmmu/main.c b/softmmu/main.c index c00432ff098..41a091f2c72 100644 --- a/softmmu/main.c +++ b/softmmu/main.c @@ -30,18 +30,18 @@ #include #endif =20 -int qemu_main(int argc, char **argv, char **envp) +void qemu_default_main(void) { - qemu_init(argc, argv, envp); qemu_main_loop(); qemu_cleanup(); - - return 0; } =20 -#ifndef CONFIG_COCOA +void (*qemu_main)(void) =3D qemu_default_main; + int main(int argc, char **argv) { - return qemu_main(argc, argv, NULL); + qemu_init(argc, argv); + qemu_main(); + + return 0; } -#endif diff --git a/softmmu/vl.c b/softmmu/vl.c index 3f264d4b093..e8c73d0bb40 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2589,7 +2589,7 @@ void qmp_x_exit_preconfig(Error **errp) } } =20 -void qemu_init(int argc, char **argv, char **envp) +void qemu_init(int argc, char **argv) { QemuOpts *opts; QemuOpts *icount_opts =3D NULL, *accel_opts =3D NULL; diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 2062b40d82b..0bde925bf83 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -221,7 +221,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char = ***envp) g_free(pretty_cmd_line); } =20 - qemu_init(result.we_wordc, result.we_wordv, NULL); + qemu_init(result.we_wordc, result.we_wordv); =20 /* re-enable the rcu atfork, which was previously disabled in qemu_ini= t */ rcu_enable_atfork(); diff --git a/ui/cocoa.m b/ui/cocoa.m index 6a4dccff7f0..55413594d14 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -100,15 +100,11 @@ static void cocoa_switch(DisplayChangeListener *dcl, static int left_command_key_enabled =3D 1; static bool swap_opt_cmd; =20 -static int gArgc; -static char **gArgv; +static QemuThread qemu_main_thread; +static bool qemu_main_terminating; static bool stretch_video; static NSTextField *pauseLabel; =20 -static QemuSemaphore display_init_sem; -static QemuSemaphore app_started_sem; -static bool allow_events; - static NSInteger cbchangecount =3D -1; static QemuClipboardInfo *cbinfo; static QemuEvent cbevent; @@ -581,18 +577,6 @@ - (void) updateUIInfoLocked =20 - (void) updateUIInfo { - if (!allow_events) { - /* - * Don't try to tell QEMU about UI information in the application - * startup phase -- we haven't yet registered dcl with the QEMU UI - * layer, and also trying to take the iothread lock would deadlock. - * When cocoa_display_init() does register the dcl, the UI layer - * will call cocoa_switch(), which will call updateUIInfo, so - * we don't lose any information here. - */ - return; - } - with_iothread_lock(^{ [self updateUIInfoLocked]; }); @@ -778,16 +762,6 @@ - (void) handleMonitorInput:(NSEvent *)event =20 - (bool) handleEvent:(NSEvent *)event { - if(!allow_events) { - /* - * Just let OSX have all events that arrive before - * applicationDidFinishLaunching. - * This avoids a deadlock on the iothread lock, which cocoa_displa= y_init() - * will not drop until after the app_started_sem is posted. (In th= eory - * there should not be any such events, but OSX Catalina now emits= some.) - */ - return false; - } return bool_with_iothread_lock(^{ return [self handleEventLocked:event]; }); @@ -1279,29 +1253,18 @@ - (void) dealloc [super dealloc]; } =20 -- (void)applicationDidFinishLaunching: (NSNotification *) note -{ - COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n"); - allow_events =3D true; - /* Tell cocoa_display_init to proceed */ - qemu_sem_post(&app_started_sem); -} - - (void)applicationWillTerminate:(NSNotification *)aNotification { COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n"); =20 with_iothread_lock(^{ - shutdown_action =3D SHUTDOWN_ACTION_POWEROFF; - qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); + if (!qemu_main_terminating) { + shutdown_action =3D SHUTDOWN_ACTION_POWEROFF; + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); + } }); =20 - /* - * Sleep here, because returning will cause OSX to kill us - * immediately; the QEMU main loop will handle the shutdown - * request and terminate the process. - */ - [NSThread sleepForTimeInterval:INFINITY]; + qemu_thread_join(&qemu_main_thread); } =20 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)t= heApplication @@ -1313,7 +1276,7 @@ - (NSApplicationTerminateReply)applicationShouldTermi= nate: (NSApplication *)= sender { COCOA_DEBUG("QemuCocoaAppController: applicationShouldTerminate\n"); - return [self verifyQuit]; + return qatomic_read(&qemu_main_terminating) || [self verifyQuit]; } =20 - (void)windowDidChangeScreen:(NSNotification *)notification @@ -1915,92 +1878,35 @@ static void cocoa_clipboard_request(QemuClipboardIn= fo *info, /* * The startup process for the OSX/Cocoa UI is complicated, because * OSX insists that the UI runs on the initial main thread, and so we - * need to start a second thread which runs the vl.c qemu_main(): - * - * Initial thread: 2nd thread: - * in main(): - * create qemu-main thread - * wait on display_init semaphore - * call qemu_main() - * ... - * in cocoa_display_init(): - * post the display_init semaphore - * wait on app_started semaphore - * create application, menus, etc - * enter OSX run loop - * in applicationDidFinishLaunching: - * post app_started semaphore - * tell main thread to fullscreen if n= eeded - * [...] - * run qemu main-loop - * - * We do this in two stages so that we don't do the creation of the - * GUI application menus and so on for command line options like --help - * where we want to just print text to stdout and exit immediately. + * need to start a second thread which runs the qemu_default_main(). */ =20 static void *call_qemu_main(void *opaque) { - int status; - - COCOA_DEBUG("Second thread: calling qemu_main()\n"); - status =3D qemu_main(gArgc, gArgv, *_NSGetEnviron()); - COCOA_DEBUG("Second thread: qemu_main() returned, exiting\n"); + COCOA_DEBUG("Second thread: calling qemu_default_main()\n"); + qemu_mutex_lock_iothread(); + qemu_default_main(); + qatomic_set(&qemu_main_terminating, true); + qemu_mutex_unlock_iothread(); + COCOA_DEBUG("Second thread: qemu_default_main() returned, exiting\n"); [cbowner release]; - exit(status); -} - -int main (int argc, char **argv) { - QemuThread thread; - - COCOA_DEBUG("Entered main()\n"); - gArgc =3D argc; - gArgv =3D argv; + [NSApp terminate:nil]; =20 - qemu_sem_init(&display_init_sem, 0); - qemu_sem_init(&app_started_sem, 0); - - qemu_thread_create(&thread, "qemu_main", call_qemu_main, - NULL, QEMU_THREAD_DETACHED); - - COCOA_DEBUG("Main thread: waiting for display_init_sem\n"); - qemu_sem_wait(&display_init_sem); - COCOA_DEBUG("Main thread: initializing app\n"); - - NSAutoreleasePool * pool =3D [[NSAutoreleasePool alloc] init]; - - // Pull this console process up to being a fully-fledged graphical - // app with a menubar and Dock icon - ProcessSerialNumber psn =3D { 0, kCurrentProcess }; - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - - [QemuApplication sharedApplication]; - - create_initial_menus(); + return NULL; +} =20 - /* - * Create the menu entries which depend on QEMU state (for consoles - * and removeable devices). These make calls back into QEMU functions, - * which is OK because at this point we know that the second thread - * holds the iothread lock and is synchronously waiting for us to - * finish. - */ - add_console_menu_entries(); - addRemovableDevicesMenuItems(); +static void cocoa_main() +{ + COCOA_DEBUG("Entered %s()\n", __func__); =20 - // Create an Application controller - QemuCocoaAppController *appController =3D [[QemuCocoaAppController all= oc] init]; - [NSApp setDelegate:appController]; + qemu_mutex_unlock_iothread(); + qemu_thread_create(&qemu_main_thread, "qemu_main", call_qemu_main, + NULL, QEMU_THREAD_JOINABLE); =20 // Start the main event loop COCOA_DEBUG("Main thread: entering OSX run loop\n"); [NSApp run]; COCOA_DEBUG("Main thread: left OSX run loop, exiting\n"); - - [appController release]; - [pool release]; - - return 0; } =20 =20 @@ -2079,25 +1985,42 @@ static void cocoa_refresh(DisplayChangeListener *dc= l) =20 static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { + NSAutoreleasePool * pool =3D [[NSAutoreleasePool alloc] init]; + COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n"); =20 - /* Tell main thread to go ahead and create the app and enter the run l= oop */ - qemu_sem_post(&display_init_sem); - qemu_sem_wait(&app_started_sem); - COCOA_DEBUG("cocoa_display_init: app start completed\n"); + qemu_main =3D cocoa_main; + + // Pull this console process up to being a fully-fledged graphical + // app with a menubar and Dock icon + ProcessSerialNumber psn =3D { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + + [QemuApplication sharedApplication]; + + create_initial_menus(); + + /* + * Create the menu entries which depend on QEMU state (for consoles + * and removeable devices). These make calls back into QEMU functions, + * which is OK because at this point we know that the second thread + * holds the iothread lock and is synchronously waiting for us to + * finish. + */ + add_console_menu_entries(); + addRemovableDevicesMenuItems(); + + // Create an Application controller + QemuCocoaAppController *controller =3D [[QemuCocoaAppController alloc]= init]; + [NSApp setDelegate:controller]; =20 - QemuCocoaAppController *controller =3D (QemuCocoaAppController *)[[NSA= pplication sharedApplication] delegate]; /* if fullscreen mode is to be used */ if (opts->has_full_screen && opts->full_screen) { - dispatch_async(dispatch_get_main_queue(), ^{ - [NSApp activateIgnoringOtherApps: YES]; - [controller toggleFullScreen: nil]; - }); + [NSApp activateIgnoringOtherApps: YES]; + [controller toggleFullScreen: nil]; } if (opts->u.cocoa.has_full_grab && opts->u.cocoa.full_grab) { - dispatch_async(dispatch_get_main_queue(), ^{ - [controller setFullGrab: nil]; - }); + [controller setFullGrab: nil]; } =20 if (opts->has_show_cursor && opts->show_cursor) { @@ -2117,6 +2040,8 @@ static void cocoa_display_init(DisplayState *ds, Disp= layOptions *opts) qemu_event_init(&cbevent, false); cbowner =3D [[QemuCocoaPasteboardTypeOwner alloc] init]; qemu_clipboard_peer_register(&cbpeer); + + [pool release]; } =20 static QemuDisplay qemu_display_cocoa =3D { --=20 2.32.1 (Apple Git-133) From nobody Sat May 18 04:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1657073792; cv=none; d=zohomail.com; s=zohoarc; b=Qiyzh5+fi9diXLU+1JVoixBlMNeDYBFiIXM+QmnbbaZ6K8gh8DFAhNmfY2qvl65K56tPvJlMbOxMln+FhnNxJRXH1PpWpzoB1LoPAtNyU1CDWPTMireNKMAQsTERTKQYMFUbMuHtyZam+od2vmU5JS7ZlwcBxWiofVvkdraB7zM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657073792; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=klW5l721zkRtbV2/1qgZifBW4d5CZpXzNC6YAnMqrO0=; b=gKXB5vgnQct5XgaeoaOQqISXCy+LpjArnnmoG1Xflpbw0Nd6OmJhBwhZ3HJYZ7VF/Vy/NTdMyCL2Wye2yQonm4bkXdrMdiWlaKdWe410slsu9kiyghx38D6MB4O0NyDl0qp5gG32OYPsRZ4oZCmlI/I4Qw20v9oAVnIaPBQ+akI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657073792460396.71279113765365; Tue, 5 Jul 2022 19:16:32 -0700 (PDT) Received: from localhost ([::1]:59706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8uac-0002Ia-Uv for importer@patchew.org; Tue, 05 Jul 2022 22:16:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8uXp-0008Ve-Jk for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:37 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:36562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8uXn-0007iw-SB for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:37 -0400 Received: by mail-pj1-x102a.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso8493310pjc.1 for ; Tue, 05 Jul 2022 19:13:35 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id ij21-20020a170902ab5500b0016bedcced2fsm3334071plb.35.2022.07.05.19.13.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Jul 2022 19:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=klW5l721zkRtbV2/1qgZifBW4d5CZpXzNC6YAnMqrO0=; b=WXq9tCMTrkQl9EyJV6A2+JCdHc4WNDDer409V7FaBudpdGw9in5VGGkdWu0JeVf4kL o4eZfDy06PWfqYNYa6+KFYWCDlf6pF4mYo5xmdOMv+Dbqc/MLvAu5Wx1gJaCo4fPHaZi UMiDKvIEe1zF1AgK8ic384QOgfJJroEfHuKMOA9YvCdEjGWTpjsyucFevUoxGx4gknmA v2fsP2zqQWB5tzt8AxuXVgGyhoUJqsxDYobBzWP+xRs4XIy43rnWfhASCbUuPrKFvLLN TDC7yIx/kUIE59v7mo0a6XVfe+h+vw5qs2Wg920hTXVst5AaLEHRkWecrID3iXGo7n86 +2Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=klW5l721zkRtbV2/1qgZifBW4d5CZpXzNC6YAnMqrO0=; b=VxrET0M167X/97/C0PEJ3XEJwku87hqFYel9uRERlijxDRZjpZ/+r3UwPq2JvF+KEw 655C7/0ESK12dgk+UnTKjcPhwDtLPhe/hsbO2Nk2rAn1Ls0wgTlxacdSemosWj19tmnu BBZ2lZBz+ymD6oLbHjHopdpxS1xBFbDs/tJcO0zddaynC4qcjfFlbEn1yNfQlWL4X/Ao HQtwE2YcSUFrADdjR7U5muanB8etAblw5p0psO96rVlZYoJ9mpiz/tRxlbTNzDorlrAm 6152NIWwQlDi5YGUxekeyZgxZ/kEYnJj9bDpzMgvBAZFHEg9F/y6+sEPgYYwui0lRmdN JF4w== X-Gm-Message-State: AJIora/e+X4LSyyMkh78SNgu7aNaGb0tj3K0m1yl4/yre73rk25S45/d F8AvqJw2xzt/N/zc0QShEO46HhFEeds= X-Google-Smtp-Source: AGRyM1v+KYjsixBEJ/YU8718/fOt0z5bwbJQIU/VkRYpUbEVBT/DZMv+/9VLTDrQxp4Hx5ouxqXXBg== X-Received: by 2002:a17:902:b598:b0:168:b0b2:f05a with SMTP id a24-20020a170902b59800b00168b0b2f05amr44684636pls.0.1657073614121; Tue, 05 Jul 2022 19:13:34 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Peter Maydell , Paolo Bonzini , Gerd Hoffmann , Emanuele Giuseppe Esposito , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki Subject: [PATCH 2/3] Revert "main-loop: Disable block backend global state assertion on Cocoa" Date: Wed, 6 Jul 2022 11:13:21 +0900 Message-Id: <20220706021322.22570-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220706021322.22570-1-akihiko.odaki@gmail.com> References: <20220706021322.22570-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1657073794537100001 Content-Type: text/plain; charset="utf-8" This reverts commit 47281859f66bdab1974fb122cab2cbb4a1c9af7f. Signed-off-by: Akihiko Odaki Reviewed-by: Emanuele Giuseppe Esposito --- include/qemu/main-loop.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 5518845299d..0aa36a4f17e 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -280,23 +280,10 @@ bool qemu_mutex_iothread_locked(void); bool qemu_in_main_thread(void); =20 /* Mark and check that the function is part of the global state API. */ -#ifdef CONFIG_COCOA -/* - * When using the Cocoa UI, addRemovableDevicesMenuItems() is called from - * a thread different from the QEMU main thread and can not take the BQL, - * triggering this assertions in the block layer (commit 0439c5a462). - * As the Cocoa fix is not trivial, disable this assertion for the v7.0.0 - * release (when using Cocoa); we will restore it immediately after the - * release. - * This issue is tracked as https://gitlab.com/qemu-project/qemu/-/issues/= 926 - */ -#define GLOBAL_STATE_CODE() -#else #define GLOBAL_STATE_CODE() \ do { \ assert(qemu_in_main_thread()); \ } while (0) -#endif /* CONFIG_COCOA */ =20 /* Mark and check that the function is part of the I/O API. */ #define IO_CODE() \ --=20 2.32.1 (Apple Git-133) From nobody Sat May 18 04:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1657073996; cv=none; d=zohomail.com; s=zohoarc; b=ZD8j1+5RVN9zFDas2knW2oBuWKNJXIMDjb/CZ7IoSZKo+dSmxQA/kh+t9i5ucFBZ3i6m5kbhtLYKOS58SvrlTQU7Vtp70yBFCbwuJ/qWufFYur70vlnkE9+t9KndFkjzUPDT7ZP2eoKa9UG1rz/h/Cv878mdlr1vAFjrWydIq+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657073996; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=/xcB4yyz0VJorUBTxjUWCNnY98x9UBxEtC0Pp+MlP1I=; b=j2Wf0EdrBqKLD2k0Jk34rHrhKKwSMYGFgSv+wFK9Vh/1fyMpupvHdIw7SxYWvR0UWYLxKNSXptYHb/jebUCuCUJ5T7vUbdmJ7d2K4ZucYBanN7ZVXqFNZjTHPiwZs3tym1ytT85YGZrCJnJLKh0wWSOIR0wvZyEOMmbmYtkk1kc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657073996122488.6571594968582; Tue, 5 Jul 2022 19:19:56 -0700 (PDT) Received: from localhost ([::1]:35728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8udv-0005NF-0u for importer@patchew.org; Tue, 05 Jul 2022 22:19:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8uXr-000074-SM for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:39 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:37642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8uXq-0007jR-CO for qemu-devel@nongnu.org; Tue, 05 Jul 2022 22:13:39 -0400 Received: by mail-pj1-x1034.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so10467637pjm.2 for ; Tue, 05 Jul 2022 19:13:38 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id ij21-20020a170902ab5500b0016bedcced2fsm3334071plb.35.2022.07.05.19.13.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Jul 2022 19:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/xcB4yyz0VJorUBTxjUWCNnY98x9UBxEtC0Pp+MlP1I=; b=AZxlGUOmCDif+/hPvCJaqJaRyb7xe4FmPWWOa+Mj6QqA/K7EOBmE+MoXjGcNr3dF1u amKq/BRvi6/HXF5xyuL6pywwFJcqIVCvTvdKWVnuOpbjRFnfiJGteUhWsU0mOAT1h04O uGLNi4frE2KzVp20FhnChCjHs+BSVuHjmbF2Hz0UYGSwcfKrAe6okWdSP1pZQ3YbiYdI +irynJKYA/6Xw5bEF5CenNEZlDoR9n3iEJA99CwblXRwnggdR4CAmhXY7H+ViRoivVlo gh/7v6+c21Flt+slMkPo43L5Zn7Fg+7993tsVERlfvwgWjHc9sOPcKGJpcyYHDVqqBJJ BXHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/xcB4yyz0VJorUBTxjUWCNnY98x9UBxEtC0Pp+MlP1I=; b=Sdb1+r/ZAIkv3++kYO5nd5pXOtrNLSdeaP/cfPwqnDIV3GcwVcFWgtACcVMjSG67Tr /LzY11HKRqt/yNsrAJnSKeNzql5rvX35/OxQ4ESEZCILERfENoG7y6lXqctvOVlHg74a trE5KKxywLyE2uKv5KgBM3xmcMeP+SY07HASRbTzF9antm0QjCHbLHsB0rny8oSNYPss ogn85J8Ks+XOzinkFs73IsF6eVp9lOKzAxTjhRRL7+mifzWGrq16lubk/X0L/ECSljFX 3W1Wc+xI0OFzzXgB8sZVhHoL4bQDE0nqj37ZYODhdID1R+Qb3cZLmRlzesuObjk0NwWJ 0fgg== X-Gm-Message-State: AJIora8BY2Wd1lUxc48kauV+c/jxBx7JJ5A3q4ergZ4JU5tvDVOjbRyl 8CfpBWDx7XdpRpJ6wK5skYwbSXFrV/s= X-Google-Smtp-Source: AGRyM1s99vitAhLqUbemh3TWXXQUueSvqZQouh+lM0ggBg9pXVcnimF3TD/5R4rVt3P7HhvUbbPDcA== X-Received: by 2002:a17:90b:388e:b0:1ec:f6b6:f31f with SMTP id mu14-20020a17090b388e00b001ecf6b6f31fmr46432195pjb.181.1657073616690; Tue, 05 Jul 2022 19:13:36 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Peter Maydell , Paolo Bonzini , Gerd Hoffmann , Emanuele Giuseppe Esposito , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Akihiko Odaki Subject: [PATCH 3/3] meson: Allow to enable gtk and sdl while cocoa is enabled Date: Wed, 6 Jul 2022 11:13:22 +0900 Message-Id: <20220706021322.22570-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220706021322.22570-1-akihiko.odaki@gmail.com> References: <20220706021322.22570-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1657073997982100001 Content-Type: text/plain; charset="utf-8" As ui/cocoa does no longer override main(), ui/gtk and ui/sdl can be enabled even ui/cocoa is enabled. Signed-off-by: Akihiko Odaki --- meson.build | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 6e1c3eb2bc5..4714a0d5cf8 100644 --- a/meson.build +++ b/meson.build @@ -587,12 +587,6 @@ if get_option('attr').allowed() endif =20 cocoa =3D dependency('appleframeworks', modules: 'Cocoa', required: get_op= tion('cocoa')) -if cocoa.found() and get_option('sdl').enabled() - error('Cocoa and SDL cannot be enabled at the same time') -endif -if cocoa.found() and get_option('gtk').enabled() - error('Cocoa and GTK+ cannot be enabled at the same time') -endif =20 vmnet =3D dependency('appleframeworks', modules: 'vmnet', required: get_op= tion('vmnet')) if vmnet.found() and not cc.has_header_symbol('vmnet/vmnet.h', @@ -919,7 +913,7 @@ if not get_option('brlapi').auto() or have_system endif =20 sdl =3D not_found -if not get_option('sdl').auto() or (have_system and not cocoa.found()) +if not get_option('sdl').auto() or have_system sdl =3D dependency('sdl2', required: get_option('sdl'), kwargs: static_k= wargs) sdl_image =3D not_found endif @@ -1185,7 +1179,7 @@ endif gtk =3D not_found gtkx11 =3D not_found vte =3D not_found -if not get_option('gtk').auto() or (have_system and not cocoa.found()) +if not get_option('gtk').auto() or have_system gtk =3D dependency('gtk+-3.0', version: '>=3D3.22.0', method: 'pkg-config', required: get_option('gtk'), --=20 2.32.1 (Apple Git-133)