From nobody Sat May 18 14:01:39 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=1683814390; cv=none; d=zohomail.com; s=zohoarc; b=liBgMGOnzEF/NjgMT9Yln+9O9xN7tv0gJgDNh0ojoD3Xwc94eJyrnP3yCqWgMy9xm9TBmkWCqArnnpoTRbtY843ODaoiW3gXSQM2v9X+tNMrnzQEf2Y/J0sIuPBZqMQ/GlzTZTRaDfHHdqEfFaEzBJeeRzS8tc5+nK/P4JtS7aE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683814390; 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=Bhy8vQ+2rTV+YQUnEofTbzBhigtmHuZk129sLHgJoow=; b=bym/+pYdLlkrRNGwnQk7J8NLCPaxrrQEQjNAg8/FNxx3XadCaJ9d7Bv8NXTqUxLUmXbkcKPyGpHS7kTvf0F8l7lW+gQJ4+Q0x58imA28Vq9olbltdaVbfWSDd6UUQDdmnwqz9GM3mKZMebX4yc9KhdaJYd9x9veNdyXEaKV2n+Y= 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 1683814390768583.5268838932122; Thu, 11 May 2023 07:13:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px723-0003Mz-Qy; Thu, 11 May 2023 10:12: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 1px722-0003Mm-7w for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:34 -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 1px720-0004nE-N0 for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:33 -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-454-zhR19GFVMUutX_7RI4BMEQ-1; Thu, 11 May 2023 10:12:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C70D61854AEF; Thu, 11 May 2023 14:12:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ACC414171C0; Thu, 11 May 2023 14:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683814351; 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=Bhy8vQ+2rTV+YQUnEofTbzBhigtmHuZk129sLHgJoow=; b=KbTtgomFHYr1X8dhWm+DUvEbzGg6NTVs93B2JiXqyKGWno7ugfIWpDcwxUW8Hvzx14S4Na TVwzNAmTG06qMy3n9oFDm1aXWzJrMhtDdHuvAwf1Vc9TjovvtI4prmWtNuDZPI5+E8ECHz YDoL5K52sVhxrAE5LFKV6ACxIHbUmoU= X-MC-Unique: zhR19GFVMUutX_7RI4BMEQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Leonardo Bras , Juan Quintela , Richard Henderson , Peter Xu , Andrei Gudkov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhenzhong Duan , Hyman Huang Subject: [PATCH v2 1/5] softmmu: Create qemu_target_pages_to_MiB() Date: Thu, 11 May 2023 16:12:04 +0200 Message-Id: <20230511141208.17779-2-quintela@redhat.com> In-Reply-To: <20230511141208.17779-1-quintela@redhat.com> References: <20230511141208.17779-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1683814393203100001 Content-Type: text/plain; charset="utf-8" Function that convert a number of target_pages into its size in MiB. Suggested-by: Richard Henderson Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson --- 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 14:01:39 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=1683814413; cv=none; d=zohomail.com; s=zohoarc; b=mAcLy8OMrqfwHtrmHRHYUPcG9dGA4eCSwqzRkpW2L6hNP09kuBFoXpfMXSR+iFPP32C4FG4ygL5c4fXcE3SesxJC/vMjG+DnTDr397hLre838fxfKAzHY8ESH5z7fn5mHtf3LWNslpXRXN2GGedycUBTzX2fUry2RFf8z64L/n8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683814413; 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=T71ZSjiS8oq4jJNU+/+xUM9P5lzCJ1/G5WSwxAANw/w=; b=HgiWKt7eGHxpdbTVITL2vdX1yTaeEDbqZZHsB+s3xyEA23XFQyeldNYodaa6KjspRhE1AyWr9tADSHkE3AqOfCyxVGE+UsoYAEzymmv3CYlnbejIuDPsM/jcNVf5PtgcIADxbGueEzBqTZaWdxloYbEALsWHGhPR4PZkpJdF9o0= 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 1683814413230528.212108891266; Thu, 11 May 2023 07:13:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px729-0003Pt-V0; Thu, 11 May 2023 10:12:41 -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 1px728-0003PR-Ew for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:40 -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 1px720-0004nD-OD for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:40 -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-127-JmG_kVjDPEio2ZoFpVvX5A-1; Thu, 11 May 2023 10:12:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 291903C10247; Thu, 11 May 2023 14:12:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E18B14171BC; Thu, 11 May 2023 14:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683814351; 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=T71ZSjiS8oq4jJNU+/+xUM9P5lzCJ1/G5WSwxAANw/w=; b=fcGy7owcpjdf5lcp8sxFraIeMsYv+OE9yXQmPaQex+pfFpDsd8r26qwO5w7BSGI6cBruW9 Avx90Yg6Bt6Okrrx/lDj6T9JZlfq9G7GjB7hLjkV1OQFk4Oa3dC0SJQblWg2MAb1UkAjMd 1jVyiMBN9QDSslaiyabR6Ph8/cHHy3I= X-MC-Unique: JmG_kVjDPEio2ZoFpVvX5A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Leonardo Bras , Juan Quintela , Richard Henderson , Peter Xu , Andrei Gudkov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhenzhong Duan , Hyman Huang Subject: [PATCH v2 2/5] Use new created qemu_target_pages_to_MiB() Date: Thu, 11 May 2023 16:12:05 +0200 Message-Id: <20230511141208.17779-3-quintela@redhat.com> In-Reply-To: <20230511141208.17779-1-quintela@redhat.com> References: <20230511141208.17779-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1683814415353100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson --- 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 180ba38c7a..38ea95af59 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" @@ -74,13 +75,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) @@ -291,8 +290,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 14:01:39 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=1683814437; cv=none; d=zohomail.com; s=zohoarc; b=GvKIlPgDPoc6u3qi6Camp2Ni4Da7bOSFUBPjuaoAi6pH4wwWoO2XUBu+ZP/SJS502oSMH9cgtu7YnBKL637W44HcU4/r8T06nfayhn29SwXk18LGUyLT6rGrwr8KJtihbYYYGl9pTFUIKCUNQ0htBOs8qvKA1f32FVlU/bxh4Ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683814437; 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=tbDjUqn8CqTSXy999ocrftl3YqxbipIVKWgS8Hz48Ms=; b=fP1lircsdpNl5cn04SuexbZPX3HCS66FN8xJbKUdDLMyoOLLsmgunpJr99cb+ulFK58WGDTI4ALsLcY4ZcKMJbOcKwFfSiw3jvl73TAelK1C4vFFgBxAQsjc1SyuLrGG29kGnFZqlaeSVAo4neOEeTYUqtYAxrxiJy2ZImsRmOk= 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 1683814437834640.6272584761774; Thu, 11 May 2023 07:13:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px72I-0003TN-U3; Thu, 11 May 2023 10:12:50 -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 1px72H-0003RM-HD for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:49 -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 1px72F-0004q4-Ei for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:48 -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-323-PH6qPgaFPfeVqYytTasKKw-1; Thu, 11 May 2023 10:12:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9FCF838601D6; Thu, 11 May 2023 14:12:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C2B714171BC; Thu, 11 May 2023 14:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683814366; 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=tbDjUqn8CqTSXy999ocrftl3YqxbipIVKWgS8Hz48Ms=; b=FKe/PNt705+p1HjJc019l0Jl2w+8muXnhsZL4ukuVujQNdBugongvnpoCB87C3nFnvOMg+ wd3EZPUPMWn/rIZk59+eWBh4ab6IZd4BcOXWKdWXKpCTBxUlmxsr/kJqm1nDTKLiMrkcj9 sVBSUZx1XT40sy/YsVnRiRXrEztgxMY= X-MC-Unique: PH6qPgaFPfeVqYytTasKKw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Leonardo Bras , Juan Quintela , Richard Henderson , Peter Xu , Andrei Gudkov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhenzhong Duan , Hyman Huang Subject: [PATCH v2 3/5] migration: Teach dirtyrate about qemu_target_page_size() Date: Thu, 11 May 2023 16:12:06 +0200 Message-Id: <20230511141208.17779-4-quintela@redhat.com> In-Reply-To: <20230511141208.17779-1-quintela@redhat.com> References: <20230511141208.17779-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1683814439138100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- migration/dirtyrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 38ea95af59..6706e3fe66 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -314,10 +314,10 @@ static void update_dirtyrate(uint64_t msec) static uint32_t get_ramblock_vfn_hash(struct RamblockDirtyInfo *info, uint64_t vfn) { + int page_size =3D qemu_target_page_size(); uint32_t crc; =20 - crc =3D crc32(0, (info->ramblock_addr + - vfn * TARGET_PAGE_SIZE), TARGET_PAGE_SIZE); + crc =3D crc32(0, info->ramblock_addr + vfn * page_size, page_size); =20 trace_get_ramblock_vfn_hash(info->idstr, vfn, crc); return crc; --=20 2.40.1 From nobody Sat May 18 14:01:39 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=1683814427; cv=none; d=zohomail.com; s=zohoarc; b=mm5WrguYXiIRMAubLtU0EoCKRyBjaNSVcn6zlZKoyiWByUi99BzO1a8zK2JiJ9n7CXJ3HJAYI07B4zZf/B+fFPzlj6zI6mQkwKMEqXixdeA8SHtiZHuev8SfwYEOhWiYwqHdjjAAgPyYrFVc0miV9qB44ToRndAVCnIACrpzfH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683814427; 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=g9Q7MtDr6fOEW6FmZVvB+xPDdCDqVpMU4L5G+ckmC5w=; b=abbS9XoKSSK+EK52yupzP6StRc32SyY0v0OXT+4VWhcqbvIqceQLlFpOW9TUtj4eKSgPQ9fbEtI7uxbnXjPPhT99Q0x/GDfs7keCc3JJXrRfS5osF3UIzIwqWT/hJYPuFweSMNYA/SNE/HFFBV3EUGEg824ZHLwpN6d983Vuk5Y= 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 1683814426951778.0179499678366; Thu, 11 May 2023 07:13:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px729-0003Pq-Bl; Thu, 11 May 2023 10:12:41 -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 1px727-0003OS-Ul for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:39 -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 1px726-0004nq-Gb for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:39 -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-296-zJ8dAixOOYyAaAIOoPa9Yg-1; Thu, 11 May 2023 10:12:33 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC5F31064B6D; Thu, 11 May 2023 14:12:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8CBB14171BC; Thu, 11 May 2023 14:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683814358; 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=g9Q7MtDr6fOEW6FmZVvB+xPDdCDqVpMU4L5G+ckmC5w=; b=M/yRLhMZ+zfXjECTBFX5cEu68AJFP0jIeq+pLbgCG09/+5cnHVpKxiXxIsCaxD1M7tYor1 fiYH8FWDRMsO9JRIr6ED1/iGqNMKCeb7Vqp8n3DRjOe5WBzSwlS3zTna5O9adBvS3k4vOQ TVEDZ6mfgU+4cG4jSb3UBF5RMIdCuRo= X-MC-Unique: zJ8dAixOOYyAaAIOoPa9Yg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Leonardo Bras , Juan Quintela , Richard Henderson , Peter Xu , Andrei Gudkov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhenzhong Duan , Hyman Huang Subject: [PATCH v2 4/5] migration: Teach dirtyrate about qemu_target_page_bits() Date: Thu, 11 May 2023 16:12:07 +0200 Message-Id: <20230511141208.17779-5-quintela@redhat.com> In-Reply-To: <20230511141208.17779-1-quintela@redhat.com> References: <20230511141208.17779-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.7 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: 1683814428169100002 Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- migration/dirtyrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 6706e3fe66..2fd089e24a 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -372,7 +372,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)); } @@ -483,7 +483,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 14:01:39 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=1683814436; cv=none; d=zohomail.com; s=zohoarc; b=RmpGFOYo53crKF/sxV3FuuQwQzX+RlkppobfCiBNZgELNui76SZaUC28t4/Fjq7SS6ReIrWyCyhLRt42wqXScGsIJGdMSGP/ilvunlreD23oi9yVqYr7vtGb0aCNZqjsF1vzb73HqwR/jgheKwq4Ms7eKV9ED7Az33ZxdVMnV6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683814436; 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=2R5kpi8ozSZtgjDYzhPZfLi5z0tCW0T/HldABEpOb8Q=; b=H5+Hs7EFDyH8uBqDkZSh64q5LTlxOtj1qxaxiJXagOWTA6WS2goVf7bedM3ugpAdE4JSJlpzWnem0JkFestNCTlcTReFSXLbrfGfnOMA6hepCa9XjpHFW0GNrGiUTnp/W9KUSb+xFTLko9l15QsZCHTe4Y9fcEIpu+YLRcUGe+I= 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 1683814436816881.3811004261424; Thu, 11 May 2023 07:13:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px72I-0003Th-V2; Thu, 11 May 2023 10:12:50 -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 1px72H-0003RN-HG for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:49 -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 1px72E-0004py-6W for qemu-devel@nongnu.org; Thu, 11 May 2023 10:12:48 -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-216-EXG9BSb3M2ePP4l-fBtNvw-1; Thu, 11 May 2023 10:12:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D80D88FBC5; Thu, 11 May 2023 14:12:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44A2B14171D5; Thu, 11 May 2023 14:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683814365; 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=2R5kpi8ozSZtgjDYzhPZfLi5z0tCW0T/HldABEpOb8Q=; b=IjdbgjiGUdTCLqoT8hQTbr6pHCtnjB2tsPY14/ybX2s076vVvXvz4EsqnXUoomjSb6Xppu N1uv/bSJZzXLDkuxGoILEjO/kvXWd7y61PXNuUN9DMed/OjlEnmDSjfhWPVCT/f16Ls3fz PYBd0I3RuzJYom9l5uiLkEvD3BnI/UU= X-MC-Unique: EXG9BSb3M2ePP4l-fBtNvw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Leonardo Bras , Juan Quintela , Richard Henderson , Peter Xu , Andrei Gudkov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhenzhong Duan , Hyman Huang Subject: [PATCH v2 5/5] migration: Make dirtyrate.c target independent Date: Thu, 11 May 2023 16:12:08 +0200 Message-Id: <20230511141208.17779-6-quintela@redhat.com> In-Reply-To: <20230511141208.17779-1-quintela@redhat.com> References: <20230511141208.17779-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1683814438125100003 Content-Type: text/plain; charset="utf-8" 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 --- - Remove check for CONFIG_SOFTMMU for dirtyrate.c, not needed (thanks Richard) --- 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 2fd089e24a..f29c1c03ea 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