From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154080; cv=none; d=zohomail.com; s=zohoarc; b=VJpdP1tfZkD+eEHd2mgrjZNsg/HrD/q9Jtg3pN5yj8IvH5qjh5V44KhxM+HNeoDkeVDW9lGaSC5x0nl2BQNFnXv4XM8madXJYdP51A/18HzJ/l03ChX0nCk0Hv48Iw/cAhN92YHtXuixODRYvb6u6UuBOPFJWZOjJWnIzvX/KmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154080; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2aNRT/QOFv5C4ygClS3otDs06SJvR/HzI4hgraYypFc=; b=DY/+3p40GCCn+18jMGRxFFxMLYVjULSGHHvYeA5LRDSY800vCMFR7pwUbyG3bo5CVy+mffmQRA339wxs7+7ZqeJ7PWc0Ti7QvVR3MR5ctdeLWJ1SieNUvPn1CpnFzgEpBF7zfIyJ7YIGR13YWu/lqwQxhvy5CKiiv3Ooad5XYUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154080533756.8142953891512; Mon, 15 May 2023 05:34:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXOm-0006Qz-Gf; Mon, 15 May 2023 08:33:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOc-0006PI-JX for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOa-0003Hg-L6 for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:46 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-UPk55WeiOzGi8rKLMfDN9Q-1; Mon, 15 May 2023 08:33:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 821121C07553; Mon, 15 May 2023 12:33:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C32435453; Mon, 15 May 2023 12:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2aNRT/QOFv5C4ygClS3otDs06SJvR/HzI4hgraYypFc=; b=fU1CkwTvoxlgIC4AIgF2Cs4Je/5sIsR5GHFS/YeCyMNpjA/FHciMDH6hYZkZjn0XD218EE l7sXYPWW5DHhsC51zJ4dWT8BQnR0u46/1c11wML2wILVklHtms57O4uI25iiqBoRmto8BO 4gpquhRIZvYZcXMET7TquUvWIgK7igQ= X-MC-Unique: UPk55WeiOzGi8rKLMfDN9Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Andrei Gudkov Subject: [PULL 01/11] migration/calc-dirty-rate: replaced CRC32 with xxHash Date: Mon, 15 May 2023 14:33:24 +0200 Message-Id: <20230515123334.58995-2-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154082427100003 Content-Type: text/plain; charset="utf-8" From: Andrei Gudkov This significantly reduces overhead of dirty page rate calculation in sampling mode. Tested using 32GiB VM on E5-2690 CPU. With CRC32: total_pages=3D8388608 sampled_pages=3D16384 millis=3D71 With xxHash: total_pages=3D8388608 sampled_pages=3D16384 millis=3D14 Signed-off-by: Andrei Gudkov Message-Id: Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/dirtyrate.c | 45 +++++++++++++++++++++++++++++++++--------- migration/trace-events | 4 ++-- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 388337a332..5bac984fa5 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -29,6 +29,7 @@ #include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "exec/memory.h" +#include "qemu/xxhash.h" =20 /* * total_dirty_pages is procted by BQL and is used @@ -308,6 +309,33 @@ static void update_dirtyrate(uint64_t msec) DirtyStat.dirty_rate =3D dirtyrate; } =20 +/* + * Compute hash of a single page of size TARGET_PAGE_SIZE. + */ +static uint32_t compute_page_hash(void *ptr) +{ + uint32_t i; + uint64_t v1, v2, v3, v4; + uint64_t res; + const uint64_t *p =3D ptr; + + v1 =3D QEMU_XXHASH_SEED + XXH_PRIME64_1 + XXH_PRIME64_2; + v2 =3D QEMU_XXHASH_SEED + XXH_PRIME64_2; + v3 =3D QEMU_XXHASH_SEED + 0; + v4 =3D QEMU_XXHASH_SEED - XXH_PRIME64_1; + for (i =3D 0; i < TARGET_PAGE_SIZE / 8; i +=3D 4) { + v1 =3D XXH64_round(v1, p[i + 0]); + v2 =3D XXH64_round(v2, p[i + 1]); + v3 =3D XXH64_round(v3, p[i + 2]); + v4 =3D XXH64_round(v4, p[i + 3]); + } + res =3D XXH64_mergerounds(v1, v2, v3, v4); + res +=3D TARGET_PAGE_SIZE; + res =3D XXH64_avalanche(res); + return (uint32_t)(res & UINT32_MAX); +} + + /* * get hash result for the sampled memory with length of TARGET_PAGE_SIZE * in ramblock, which starts from ramblock base address. @@ -315,13 +343,12 @@ static void update_dirtyrate(uint64_t msec) static uint32_t get_ramblock_vfn_hash(struct RamblockDirtyInfo *info, uint64_t vfn) { - uint32_t crc; + uint32_t hash; =20 - crc =3D crc32(0, (info->ramblock_addr + - vfn * TARGET_PAGE_SIZE), TARGET_PAGE_SIZE); + hash =3D compute_page_hash(info->ramblock_addr + vfn * TARGET_PAGE_SIZ= E); =20 - trace_get_ramblock_vfn_hash(info->idstr, vfn, crc); - return crc; + trace_get_ramblock_vfn_hash(info->idstr, vfn, hash); + return hash; } =20 static bool save_ramblock_hash(struct RamblockDirtyInfo *info) @@ -454,13 +481,13 @@ out: =20 static void calc_page_dirty_rate(struct RamblockDirtyInfo *info) { - uint32_t crc; + uint32_t hash; int i; =20 for (i =3D 0; i < info->sample_pages_count; i++) { - crc =3D get_ramblock_vfn_hash(info, info->sample_page_vfn[i]); - if (crc !=3D info->hash_result[i]) { - trace_calc_page_dirty_rate(info->idstr, crc, info->hash_result= [i]); + hash =3D get_ramblock_vfn_hash(info, info->sample_page_vfn[i]); + if (hash !=3D info->hash_result[i]) { + trace_calc_page_dirty_rate(info->idstr, hash, info->hash_resul= t[i]); info->sample_dirty_count++; } } diff --git a/migration/trace-events b/migration/trace-events index 92161eeac5..f39818c329 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -342,8 +342,8 @@ dirty_bitmap_load_success(void) "" # dirtyrate.c dirtyrate_set_state(const char *new_state) "new state %s" query_dirty_rate_info(const char *new_state) "current state %s" -get_ramblock_vfn_hash(const char *idstr, uint64_t vfn, uint32_t crc) "ramb= lock name: %s, vfn: %"PRIu64 ", crc: %" PRIu32 -calc_page_dirty_rate(const char *idstr, uint32_t new_crc, uint32_t old_crc= ) "ramblock name: %s, new crc: %" PRIu32 ", old crc: %" PRIu32 +get_ramblock_vfn_hash(const char *idstr, uint64_t vfn, uint32_t hash) "ram= block name: %s, vfn: %"PRIu64 ", hash: %" PRIu32 +calc_page_dirty_rate(const char *idstr, uint32_t new_hash, uint32_t old_ha= sh) "ramblock name: %s, new hash: %" PRIu32 ", old hash: %" PRIu32 skip_sample_ramblock(const char *idstr, uint64_t ramblock_size) "ramblock = name: %s, ramblock size: %" PRIu64 find_page_matched(const char *idstr) "ramblock %s addr or size changed" dirtyrate_calculate(int64_t dirtyrate) "dirty rate: %" PRIi64 " MB/s" --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154159; cv=none; d=zohomail.com; s=zohoarc; b=hsK0SA7wTfkyqQ/5JrqjXwIhZEyYU/FmpjaCbUqXp0aX+ugJN2d/DdfdAIkicm5FJdnSWHA4Trr324npU7w+GQ89+QPfuVjqTAkNqMtHFK+TUnf2XxOGVF8AJA3TQ1jBveNa/TBzZPXNcx7qRDl1NTDrqbjubUWx40k92XmZXmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154159; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=95lQhwQsYaDYNogO8cgjiJ0NBYPqWgKFLGrU7Vr2/iA=; b=S3WL8wbuxjAlihepFD7u5Z2bbgLMjRWVcvUMViUAdiJlqpoE3shqkYpRVsj6A2nLzajk6Nreuhn/SYJduiaB/ctD7Jk4o8GYeQPd3DTD8u6vXVpuFq9b67hQ86GN/GM95UEpb1LOS3D5bjvSVKA3tzD1PxIuwk0q7IvFNIrI0/M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154159561302.9876483842818; Mon, 15 May 2023 05:35:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPH-0006XA-Qw; Mon, 15 May 2023 08:34:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOh-0006Qx-UC for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOf-0003Jn-QF for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-VVrqOjb-OTKTZ0XGQZeWQQ-1; Mon, 15 May 2023 08:33:42 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACC2F2808E61; Mon, 15 May 2023 12:33:41 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id C992A35453; Mon, 15 May 2023 12:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=95lQhwQsYaDYNogO8cgjiJ0NBYPqWgKFLGrU7Vr2/iA=; b=H0wbQ+Nun/GY/r4ZzT+QCDrehBZualiBrVlhefNYk0lFUeUNg2NzXWi3WpfKas9VPWWcVt Va8hLyYguXYipfUdv8ai8U5pVAICglsbP2c5Barxkqq2VuUaIi7KU3UlZ7gcApbvNX4+6p LeqBYrUMF1Z+RXzEyIB1KjVN8YTbIzs= X-MC-Unique: VVrqOjb-OTKTZ0XGQZeWQQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Richard Henderson Subject: [PULL 02/11] softmmu: Create qemu_target_pages_to_MiB() Date: Mon, 15 May 2023 14:33:25 +0200 Message-Id: <20230515123334.58995-3-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154161710100003 Content-Type: text/plain; charset="utf-8" Function that convert a number of target_pages into its size in MiB. Suggested-by: Richard Henderson Richard Henderson Signed-off-by: Juan Quintela Message-Id: <20230511141208.17779-2-quintela@redhat.com> --- include/exec/target_page.h | 1 + softmmu/physmem.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/exec/target_page.h b/include/exec/target_page.h index 96726c36a4..bbf37aea17 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -18,4 +18,5 @@ size_t qemu_target_page_size(void); int qemu_target_page_bits(void); int qemu_target_page_bits_min(void); =20 +size_t qemu_target_pages_to_MiB(size_t pages); #endif diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 0e0182d9f2..efaed36773 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -3357,6 +3357,17 @@ int qemu_target_page_bits_min(void) return TARGET_PAGE_BITS_MIN; } =20 +/* Convert target pages to MiB (2**20). */ +size_t qemu_target_pages_to_MiB(size_t pages) +{ + int page_bits =3D TARGET_PAGE_BITS; + + /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ + g_assert(page_bits < 20); + + return pages >> (20 - page_bits); +} + bool cpu_physical_memory_is_io(hwaddr phys_addr) { MemoryRegion*mr; --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154080; cv=none; d=zohomail.com; s=zohoarc; b=EECi7RX5c+XT7FcOFiyZBGdVBkRWD9Y43zmRA4iwpF5QI59zljeBBfvrk3PJfyMWfAJxu5t3n/QEJVLS5kCU8Dzhk8TreEzdPmjqppj6oKkoO9hUzHwgh0hUD37UVTHriIfhxdbE8XHEkbXvo5JujC43809TjpFOy8FlQ2oyw0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154080; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zHITF7fqKh3KwcWERjg4I/zSMoPKNfMkQAlqeVndp6I=; b=Pyej2vwINRBYB1PJuECX9dVpXuT/hkLX08w1p80/ptRg9PjrwKfPpBK83c3dQh4H1CeqXDQBWV9H7yIQil83dVnuJ+K7T7eR2bjOHOC294l4wfpdFPokz7sy9THHzPVnjCvfxTv9X7rWs3PH1Bo1FU5UoyIoT2bhaiLulcTQiLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154080431487.793097825299; Mon, 15 May 2023 05:34:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPH-0006Wo-8D; Mon, 15 May 2023 08:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOg-0006QK-Ph for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOf-0003Jb-1T for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-18-bkyUVAwMNxeYukTeV25OXQ-1; Mon, 15 May 2023 08:33:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4A7286C60B; Mon, 15 May 2023 12:33:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3A5E35453; Mon, 15 May 2023 12:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zHITF7fqKh3KwcWERjg4I/zSMoPKNfMkQAlqeVndp6I=; b=Do3d1GdtnekQ6sTAtWFZqV1t0V5ZDdDksjkfZCy+6DtYraawXMaPzhgHguzzoJz3LWqDiv 23LcTOdRHS1cf9McamuJsBUEy6+3YkDriTI+7MVtesoNvTDXFjsisyOwx135T8I4yByscH y8lV7K0K2VlcL6QGy78lfIXkbhEn4rE= X-MC-Unique: bkyUVAwMNxeYukTeV25OXQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Richard Henderson Subject: [PULL 03/11] Use new created qemu_target_pages_to_MiB() Date: Mon, 15 May 2023 14:33:26 +0200 Message-Id: <20230515123334.58995-4-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154082627100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Message-Id: <20230511141208.17779-3-quintela@redhat.com> --- migration/dirtyrate.c | 11 +++++------ softmmu/dirtylimit.c | 11 +++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 5bac984fa5..ae52c42c4c 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -16,6 +16,7 @@ #include "qapi/error.h" #include "cpu.h" #include "exec/ramblock.h" +#include "exec/target_page.h" #include "exec/ram_addr.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" @@ -75,13 +76,11 @@ static inline void record_dirtypages(DirtyPageRecord *d= irty_pages, static int64_t do_calculate_dirtyrate(DirtyPageRecord dirty_pages, int64_t calc_time_ms) { - uint64_t memory_size_MB; uint64_t increased_dirty_pages =3D dirty_pages.end_pages - dirty_pages.start_pages; + uint64_t memory_size_MiB =3D qemu_target_pages_to_MiB(increased_dirty_= pages); =20 - memory_size_MB =3D (increased_dirty_pages * TARGET_PAGE_SIZE) >> 20; - - return memory_size_MB * 1000 / calc_time_ms; + return memory_size_MiB * 1000 / calc_time_ms; } =20 void global_dirty_log_change(unsigned int flag, bool start) @@ -292,8 +291,8 @@ static void update_dirtyrate_stat(struct RamblockDirtyI= nfo *info) DirtyStat.page_sampling.total_dirty_samples +=3D info->sample_dirty_co= unt; DirtyStat.page_sampling.total_sample_count +=3D info->sample_pages_cou= nt; /* size of total pages in MB */ - DirtyStat.page_sampling.total_block_mem_MB +=3D (info->ramblock_pages * - TARGET_PAGE_SIZE) >> 20; + DirtyStat.page_sampling.total_block_mem_MB +=3D + qemu_target_pages_to_MiB(info->ramblock_pages); } =20 static void update_dirtyrate(uint64_t msec) diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 71bf6dc7a4..015a9038d1 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -235,20 +235,15 @@ bool dirtylimit_vcpu_index_valid(int cpu_index) static uint64_t dirtylimit_dirty_ring_full_time(uint64_t dirtyrate) { static uint64_t max_dirtyrate; - unsigned target_page_bits =3D qemu_target_page_bits(); - uint64_t dirty_ring_size_MB; + uint64_t dirty_ring_size_MiB; =20 - /* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ - assert(target_page_bits < 20); - - /* Convert ring size (pages) to MiB (2**20). */ - dirty_ring_size_MB =3D kvm_dirty_ring_size() >> (20 - target_page_bits= ); + dirty_ring_size_MiB =3D qemu_target_pages_to_MiB(kvm_dirty_ring_size()= ); =20 if (max_dirtyrate < dirtyrate) { max_dirtyrate =3D dirtyrate; } =20 - return dirty_ring_size_MB * 1000000 / max_dirtyrate; + return dirty_ring_size_MiB * 1000000 / max_dirtyrate; } =20 static inline bool dirtylimit_done(uint64_t quota, --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154191; cv=none; d=zohomail.com; s=zohoarc; b=OX3UlEXnNVfoAXfnGQ7ILOFDNT0sJ3AVzwjmAarcOdUTzAI4/+pb7EGsAElwHMW4tauzIA/4/qR3FCSOCqxZpYhIEYtoG946dExAv9pwApup6TKMadds5TG0tjnv7Fpm1SdrSuUJjmA4WZ1ntmcCYzXj+IrG7nLB9j4/qGo6V8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154191; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tN/SR4Ju+jfq6SzQNNQ4u1IOrbHLiPvooaqy1t3mEOA=; b=iAf3uzE6MOhfzV5Bmme9KLn20w7tidVO8bZoZdK9bEamZiDk7V602i8gugYccoCKO1cgjTCXpmTJfFGHspoNyETCvr2Ca6+nqlv4MRNYG1iv2hfBL8ecVopMEHYMH3ODI9hE3V+vHb22CLK9Y+Ly26RFAcVNuYFXkRcW2hruQEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154191400879.4280144004266; Mon, 15 May 2023 05:36:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPT-0006jC-2a; Mon, 15 May 2023 08:34:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOk-0006RD-Bp for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOg-0003K1-HU for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:52 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-2lbDfOc8NJO0U5JhmsYsWg-1; Mon, 15 May 2023 08:33:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0C4841854CA0; Mon, 15 May 2023 12:33:46 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A02C63F8F; Mon, 15 May 2023 12:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tN/SR4Ju+jfq6SzQNNQ4u1IOrbHLiPvooaqy1t3mEOA=; b=UGHklDInXZ2Eb7WTWirlkjCrRI1OJqNDHu/3ftC1f+yNNgZ8I34Yl5nu26dfYeLKOl6lYO B2Kh+xy+74lDve+3OITNRoVXUAxE0fnVwklQ+QSMsonax6qqrkBCAC7y1MoTNQP7Vgm65O TcfqcERBI2ri+mQ8XaG3wXYJT5qNwd8= X-MC-Unique: 2lbDfOc8NJO0U5JhmsYsWg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Richard Henderson Subject: [PULL 04/11] migration: Teach dirtyrate about qemu_target_page_size() Date: Mon, 15 May 2023 14:33:27 +0200 Message-Id: <20230515123334.58995-5-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154192146100001 Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230511141208.17779-4-quintela@redhat.com> --- migration/dirtyrate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index ae52c42c4c..9383e91cd6 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -313,6 +313,7 @@ static void update_dirtyrate(uint64_t msec) */ static uint32_t compute_page_hash(void *ptr) { + size_t page_size =3D qemu_target_page_size(); uint32_t i; uint64_t v1, v2, v3, v4; uint64_t res; @@ -322,14 +323,14 @@ static uint32_t compute_page_hash(void *ptr) v2 =3D QEMU_XXHASH_SEED + XXH_PRIME64_2; v3 =3D QEMU_XXHASH_SEED + 0; v4 =3D QEMU_XXHASH_SEED - XXH_PRIME64_1; - for (i =3D 0; i < TARGET_PAGE_SIZE / 8; i +=3D 4) { + for (i =3D 0; i < page_size / 8; i +=3D 4) { v1 =3D XXH64_round(v1, p[i + 0]); v2 =3D XXH64_round(v2, p[i + 1]); v3 =3D XXH64_round(v3, p[i + 2]); v4 =3D XXH64_round(v4, p[i + 3]); } res =3D XXH64_mergerounds(v1, v2, v3, v4); - res +=3D TARGET_PAGE_SIZE; + res +=3D page_size; res =3D XXH64_avalanche(res); return (uint32_t)(res & UINT32_MAX); } @@ -344,7 +345,8 @@ static uint32_t get_ramblock_vfn_hash(struct RamblockDi= rtyInfo *info, { uint32_t hash; =20 - hash =3D compute_page_hash(info->ramblock_addr + vfn * TARGET_PAGE_SIZ= E); + hash =3D compute_page_hash(info->ramblock_addr + + vfn * qemu_target_page_size()); =20 trace_get_ramblock_vfn_hash(info->idstr, vfn, hash); return hash; --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154320; cv=none; d=zohomail.com; s=zohoarc; b=chbEjbN3Knb+SIQ5A2oz2BPQhAYjV/tmBVUR3ZkcAVIkEAFXoG7sWdIDeog/cmDX+0dWmFVVhJb6ShOEGWFgZ0gOgjOQ6kqXwoMIaCN6fqplYULQ8jm845oj470PVz9h69OreqDm7RvYSX2Sa8euzlwVMXPp9eLp8z9xNX8ppdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RGR799pEPaaflMBwWin8y5gwV1MT3AgFnGKYFTkrW/8=; b=JqluGJyc9OuI3ElTb3HuNct6iNHpPFkMb+N9HLIcd5FX+ZK5Mg1C9J6hJ8N7/oIetH9NhfshvT8BZfSHHEKIAs4TAyV7kMzl+UQGEdeJCeQN3KdFIjBAK7Kbjko5+jgLqpID+B6Iyk1R/qb6+oS8PgcX1ytZ3TnUTks7gN1IG6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154320344634.346426773312; Mon, 15 May 2023 05:38:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPM-0006Z0-AP; Mon, 15 May 2023 08:34:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOq-0006S5-BP for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOk-0003Kn-Qf for qemu-devel@nongnu.org; Mon, 15 May 2023 08:33:57 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-416-ClrQVqfrMS-7MGU5zfBOkg-1; Mon, 15 May 2023 08:33:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 36E7B3C0F372; Mon, 15 May 2023 12:33:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5364163F5F; Mon, 15 May 2023 12:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RGR799pEPaaflMBwWin8y5gwV1MT3AgFnGKYFTkrW/8=; b=BXKSWsY8DghR2VQLPhLtlszZhdPU9CBpaJvJgFkGR2Pt/DSyMOpRIKuptlr0nLKS/HqR7n pJIEAwtVJLkJPU8O6Hg4mOU7chLmGbvOTYmr/Bpw8XYpRSw0S9g8w1b9+j7W6hMOh8ueIt Vwkgowa+3Dcgz61KacoyllvHcrMso/8= X-MC-Unique: ClrQVqfrMS-7MGU5zfBOkg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Richard Henderson Subject: [PULL 05/11] migration: Teach dirtyrate about qemu_target_page_bits() Date: Mon, 15 May 2023 14:33:28 +0200 Message-Id: <20230515123334.58995-6-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154321199100007 Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20230511141208.17779-5-quintela@redhat.com> --- migration/dirtyrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 9383e91cd6..f32a690a56 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -401,7 +401,7 @@ static void get_ramblock_dirty_info(RAMBlock *block, sample_pages_per_gigabytes) >> 30; /* Right shift TARGET_PAGE_BITS to calc page count */ info->ramblock_pages =3D qemu_ram_get_used_length(block) >> - TARGET_PAGE_BITS; + qemu_target_page_bits(); info->ramblock_addr =3D qemu_ram_get_host_addr(block); strcpy(info->idstr, qemu_ram_get_idstr(block)); } @@ -512,7 +512,7 @@ find_block_matched(RAMBlock *block, int count, =20 if (infos[i].ramblock_addr !=3D qemu_ram_get_host_addr(block) || infos[i].ramblock_pages !=3D - (qemu_ram_get_used_length(block) >> TARGET_PAGE_BITS)) { + (qemu_ram_get_used_length(block) >> qemu_target_page_bits())) { trace_find_page_matched(block->idstr); return NULL; } --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154257; cv=none; d=zohomail.com; s=zohoarc; b=G/5sQIhF566yLMrH/RkbcPnpzSmMTnLlRb36Rdz/Mj1rF0MkAcS2L6aPUnBCN8axjFb2AKX0KtnuNa18UhUf45PcfGa6fLNNV7bEcJIxhqmfFwNli4CVZIEngxYEOnfXyyB5lS9lYfvEA6J0NFjKTyUEfjmQ0q1pprFAHe+KqIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154257; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Vk+8R6FXeCz4rA3di+iEjQ1mpLmDpWeLarwa+8mCuEY=; b=dMBKkcgOZHMAcdHBJeZ7KocCgjc4CeIemZOdXvNV/AVAQ6Iuo0pXKdwfD1bbr8BESb6q8KyEmdh+uq1J8kkMhSITaIuSyX2DifN48Tq0ONWCD7JGY9UT1angPwyUyJ75tx8CGrYfwTI8NqHv5vrkAcc+fG/I1+xTBTiwC3gqzVg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154257423511.5803079769033; Mon, 15 May 2023 05:37:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPP-0006g2-0w; Mon, 15 May 2023 08:34:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOu-0006Si-8Z for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOl-0003Kx-Uo for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-RFiDc2ulN6OqLvWfQBopaQ-1; Mon, 15 May 2023 08:33:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63AC386C60D; Mon, 15 May 2023 12:33:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8009963F8F; Mon, 15 May 2023 12:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vk+8R6FXeCz4rA3di+iEjQ1mpLmDpWeLarwa+8mCuEY=; b=W6cKCBHxa3owNST+CgZV4W9LCd9tkyEoaPd0a04PZVfrsdR9lOwk+ugDyvemfeffFjOQzg ++x2JIWhRKxs9KvgiNmQoSVptCmQzAefOqqpxhfE9Wyz9/5iBUn6uMaGz0PGNHtjncYSoS GpvGGC3yVzdNOeQY1atgdFdZhxHToyU= X-MC-Unique: RFiDc2ulN6OqLvWfQBopaQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , Richard Henderson Subject: [PULL 06/11] migration: Make dirtyrate.c target independent Date: Mon, 15 May 2023 14:33:29 +0200 Message-Id: <20230515123334.58995-7-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154258313100001 After the previous two patches, there is nothing else that is target specific. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230511141208.17779-6-quintela@redhat.com> --- migration/dirtyrate.c | 2 -- migration/meson.build | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index f32a690a56..c06f12c39d 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -14,10 +14,8 @@ #include "qemu/error-report.h" #include #include "qapi/error.h" -#include "cpu.h" #include "exec/ramblock.h" #include "exec/target_page.h" -#include "exec/ram_addr.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" #include "qapi/qapi-commands-migration.h" diff --git a/migration/meson.build b/migration/meson.build index eb41b77db9..dc8b1daef5 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -13,6 +13,7 @@ softmmu_ss.add(files( 'block-dirty-bitmap.c', 'channel.c', 'channel-block.c', + 'dirtyrate.c', 'exec.c', 'fd.c', 'global_state.c', @@ -42,6 +43,5 @@ endif softmmu_ss.add(when: zstd, if_true: files('multifd-zstd.c')) =20 specific_ss.add(when: 'CONFIG_SOFTMMU', - if_true: files('dirtyrate.c', - 'ram.c', + if_true: files('ram.c', 'target.c')) --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154117; cv=none; d=zohomail.com; s=zohoarc; b=EWCCSLq08pRRI+SwTM+o2AKYYyqAqdF+gULM1nsSdHl+jADgCT1yyXkc+O2k8kYN5Uk1faGlp8oZz1skodrcXqpkPZSYaVsQDvxhbgDNaCI+0qUJ+nZ8TVa5dGUq1UrTnIxJRk/u2c3NObPXg49fqq+ubfZqyIIUSdYfnXvEkLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154117; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D6oKoZ4O6uldHm4D+Zo5e6BNr/w9mJRMN8Y/8Eua9Cc=; b=TOPut0GbcacE6P+/fQb1FxBPjVYfni35QwjGbT0qo6N1JU4xg2OqBMcqRyGp2xWquzRNC09VYK6LmsQvXutcTgRw2Cm5W7UalCTKevmT4AvLVN72hCPyfkHuSSpAF4fQwEcidi+pRgx+PAY4UEzLVZhS/qXLsN0JaCL3kDKaQH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154116642442.35693995116014; Mon, 15 May 2023 05:35:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPk-0006y6-FN; Mon, 15 May 2023 08:34:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOy-0006T4-9n for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOq-0003LK-4G for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-313-yK4NfgRgPMaQ6ymTVpWPrw-1; Mon, 15 May 2023 08:33:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FE351012BC0; Mon, 15 May 2023 12:33:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB14F35453; Mon, 15 May 2023 12:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D6oKoZ4O6uldHm4D+Zo5e6BNr/w9mJRMN8Y/8Eua9Cc=; b=FM+0YBOHiZDQSCp5tRzXhHR1nPGHtXP5YpsA72ZEHkPJyJ1S/XM69Xd1q24gVWkCjZwRij Tr9xtnAiBFT2wnisX3hsf5qqCR4Es079EwyMGYM6+ZjryS+pZWpd/VmwnXHSwlqo01Ma8O fPEqkPPE3cYmedaLAORqmWcu+UTHsKQ= X-MC-Unique: yK4NfgRgPMaQ6ymTVpWPrw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 07/11] migration: A rate limit value of 0 is valid Date: Mon, 15 May 2023 14:33:30 +0200 Message-Id: <20230515123334.58995-8-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154118786100001 And it is the best way to not have rate_limit. Signed-off-by: Juan Quintela Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20230508130909.65420-2-quintela@redhat.com> --- migration/migration.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 439e8651df..5636119e8e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2140,12 +2140,7 @@ static int postcopy_start(MigrationState *ms) * will notice we're in POSTCOPY_ACTIVE and not actually * wrap their state up here */ - /* 0 max-postcopy-bandwidth means unlimited */ - if (!bandwidth) { - qemu_file_set_rate_limit(ms->to_dst_file, INT64_MAX); - } else { - qemu_file_set_rate_limit(ms->to_dst_file, bandwidth / XFER_LIMIT_R= ATIO); - } + qemu_file_set_rate_limit(ms->to_dst_file, bandwidth / XFER_LIMIT_RATIO= ); if (migrate_postcopy_ram()) { /* Ping just for debugging, helps line traces up */ qemu_savevm_send_ping(ms->to_dst_file, 2); --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154283; cv=none; d=zohomail.com; s=zohoarc; b=ApAbk9TfAV2ql+oqAcFD9il1tgbFns2Lo1quJQOERfk8oEvRhS/KQOQAWTydeBvkAXCb23UxyEgaQjCHrcX3L+7KGQ4SiTG1BLPEWZ8hBpFahrzpiSuoH68OnfrzXhNWJq66uAwrEtzRbifPO5uHa/ZV1WxXRCLtUIFxgs6zFSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154283; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8PlvK0jZEypQL5Au5TZqNRqloEjsCBWZio4hIgCCZls=; b=augT7gjJZrJ4mL0i9ntngSNfZC++447P7TSSM2tz7czJKsp7i6VGEgfip+JU6C9UVTd0TvflpSjNggNOS8i3u7NLrrN4fU9Dympch7tDL+lroqNMDgA4vPOUuiZ10nx0Av2n4JF+5+xmVxf+45fib9bTJo+JkU+ziZLkGoNZybw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154283696757.8335161667176; Mon, 15 May 2023 05:38:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPh-0006qo-Li; Mon, 15 May 2023 08:34:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXPA-0006Up-3s for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOs-0003Lr-DO for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:18 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-jgZ8rO_EPriEu1Wo0fYpZg-1; Mon, 15 May 2023 08:33:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70B738123AD; Mon, 15 May 2023 12:33:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9A4D35453; Mon, 15 May 2023 12:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8PlvK0jZEypQL5Au5TZqNRqloEjsCBWZio4hIgCCZls=; b=M4tqc+Z6pN3v/PeLDZds9hwM2wAqglsWwgOs69p+v1oWnGKt8PyxMmqrMdOTi4FNtfk+Iu B5sHnKjXxI+zVfLSRJXXvorzSg0CHvlrwK2yse1FYKl0QfuKnjPJM0DNgTKz6NxcdLdD7k htMAvGQFRO8g5R24FgiYzSVnkl34C2I= X-MC-Unique: jgZ8rO_EPriEu1Wo0fYpZg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 08/11] migration: We set the rate_limit by a second Date: Mon, 15 May 2023 14:33:31 +0200 Message-Id: <20230515123334.58995-9-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154284330100001 That the implementation does the check every 100 milliseconds is an implementation detail that shouldn't be seen on the interfaz. Notice that all callers of qemu_file_set_rate_limit() used the division or pass 0, so this change is a NOP. Signed-off-by: Juan Quintela Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20230508130909.65420-4-quintela@redhat.com> --- migration/migration.c | 7 +++---- migration/options.c | 4 ++-- migration/qemu-file.c | 6 +++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5636119e8e..73ac63746b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2140,7 +2140,7 @@ static int postcopy_start(MigrationState *ms) * will notice we're in POSTCOPY_ACTIVE and not actually * wrap their state up here */ - qemu_file_set_rate_limit(ms->to_dst_file, bandwidth / XFER_LIMIT_RATIO= ); + qemu_file_set_rate_limit(ms->to_dst_file, bandwidth); if (migrate_postcopy_ram()) { /* Ping just for debugging, helps line traces up */ qemu_savevm_send_ping(ms->to_dst_file, 2); @@ -3231,11 +3231,10 @@ void migrate_fd_connect(MigrationState *s, Error *e= rror_in) =20 if (resume) { /* This is a resumed migration */ - rate_limit =3D migrate_max_postcopy_bandwidth() / - XFER_LIMIT_RATIO; + rate_limit =3D migrate_max_postcopy_bandwidth(); } else { /* This is a fresh new migration */ - rate_limit =3D migrate_max_bandwidth() / XFER_LIMIT_RATIO; + rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ notifier_list_notify(&migration_state_notifiers, s); diff --git a/migration/options.c b/migration/options.c index 7ed88b7b32..c2a278ee2d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1243,7 +1243,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) s->parameters.max_bandwidth =3D params->max_bandwidth; if (s->to_dst_file && !migration_in_postcopy()) { qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); + s->parameters.max_bandwidth); } } =20 @@ -1273,7 +1273,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; if (s->to_dst_file && migration_in_postcopy()) { qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); + s->parameters.max_postcopy_bandwidth); } } if (params->has_max_cpu_throttle) { diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 61fb580342..60f6345033 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -29,6 +29,7 @@ #include "migration.h" #include "qemu-file.h" #include "trace.h" +#include "options.h" #include "qapi/error.h" =20 #define IO_BUF_SIZE 32768 @@ -744,7 +745,10 @@ int64_t qemu_file_get_rate_limit(QEMUFile *f) =20 void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit) { - f->rate_limit_max =3D limit; + /* + * 'limit' is per second. But we check it each 100 miliseconds. + */ + f->rate_limit_max =3D limit / XFER_LIMIT_RATIO; } =20 void qemu_file_reset_rate_limit(QEMUFile *f) --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154311; cv=none; d=zohomail.com; s=zohoarc; b=Ma6bzbkaHGktYdSQSz3mqI/8xtys+FU69kPjbrjf/rz0yyhSJI8fpfXxo+fHXiI9/IV1f/tehHCGBgiLansK90W2nbbxlyFhJqjOnjkbzg60KtsBJMjEv/oqLgsUnxsmN8NuS78bQmXQAAmC+hBq7Clwl5ltlocB4IN8zzEm36g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154311; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6Q9N5+WD+9qH+TkM6MjDSCGr3Du7RKNkPvAxZvkRQFY=; b=kdkXT3ZedwKsEDyb1yMJ7DtYB4JENvrugqH1DCZE+ZJQNnP1zIAH12blUT3sf59uoRv0hjYR247Gyyf9LdEsNvogPbIk6tM3UlapabJvXFSTSd2sSUWE5WmdHz8J/7KSAU9nREutetGBumM/zFdThKJSi5jDiDnaYVuyu9s22oE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154311766556.083460208986; Mon, 15 May 2023 05:38:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPs-00070s-1K; Mon, 15 May 2023 08:35:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOz-0006T7-OK for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOt-0003MH-LF for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-w9Kw_ah_Meq60OjcrYSluQ-1; Mon, 15 May 2023 08:33:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0606B1854CA0; Mon, 15 May 2023 12:33:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B41763F5F; Mon, 15 May 2023 12:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Q9N5+WD+9qH+TkM6MjDSCGr3Du7RKNkPvAxZvkRQFY=; b=H9XAh/R5TYuYyOi6YkgnhmEcNQLMfZHrShwMG14D4rr9gm9+f0NysVFS27dtBqKw35QjPh YXalTAl+JgFKHHy1oWQZpX00jUwCjZnAau9FI/lYSbb1ayXOIPbrJieU8G5thSuCZ+NUed sjA7WQl1ejl41EUd6OZdRxA70a42ReQ= X-MC-Unique: w9Kw_ah_Meq60OjcrYSluQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 09/11] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t Date: Mon, 15 May 2023 14:33:32 +0200 Message-Id: <20230515123334.58995-10-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154312567100002 It is really size_t. Everything else uses uint64_t, so move this to uint64_t as well. A size can't be negative anyways. Signed-off-by: Juan Quintela Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20230508130909.65420-5-quintela@redhat.com> --- migration/qemu-file.h | 4 ++-- migration/qemu-file.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 4ee58a87dd..13c7c78c0d 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -139,8 +139,8 @@ void qemu_file_reset_rate_limit(QEMUFile *f); * need to be applied to the rate limiting calcuations */ void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len); -void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); -int64_t qemu_file_get_rate_limit(QEMUFile *f); +void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate); +uint64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error_obj(QEMUFile *f, Error **errp); int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp); void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err); diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 60f6345033..94d1069c8e 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -44,7 +44,7 @@ struct QEMUFile { * Maximum amount of data in bytes to transfer during one * rate limiting time window */ - int64_t rate_limit_max; + uint64_t rate_limit_max; /* * Total amount of data in bytes queued for transfer * during this rate limiting time window @@ -738,12 +738,12 @@ int qemu_file_rate_limit(QEMUFile *f) return 0; } =20 -int64_t qemu_file_get_rate_limit(QEMUFile *f) +uint64_t qemu_file_get_rate_limit(QEMUFile *f) { return f->rate_limit_max; } =20 -void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit) +void qemu_file_set_rate_limit(QEMUFile *f, uint64_t limit) { /* * 'limit' is per second. But we check it each 100 miliseconds. --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154142; cv=none; d=zohomail.com; s=zohoarc; b=cccv/XI1YkOizQ3iYpbujUA2r2anOpo3xTyhR/N5ENCbrF3WMgxCknCebotl2LCmu79mEqGPXgo8DZHgJYa8fLc6D3oz2nBUwzKthHC9p2rVZTsS6giXpfuJXXZZW8A+QYWr7mk02b/hAN+igAhMbDyVSxFOri8LQhi3qWfE39Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aWmRjz4fwuIJDiq0s/t2IkjQIvfxRe7eKWP6VfkWff8=; b=LHSQSr1sz1k3f+f0v8EN8x9vUmEiOHb/7I4UKbwmJlDTxz3wunonVpAASMPhig2kV0VXguY8Bnf/q9UD/bEfwiOaoKO/tYlTCwCvlHPWC6KDWBbD+R39o+uh6wW0gJxHw1wr+yIpHn9lQbysugzw36Y7plEQSI0clw05Gc53gvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154142392340.9084684732936; Mon, 15 May 2023 05:35:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPg-0006p6-7X; Mon, 15 May 2023 08:34:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXP1-0006TG-HF for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOw-0003MX-J5 for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-o5W7XfJMOtCLsoRRX7Bq_A-1; Mon, 15 May 2023 08:33:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E0C938123A5; Mon, 15 May 2023 12:33:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 504A963F3D; Mon, 15 May 2023 12:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWmRjz4fwuIJDiq0s/t2IkjQIvfxRe7eKWP6VfkWff8=; b=WZbCq+j6ybiaBID7HcwM0l1p91JKIOuKeOcn89B16guISUYPLTpOZhVUTdLrzDLW6b4Cm7 JGYu0UOk5Blf784W1/iYO3sxhqo/ce12qRQV2Ouxv0y9+67T/hDRS4mST63Y4vrlKklnyH HV1EEVhXLMpLKN4uMUL+LnhTsUDA7K4= X-MC-Unique: o5W7XfJMOtCLsoRRX7Bq_A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 10/11] qemu-file: Make rate_limit_used an uint64_t Date: Mon, 15 May 2023 14:33:33 +0200 Message-Id: <20230515123334.58995-11-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154142891100001 Change all the functions that use it. It was already passed as uint64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20230508130909.65420-6-quintela@redhat.com> --- migration/qemu-file.h | 2 +- migration/qemu-file.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 13c7c78c0d..6905825f23 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -138,7 +138,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f); * out of band from the main file object I/O methods, and * need to be applied to the rate limiting calcuations */ -void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len); +void qemu_file_acct_rate_limit(QEMUFile *f, uint64_t len); void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate); uint64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error_obj(QEMUFile *f, Error **errp); diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 94d1069c8e..1b39d51dd4 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -49,7 +49,7 @@ struct QEMUFile { * Total amount of data in bytes queued for transfer * during this rate limiting time window */ - int64_t rate_limit_used; + uint64_t rate_limit_used; =20 /* The sum of bytes transferred on the wire */ uint64_t total_transferred; @@ -756,7 +756,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f) f->rate_limit_used =3D 0; } =20 -void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len) +void qemu_file_acct_rate_limit(QEMUFile *f, uint64_t len) { f->rate_limit_used +=3D len; } --=20 2.40.1 From nobody Sat May 18 23:44:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1684154110; cv=none; d=zohomail.com; s=zohoarc; b=S4Pay8JuGSrLojGnI5/F1rRT+cziTr0ofxgOZvYDy9ur3x1apTGNDNw0p/wndkUIpMgZCT6haq6/ZFgouVEbKpjsWlHhdy5muKxf5TrPCORL6VIWDRpbO8RebYuMbz8yvlV7hWYjy/PbHNqGpI75/eVDe8aTFKLN1qfLo+Ny6Xk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684154110; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dc6X+NBz3GJ994pHYidadEF/IgH2avlOCrttW4lMDMU=; b=SREEuVsNhwUZT7hTaSDK4jm7oez1ijbtR+0K4EZvSFPWMKoBLDunhpgz7QyPYVonKeTYRyxSKWvKg5ixDj4KiP3hnALcG5gEC/earfDCwNWzkRkxf6N4t0sV8Vlb3wH1F/NnIjquMJD1s08B0mdFDAfVo4hAP/UlnGDvxjgIcsE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1684154110424741.1447572520872; Mon, 15 May 2023 05:35:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyXPJ-0006XI-SU; Mon, 15 May 2023 08:34:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXP1-0006TH-HX for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyXOx-0003N7-E3 for qemu-devel@nongnu.org; Mon, 15 May 2023 08:34:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-306-_TbfhlCWPYCol3liWU7_LA-1; Mon, 15 May 2023 08:34:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8981338123A5; Mon, 15 May 2023 12:34:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A753863F3D; Mon, 15 May 2023 12:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684154045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dc6X+NBz3GJ994pHYidadEF/IgH2avlOCrttW4lMDMU=; b=RJSV9zlcUlTgttxSPESuvkHcaJhioMRharu804yntkRwjN1EvB3miZpM3txzS7AokCk5+2 Ub51YiCuLMZ0KzqB0oXVsuHjWy0OcVcUZ3H3Wm5OAo2nh/P74ORjaes/qWvXtD9ndX6mW4 d9tOUAr6Hh1xXFEAjXR2xnoyyO2X1zU= X-MC-Unique: _TbfhlCWPYCol3liWU7_LA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , qemu-block@nongnu.org, Juan Quintela , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Leonardo Bras , Peter Xu , Stefan Hajnoczi , Fam Zheng , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 11/11] qemu-file: Remove total from qemu_file_total_transferred_*() Date: Mon, 15 May 2023 14:33:34 +0200 Message-Id: <20230515123334.58995-12-quintela@redhat.com> In-Reply-To: <20230515123334.58995-1-quintela@redhat.com> References: <20230515123334.58995-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684154112521100001 Function is already quite long. Signed-off-by: Juan Quintela Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20230508130909.65420-7-quintela@redhat.com> --- migration/qemu-file.h | 10 +++++----- migration/block.c | 4 ++-- migration/migration.c | 2 +- migration/qemu-file.c | 4 ++-- migration/savevm.c | 6 +++--- migration/vmstate.c | 5 ++--- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 6905825f23..bcc39081f2 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -68,7 +68,7 @@ void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks= *hooks); int qemu_fclose(QEMUFile *f); =20 /* - * qemu_file_total_transferred: + * qemu_file_transferred: * * Report the total number of bytes transferred with * this file. @@ -83,19 +83,19 @@ int qemu_fclose(QEMUFile *f); * * Returns: the total bytes transferred */ -uint64_t qemu_file_total_transferred(QEMUFile *f); +uint64_t qemu_file_transferred(QEMUFile *f); =20 /* - * qemu_file_total_transferred_fast: + * qemu_file_transferred_fast: * - * As qemu_file_total_transferred except for writable + * As qemu_file_transferred except for writable * files, where no flush is performed and the reported * amount will include the size of any queued buffers, * on top of the amount actually transferred. * * Returns: the total bytes transferred and queued */ -uint64_t qemu_file_total_transferred_fast(QEMUFile *f); +uint64_t qemu_file_transferred_fast(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/block.c b/migration/block.c index a37678ce95..12617b4152 100644 --- a/migration/block.c +++ b/migration/block.c @@ -747,7 +747,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - uint64_t last_bytes =3D qemu_file_total_transferred(f); + uint64_t last_bytes =3D qemu_file_transferred(f); =20 trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -799,7 +799,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); - uint64_t delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_transferred(f) - last_bytes; return (delta_bytes > 0); } =20 diff --git a/migration/migration.c b/migration/migration.c index 73ac63746b..00d8ba8da0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2648,7 +2648,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) /* How many bytes have we transferred since the beginning of the migration= */ static uint64_t migration_total_bytes(MigrationState *s) { - return qemu_file_total_transferred(s->to_dst_file) + + return qemu_file_transferred(s->to_dst_file) + stat64_get(&mig_stats.multifd_bytes); } =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 1b39d51dd4..597054759d 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -709,7 +709,7 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -uint64_t qemu_file_total_transferred_fast(QEMUFile *f) +uint64_t qemu_file_transferred_fast(QEMUFile *f) { uint64_t ret =3D f->total_transferred; int i; @@ -721,7 +721,7 @@ uint64_t qemu_file_total_transferred_fast(QEMUFile *f) return ret; } =20 -uint64_t qemu_file_total_transferred(QEMUFile *f) +uint64_t qemu_file_transferred(QEMUFile *f) { qemu_fflush(f); return f->total_transferred; diff --git a/migration/savevm.c b/migration/savevm.c index 032044b1d5..e33788343a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,9 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - uint64_t old_offset =3D qemu_file_total_transferred_fast(f); + uint64_t old_offset =3D qemu_file_transferred_fast(f); se->ops->save_state(f, se->opaque); - uint64_t size =3D qemu_file_total_transferred_fast(f) - old_offset; + uint64_t size =3D qemu_file_transferred_fast(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); @@ -2956,7 +2956,7 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, goto the_end; } ret =3D qemu_savevm_state(f, errp); - vm_state_size =3D qemu_file_total_transferred(f); + vm_state_size =3D qemu_file_transferred(f); ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; diff --git a/migration/vmstate.c b/migration/vmstate.c index 351f56104e..af01d54b6f 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -361,7 +361,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, void *curr_elem =3D first_elem + size * i; =20 vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems= ); - old_offset =3D qemu_file_total_transferred_fast(f); + old_offset =3D qemu_file_transferred_fast(f); if (field->flags & VMS_ARRAY_OF_POINTER) { assert(curr_elem); curr_elem =3D *(void **)curr_elem; @@ -391,8 +391,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, return ret; } =20 - written_bytes =3D qemu_file_total_transferred_fast(f) - - old_offset; + written_bytes =3D qemu_file_transferred_fast(f) - old_offs= et; vmsd_desc_field_end(vmsd, vmdesc_loop, field, written_byte= s, i); =20 /* Compressed arrays only care about the first element */ --=20 2.40.1