From nobody Thu Apr 25 14:55:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528793576515435.1107883553815; Tue, 12 Jun 2018 01:52:56 -0700 (PDT) Received: from localhost ([::1]:53919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSf2q-0007zT-Mw for importer@patchew.org; Tue, 12 Jun 2018 04:52:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSf0t-00070o-AH for qemu-devel@nongnu.org; Tue, 12 Jun 2018 04:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSf0o-0004o2-Fg for qemu-devel@nongnu.org; Tue, 12 Jun 2018 04:50:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSf0o-0004nd-5C for qemu-devel@nongnu.org; Tue, 12 Jun 2018 04:50:46 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5C8nqKM043423 for ; Tue, 12 Jun 2018 04:50:45 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jj7s40n62-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Jun 2018 04:50:44 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jun 2018 09:50:42 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 12 Jun 2018 09:50:40 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5C8odGl31719522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 12 Jun 2018 08:50:39 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 521EBAE04D; Tue, 12 Jun 2018 09:39:31 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E69BAE059; Tue, 12 Jun 2018 09:39:30 +0100 (BST) Received: from localhost.localdomain.in.ibm.com (unknown [9.122.211.61]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 12 Jun 2018 09:39:30 +0100 (BST) From: Balamuruhan S To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 14:20:09 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180612085009.17594-1-bala24@linux.vnet.ibm.com> References: <20180612085009.17594-1-bala24@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18061208-0028-0000-0000-000002CFDDBE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061208-0029-0000-0000-00002386F8BD Message-Id: <20180612085009.17594-2-bala24@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-12_01:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806120105 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v4 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: lvivier@redhat.com, Balamuruhan S , david@gibson.dropbear.id.au, dgilbert@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" expected_downtime value is not accurate with dirty_pages_rate * page_size, using ram_bytes_remaining() would yeild it resonable. consider to read the remaining ram just after having updated the dirty pages count later migration_bitmap_sync_range() in migration_bitmap_sync() and reuse the `remaining` field in ram_counters to hold ram_bytes_remaining= () for calculating expected_downtime. Reported-by: Michael Roth Signed-off-by: Balamuruhan S Signed-off-by: Laurent Vivier Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 3 +-- migration/ram.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ea9a6cbb87..cb14dadb26 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2739,8 +2739,7 @@ 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 =3D ram_counters.dirty_pages_rate * - qemu_target_page_size() / bandwidth; + s->expected_downtime =3D ram_counters.remaining / bandwidth; } =20 qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/ram.c b/migration/ram.c index a500015a2f..a94a2b829e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1159,6 +1159,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBLOCK_FOREACH_MIGRATABLE(block) { migration_bitmap_sync_range(rs, block, 0, block->used_length); } + ram_counters.remaining =3D ram_bytes_remaining(); rcu_read_unlock(); qemu_mutex_unlock(&rs->bitmap_mutex); =20 --=20 2.14.3