From patchwork Wed Apr 25 07:10:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balamuruhan S X-Patchwork-Id: 10361797 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 D63FF601BE for ; Wed, 25 Apr 2018 07:13:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1F1428E03 for ; Wed, 25 Apr 2018 07:13:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6D6828F76; Wed, 25 Apr 2018 07:13:06 +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=-6.7 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_NUMERIC_HELO 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 5362628E03 for ; Wed, 25 Apr 2018 07:13:06 +0000 (UTC) Received: from localhost ([::1]:34207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBEbx-0000yK-CT for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Apr 2018 03:13:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBEaV-0000LY-ET for qemu-devel@nongnu.org; Wed, 25 Apr 2018 03:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBEaS-0005Co-6J for qemu-devel@nongnu.org; Wed, 25 Apr 2018 03:11:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53102 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fBEaS-0005Ce-0x for qemu-devel@nongnu.org; Wed, 25 Apr 2018 03:11:32 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3P750VQ014759 for ; Wed, 25 Apr 2018 03:11:31 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hjjdq673u-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Apr 2018 03:11:31 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Apr 2018 08:11:29 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Apr 2018 08:11:28 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3P7BR0U6488348; Wed, 25 Apr 2018 07:11:27 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD8FA4C044; Wed, 25 Apr 2018 08:03:47 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D08614C052; Wed, 25 Apr 2018 08:03:46 +0100 (BST) Received: from 9.122.211.20 (unknown [9.122.211.20]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 25 Apr 2018 08:03:46 +0100 (BST) From: Balamuruhan S To: qemu-devel@nongnu.org Date: Wed, 25 Apr 2018 12:40:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180425071040.25542-1-bala24@linux.vnet.ibm.com> References: <20180425071040.25542-1-bala24@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18042507-0012-0000-0000-000005CE7526 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042507-0013-0000-0000-0000194AEC45 Message-Id: <20180425071040.25542-2-bala24@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-25_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804250064 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v3 1/1] migration: calculate expected_downtime with ram_bytes_remaining() 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: dgibson@redhat.com, Balamuruhan S , dgilbert@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP expected_downtime value is not accurate with dirty_pages_rate * page_size, using ram_bytes_remaining would yeild it correct. It will initially be a gross over-estimate, but for for non-converging migrations it should approach a reasonable estimate later on. currently bandwidth and expected_downtime value are calculated in migration_update_counters() during each iteration from migration_thread(), where as remaining ram is calculated in qmp_query_migrate() when we actually call "info migrate". Due to this there is some difference in expected_downtime value being calculated. with this patch bandwidth, expected_downtime and remaining ram are calculated in migration_update_counters(), retrieve the same value during "info migrate". By this approach we get almost close enough value. Reported-by: Michael Roth Signed-off-by: Balamuruhan S --- migration/migration.c | 11 ++++++++--- migration/migration.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52a5092add..5d721ee481 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -614,7 +614,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) } if (s->state != MIGRATION_STATUS_COMPLETED) { - info->ram->remaining = ram_bytes_remaining(); + info->ram->remaining = s->ram_bytes_remaining; info->ram->dirty_pages_rate = ram_counters.dirty_pages_rate; } } @@ -2227,6 +2227,7 @@ static void migration_update_counters(MigrationState *s, transferred = qemu_ftell(s->to_dst_file) - s->iteration_initial_bytes; time_spent = current_time - s->iteration_start_time; bandwidth = (double)transferred / time_spent; + s->ram_bytes_remaining = ram_bytes_remaining(); s->threshold_size = bandwidth * s->parameters.downtime_limit; s->mbps = (((double) transferred * 8.0) / @@ -2237,8 +2238,12 @@ static void migration_update_counters(MigrationState *s, * recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred > 10000) { - s->expected_downtime = ram_counters.dirty_pages_rate * - qemu_target_page_size() / bandwidth; + /* + * It will initially be a gross over-estimate, but for for + * non-converging migrations it should approach a reasonable estimate + * later on + */ + s->expected_downtime = s->ram_bytes_remaining / bandwidth; } qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/migration.h b/migration/migration.h index 8d2f320c48..8584f8e22e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -128,6 +128,7 @@ struct MigrationState int64_t downtime_start; int64_t downtime; int64_t expected_downtime; + int64_t ram_bytes_remaining; bool enabled_capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; /*