From patchwork Mon Aug 26 10:37: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: 11114349 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 A881614DE for ; Mon, 26 Aug 2019 10:39:24 +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 7DDFB20828 for ; Mon, 26 Aug 2019 10:39:24 +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="A8ZsgCFL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DDFB20828 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]:51622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2CPD-0001zi-9N for patchwork-qemu-devel@patchwork.kernel.org; Mon, 26 Aug 2019 06:39:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2CO7-0000nn-UG for qemu-devel@nongnu.org; Mon, 26 Aug 2019 06:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2CO4-0002Cp-8n for qemu-devel@nongnu.org; Mon, 26 Aug 2019 06:38:13 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:58946) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2CO3-0002Bf-H9 for qemu-devel@nongnu.org; Mon, 26 Aug 2019 06:38:12 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id BDEDB2E0A7B; Mon, 26 Aug 2019 13:38:06 +0300 (MSK) Received: from smtpcorp1j.mail.yandex.net (smtpcorp1j.mail.yandex.net [2a02:6b8:0:1619::137]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dfExGbmTBM-c6ZeEwnF; Mon, 26 Aug 2019 13:38:06 +0300 Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1566815886; bh=yN3IEesQ55CoH347dHf+CtEz8HzlupVOz6+KV1wBYCY=; h=Message-Id:Date:Subject:To:From:Cc; b=A8ZsgCFLa1Qr+rME7KXpHcTTqO/g9fqWWVjvohYkmtXO7o5gT9/UPazxmPA6fMegz DvSE+IBptWu2fa2bvHuNqdGuxrzTaBXTdEOKV/NQQRk9wRmKLYD21mYyY6QjfA7mib QriQ5o2ppBiMqfcORHAQL2qPLV+18N9IvhRp+CSw= 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:408:dc67:69ff:2705:c046]) by smtpcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mDIbqN0Ee6-c60SpSll; Mon, 26 Aug 2019 13:38:06 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Yury Kotov To: Paolo Bonzini , Richard Henderson , Juan Quintela , "Dr. David Alan Gilbert" , Thomas Huth , Laurent Vivier , Stefan Weil Date: Mon, 26 Aug 2019 13:37:23 +0300 Message-Id: <20190826103726.25538-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 77.88.29.217 Subject: [Qemu-devel] [PATCH v5 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" Hi, 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 | 18 ++++++ tests/migration-test.c | 120 +++++++++++++++++++++++++++++++++++---- util/qemu-thread-posix.c | 40 +++++++++---- util/qemu-thread-win32.c | 16 ++++++ util/qsp.c | 18 ++++++ 6 files changed, 206 insertions(+), 31 deletions(-)