From patchwork Mon Dec 20 09:34:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12688289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A036BC433EF for ; Mon, 20 Dec 2021 17:24:39 +0000 (UTC) Received: from localhost ([::1]:56034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzMOs-0004q6-IO for qemu-devel@archiver.kernel.org; Mon, 20 Dec 2021 12:24:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKvB-0007yC-Fg for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:49:53 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:36194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKv7-00040X-Cj for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:49:53 -0500 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BK7KMqP010687; Mon, 20 Dec 2021 09:34:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=MZ6XbvoaSThDVjWcUtxZC+mgJBiEPDGVEQ9inP2BMcU=; b=RElG0RBN2c4fW7wQK/ySUdP5QfghsGGSHnYdVhWDEBizciER5lNz5zWNjm7D7DgBUZ6J grCjwdwheme2Yy6J72VcQm9Ornvyb5C9L2SZJUgmHbH0EnsvESJVSAti22QyAoNn+6Rj DHNOIo1kBmIyVS//OmqmogHADy87vZAQXI/HX5/+hYKfK+gsJuXMqsc4vAoMAiaWM8Xk xaNW0BnsI+Nbg9ThlgYZwrv6yky5VDu/9SclnAHc3qzpsf1U7dfINeTI4rJV6G2pwycp Rm4WHfcYHkX2A2C+m6dt+p2e4aCfbysha4kXkB90PZSYCImgNb/1xPKPRJQCiyJXUrK9 Xg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3d16e2axd6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Dec 2021 09:34:24 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1BK9UIPY055954; Mon, 20 Dec 2021 09:34:23 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by userp3020.oracle.com with ESMTP id 3d193kdpws-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Dec 2021 09:34:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrrWsy3NdGvzpqRPj4pEdQA86o2XXB8rv9oaOA2O/JNnj0tluK9Bm3MEs6ITLTYtGfBLZnoDy0Msix1VSrVg5F6TPyjctNNuDI3qbh8VAIUnB+BSq6bbX8BBGf5tEn1K8cum/v+AyLhJHgGOXELGkkwLju3E245Vuh6yEyqqKKogtj6Wk3u4VCD6MdwhEpy6t9aYwqyb3bXsLuUCTIDJlYQ7FHsEB4JdxURGUhmejuJDkLXpKNd5wT3I8giPOa0Zg5HcwnanQMHwtPS1tdFTMHHBh0OKFAvGk1+fG8tyS3WBEVYamGnYHohyeFgdUxBBnw8f/g+hoWsE7fT//9wBXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MZ6XbvoaSThDVjWcUtxZC+mgJBiEPDGVEQ9inP2BMcU=; b=cy0TTFIP0l5w1ZB0asaWAmRH17w+6UOlHbRIjaPfdR/x84oKiHRYV0b9Z75mWZGYLi9pvGqBlHcp9L/c7HhcA6G7jg6yJH769k+QfAbb5BlMO1c8NE+nmkDdddZfCh3JXkygsUnlVeEc+JyxDsgLA4Wu3tLUMtxaCbnR6zMjQVOELzckUYF5wDz667dDcPEmhJi0elraPf5IHhjRL2k1f4aqmZmxWfiSSj5kyeKRJaG0UvkF1SkC3SZWCB92GcNV8ioOiXQu8v7TPhirFOa/1Z43yKwQ6UM/xYsxLEW2U7fZaP4rdYKBFGdWcEGuWYfsqG1kgSc1eyvSw08hVNYjTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MZ6XbvoaSThDVjWcUtxZC+mgJBiEPDGVEQ9inP2BMcU=; b=lA02aHps5bviJ852XYyBePrx9FOVSwTX9IOnrBFWNZFBQNfbmCNJlIsbFzyPpQJci5mpudWbCzI35tABHKcso0bvk/qT4PwQQMU5/sGmrm0b622ysURdfXSSBKl+Z5P1X/QLhSSV9yDSz7t5vQp/hNv8Mq+TqjMNUd7Dk3wrPPc= Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DS7PR10MB5184.namprd10.prod.outlook.com (2603:10b6:5:38e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Mon, 20 Dec 2021 09:34:21 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::c517:d737:a012:1a0e]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::c517:d737:a012:1a0e%6]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 09:34:21 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [RFC v2 1/2] migration: Introduce ram_transferred_add() Date: Mon, 20 Dec 2021 09:34:12 +0000 Message-Id: <20211220093413.1383190-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211220093413.1383190-1-david.edmondson@oracle.com> References: <20211220093413.1383190-1-david.edmondson@oracle.com> X-ClientProxiedBy: LO2P265CA0440.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::20) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03d25e7b-5476-4131-4a16-08d9c39be6ee X-MS-TrafficTypeDiagnostic: DS7PR10MB5184:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HNRG17RP5+eeiVuto6R8gQDELze4BIC+s13Q3uFe49jSfslrEYSUv6XLR75d/xThf8JYaKH7efrP6mX74ayHgRgPyFIMas//L51CqDkLVSs1KpyRWxj39+AE+n3h3QfjTBTUrGAyZpGtv81jMymm13jM5uL37ea6LZIW684uwNfL4IoeImUkej/INuaWr2s7r1iwCbe/0qouAUJcVTLbLL51QGP14bV8cUeH5YhXWN/EHNKDEOYiQYu1HvAPKLVaRtr6KgcG5QFuW/GtILH80JeVjgjRsLrIaC0jert18GVYE3c3uxp6YiDXD/CtWMRRqp3qjW+ru5nIzGHceMSHq0QNVWzSbHG0Ls5E102/j+2K6OXZCgHe0AR0dORcX7pIEYRM8YuYzwK1AZLh5TL5HXuiN1y3qQt6eptICj2JhjBo1ew06ZjjrY/UImmCY/Emni4+tFEuYJVvw9bHo0P0X9MxJBmwb8qF78aelS87/4u0ga7T1SM9fVU5JOMLNQSPNwO647jvH70PU6TizbB1kc039eRtHIfO4zcP8ekkt2QqBjX5HcipHxchQ8qWpZST9yGA+skrKrd+p0MaDcRd7WYmJIhHO3o0xdkEYuzsTLs8BsfMQCgLYgHdaReKjPdPrOavYgjyoRXSM2ylyAtZKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3148.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6486002)(36756003)(1076003)(66476007)(66946007)(6512007)(66556008)(38100700002)(6916009)(52116002)(508600001)(5660300002)(54906003)(4326008)(186003)(107886003)(316002)(86362001)(6506007)(8676002)(2616005)(44832011)(6666004)(8936002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TFBcCqIPWjY0CGjI/kb0kuYyH6DoL0lD6XlSZ7h7HKU0zZAjUqIMTCfioWd4LweX3gUbNY5poeAWXYUNImDt2XB2WcLc/t/55w6Zu3iRGbsodB+5sNZOoeekbnJvBk5yK1CLc4VzE74UtUBbGkjcXRfl8Jj55+av1ZrOd1P8x6m8Gkos5GhxVwWmcwsGDa4Zh/tNZ0by/MgawmD8DZG3vzlHuuVf/C0RR5HSkU3mBC6AxV9KwxdegdzmaAbCahrNQD1nQw8xwy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V2QBqMDYojkDNFi6JeCr65gO5QkhOU4zhMQhv2z2yl60wy0aq9b01bsEv7fzP3OicJBwImM3Xp+yTAEzEDJPMZn9le7JTyhMN4mZvZjUbLBJ0dQ8WnPImphJMa418pKfqoyK1ML6Z+8rX569FENrj4g5ss3nAymrYUxmuV122u9VedwX4Xqjb/a5N8iwVX3oUYA9K/3o1tSqrtxFGqXui4pQFT2cCvukjtWObs9i6PFIwCoo4KaYnAXzHWjQLUTX0Batvvd4CExyqL5N32JWWCqScfGmZ5KSK2Y3xiNd6sZfdkS5i2xVdycgmVllB6FGGbwG7Bxw9bkUUv8INyxCzBUgg6V2v4yM+F/hQqZx8QUGEhAX7XHEfJWdvP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03d25e7b-5476-4131-4a16-08d9c39be6ee X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 09:34:21.3508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AgzGn5xMELXBOvh1DxDr7a7udIsaCAELLV8np0Qy5lZ8wZLB4ndfRIKQL+X3vkBtY6k7ixV4E7NJgRC9UJ0wM8Ije0wbnENUEmx2dXaD9lI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5184 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10203 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112200055 X-Proofpoint-ORIG-GUID: jpjF_r5tTspQeefFlr71PYsoskZwj3Bq X-Proofpoint-GUID: jpjF_r5tTspQeefFlr71PYsoskZwj3Bq Received-SPF: pass client-ip=205.220.177.32; envelope-from=david.edmondson@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Edmondson , Juan Quintela , Eric Blake , Markus Armbruster , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" ...and use it. Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daudé --- migration/ram.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 57efa67f20..bd53e50a7f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -386,6 +386,11 @@ uint64_t ram_bytes_remaining(void) MigrationStats ram_counters; +static void ram_transferred_add(uint64_t bytes) +{ + ram_counters.transferred += bytes; +} + /* used by the search for pages to send */ struct PageSearchStatus { /* Current block being searched */ @@ -767,7 +772,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data, * RAM_SAVE_FLAG_CONTINUE. */ xbzrle_counters.bytes += bytes_xbzrle - 8; - ram_counters.transferred += bytes_xbzrle; + ram_transferred_add(bytes_xbzrle); return 1; } @@ -1198,7 +1203,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset) if (len) { ram_counters.duplicate++; - ram_counters.transferred += len; + ram_transferred_add(len); return 1; } return -1; @@ -1234,7 +1239,7 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset, } if (bytes_xmit) { - ram_counters.transferred += bytes_xmit; + ram_transferred_add(bytes_xmit); *pages = 1; } @@ -1265,8 +1270,8 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset, static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset, uint8_t *buf, bool async) { - ram_counters.transferred += save_page_header(rs, rs->f, block, - offset | RAM_SAVE_FLAG_PAGE); + ram_transferred_add(save_page_header(rs, rs->f, block, + offset | RAM_SAVE_FLAG_PAGE)); if (async) { qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE, migrate_release_ram() & @@ -1274,7 +1279,7 @@ static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset, } else { qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE); } - ram_counters.transferred += TARGET_PAGE_SIZE; + ram_transferred_add(TARGET_PAGE_SIZE); ram_counters.normal++; return 1; } @@ -1373,7 +1378,7 @@ exit: static void update_compress_thread_counts(const CompressParam *param, int bytes_xmit) { - ram_counters.transferred += bytes_xmit; + ram_transferred_add(bytes_xmit); if (param->zero_page) { ram_counters.duplicate++; @@ -2298,7 +2303,7 @@ void acct_update_position(QEMUFile *f, size_t size, bool zero) ram_counters.duplicate += pages; } else { ram_counters.normal += pages; - ram_counters.transferred += size; + ram_transferred_add(size); qemu_update_position(f, size); } } @@ -3133,7 +3138,7 @@ out: multifd_send_sync_main(rs->f); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); - ram_counters.transferred += 8; + ram_transferred_add(8); ret = qemu_file_get_error(f); } From patchwork Mon Dec 20 09:34:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Edmondson X-Patchwork-Id: 12688315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 39CD2C433EF for ; Mon, 20 Dec 2021 17:48:02 +0000 (UTC) Received: from localhost ([::1]:54594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzMlV-0000uG-4d for qemu-devel@archiver.kernel.org; Mon, 20 Dec 2021 12:48:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzL9n-0001ie-W0 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 11:05:08 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:46076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzL9T-0001dW-RQ for qemu-devel@nongnu.org; Mon, 20 Dec 2021 11:04:51 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BK9PPm7023723; Mon, 20 Dec 2021 09:34:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=wLXzHHw/U24hNuoXv7mrAaFWbb/tN1WdN+uzS+ipsv0=; b=J89VlDFYYaIy6TK8XVQTOIj9sp3w/WynWXtgoEvZn+dT4pyeql6xD+C+1w5+xI4dfnjR GddL8NcB6Aa4vC2NzP9qZ04REjc/jBptTwite3e0R68llbXvOtB71/pMl1YiysCDROka rwg0px47DfBBRwy1H+87atWXBr3VMKHjpol55WDWtKRO07glYyQNLA+2Brq0GSKcv19R qO4nQ0SU8qH/K1apG+7QBSiig6TjKf5zTo75mBspxCQU9hbLsgizQ4XxB/DsYoLfHSzm ownoJn2Fxt9WtQJNRaa/GUtMIHOPjoFi0+yHWsQiN8InSaNgfkwyZGnexuPe7/mIsmvg yw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3d2q6eg0ub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Dec 2021 09:34:24 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1BK9UIPZ055954; Mon, 20 Dec 2021 09:34:23 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by userp3020.oracle.com with ESMTP id 3d193kdpws-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Dec 2021 09:34:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aGoe+xpFjviM80cxav/4xov0XN8aOKEOz4wiyTIw0rL9x1+vhpWjMtaRGgSN2rFibObm4JawKR6nXaFadVfzfPi53nVWxGUeFsU6IaObinEezJ6DyX7vyp1UYBiQ8jA+pYX6GFWOzw4s3gFMOkdEN9sKNUYjXNN4c35nZ8PVbLcQdkUjTG4mGScJH8rMn/KwXzZDpSTsJ+VwVFmu4RNTl3X23BSQvfN23o7tq6AToyHG6j6FBt6+LkGKYiyjCOI0KK5Zm+kykzEyPgaU4FjtW92knKT8rXhB0P9WRN4xAYPP5RvvOej3jnfVCB4YqiZb/iSO7Q2x0O2aRpH4pRmN3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wLXzHHw/U24hNuoXv7mrAaFWbb/tN1WdN+uzS+ipsv0=; b=Cm+CNYd8wJvbvmn6spPVU6ChJAwKcCGrw8LGGDDwIJhivVyXfZjex9CpLA5QFVTn8+9iEMfYZ+Ehx1Q6ozp67sPbuqj1fQgr0KZgAoDGcraRkKltqZSZMBD5t5Yhlm9ZXv0l1NX7+a4i3bggAlJGUITlab0pgnM08OdLH3QDO7oEWdLsqGR3AdTTdyerjIz1SAvwOQKwV27GRbaNceUHlO196LpyHJPO3jubii96EHhCdqHxgOWjlrIqRGxErocuDEN25H0jg7IAIp2KetH0wBCNuRT65vo84XDWUHsj674X9tt8f1TBAX/Ur9jOCWXU8v46VPOHhNeV2DbXWdmgxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wLXzHHw/U24hNuoXv7mrAaFWbb/tN1WdN+uzS+ipsv0=; b=M5a7P2RnGa4GuOj8T2TeBeTIPnY5WMP+FFErg8Izt5mVkrnkobUVgUTu1U1mOU8uz2Rsr6nKKgGm/SCn5NRBr67VTECTwuLHXAx92/azXgalbHnuPGlWzLB0DclTuX3I9aY0BK5iG8YZd+uQaNkZfRUpRWDRGAs7SH/7S6NpJ3c= Received: from DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) by DS7PR10MB5184.namprd10.prod.outlook.com (2603:10b6:5:38e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Mon, 20 Dec 2021 09:34:21 +0000 Received: from DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::c517:d737:a012:1a0e]) by DM6PR10MB3148.namprd10.prod.outlook.com ([fe80::c517:d737:a012:1a0e%6]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 09:34:21 +0000 From: David Edmondson To: qemu-devel@nongnu.org Subject: [RFC v2 2/2] migration: Tally pre-copy, downtime and post-copy bytes independently Date: Mon, 20 Dec 2021 09:34:13 +0000 Message-Id: <20211220093413.1383190-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211220093413.1383190-1-david.edmondson@oracle.com> References: <20211220093413.1383190-1-david.edmondson@oracle.com> X-ClientProxiedBy: LO4P123CA0063.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::14) To DM6PR10MB3148.namprd10.prod.outlook.com (2603:10b6:5:1a4::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b1ef474-8505-4b07-9aa2-08d9c39be707 X-MS-TrafficTypeDiagnostic: DS7PR10MB5184:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:261; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GTPP7lmH+6t01a4q5Bqy0DWZEiahxbI4c3fWb9+XH2nYLrOmo8WJTSTfyg5V+aIDwkfy1RyJ6LrStTBE71iEY3Fgw2gI+RB9ySCnfXm36Gj2lHZAIpOD7JgyHwQD60Zdt/ZWISlFGstoKg385I6UNRxVWwoh1gC8tGrl1n8CNbtWULYPqDSaGQTHX1B8Lz+BNlTFlhL+mTNmLm6lMeJA4kXesqHtuENtt6EGnGppyWtNzbBVn+KXJLpvN3+tH+D/SVOeQGGKp+6t0usmqS2RKpPVbG4JAgUv3aXx/XYH9CzUXdh2TRJkRfXRSnDkGiPhF0D/H6MN3zmZjBV0aUCO5l/t6n2d7re2oRTM/IXmUivWDFqDJFAY4N2a2toaGvJyi9IX/ITHlICjvGrTKTqTEJ2H5fV5P9WWvR2uY+kwqoYzZ5h+4Tfn8EbekWbmV/+rda4jZjZ4MHH0GU8Uv4RGMHJDNq7NV2wUjHvpcGaJefuO2JmMP83oio/2wnweiRqgWILtcTNYJnnKqJQIikNpG+0xtC2k6lSFTdrR1B6+7TrGX0yQsmuy80fycW6kT3ty8jemEdONAqVRU5n/E4jc+XLuEkP1+La8M/GgQDzVfLd9KX5qLwWmTNfUP0rRXo/KLCuB7Fa0EgzIx1NFRd8mRA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB3148.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6486002)(36756003)(1076003)(66476007)(66946007)(6512007)(66556008)(38100700002)(6916009)(52116002)(508600001)(5660300002)(54906003)(4326008)(186003)(107886003)(316002)(86362001)(6506007)(8676002)(2616005)(44832011)(6666004)(8936002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tP7Xq6BKizjhGPsmcgpTvzz8i+0rW4DTbcxan1R4jqBJJrmtjQsycXzWIwq+5Duai1/A8sUak7U/XFnv5dhVEczce+Bv3fXzXcxEqGuwUX80EBrP5EJIreuNqkkHZs2kiMauizH0hHEQagGckTDFoPykcXzmz9tKCu7dDIuZdrx+ZVHf9znx6hpcXrRALC5zakqqjhRv2GYWTY1TAhPJM33u/EB2k5lXCWoZhCNrd94qamlkdz924W2OVsExwc97x8SrA2MkP2jbk5QdbAHnQVrC6nxAhr8PuBmeExtDdL35H2dB9q55hW1YrgAoGJePgQSbmmzGw7a+0pZtX8CSXHKJm2lX075B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UF3ugkBAUlGOt1+nQwq+hu6Ru6gYV1OEQtSAccISizJeFhVMxl+fqJMPXWiZIOxkLhRMzlOQ1oM7hougL8qPTKnLOr25muCL/W4KRpSBmNAp6ibtiUbw0HHFQvYz5XFvdriS/Fu+fbTyn6NXNEDcZZBIFg7TzeDrdyBjwy44zhIFUOv3zAhm0QrVuYmkOzthW54qhaFpMXEnMRQDcWgxwQnQv5XKo4uqcS/k98JcKRtwCkzHsNGWo4BRMJQjJX1nQWvEtQ93aRjcXNqlD2XXCMxVpXhVy+aDiI4u1D1E9IIwllnIs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b1ef474-8505-4b07-9aa2-08d9c39be707 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB3148.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 09:34:21.5037 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qaqGxvH8PBsIzAUtIan8C1QUxZCGG1gA7xt4LKkVn5NUCeACWPkgqehBtXYX3aEakNekSJdzwZrsLjmY6war8/evGbpEFEyWmPqpjtgwpqM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5184 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10203 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112200055 X-Proofpoint-GUID: P1AvFtDBKxL4nAHo4tJ3nyQc8OxRlv7z X-Proofpoint-ORIG-GUID: P1AvFtDBKxL4nAHo4tJ3nyQc8OxRlv7z Received-SPF: pass client-ip=205.220.177.32; envelope-from=david.edmondson@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Edmondson , Juan Quintela , Eric Blake , Markus Armbruster , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Provide information on the number of bytes copied in the pre-copy, downtime and post-copy phases of migration. Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daudé --- migration/migration.c | 3 +++ migration/ram.c | 7 +++++++ monitor/hmp-cmds.c | 12 ++++++++++++ qapi/migration.json | 13 ++++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 3de11ae921..3950510be7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1013,6 +1013,9 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->ram->page_size = page_size; info->ram->multifd_bytes = ram_counters.multifd_bytes; info->ram->pages_per_second = s->pages_per_second; + info->ram->precopy_bytes = ram_counters.precopy_bytes; + info->ram->downtime_bytes = ram_counters.downtime_bytes; + info->ram->postcopy_bytes = ram_counters.postcopy_bytes; if (migrate_use_xbzrle()) { info->has_xbzrle_cache = true; diff --git a/migration/ram.c b/migration/ram.c index bd53e50a7f..389868c988 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -388,6 +388,13 @@ MigrationStats ram_counters; static void ram_transferred_add(uint64_t bytes) { + if (runstate_is_running()) { + ram_counters.precopy_bytes += bytes; + } else if (migration_in_postcopy()) { + ram_counters.postcopy_bytes += bytes; + } else { + ram_counters.downtime_bytes += bytes; + } ram_counters.transferred += bytes; } diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 9c91bf93e9..6049772178 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -293,6 +293,18 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) monitor_printf(mon, "postcopy request count: %" PRIu64 "\n", info->ram->postcopy_requests); } + if (info->ram->precopy_bytes) { + monitor_printf(mon, "precopy ram: %" PRIu64 " kbytes\n", + info->ram->precopy_bytes >> 10); + } + if (info->ram->downtime_bytes) { + monitor_printf(mon, "downtime ram: %" PRIu64 " kbytes\n", + info->ram->downtime_bytes >> 10); + } + if (info->ram->postcopy_bytes) { + monitor_printf(mon, "postcopy ram: %" PRIu64 " kbytes\n", + info->ram->postcopy_bytes >> 10); + } } if (info->has_disk) { diff --git a/qapi/migration.json b/qapi/migration.json index bbfd48cf0b..5975a0e104 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -46,6 +46,15 @@ # @pages-per-second: the number of memory pages transferred per second # (Since 4.0) # +# @precopy-bytes: The number of bytes sent in the pre-copy phase +# (since 7.0). +# +# @downtime-bytes: The number of bytes sent while the guest is paused +# (since 7.0). +# +# @postcopy-bytes: The number of bytes sent during the post-copy phase +# (since 7.0). +# # Since: 0.14 ## { 'struct': 'MigrationStats', @@ -54,7 +63,9 @@ 'normal-bytes': 'int', 'dirty-pages-rate' : 'int', 'mbps' : 'number', 'dirty-sync-count' : 'int', 'postcopy-requests' : 'int', 'page-size' : 'int', - 'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64' } } + 'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64', + 'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64', + 'postcopy-bytes' : 'uint64' } } ## # @XBZRLECacheStats: