From nobody Sat May 18 06:31:18 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=1657893006; cv=none; d=zohomail.com; s=zohoarc; b=nw4WwCDdLgO1mCyAWUBV7ruZAp5o0OIM815YVB2tilEOnPsq07wl5nfd/71hbw2vEuakS3xqfgQcv/Q22ILTTJwYWRZ+c58Rk7SW5L59FTeG93PoKv1I1EGJd1KJFi7k2V9y3QptiI311iz3A7we4igoTO0kppahLGrSXIiOJe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657893006; 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=ILRCxESwXw2motCxjKzehf6XocAbEsaLvlxWm72l6J8=; b=iU9XwBQd9JSaycWyOr7jcXM8cgj4Kd5e4pghk/OINWd+pfUsuBdtMNgdv9oiK+V3uIuHmmvKlmydee08d2SxjuN18tGwJNEIn8xUccKa8YN3qYd9PnwVGsaZ3OFC0C/cPVp72FT57X+pQ6NtjGsv6mcmuADMG8xdtbbOTiCcre4= 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 1657893006814719.3206809692318; Fri, 15 Jul 2022 06:50:06 -0700 (PDT) Received: from localhost ([::1]:39710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCLhl-0002Vf-MI for importer@patchew.org; Fri, 15 Jul 2022 09:50:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCLgN-0000Pp-Jv for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:39 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:43835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCLgL-0006t6-8g for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:39 -0400 Received: by mail-pj1-x102b.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so6138778pjf.2 for ; Fri, 15 Jul 2022 06:48:36 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:d554:ffbd:f962:2efd]) by smtp.gmail.com with ESMTPSA id x22-20020a17090a165600b001f035bfcc53sm5579126pje.18.2022.07.15.06.48.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Jul 2022 06:48:34 -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=ILRCxESwXw2motCxjKzehf6XocAbEsaLvlxWm72l6J8=; b=GArfDDb3w/hFoAah4fb4KfymQuqpJTMNNOD/D1VV0A0LPInfVfgwFVueIoU0JRgJic Hll3Bi+PALey03Ilp1mMfZGkJQJW8RBIIaUWq74BXLtFtS44jn/BSAb4A98adbBpe5yB nXRrIbhWcHPXzpSq39PH+yWP1Mt6m+1/oJ2W9FDyUhWrBvGzn/nZxWXyvSkV1kDgQL6v xK50a+TY145DU7H+6nr54ZlBAIIFM7zG4B4s76m/CRwG0LHgZo8bdh/32p2irYALPXs5 dOehclaVWMJ5N+YaJlJM56+UEKWitf0ZH1C6RC54ttr4S8VuvV7mevCEFaaeDEekRuzM lQXw== 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=ILRCxESwXw2motCxjKzehf6XocAbEsaLvlxWm72l6J8=; b=vvp5bYfb5hmf+xAaw5Ot0gPYAX8m1XdyJ4KU8hul0xaSJAkAu9tic1l56hv0IKw1rc VIAgSfjEKlmRA2aAXgVA/UOdJt6u1hboadcx9GvYSFS1mUt3NfGJrkITg7/i4lign5fz y5/z60UDAYK1KXGRpGaReHqB2cjGesSJsAgAltV5kJ228hjt9RBkdRJBubYb9PTP+ruO kA+iS21Zwdx5jUjlo+8A3Ht/yuHgGGaIPfZR1cnn4XfQSxpqO8oo0a6udL6Rswrlhk2u pMEqzGePgh1zjpwi72gqHcV9+RECMCp/UyPCnv98PSKv17IraB1Rc+cZEnuEnbwMaqRN Jt5g== X-Gm-Message-State: AJIora98C7Y8UON9j+9RzFV5RAZX/ajuNzfT/mvoPYQ2ygPbR+IipM6t WPDQWA6tJbXLylW4bx/OQKBXhcgCR84= X-Google-Smtp-Source: AGRyM1uWf6+Ifjmf2cABq6G2C7aA68XW76pYidkypU00e/mjrrRQxZZQBmf6lT0ge+wVB75Mk6CU5g== X-Received: by 2002:a17:90b:3b43:b0:1ef:d89b:3454 with SMTP id ot3-20020a17090b3b4300b001efd89b3454mr22150128pjb.87.1657892915464; Fri, 15 Jul 2022 06:48:35 -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 v3 1/3] ui/cocoa: Run qemu_init in the main thread Date: Fri, 15 Jul 2022 22:47:48 +0900 Message-Id: <20220715134750.63090-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220715134750.63090-1-akihiko.odaki@gmail.com> References: <20220715134750.63090-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: 1657893010703100005 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 | 172 +++++++++++++++------------------------- 7 files changed, 76 insertions(+), 123 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 0ad4ba9e94d..678c312923a 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -236,7 +236,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..c181d8d2fb3 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -100,13 +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; =20 static NSInteger cbchangecount =3D -1; @@ -585,7 +583,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. @@ -778,16 +776,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]; }); @@ -1283,8 +1271,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 @@ -1292,16 +1278,13 @@ - (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 +1296,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 +1898,42 @@ 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; - - 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; - - 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); + [NSApp terminate:nil]; =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(); + 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 +2012,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 +2067,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 06:31:18 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=1657893006; cv=none; d=zohomail.com; s=zohoarc; b=UHcXLcSr/6F0kanDstMZENkpJaOyVs+fhzGql6sCC7eJFoNdWiQ/jJ6874sCxaJCTs8c9A7XottA8Ua7Lj91Oee5+ArknJfMulH6UmcBw4azMlfHAfal7VnvwK6+pFwaQDhTZbe2nNta5j/56t/M5//GCr37BNGcwJARN7rnHCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657893006; 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=ylb4woiWl7rRdOJRD6I0pk2qnNC5s/O1KGQ+3BsXcPM=; b=IAmTasnGg+fchnWp2AdfaF6GF66vyeU1C4iEuYqvM3lvS/1zq70GExceL68DnXzoR0JuETKY4tarEiJjdlJY44e3u+ogzZdcfk19bg7CTKi4RXyhdHQ9Mt7WgAdURZCPg8MpF5whtH/h08cU/37/dGf3SZ4cq+GBjL0OvLakawk= 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 165789300635345.115277031666665; Fri, 15 Jul 2022 06:50:06 -0700 (PDT) Received: from localhost ([::1]:39728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCLhl-0002WW-7g for importer@patchew.org; Fri, 15 Jul 2022 09:50:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCLgP-0000To-OK for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:41 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:39785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCLgO-0006u1-2F for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:41 -0400 Received: by mail-pg1-x52a.google.com with SMTP id q16so1352002pgq.6 for ; Fri, 15 Jul 2022 06:48:39 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:d554:ffbd:f962:2efd]) by smtp.gmail.com with ESMTPSA id x22-20020a17090a165600b001f035bfcc53sm5579126pje.18.2022.07.15.06.48.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Jul 2022 06:48:37 -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=ylb4woiWl7rRdOJRD6I0pk2qnNC5s/O1KGQ+3BsXcPM=; b=m1m9TqU1bLwixnbSjGQt3k1V6m75kmNDq6ipDEgMZ9mdT4V9kQ1Up3i1n4OdN+IfyR VLUecg0XNshayVLKbtw+rNCxcGKbHKzw1c1tYHDNNfbMK2R+gc3/rhmVaAYxXDku7/d+ g+D+Nn5KsBH6WGZawu0+cvHo8YdatkjbOlaxV13D5Bxw+XGxQ2JPHetfs8aro+4lL080 BcRN9E+ourA5tTuQvci/Hqf/N3Udr5R7as01vaI/bj8+rk4O1Xdju65qzvKDmlgwrWQN OSLIYjmekFzM2OVvpdoHoo1TRKwoiwTggOdz8e+zXha6faC6nD/uc5vicXIE1c6yjub/ jVpA== 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=ylb4woiWl7rRdOJRD6I0pk2qnNC5s/O1KGQ+3BsXcPM=; b=K1j/Us/pqAMcVPmb6SK9OSdFjzGe56XAMgd9GiDvmL7dLB81IcYCpQGoUD2pKyimdq cGv4kyl1NJFI4Zs6fxCF/Lmw9XTlHcxQ2IctUcPWxxtdCMZnRI8C+6CkGRmRI3NBhgeE xQbHRBrftrWtnYXiRVqciT4y72hUNdJyiC242Y2BM6Dg7zGEDF+CQ0YN0DM5j9h2z248 Qk94x4VnezTACXP6NbYwR3PzeIoMSQvNtd0S45U2kwnlvTC7uPJM/yU0G+hndzwuuuIL dGPLRM+n5KvvLGLFULPc87+dipuWE0CKxYOJ9zt2ugw9RrnnYnJmoYvA+ERvX1o3QYtY Y7NQ== X-Gm-Message-State: AJIora+bXCuSX8ILyjuPBSZ1gRyaPduUF9or7uODy4fncNVGx3vN7K5E 4GarMFs2+ed5BD1V1b1OQv+ob/oppQA= X-Google-Smtp-Source: AGRyM1slvqB1ALnPH9qMgCEyt0UQJDmbjyMYZACqOHN5M2H2CSFrxV79u9za+qU+8JQBM2RUK+OwOQ== X-Received: by 2002:a62:542:0:b0:525:a313:fe28 with SMTP id 63-20020a620542000000b00525a313fe28mr13910056pff.73.1657892918211; Fri, 15 Jul 2022 06:48:38 -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 v3 2/3] Revert "main-loop: Disable block backend global state assertion on Cocoa" Date: Fri, 15 Jul 2022 22:47:49 +0900 Message-Id: <20220715134750.63090-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220715134750.63090-1-akihiko.odaki@gmail.com> References: <20220715134750.63090-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::52a; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52a.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: 1657893008613100003 Content-Type: text/plain; charset="utf-8" This reverts commit 47281859f66bdab1974fb122cab2cbb4a1c9af7f. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- 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 06:31:18 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=1657893148; cv=none; d=zohomail.com; s=zohoarc; b=mnRkSTjXYlNRKuWdEvtKSfN1jnwTOYddHF3syQIFmLN5wcm7oxs6wy9AdEpPJQ68zhDfOFd2eHbF41S79AIZhjrKnCxpTUQw3N+ua9oFFHa63s51CHMro5hSHqG6ea7gaqZk1K8zur+wYJiqYshTdk+W7poWXg6AUFohz+5tUUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657893148; 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=zJST1JlzrBFRfYOJJKYdNOjdYpGZW6q5WVfQSu/8SsM=; b=Z3JVlpbfFWytHsxAzJyu1n68MV/UJGE18T9LWzNoSQxMWtydVOlBk/LRWYYkjylTfXsw59YBPxYtVyLwjNtwOLBVz1eadt3mDwksqIYTn4pOidQ52BMqql5WrIX/HA2WtqKToaw15tdwKbfZ3oIXQ+XdIw2dzCCqST3I0ZZeHcA= 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 1657893148916884.7004210411168; Fri, 15 Jul 2022 06:52:28 -0700 (PDT) Received: from localhost ([::1]:43804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCLk3-0005M7-TK for importer@patchew.org; Fri, 15 Jul 2022 09:52:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCLgR-0000a2-Vr for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:44 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:42829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCLgQ-0006ue-Ix for qemu-devel@nongnu.org; Fri, 15 Jul 2022 09:48:43 -0400 Received: by mail-pl1-x631.google.com with SMTP id 5so3275805plk.9 for ; Fri, 15 Jul 2022 06:48:42 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c360:8200:d554:ffbd:f962:2efd]) by smtp.gmail.com with ESMTPSA id x22-20020a17090a165600b001f035bfcc53sm5579126pje.18.2022.07.15.06.48.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Jul 2022 06:48:40 -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=zJST1JlzrBFRfYOJJKYdNOjdYpGZW6q5WVfQSu/8SsM=; b=VUYn5pkiSOAR6r52O+vBqb0sH+aaHoUhKFrLfVB+LXuJO98u6DxyMPR9ptHmSUm4TP +AEcBMZRKxLJtdUw3GIE6qsonxUZUpdL4CPteEzKuOYKODgAv73Vk9F9kgXyxu8m3xI9 6Q1Dr9kS/gop1Y86qTwxvRVKBgzldtBqDXbrd+C1Tk/r0oAK/Irz/WPsWXbGX39S9PYQ DXv9RNMcfGtQVHdTA8JnrT1C2WQJZXBnQzCSEJqwALhJCqN6cG85rWwX2PbIuEuUo+Q+ 8oY4eVVYaR2D007Sxxni52RDIIvys7AkJUglWwiAk+9tNSH7an0EakSBPZDdOBxE9aJP vjhw== 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=zJST1JlzrBFRfYOJJKYdNOjdYpGZW6q5WVfQSu/8SsM=; b=bdDYjwhQGh1/cyMN58LbkubJFCNZ4IGZ6Qo93HbyQaLoaWk7+SHFvZLwMRHLQ3DIry LXCMC1PrymdbAbKA8COyPIF8Jvqcar6pzgfI5ST9PIZlvCbqBs3EJp4ZmVxZjFBziIHB SSoc8p9zesBy8gv/y7raH4JPrHYibTzxJj2SuyHbZWmaG0gI/VUBCLrgxZj9mcOq3o7b dPTg4FxJzG4YGZyKD01QE78nkOjtFlp1PxXqa+mcvKxj4kioWXvgRbEZ6a/bVppl8MUu lMrFSQgyIHFGavxxJ59hKtVYxRSl0cr/fClvj0hWJzA29RFjfQ7iQpxB/jIew628nW0t +hQQ== X-Gm-Message-State: AJIora/0TFrhTHwSynoq0dSdCassi+OMpWokOIMNZFbTwa0iqppLHVYd oFnmpDYAp3cuain0tWOtoehb3SES0/M= X-Google-Smtp-Source: AGRyM1txr8wv7c1Vrx/NQr3dyPgltNCam9fP1pXyYDQZiOxfkaK5THueokD5vqV74I2g2SfpRVtA0A== X-Received: by 2002:a17:90b:1c87:b0:1ef:1e29:8a93 with SMTP id oo7-20020a17090b1c8700b001ef1e298a93mr21991504pjb.179.1657892920912; Fri, 15 Jul 2022 06:48:40 -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 v3 3/3] meson: Allow to enable gtk and sdl while cocoa is enabled Date: Fri, 15 Jul 2022 22:47:50 +0900 Message-Id: <20220715134750.63090-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220715134750.63090-1-akihiko.odaki@gmail.com> References: <20220715134750.63090-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::631; envelope-from=akihiko.odaki@gmail.com; helo=mail-pl1-x631.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: 1657893155647100001 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 --- meson.build | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index bc5569ace15..7baec7896ef 100644 --- a/meson.build +++ b/meson.build @@ -583,12 +583,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', @@ -915,7 +909,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 @@ -1181,7 +1175,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)