From nobody Sun Apr 28 18:54:07 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=1660915879; cv=none; d=zohomail.com; s=zohoarc; b=ke2hPtNhjJd0nblIMASzdy68H/AkXshlnpBDx2YvWeaSawalDUP5eOapnikIEsM4iagByjZFE62IPzrB8hexVUwd039mWgNDm289FWuFSwb5rZhga2Nl/+hXyR6/geEL8QZlqEoOOoG3YIfbk6HRUxEyvDe+yXYWfPY+EhieBsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660915879; 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=MsHOELyL41xuCPGT0vkMOuAjHxEfl1oFU7luhqMaWPU=; b=n4xjXQOuGvNQJ5vu6sUMDn5Q10VU+q7gYhEFbHbd3JUu9CXh+ebUsGPl5Rj2m3p5nTsIbGb7p4Wjg/BuFJA5O1LH2giGd18OjAKOMGHxlc+VhLL3xRyABwGA4bxQcQTDDV/IrDTkFxcD+9uJF9nQ+qBDYSf1zeeCfWrdbTbqubM= 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 1660915879361829.022305064985; Fri, 19 Aug 2022 06:31:19 -0700 (PDT) Received: from localhost ([::1]:46330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP25l-0006pu-M1 for importer@patchew.org; Fri, 19 Aug 2022 09:31:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP22r-0004gP-VO for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:17 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:37478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP22p-0001zV-NS for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:17 -0400 Received: by mail-pg1-x52f.google.com with SMTP id bh13so3711523pgb.4 for ; Fri, 19 Aug 2022 06:28:15 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:c4c3:cfa3:24fd:3a7]) by smtp.gmail.com with ESMTPSA id p4-20020a1709026b8400b0016edb59f670sm3195005plk.6.2022.08.19.06.28.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 Aug 2022 06:28:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MsHOELyL41xuCPGT0vkMOuAjHxEfl1oFU7luhqMaWPU=; b=GPOcZZbZEa7ZnKL69r0E7hQbHMU7iHCQR0h07pjRo2/MDNds+WktVeFULfddJ5SuLn yU8tGXjr7c9Ys8+n6O3SRikNHsiGLc+54L00diuA7Q4y8OZHTd4Bx4hqYr9ibEyHztmu vfS7101NwgZ+5DnkfxMHsCmGaAJ84265MD0XvTx/2iRU/hino/uxNIL1rN4ZSEUsVQjh yLDVS5IY6/I30cwwYPIPJxoO7m4uCjrxPwSsIBe7qQMbBJluCs66PUX12r5v5L58DWPm CroHbm9fmJCp5WFfGejco4Svl3wJnSFqhLG9KIDYkqA3x1wf7yDMhAeS+IDBH4JqVqQU uEjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MsHOELyL41xuCPGT0vkMOuAjHxEfl1oFU7luhqMaWPU=; b=DuqHofeD6tZfEyltpDaST5zX71cb1J4BTvKcOjk9FUSX8FsmkVk6YXqrUkeU2ondYS Dk6eJFbWUo/iIE9G4M40TLIUs0/r/2Z5znuzT3UA8ROPI4tO17sjEz7nQj0Xtxm1hIA5 27+maZX1hgqani6X3sMN7QhrZx92mTa8FwQJlGeb0MHyWeJdbyqOL4TQGZUVD/aYiaz2 z7Z6HUyBp6aXzK7W82KDfpaF9VaFzXS7YVd+ycP5IsPDuwCdrJjCPCjAHu1ckTx1j1zS bahcc2Q0+AfI1UAAKZsjfxFUjVzKavT5aCgYV43orAx2nU3E2h5mxxq+rbCkjT0TPJqi Js7g== X-Gm-Message-State: ACgBeo0JLEOeEyyLpK6SgWKONcS9/4v7zbp6BSpD45nK7IJ3r9NCoMaX 96ZCMretYG5/Ao7QrecWB81qi1/1iiU= X-Google-Smtp-Source: AA6agR7f7ajOq8rdDzp359pUG5mkD09bV4utIJRUUt1GLZQunRNf/2ZapyRNeLJDdxV4f9Ctfjihzw== X-Received: by 2002:a63:8143:0:b0:42a:3ec3:3b56 with SMTP id t64-20020a638143000000b0042a3ec33b56mr2394595pgd.146.1660915693911; Fri, 19 Aug 2022 06:28:13 -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 v5 1/3] ui/cocoa: Run qemu_init in the main thread Date: Fri, 19 Aug 2022 22:27:54 +0900 Message-Id: <20220819132756.74641-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220819132756.74641-1-akihiko.odaki@gmail.com> References: <20220819132756.74641-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::52f; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: 1660915880121100001 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 | 10 +-- softmmu/vl.c | 2 +- tests/qtest/fuzz/fuzz.c | 2 +- ui/cocoa.m | 144 ++++++++++++++-------------------------- 7 files changed, 62 insertions(+), 105 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..940960a7dbc 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); +int qemu_default_main(void); +extern int (*qemu_main)(void); =20 #endif /* QEMU_MAIN_H */ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 31aa45160be..6a7a31e64de 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); int qemu_main_loop(void); void qemu_cleanup(void); =20 diff --git a/softmmu/main.c b/softmmu/main.c index 1b675a8c036..694388bd7f7 100644 --- a/softmmu/main.c +++ b/softmmu/main.c @@ -30,20 +30,20 @@ #include #endif =20 -int qemu_main(int argc, char **argv, char **envp) +int qemu_default_main(void) { int status; =20 - qemu_init(argc, argv, envp); status =3D qemu_main_loop(); qemu_cleanup(); =20 return status; } =20 -#ifndef CONFIG_COCOA +int (*qemu_main)(void) =3D qemu_default_main; + int main(int argc, char **argv) { - return qemu_main(argc, argv, NULL); + qemu_init(argc, argv); + return qemu_main(); } -#endif diff --git a/softmmu/vl.c b/softmmu/vl.c index 706bd7cff79..204b0cd944b 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2603,7 +2603,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 2b3bc1fb9df..eb7520544b8 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -218,7 +218,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 5a8bd5dd84e..660d3e09356 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -100,13 +100,9 @@ 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 bool stretch_video; static NSTextField *pauseLabel; =20 -static QemuSemaphore display_init_sem; -static QemuSemaphore app_started_sem; static bool allow_events; =20 static NSInteger cbchangecount =3D -1; @@ -597,7 +593,7 @@ - (void) updateUIInfo /* * 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. + * layer. * 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. @@ -790,16 +786,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]; }); @@ -1287,8 +1273,6 @@ - (void)applicationDidFinishLaunching: (NSNotificatio= n *) note { COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n"); allow_events =3D true; - /* Tell cocoa_display_init to proceed */ - qemu_sem_post(&app_started_sem); } =20 - (void)applicationWillTerminate:(NSNotification *)aNotification @@ -1919,92 +1903,45 @@ 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: + * need to start a second thread which runs the qemu_default_main(): * 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. + * in cocoa_display_init(): + * assign cocoa_main to qemu_main + * create application, menus, etc + * in cocoa_main(): + * create qemu-main thread + * enter OSX run loop */ =20 static void *call_qemu_main(void *opaque) { int status; =20 - 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(); + status =3D qemu_default_main(); + qemu_mutex_unlock_iothread(); + COCOA_DEBUG("Second thread: qemu_default_main() returned, exiting\n"); [cbowner release]; exit(status); } =20 -int main (int argc, char **argv) { +static int cocoa_main() +{ QemuThread thread; =20 - COCOA_DEBUG("Entered main()\n"); - gArgc =3D argc; - gArgv =3D argv; - - qemu_sem_init(&display_init_sem, 0); - qemu_sem_init(&app_started_sem, 0); + COCOA_DEBUG("Entered %s()\n", __func__); =20 + qemu_mutex_unlock_iothread(); qemu_thread_create(&thread, "qemu_main", call_qemu_main, NULL, QEMU_THREAD_DETACHED); =20 - 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(); - - /* - * 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 *appController =3D [[QemuCocoaAppController all= oc] init]; - [NSApp setDelegate:appController]; - // 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"); + COCOA_DEBUG("Main thread: left OSX run loop, which should never happen= \n"); =20 - [appController release]; - [pool release]; - - return 0; + abort(); } =20 =20 @@ -2083,25 +2020,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) { @@ -2121,6 +2075,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 Sun Apr 28 18:54:07 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=1660916080; cv=none; d=zohomail.com; s=zohoarc; b=nV+ullFmzLkCEzPI3WdUCbGYs6vYnYZG3MY1tq3AChlDdoKK1Xxj3TvJExeZHbanfB1kL2aJhCGFxatZEZXEfFv0p24ug8t/42J32IJ6fyjvujfMXpKJJCUKUYCVpGvaLe0mGUDmO5+gOJYBZ2N3gpAYZmGEgV4h4zsrHSdgKOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660916080; 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=PNJRJesXZZQqJUbxS87KqUPXjO+p3EmWgOG4tm1aKkY=; b=XiZnS0/zsUIySASnY+IPHtTHpy/EYeN3e2NTJ2uOOthw5urtJXJj6QFKT8/8bBkrCBJc1BcE7VBdU/yeky7xnDNSBZjxPfe0jVF07aRC5zw2J6TgMAB0XBXLvjaVk4eFlwU6BfG4NiHYpWxYH08QELagaaZzI/ij5esKtUS3y1U= 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 1660916080804923.5566033592031; Fri, 19 Aug 2022 06:34:40 -0700 (PDT) Received: from localhost ([::1]:51074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP291-0003k4-Hw for importer@patchew.org; Fri, 19 Aug 2022 09:34:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP22u-0004i1-Oj for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:20 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:36485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP22t-0001zi-0U for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:20 -0400 Received: by mail-pj1-x102b.google.com with SMTP id r14-20020a17090a4dce00b001faa76931beso7546752pjl.1 for ; Fri, 19 Aug 2022 06:28:18 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:c4c3:cfa3:24fd:3a7]) by smtp.gmail.com with ESMTPSA id p4-20020a1709026b8400b0016edb59f670sm3195005plk.6.2022.08.19.06.28.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 Aug 2022 06:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=PNJRJesXZZQqJUbxS87KqUPXjO+p3EmWgOG4tm1aKkY=; b=pkFNZwOHehc/he3NZB0IPqFONEUfxekKCtt/7ye/dQQ3lLb9gHyQwr5rHMYOZpEtyE 0nEzcEd+LDAb1k95t2ZA6za6tpfmtyUPt/Aq1GoxlYUG29r91nOxi5eT8gjlWYCGaUKf /vsA7kYo7CyHBA21HA8iSPuAYyCKFBbVl4K2H2yIkxGLffOy81kNyO9R1ECSTt6Eepn7 C0pyOXym6p+F9xVVdjWkN+CmpNebs/4MlnLDKCaMegRqQJs31cs5mPP5P9NkXdfch4Rt EGdIgGX6h8NHoz94RTRq6b1QU1M/DNHp3GExaNi5gpyeKprOZ8nevtWtVG5WhlxJsIAD QaBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=PNJRJesXZZQqJUbxS87KqUPXjO+p3EmWgOG4tm1aKkY=; b=zhgveGznydrKffavqvKbLMrN/vd78Bft+RJ+UMnOJkRyNi1q6InivV++03rdnXTyU/ tuEUlQlPr1XHVE7hggURHme9HVg+mnoppoIl8Zvf1d2S50BYOaGxbdHrrWJjB0YxPrs2 vFlJTKzz7H7vGKAdJURF0WkIEoUuHfvOCoujap+jyoze0w6GmWrfVfsoTQIXe+ZnC60w PtfUDI7+SnjTChMeBLC2Q37Fsq9ZB3LGND+fc6Gg4SveGsRZPj14d5FWX0GNjWEOgzs5 F0qOwC8tBPqmf1UD/B3UUbMSzVtAt2m7FpEhiNp2jZbIxhzppZusg+ZJ/dGSWEUHtvTl vVkw== X-Gm-Message-State: ACgBeo3gk0h2O8NwUV4j+e7Xv7NMuqXVwKZr6zBjMbwQqnJQ6r0KXMS2 z+TMhv2isOlDKd5hHh/mTDj9RFw3tl8= X-Google-Smtp-Source: AA6agR7U2FJQFVp0M/EhXZIhVQcICOvVASsLd7bThn1nJWdMC1CzRAZlm96EH6+uT2qY3SnNqChHmA== X-Received: by 2002:a17:902:ef50:b0:170:9f15:b998 with SMTP id e16-20020a170902ef5000b001709f15b998mr7386591plx.102.1660915697248; Fri, 19 Aug 2022 06:28:17 -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 v5 2/3] Revert "main-loop: Disable block backend global state assertion on Cocoa" Date: Fri, 19 Aug 2022 22:27:55 +0900 Message-Id: <20220819132756.74641-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220819132756.74641-1-akihiko.odaki@gmail.com> References: <20220819132756.74641-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::102b; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: 1660916081314100001 Content-Type: text/plain; charset="utf-8" This reverts commit 47281859f66bdab1974fb122cab2cbb4a1c9af7f. Signed-off-by: Akihiko Odaki Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Peter Maydell Reviewed-by: Paolo Bonzini --- 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 c50d1b7e3ab..aac707d073a 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -284,23 +284,10 @@ bool qemu_in_main_thread(void); * Please refer to include/block/block-global-state.h for more * information about GS 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. --=20 2.32.1 (Apple Git-133) From nobody Sun Apr 28 18:54:07 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=1660915897; cv=none; d=zohomail.com; s=zohoarc; b=CvFEA+u0qX97HA1Q196yoTG9aLVDTl/l1JCTEg3Q/7leAlhJzn3TpjRovVcFEyDV7VlK2ERvgSzmjt7+VOQ9JY27PxhIHwKtfQBniNvB6HGa77ALseZ+TxxD/24oXdIxdx7mganWuC9KK49aJoLBaFXv8Um3qEyyg8+i4HkReDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660915897; 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=MPQW4Rnem4KMReYwXiEy55PhYSsQ/M3unNrHvLUzwfA=; b=EXn6pAAdvpUbc423H5v0quSp1VLNCj0KpQaOsQamZs8LYEjRAOucnbOzBURc/ApM6P3Y56Z/t/oMO+Mxg46c1kElubEemMRR9yAvpQesFn2gNoVIBUGszhOkNA2RfyayrxTmhTTiBYjB6q6UCYtZe9jpZRXwpy1E+y/RrBWC/Do= 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 1660915897023417.5315151176037; Fri, 19 Aug 2022 06:31:37 -0700 (PDT) Received: from localhost ([::1]:33834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oP25z-0007SD-8e for importer@patchew.org; Fri, 19 Aug 2022 09:31:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oP22x-0004nv-TE for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:23 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:41571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oP22w-0001zt-AX for qemu-devel@nongnu.org; Fri, 19 Aug 2022 09:28:23 -0400 Received: by mail-pj1-x1032.google.com with SMTP id t2-20020a17090a4e4200b001f21572f3a4so4910951pjl.0 for ; Fri, 19 Aug 2022 06:28:21 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:c4c3:cfa3:24fd:3a7]) by smtp.gmail.com with ESMTPSA id p4-20020a1709026b8400b0016edb59f670sm3195005plk.6.2022.08.19.06.28.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 Aug 2022 06:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MPQW4Rnem4KMReYwXiEy55PhYSsQ/M3unNrHvLUzwfA=; b=TUml19oXwiREqzt7pFgdB8eacU4HUzHtxk+4APzqCZK9K10wuxzEHolNTwlwUoq4Ez jzx6BT7JcbgsSGMzk3wi3v/2hoODqfm/12n9NZyWBGt7KtXrE7RtPx6tH4VVRB/xHpe8 ZEzaIuHRFtdS//LIADr1N7gNLB541GQr9et0Ioo4ld+FAWx4a3wQhiHGp//U9Nl0YZ9k 9msBV/hXRyuIIBxQhcBxFhes9NHrm0FtREiRTvGAp/zBzMaJerhD7gFE/ZYeZQSjwwDw p824JUVc+Y8w55YHSnhmb7Y7FdIQAjSw90I+8BcYZlbo7rQQC9ERnDZB8yfZ9uPKB0Js WyPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MPQW4Rnem4KMReYwXiEy55PhYSsQ/M3unNrHvLUzwfA=; b=X+IrJUGLJ4KtKLVThvsqeyQQf/f2u7B/rGb5LSK8AP7ZyhusXgILo3iLVLbJaDBjDd Mc4gjd/CcxHP6Ah3fKcjbJDAQesupUIzc/QltZnttkXFYwz/7G+Rjq6kLqITwxjLge7w 5krs+NzDUi1EPQ9RbH4PlqT8aNwC1LgR6aK5tPMwqwjlkoBmOAxxfIRPl9EVp658UDfp Ql1pNwHlBFJMTN0DvSQHKEFtI6nNclKyl60AC7frf8NsHYfhzYdLB8OBSifS1oS2A7Sz 0hGiqj+Dy5qTgP6uB3ra7mIncNXSJUzDcbk+Vpht8R01J6ptggqEnXvqVTRh8IAYUJx9 CtAg== X-Gm-Message-State: ACgBeo1DBGnhIBHlW3RvSDcHJuExVxwJcuG0QzOVm6JcptZdZWkfvoCP RoRCfj+qS8GyUZtMx2no7h+s3gRei0c= X-Google-Smtp-Source: AA6agR7O30pC3TZVtxGOfLRcZlAoYCVv827KkXN0s8PFYXB1/fMl7QdTTNsUVbpx65L5nzwnwFTVOA== X-Received: by 2002:a17:902:dac7:b0:16f:13c6:938d with SMTP id q7-20020a170902dac700b0016f13c6938dmr7533051plx.11.1660915700630; Fri, 19 Aug 2022 06:28:20 -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 v5 3/3] meson: Allow to enable gtk and sdl while cocoa is enabled Date: Fri, 19 Aug 2022 22:27:56 +0900 Message-Id: <20220819132756.74641-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220819132756.74641-1-akihiko.odaki@gmail.com> References: <20220819132756.74641-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::1032; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: 1660915898042100002 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 Reviewed-by: Peter Maydell Reviewed-by: Paolo Bonzini --- meson.build | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 20fddbd707c..48b6c22aab7 100644 --- a/meson.build +++ b/meson.build @@ -589,12 +589,6 @@ endif =20 cocoa =3D dependency('appleframeworks', modules: ['Cocoa', 'CoreVideo'], required: get_option('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', @@ -921,7 +915,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 @@ -1187,7 +1181,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)