From patchwork Thu Jun 15 13:33:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Butsykin X-Patchwork-Id: 9788891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F97B60384 for ; Thu, 15 Jun 2017 13:36:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F010A28517 for ; Thu, 15 Jun 2017 13:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4B1D28622; Thu, 15 Jun 2017 13:36:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00F3B28517 for ; Thu, 15 Jun 2017 13:36:16 +0000 (UTC) Received: from localhost ([::1]:54120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLUwZ-0002Rf-9Q for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Jun 2017 09:36:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLUvK-0001ws-L5 for qemu-devel@nongnu.org; Thu, 15 Jun 2017 09:35:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLUvG-0000nC-6x for qemu-devel@nongnu.org; Thu, 15 Jun 2017 09:34:58 -0400 Received: from mail-eopbgr00111.outbound.protection.outlook.com ([40.107.0.111]:53168 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLUvA-0000lT-DY; Thu, 15 Jun 2017 09:34:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GOPtx5VYaYPoeM8cyjligZsq4CdUS5nxoIzMA66NRa8=; b=OZKcVEyBguDxdaZe48SpFEDq5RVgviC2zBIOsV7anaBcS61zi2SBp1xT6cij/oR995KWwJ6eP2opMJXUgyTbKyR/1hyUx1PL9fmRbnzefbJjEyAfUtm2jUFd8hIWpenByKZ7sPchdFbTtCntVa6AwY1x1whV+E3HTy3fQTF+e5k= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from [172.16.25.50] (195.214.232.6) by VI1PR0802MB2560.eurprd08.prod.outlook.com (2603:10a6:800:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Thu, 15 Jun 2017 13:34:38 +0000 To: Kevin Wolf References: <20170522135704.842-1-stefanha@redhat.com> <20170522135704.842-4-stefanha@redhat.com> <99f414f1-7a0f-b659-be81-d6f38fd04ff4@virtuozzo.com> <20170614144324.GA4785@noname.redhat.com> From: Pavel Butsykin Message-ID: Date: Thu, 15 Jun 2017 16:33:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170614144324.GA4785@noname.redhat.com> Content-Language: en-US X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: SG2PR06CA0174.apcprd06.prod.outlook.com (2603:1096:1:1e::28) To VI1PR0802MB2560.eurprd08.prod.outlook.com (2603:10a6:800:ae::10) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0802MB2560: X-MS-Office365-Filtering-Correlation-Id: ac4de4b2-c6cd-4b50-ec66-08d4b3f348b9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR0802MB2560; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2560; 3:jkFyInfcbJQwaCNLCV35pHZBHC/zA1/qU1NujvhLSVw7u5QPkeI7UqMjffjcrqf9I8zEf1uOaB5R8v3eW8jSbuHMXSRM8TFOMsNNN40izQwCTt7NxkWmR4A/g7XdJsuME/RniiSTmGc4iFQZkhFNGQ86JaBT0uofpNJ91NcD/1u6CZDjYAK/3uQIa18f+imd2DtlE6IVJGyPMqHXD+pCWISUSH2cAZn3LA5+snd16hdrJNEyAQL8qLOXEGwOF1fvpUr2nLAajD3nRp1Htd1FzslrG96hd/csJalmvLRDPCyvJ8RJNKJC7ENThG1Jy1InjJ0q/Z3RQdYCiScbW9l85g==; 25:8s/UzPFawgIA6ztaEhZ517WAWLE3l+mEEckvprImHyiJG3L3hbEf3d74BH1jZChAYTub4trywptfBLmeLkpfW6kn45ZOoyCvdUyxAKTeN0TiDu0WMqG2ybHovSviok9rKEW92CgPYhuo+m+N1EhHHT0Qr+Q28/+CC47hUhmQqkn0lES18ssZpD7/4ZGVoSEm4BK6qGECMB9IVcLDuZaj3EiuY3tMrlXiiXWI1EIFYj/lkUD4Z11xo5ZLwXCn+VjQ4SggKtx+IXQWX42Di/ylLjkyO4zCexp43Xv98RPenIprOGaRfme9UbJf6lnz9NBMTQshJdd5QQE+4gdk4VAGE8lIQ8jbMbcv9THNIN/elazFoXl+VYP5QwkpeCn90+X9TYmlN9lqCaGS43kHnbiKJgOMCuNGEVoeh+RlJYHAGoskgsIPsji8rfMQcGdmy8vFwoALQxccV6CN9Y9bEqQmMuSwsqj4ax0cRQeZta/YxV+QZtqMkLHOdZA+QIKGDAVO9ZV+vmEFA/yFmWgqcDpe3Q== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2560; 31:Dt3XrS5CfgcGl7mse0t2tp4Dat5kHYMPXZWp1R0PEOmAjC7nPFDlTOtqxqg1DoI8/lM0/ouOXsp8lQf1Fdb5Cqynn3YZteazBw/0zRtBpS9dCKdzTtcV17gVwo3PkS+QL16dkboB8HkBz2d01r4d3k3qEgLgMs1j9j6z9cK5yowlnZgJjqHwjsJ5FelxeSQ7o179+FGrlXWh3Z9D2j1Aa1PTxuDGsI9kAn5/q8PXTVpRcP6QB93+0B+4wvgQcFXMfvZs9hGcxRE2KBxKbcYHCEOOgh4XFGiPhpi0LSTXmxUfZextvD19pPvCPxVYnVgx; 20:/klYq5pxNiCGQxawo0SPlMKLEW6eM7xpgw++EYP0NVqrDGOUJNjz508XVWcMXEUor2gNzLnqWV6rX2nwz5WWERqm+PXUee9susEE9qLrGB4sYssP57OreFrkOVAyhhtIgF5C5EaJn0m/jAJg9qhYzKXpjJkKUVNA7mleN6VBVCG4hf68fsEavqkgLcNsfEoZdt20pYXBTWomYu+TuAcxJlq0l+aBoFytK7Yz8Cfip5sxSPl0I2Rngr9G2hbwln2djzs9E4ec/aP8dFUMcJsNG13FGO51OPtwMF9751F4OjRftdDkL9vOnq7HiluEf9qJn65kgHjLqCoEF0fQbZLHRHBizzSdgVekzyc8HJ4oWe43qPJ0L8aVTTP/7QOwLSUXOsn0ugyOaRdNXA1WfyY/pOtEXVINuGJ7Rj0Y00YzZeo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0802MB2560; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0802MB2560; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0802MB2560; 4:saUZoKI21N+URwd5z5Difd8QxCYLPmvKfRHIL/NA?= =?us-ascii?Q?FZPG30xvsWrobUawR4fLY1ApW1SexTK30pW2dpAdopzNL+lBFG6/aO54KyF5?= =?us-ascii?Q?rRknnykLGPUsU+iiSNMWXBYOn5d30nk1pqh6OwW1aDwM3NK5DLWOaSOYT5+I?= =?us-ascii?Q?A5PD4yrD7il0VWUWctulJZx7MmO2mOyfIvgDgmp6V+F7updyTmK5jnF1KHqp?= =?us-ascii?Q?TzPfMl+boveQNDQutPLHHcusqEK6TUJ6O8CpejlJcflRZYsW5/n9Z2zZua8x?= =?us-ascii?Q?7QiMcgwI2KO2BH79i8hIGPz8zt2FJBNTt4g1OViN6KogRRuQlhHpFkMcsi3l?= =?us-ascii?Q?eO1pP/L1YGXUHbOWD2vuhuV7nkwtuyVncrGgxU1rXohGAPUFox+nWhBB47CX?= =?us-ascii?Q?UWDfDQBLswgs7/0IWQWG0bbjBqK4szkc4l2Hj3kLI6VvnQfwTdB/g6to57Oq?= =?us-ascii?Q?d+4tdmzsbP4CKjGpARL1rbZepNzX3R/LMrAmTczfg2Hqr+4B470b75iXarYF?= =?us-ascii?Q?08Y5ToTFa7Sf6qa2LAVVPhSIaILHOV9G7xOH/FQxlAF0QAC6g4I+nGvpBSP7?= =?us-ascii?Q?uTtzgQeYQVRAFctUevAJb7i9wR6AllA6gV7qiwmumLl5Z5c9NE6ZZeeTVUs8?= =?us-ascii?Q?GR12QTDF7mAwe4DgbcJpfy15jEyXokSw5+Gsm7O6UO1WxGXAtloHPwssUNo9?= =?us-ascii?Q?eQ251i7zAgzOox9FfL90lvh4dzTNvQygi0GfNtpxdPmJdPld3xcDt+Ciy9ds?= =?us-ascii?Q?A7JqseEBraB+izBv/EgIzo1XZmLCDpkVKmFCw5mTX2UeyHs8jLBBgw7Bi+kZ?= =?us-ascii?Q?JcApMZ40PmykTP4H1CrRNN8/HSONokDSLFcxjGxcNsnXMlDg4On5PwT0g1Mv?= =?us-ascii?Q?crwifdBmQ+a5oih0mbK7iEQzba/S1tG5GJTWmzeoH2hMCWix4JVAUeIOKBJW?= =?us-ascii?Q?1zIFCRQ44kB69ieZbQ/U/5OSfCUR+vCBOWipivaKhR/VAOuqOM+ER6lnM92Z?= =?us-ascii?Q?nvYCERIl8MceC0E9EFml3urp9cAmg9+Nap1mvNk1Z2zj+DnSWgCveVyQsSYD?= =?us-ascii?Q?iQ1LnZ11RieVIUppTmxJXQxJU2wvbcB8eHXOT9PQ6TmjyWcSmUy5oo5bbRmB?= =?us-ascii?Q?CDvzp/r4L5KQgsiLxDojyjomQ/k51Xf1ZgpCoAwnZcju2EoNlwXlbQ=3D=3D?= X-Forefront-PRVS: 0339F89554 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6049001)(39400400002)(39410400002)(39830400002)(39450400003)(24454002)(305945005)(229853002)(2476003)(4610100001)(53936002)(478600001)(189998001)(110136004)(7736002)(38730400002)(83506001)(6246003)(31696002)(77096006)(5890100001)(2950100002)(86362001)(6916009)(84326002)(54906002)(5660300001)(4001350100001)(33646002)(270700001)(6666003)(6486002)(2906002)(36756003)(3846002)(66066001)(65806001)(6116002)(42186005)(31686004)(551934003)(568964002)(93886004)(54356999)(65956001)(8676002)(81166006)(4326008)(53546009)(25786009)(50986999)(76176999); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0802MB2560; H:[172.16.25.50]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microso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VSm5hPifoR+iPvGnd48XUBvdzXQy7npBT22aR7NkeCRhivI0mZx6Nx0rYFUbF4OyRy9AiapqxT0ebFXwbVQsZWJbvmuiVWYbaaAEMZM9gO4cFSX0OmdSfA== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2560; 5:0LEgb4iXshNK2acC7Vtvq6zn8HQ5wSpTnJmcIlj3s+OwdkSRt91G6I5aFjuN8ounCjcqYit5hz59BxxyKineRB52Rni9f9PaWcmWl7HYJYfuYnQWP9jyyqvKBsB1d8I4kKryUJAtgfQfw6aj20Y+/SLtuVyqN8wMghfWz2Lbd2Wlp8ExfkPNMhFWVXUvxYz2gMHo6YhRrzIJJmkaO6hB84PP2CRo5LXulCnDoF26zUbZtVwSqzwTLv4BFgoUWUn06MJull+O/QOlbHnndxcma72binZLARSDreMM8ku0uPtUqXj6Whx6LTbaRxq0OY5PaFdjS05Ro0D0kzjisaw4TGrLJcGjv0OX6luvS4+Ysx3oPSgR543lqG30nPm6xzvX8LHuhGU51N+9GewgGUemkLiZOUdC7rV3RPXRi4r/6ffRD+I8mgbrHhc3TsSMigz2O99Kpwjr+j66eZznx5MZvtSH1M/+dobD3f2wNtk0ASMx94DdwnXf1fgmXu5VrgrM; 24:Chu6ISKMXdkKHa+HtbMtUboO4w6Foy5WNVka9cYAnsWfcoOZR4boQqjxe0nYnua6Evth11hqn9CZCneGFeJGap23Cu62DVsPSFODXxpOb9g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2560; 7:xabWivxODsk4EluAfgZfuPoXJh8lOhyRycp7ANuAAkjqw8H9DPtA5NGtBGgQQab/Av4LfH45/CNZh7UlOpgeXUBExW9FtZb2zBRB4ovT5g2RWaifxHrUGDFzYSSLrl3tDZEW7RQ5In74wdNcR4qIyt4/lpsJhZE5kXkX7k6JlAj8YnE7zuq4FxaCeH8/ykyQ5KqBuCWoRQ5Xb9UQUHrignGkn2l9TlE+6UDrcY+66OiJidGBjpPYI5de95YIbISr2A4eS5s2ygA18wU5MrLcyL9UGJSrr4hVUmpRL7w2V9GX9RjQkSiop1KsLMnJMwEzgfe9nlUrES+7cugacp2q6g==; 20:dH2SuAcnarf1vXcetonymHApZq3PrqSZOyxoXHcev+lhEWGHVGviQz4A05uAp1OFAzz5Tn7ahrO9jvBPTxomPPI+VGeObe3DWoOuio/2FFQR6PohDYpwclIYj7aKh7v+v1tBENjB6uO2a2bRdr6hzL5xyUnVuv9kSZ1jozn1JZg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2017 13:34:38.4026 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2560 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.111 Subject: Re: [Qemu-devel] [PATCH v3 3/4] migration: avoid recursive AioContext locking in save_vmstate() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-block@nongnu.org, Fam Zheng , qemu-devel@nongnu.org, Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 14.06.2017 17:43, Kevin Wolf wrote: > Am 14.06.2017 um 15:15 hat Pavel Butsykin geschrieben: >> On 14.06.2017 13:10, Pavel Butsykin wrote: >>> >>> On 22.05.2017 16:57, Stefan Hajnoczi wrote: >>>> AioContext was designed to allow nested acquire/release calls. It uses >>>> a recursive mutex so callers don't need to worry about nesting...or so >>>> we thought. >>>> >>>> BDRV_POLL_WHILE() is used to wait for block I/O requests. It releases >>>> the AioContext temporarily around aio_poll(). This gives IOThreads a >>>> chance to acquire the AioContext to process I/O completions. >>>> >>>> It turns out that recursive locking and BDRV_POLL_WHILE() don't mix. >>>> BDRV_POLL_WHILE() only releases the AioContext once, so the IOThread >>>> will not be able to acquire the AioContext if it was acquired >>>> multiple times. >>>> >>>> Instead of trying to release AioContext n times in BDRV_POLL_WHILE(), >>>> this patch simply avoids nested locking in save_vmstate(). It's the >>>> simplest fix and we should step back to consider the big picture with >>>> all the recent changes to block layer threading. >>>> >>>> This patch is the final fix to solve 'savevm' hanging with -object >>>> iothread. >>> >>> The same I see in external_snapshot_prepare(): >>> [...] >>> and at the moment BDRV_POLL_WHILE(bs, flush_co.ret == NOT_DONE), >>> we have at least two locks.. So here is another deadlock. >> >> Sorry, here different kind of deadlock. In external_snapshot case, the >> deadlock can happen only if state->old_bs->aio_context == my_iothread->ctx, >> because in this case the aio_co_enter() always calls aio_co_schedule(): > > Can you please write qemu-iotests case for any deadlock case that we're > seeing? Stefan, we could also use one for the bug fixed in this series. It's 085 test, only need to enable iothread. (patch attached) # ./check -qcow2 085 -iothread ... +Timeout waiting for return on handle 0 Failures: 085 Failed 1 of 1 tests The timeout because of the deadlock. Actually the deadlock for the same reason :D A recursive lock occurs when in the transaction more than one action: void qmp_transaction(TransactionActionList *dev_list, ... /* We don't do anything in this loop that commits us to the operations */ while (NULL != dev_entry) { ... state->ops->prepare(state, &local_err); if (local_err) { error_propagate(errp, local_err); goto delete_and_fail; } } QSIMPLEQ_FOREACH(state, &snap_bdrv_states, entry) { if (state->ops->commit) { state->ops->commit(state); There the contex lock is acquired in state->ops->prepare(), but is released in state->ops->commit() (at bdrv_reopen_multiple()). And when in a transaction two or more actions, we will see a recursive lock. Unfortunately I have no idea how cheap it is to fix this. > Kevin > From 674132232f94c1db8015ed780ba84f49fb0fd2bc Mon Sep 17 00:00:00 2001 From: Pavel Butsykin Date: Thu, 15 Jun 2017 15:42:26 +0300 Subject: [PATCH] qemu-iotests: add -iothread option Signed-off-by: Pavel Butsykin --- tests/qemu-iotests/085 | 9 ++++++++- tests/qemu-iotests/common | 7 +++++++ tests/qemu-iotests/common.qemu | 9 +++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085 index b97adcd8db..7b4419deeb 100755 --- a/tests/qemu-iotests/085 +++ b/tests/qemu-iotests/085 @@ -131,7 +131,14 @@ echo === Running QEMU === echo qemu_comm_method="qmp" -_launch_qemu -drive file="${TEST_IMG}.1",if=virtio -drive file="${TEST_IMG}.2",if=virtio +if [ "${IOTHREAD_QEMU}" = "y" ]; then + _launch_qemu -drive file="${TEST_IMG}.1",if=none,id=virtio0 \ + -device virtio-blk-pci,iothread=iothread1,drive=virtio0 \ + -drive file="${TEST_IMG}.2",if=none,id=virtio1 \ + -device virtio-blk-pci,iothread=iothread1,drive=virtio1 +else + _launch_qemu -drive file="${TEST_IMG}.1",if=virtio -drive file="${TEST_IMG}.2",if=virtio +fi h=$QEMU_HANDLE echo diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index f2a7199c4b..fffbf39d55 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -53,6 +53,7 @@ export QEMU_IO_OPTIONS="" export CACHEMODE_IS_DEFAULT=true export QEMU_OPTIONS="-nodefaults -machine accel=qtest" export VALGRIND_QEMU= +export IOTHREAD_QEMU= export IMGKEYSECRET= export IMGOPTSSYNTAX=false @@ -165,6 +166,7 @@ image protocol options other options -xdiff graphical mode diff -nocache use O_DIRECT on backing file + -iothread enable iothread -misalign misalign memory allocations -n show me, do not run tests -o options -o options to pass to qemu-img create/convert @@ -297,6 +299,11 @@ testlist options xpand=false ;; + -iothread) + IOTHREAD_QEMU='y' + xpand=false + ;; + -g) # -g group ... pick from group file group=true xpand=false diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index 7a78a00999..230898ab43 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -139,6 +139,7 @@ function _launch_qemu() local comm= local fifo_out= local fifo_in= + local iothread= if (shopt -s nocasematch; [[ "${qemu_comm_method}" == "monitor" ]]) then @@ -148,6 +149,10 @@ function _launch_qemu() comm="-monitor none -qmp stdio" fi + if [ "${IOTHREAD_QEMU}" = "y" ]; then + iothread="--enable-kvm -object iothread,id=iothread1" + fi + fifo_out=${QEMU_FIFO_OUT}_${_QEMU_HANDLE} fifo_in=${QEMU_FIFO_IN}_${_QEMU_HANDLE} mkfifo "${fifo_out}" @@ -155,12 +160,12 @@ function _launch_qemu() if [ -z "$keep_stderr" ]; then QEMU_NEED_PID='y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${iothread} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ 2>&1 \ <"${fifo_in}" & elif [ "$keep_stderr" = "y" ]; then QEMU_NEED_PID='y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${iothread} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ <"${fifo_in}" & else exit 1 -- 2.13.0