From patchwork Wed Jul 10 09:23:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Kotov X-Patchwork-Id: 11038337 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 E12FB14DB for ; Wed, 10 Jul 2019 09:25:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4704287BF for ; Wed, 10 Jul 2019 09:25:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C867E28821; Wed, 10 Jul 2019 09:25:24 +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 6ED28287BF for ; Wed, 10 Jul 2019 09:25:24 +0000 (UTC) Received: from localhost ([::1]:59288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hl8qp-000175-PD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Jul 2019 05:25:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47439) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hl8pe-0008Aj-8A for qemu-devel@nongnu.org; Wed, 10 Jul 2019 05:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hl8pc-0007sl-MS for qemu-devel@nongnu.org; Wed, 10 Jul 2019 05:24:10 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:54432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hl8pc-0007kO-5X for qemu-devel@nongnu.org; Wed, 10 Jul 2019 05:24:08 -0400 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 551882E0A03; Wed, 10 Jul 2019 12:24:01 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id cOQwEUnMaj-O0imMNSi; Wed, 10 Jul 2019 12:24:01 +0300 Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1562750641; bh=ikfGEsCCjo83Cs34/TDb++y7x/1OZ2QOYoPo+b2xQKk=; h=Message-Id:Date:Subject:To:From:Cc; b=RT6YlxW6O0rmuy9ewjS8k0LirG0LVQ0eQi3xtmtEJHu17+arg/DnwHL2+fGryJOu/ plTakFNqMn5+1vJhuBWaQth2nBUsk4Tp41zSZjtRR04sWmXaamL/0430z6zX+CjJxY zg6uwWq/xhZx97tIsJKLQJZ1jQ55H+XSFlPJTlv4= Authentication-Results: mxbackcorp1o.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:649c:ccd6:daab:d003]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id c6HGiW8rtf-O0waYlpv; Wed, 10 Jul 2019 12:24:00 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Yury Kotov To: Paolo Bonzini , Richard Henderson , Stefan Weil , Juan Quintela , "Dr. David Alan Gilbert" Date: Wed, 10 Jul 2019 12:23:36 +0300 Message-Id: <20190710092338.23559-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] [RFC PATCH 0/2] 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, 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. I tried to fix it by using timedwait for ms part of sleep. E.g timedwait(halt_cond, 1ms) + usleep(500). But I'm not sure about using timedwait function here with qemu_global_mutex. The original function uses qemu_mutex_unlock_iothread + qemu_mutex_lock_iothread It differs from locking/unlocking (inside timedwait) qemu_global_mutex because of using qemu_bql_mutex_lock_func function which could be anything. This is why the series is RFC. What do you think? Thanks! Yury Kotov (2): qemu-thread: Add qemu_cond_timedwait cpus: Fix throttling during vm_stop cpus.c | 27 +++++++++++++++++++-------- include/qemu/thread.h | 12 ++++++++++++ util/qemu-thread-posix.c | 40 ++++++++++++++++++++++++++++------------ util/qemu-thread-win32.c | 16 ++++++++++++++++ 4 files changed, 75 insertions(+), 20 deletions(-)