From patchwork Mon Sep 9 10:49:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 11137681 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34A2C14E5 for ; Mon, 9 Sep 2019 10:51:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 088F421A4A for ; Mon, 9 Sep 2019 10:51:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=yandex-team.ru header.i=@yandex-team.ru header.b="l9GMpsJG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 088F421A4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=yandex-team.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7HGo-00080U-Ql for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 Sep 2019 06:51:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60100) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7HFa-0006VF-MB for qemu-devel@nongnu.org; Mon, 09 Sep 2019 06:50:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7HFX-00075N-Lo for qemu-devel@nongnu.org; Mon, 09 Sep 2019 06:50:24 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:40184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i7HFX-0006yp-3p for qemu-devel@nongnu.org; Mon, 09 Sep 2019 06:50:23 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 5C1572E1429; Mon, 9 Sep 2019 13:50:19 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3crOw56ucZ-oIW4R6P8; Mon, 09 Sep 2019 13:50:19 +0300 Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1568026219; bh=I9Otm40/SXZRGB83vtneLojZbFBJFQ/cvt5qNHvBiD4=; h=Message-Id:Date:Subject:To:From:Cc; b=l9GMpsJGOwfQbsHmkStL6AUhBYtktlkQcFbAYMN2BC+l8fdmejyTqu8lIJfq1TEdB HIGT6MknlfBAuPYcrvT74lm2S9JFMtRC0cFFrXMclGf9lffjiIdPHgNuijs4eRm0aW MmbfSWvT8ETbR+bQgtIo55lhbbkdqK6mo9o3VHvU= Authentication-Results: mxbackcorp1j.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:408:c41:6db7:e9d4:e9e0]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Skp3BT4RoZ-oID0rYkn; Mon, 09 Sep 2019 13:50:18 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Yury Kotov To: "Dr. David Alan Gilbert" , Eric Blake , Juan Quintela , Laurent Vivier , Paolo Bonzini , Richard Henderson , Stefan Weil , Thomas Huth Date: Mon, 9 Sep 2019 13:49:45 +0300 Message-Id: <20190909104948.30253-1-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.29.217 Subject: [Qemu-devel] [PATCH v6 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: qemu-devel@nongnu.org, yc-core@yandex-team.ru Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Hi, V6: * Fix "Add qemu_cond_timedwait" patch: - Changed return type for qemu_cond_timedwait (void -> bool) - Added details in commit message V5: * Updated sleep loop in throttle_thread at the suggestion of Paolo Bonzini * Fixed hanging of test V4: * The test was simplified to prevent false fails. 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 | 25 +++++--- include/qemu/thread.h | 19 +++++++ tests/migration-test.c | 120 +++++++++++++++++++++++++++++++++++---- util/qemu-thread-posix.c | 41 +++++++++---- util/qemu-thread-win32.c | 17 ++++++ util/qsp.c | 20 +++++++ 6 files changed, 211 insertions(+), 31 deletions(-)