From patchwork Thu Jul 18 09:17:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 11048681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62D3913AC for ; Thu, 18 Jul 2019 09:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5062A27F94 for ; Thu, 18 Jul 2019 09:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F5E1285EC; Thu, 18 Jul 2019 09:18:22 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2E81527F94 for ; Thu, 18 Jul 2019 09:18:21 +0000 (UTC) Received: from localhost ([::1]:35732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ho2YN-000705-Aj for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Jul 2019 05:18:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38995) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ho2Y5-0005jM-BY for qemu-devel@nongnu.org; Thu, 18 Jul 2019 05:18:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ho2Y4-000855-8I for qemu-devel@nongnu.org; Thu, 18 Jul 2019 05:18:01 -0400 Received: from forwardcorp1o.mail.yandex.net ([2a02:6b8:0:1a2d::193]:43466) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ho2Y3-00081v-Su for qemu-devel@nongnu.org; Thu, 18 Jul 2019 05:18:00 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 04AC12E1296; Thu, 18 Jul 2019 12:17:53 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ZPxywNe0KQ-HqtqDsXY; Thu, 18 Jul 2019 12:17:52 +0300 Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1563441472; bh=Ffhebm3fHoTde1H0seF6qGZqXFVn0jNyvsQjr29UQKU=; h=Message-Id:Date:Subject:To:From:Cc; b=BT5RMcpEGUS+lrCS5NbYgBo7OVzlROkGVXq9mbWgnvE+HnfT3tyTSqI7nJy2IKZal +96cSRk4aDJIxhIxP6HEyR/J6nJXeKvE02DbwO+6pkz5mjsnKnAGt5r/5dq3JXhGiW nqoRxvw69BJE9nY/2CJYqOQxUWDtNnLViikw1Ekw= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:9028:49c4:6359:9be1]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JhNdbP5MZj-HpwqlOrQ; Thu, 18 Jul 2019 12:17:51 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Yury Kotov To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Juan Quintela , "Dr. David Alan Gilbert" , Stefan Weil Date: Thu, 18 Jul 2019 12:17:23 +0300 Message-Id: <20190718091726.9874-1-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a02:6b8:0:1a2d::193 Subject: [Qemu-devel] [PATCH v3 0/3] High downtime with 95+ throttle pct X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:Overall" , yc-core@yandex-team.ru Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, V3: * Rebase fixes (migrate_set_parameter -> migrate_set_parameter_int) V2: * Added a test * Fixed qemu_cond_timedwait for qsp I wrote a test for migration auto converge and found out a strange thing: 1. Enable auto converge 2. Set max-bandwidth 1Gb/s 3. Set downtime-limit 1ms 4. Run standard test (just writes a byte per page) 5. Wait for converge 6. It's converged with 99% throttle percentage 7. The result downtime was about 300-600ms <<<< It's much higher than expected 1ms. I figured out that cpu_throttle_thread() function sleeps for 100ms+ for high throttle percentage (>=95%) in VCPU thread. And it sleeps even after a cpu kick. Fixed it by using timedwait for ms part of sleep. E.g timedwait(halt_cond, 1ms) + usleep(500). Regards, Yury Yury Kotov (3): qemu-thread: Add qemu_cond_timedwait cpus: Fix throttling during vm_stop tests/migration: Add a test for auto converge cpus.c | 27 ++++++--- include/qemu/thread.h | 18 ++++++ tests/migration-test.c | 119 +++++++++++++++++++++++++++++++++++---- util/qemu-thread-posix.c | 40 +++++++++---- util/qemu-thread-win32.c | 16 ++++++ util/qsp.c | 18 ++++++ 6 files changed, 207 insertions(+), 31 deletions(-)