From nobody Fri May 17 02:03:26 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=1681921478; cv=none; d=zohomail.com; s=zohoarc; b=DshN31vFT4eRQO7Erg/01Xyy3drM25QJ5P3Lug0JpbqGG9PeY6Gxi6N3QhzXZ1Y2qNhZFr6tu3z/yEf7xEyrKVJP+byADXA/+5LxhJJ6s9kwF2kqN6rk4wlA4c2AE2yu5D1dfHB73vYcVE9+QDevCGWZk1I5CnVEle7ZjcS6h+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921478; 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=OeIQ46vcpV0HY3TmJz1d1p29HzMSe5cPBTrVQOOqC4k=; b=XdQJ4/cRFYGsa6UB/P6rLe1Hm0GVjhBn4De/a0t3LaOlfni2mUdNcQPAA0NLlPzBH7wvEUM3gHmKoW6WK3YLQSYuvYpypvsuTUDAv7zIgOIm3nsa70AVdOWLXzcfxCrycT+KJREHFYWVDSlfdWNoIHvDucfUky9mpiBzHVQrg08= 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 168192147820296.90569475753864; Wed, 19 Apr 2023 09:24:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbZ-0000XC-HH; Wed, 19 Apr 2023 12:24:25 -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 1ppAbX-0000Wm-MF for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:23 -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 1ppAbV-0008Cy-I0 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:23 -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-hExV-R-6M-eDTIRVMYsd5A-1; Wed, 19 Apr 2023 12:24:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9182A381D4C4 for ; Wed, 19 Apr 2023 16:24:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A02871121314; Wed, 19 Apr 2023 16:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921460; 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=OeIQ46vcpV0HY3TmJz1d1p29HzMSe5cPBTrVQOOqC4k=; b=DCad+aNM99qg22fZuYqSfVt3qQOR28DeQkPU/nhdygTR6mAVhw3MKp+tJoX2mBMQmYX9yh 1OEJvzdBJJO8l7U0HSpqeXTYrj23ZCG+LwJjSFqkRide0BlGSHEWvP+u1Ktoz5pV2DWQzQ HP1XhT0eJkxWCiA/vUOpJHjviOhU338= X-MC-Unique: hExV-R-6M-eDTIRVMYsd5A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 01/12] migration: Merge ram_counters and ram_atomic_counters Date: Wed, 19 Apr 2023 18:24:04 +0200 Message-Id: <20230419162415.16260-2-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921479436100001 Content-Type: text/plain; charset="utf-8" Using MgrationStats as type for ram_counters mean that we didn't have to re-declare each value in another struct. The need of atomic counters have make us to create MigrationAtomicStats for this atomic counters. Create RAMStats type which is a merge of MigrationStats and MigrationAtomicStats removing unused members. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- Fix typos found by David Edmondson --- migration/ram.h | 28 +++++++++++++++------------- migration/migration.c | 8 ++++---- migration/multifd.c | 4 ++-- migration/ram.c | 39 ++++++++++++++++----------------------- 4 files changed, 37 insertions(+), 42 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 81cbb0947c..7c026b5242 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -35,25 +35,27 @@ #include "qemu/stats64.h" =20 /* - * These are the migration statistic counters that need to be updated using - * atomic ops (can be accessed by more than one thread). Here since we - * cannot modify MigrationStats directly to use Stat64 as it was defined in - * the QAPI scheme, we define an internal structure to hold them, and we - * propagate the real values when QMP queries happen. - * - * IOW, the corresponding fields within ram_counters on these specific - * fields will be always zero and not being used at all; they're just - * placeholders to make it QAPI-compatible. + * These are the ram migration statistic counters. It is loosely + * based on MigrationStats. We change to Stat64 any counter that + * needs to be updated using atomic ops (can be accessed by more than + * one thread). */ typedef struct { - Stat64 transferred; + int64_t dirty_pages_rate; + int64_t dirty_sync_count; + uint64_t dirty_sync_missed_zero_copy; + uint64_t downtime_bytes; Stat64 duplicate; + uint64_t multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; -} MigrationAtomicStats; + int64_t postcopy_requests; + uint64_t precopy_bytes; + int64_t remaining; + Stat64 transferred; +} RAMStats; =20 -extern MigrationAtomicStats ram_atomic_counters; -extern MigrationStats ram_counters; +extern RAMStats ram_counters; extern XBZRLECacheStats xbzrle_counters; extern CompressionStats compression_counters; =20 diff --git a/migration/migration.c b/migration/migration.c index bda4789193..10483f3cab 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1140,12 +1140,12 @@ static void populate_ram_info(MigrationInfo *info, = MigrationState *s) size_t page_size =3D qemu_target_page_size(); =20 info->ram =3D g_malloc0(sizeof(*info->ram)); - info->ram->transferred =3D stat64_get(&ram_atomic_counters.transferred= ); + info->ram->transferred =3D stat64_get(&ram_counters.transferred); info->ram->total =3D ram_bytes_total(); - info->ram->duplicate =3D stat64_get(&ram_atomic_counters.duplicate); + info->ram->duplicate =3D stat64_get(&ram_counters.duplicate); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; - info->ram->normal =3D stat64_get(&ram_atomic_counters.normal); + info->ram->normal =3D stat64_get(&ram_counters.normal); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; @@ -1157,7 +1157,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D ram_counters.precopy_bytes; info->ram->downtime_bytes =3D ram_counters.downtime_bytes; - info->ram->postcopy_bytes =3D stat64_get(&ram_atomic_counters.postcopy= _bytes); + info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 if (migrate_use_xbzrle()) { info->xbzrle_cache =3D g_malloc0(sizeof(*info->xbzrle_cache)); diff --git a/migration/multifd.c b/migration/multifd.c index cbc0dfe39b..01fab01a92 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -433,7 +433,7 @@ static int multifd_send_pages(QEMUFile *f) transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); ram_counters.multifd_bytes +=3D transferred; - stat64_add(&ram_atomic_counters.transferred, transferred); + stat64_add(&ram_counters.transferred, transferred); qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); =20 @@ -628,7 +628,7 @@ int multifd_send_sync_main(QEMUFile *f) p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); ram_counters.multifd_bytes +=3D p->packet_len; - stat64_add(&ram_atomic_counters.transferred, p->packet_len); + stat64_add(&ram_counters.transferred, p->packet_len); qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } diff --git a/migration/ram.c b/migration/ram.c index 79d881f735..95ba5ea0c5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -458,25 +458,18 @@ uint64_t ram_bytes_remaining(void) 0; } =20 -/* - * NOTE: not all stats in ram_counters are used in reality. See comments - * for struct MigrationAtomicStats. The ultimate result of ram migration - * counters will be a merged version with both ram_counters and the atomic - * fields in ram_atomic_counters. - */ -MigrationStats ram_counters; -MigrationAtomicStats ram_atomic_counters; +RAMStats ram_counters; =20 void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { ram_counters.precopy_bytes +=3D bytes; } else if (migration_in_postcopy()) { - stat64_add(&ram_atomic_counters.postcopy_bytes, bytes); + stat64_add(&ram_counters.postcopy_bytes, bytes); } else { ram_counters.downtime_bytes +=3D bytes; } - stat64_add(&ram_atomic_counters.transferred, bytes); + stat64_add(&ram_counters.transferred, bytes); } =20 void dirty_sync_missed_zero_copy(void) @@ -756,7 +749,7 @@ void mig_throttle_counter_reset(void) =20 rs->time_last_bitmap_sync =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&ram_atomic_counters.transferred); + rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } =20 /** @@ -1130,8 +1123,8 @@ uint64_t ram_pagesize_summary(void) =20 uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_atomic_counters.normal) + - stat64_get(&ram_atomic_counters.duplicate) + + return stat64_get(&ram_counters.normal) + + stat64_get(&ram_counters.duplicate) + compression_counters.pages + xbzrle_counters.pages; } =20 @@ -1192,7 +1185,7 @@ static void migration_trigger_throttle(RAMState *rs) MigrationState *s =3D migrate_get_current(); uint64_t threshold =3D s->parameters.throttle_trigger_threshold; uint64_t bytes_xfer_period =3D - stat64_get(&ram_atomic_counters.transferred) - rs->bytes_xfer_prev; + stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; uint64_t bytes_dirty_threshold =3D bytes_xfer_period * threshold / 100; =20 @@ -1255,7 +1248,7 @@ static void migration_bitmap_sync(RAMState *rs) /* reset period counters */ rs->time_last_bitmap_sync =3D end_time; rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&ram_atomic_counters.transferre= d); + rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } if (migrate_use_events()) { qapi_event_send_migration_pass(ram_counters.dirty_sync_count); @@ -1331,7 +1324,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMU= File *f, RAMBlock *block, int len =3D save_zero_page_to_file(pss, f, block, offset); =20 if (len) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); ram_transferred_add(len); return 1; } @@ -1368,9 +1361,9 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, } =20 if (bytes_xmit > 0) { - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); } else if (bytes_xmit =3D=3D 0) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); } =20 return true; @@ -1402,7 +1395,7 @@ static int save_normal_page(PageSearchStatus *pss, RA= MBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); return 1; } =20 @@ -1458,7 +1451,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMB= lock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); =20 return 1; } @@ -1497,7 +1490,7 @@ update_compress_thread_counts(const CompressParam *pa= ram, int bytes_xmit) ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); return; } =20 @@ -2632,9 +2625,9 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) uint64_t pages =3D size / TARGET_PAGE_SIZE; =20 if (zero) { - stat64_add(&ram_atomic_counters.duplicate, pages); + stat64_add(&ram_counters.duplicate, pages); } else { - stat64_add(&ram_atomic_counters.normal, pages); + stat64_add(&ram_counters.normal, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921567; cv=none; d=zohomail.com; s=zohoarc; b=DEwB1MVrwbSqT2UDqHGYSewbW2D2yV/DUf3yw8ykpZ35AYFBlhDv5b6Fb/9bg/TwxMDODdUqV3x8M+3VKYH3rDKWGYKNL4w4OTgAL+GLEzCYS2ITF33164slyRM6GWmmwzYVeZz8gtkJe0nLae2LogHdaV/QU8Am/UgNr5qPUlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921567; 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=DcXEM68b1vdNEze/X5hXhtV6xGkRmb7Lz4ZfjJGFbIg=; b=fZNLYMKNSJYRhGRRqCy72yZUs5x8jYXOSV2bL+ayronn1eVPVKmKLjzQ1yHXSmeV/hhlO3YFOwZRxlhGUOJEhur61XuUuOFGmYcYeKNiC6UT16W8dTLfYdzd0MOco+uMQyOaZLx/0EpDdsZO6uTyj8MoqKxPLeP0MJLQmqEgdC0= 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 1681921567309401.43539724449477; Wed, 19 Apr 2023 09:26:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbh-0000bC-OG; Wed, 19 Apr 2023 12:24:33 -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 1ppAbc-0000Y7-Pe for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:30 -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 1ppAbX-0008DP-39 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:28 -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-153-T6MZUFa9Mm2eGyZWk2UFGg-1; Wed, 19 Apr 2023 12:24:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE20328135BC; Wed, 19 Apr 2023 16:24:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8AB11121314; Wed, 19 Apr 2023 16:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921462; 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=DcXEM68b1vdNEze/X5hXhtV6xGkRmb7Lz4ZfjJGFbIg=; b=eWGGfOUtEC/iMGFbarwUaQIIt7A/WTVxj0WscmTOvmCbZdOrw+M0wgpFXX05AIxNYgA/gk kFavOAY5niYgozmT6vF7ukGENL29SaJubb2zd8FegSCMuk4OaxjZqk6h97KipC5QD2bSWB UMlhvzGUEPlJZr+ZS8BIa08Av3CzUOk= X-MC-Unique: T6MZUFa9Mm2eGyZWk2UFGg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras , David Edmondson Subject: [PATCH v3 02/12] migration: Update atomic stats out of the mutex Date: Wed, 19 Apr 2023 18:24:05 +0200 Message-Id: <20230419162415.16260-3-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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_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: 1681921568514100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: David Edmondson Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/multifd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 01fab01a92..6ef3a27938 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -433,8 +433,8 @@ static int multifd_send_pages(QEMUFile *f) transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); ram_counters.multifd_bytes +=3D transferred; + qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, transferred); - qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); =20 return 1; @@ -628,8 +628,8 @@ int multifd_send_sync_main(QEMUFile *f) p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); ram_counters.multifd_bytes +=3D p->packet_len; + qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, p->packet_len); - qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } for (i =3D 0; i < migrate_multifd_channels(); i++) { --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921540; cv=none; d=zohomail.com; s=zohoarc; b=P3Cp4Tr5sgzAYCWsMy1glap3/swiZoBO/RIitO8+xdlwL8iIkrR43tgtKpQNFwlBTxWJ/89943yaeAAddcGyMtN/7PWlcYTwqlTta6L+xujxJ01Etu9ZxPin7mbRUeX/YRkcuV24aCiyhj1cN9weGUkoiMaHKmEGuNYBsn2aos8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921540; 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=+fd+DsGBBcviY9SKlt6QZX7MGii4RgH8qfkfxoxcAU0=; b=NP06LgBQQIxMqbfp9RT4iJ7hlagp3QI+cdNZmIu4MPbeWJhWKVVV1qnKW/xiG7HIjqVRpvWl2xxpf29BJja5vZafymP/AnaHSqZ3urn/44SApytKi0o30+xb0/hwFY+L3iBbz9TwnmQoFovoGt/nTb9wR3hsKi5uDTyhJIG0w3w= 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 1681921540546208.7124587981274; Wed, 19 Apr 2023 09:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbf-0000Yx-Ms; Wed, 19 Apr 2023 12:24:31 -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 1ppAbb-0000Xb-MU for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:28 -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 1ppAbZ-0008E8-9K for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:27 -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-418-cRXTdRdyOmyQq3bNNitMug-1; Wed, 19 Apr 2023 12:24:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 30DA928135BA; Wed, 19 Apr 2023 16:24:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FF181121314; Wed, 19 Apr 2023 16:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921464; 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=+fd+DsGBBcviY9SKlt6QZX7MGii4RgH8qfkfxoxcAU0=; b=I3kPFQoOXM/+ZDBC5Bvg9dImKAOy5RSnj8f5TxqKXqlWTCX2m60AwEPxULraFST2ed/vRL Lg7F0rhWpFseYjSbz1OOF9+OH20eT/TS/ysk5P/+btLq8PtDud3MOIAJxAPunNKzDDXQNI mTb/d/8EjZ2h3NQdRRNx/UHmCyv9718= X-MC-Unique: cRXTdRdyOmyQq3bNNitMug-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras , David Edmondson Subject: [PATCH v3 03/12] migration: Make multifd_bytes atomic Date: Wed, 19 Apr 2023 18:24:06 +0200 Message-Id: <20230419162415.16260-4-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921542294100014 Content-Type: text/plain; charset="utf-8" In the spirit of: commit 394d323bc3451e4d07f13341cb8817fac8dfbadd Author: Peter Xu Date: Tue Oct 11 17:55:51 2022 -0400 migration: Use atomic ops properly for page accountings Reviewed-by: David Edmondson Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 4 ++-- migration/multifd.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 7c026b5242..ed70391317 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -46,7 +46,7 @@ typedef struct { uint64_t dirty_sync_missed_zero_copy; uint64_t downtime_bytes; Stat64 duplicate; - uint64_t multifd_bytes; + Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; int64_t postcopy_requests; diff --git a/migration/migration.c b/migration/migration.c index 10483f3cab..c3debe71f6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1153,7 +1153,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) ram_counters.dirty_sync_missed_zero_copy; info->ram->postcopy_requests =3D ram_counters.postcopy_requests; info->ram->page_size =3D page_size; - info->ram->multifd_bytes =3D ram_counters.multifd_bytes; + info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D ram_counters.precopy_bytes; info->ram->downtime_bytes =3D ram_counters.downtime_bytes; @@ -3778,7 +3778,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) static uint64_t migration_total_bytes(MigrationState *s) { return qemu_file_total_transferred(s->to_dst_file) + - ram_counters.multifd_bytes; + stat64_get(&ram_counters.multifd_bytes); } =20 static void migration_calculate_complete(MigrationState *s) diff --git a/migration/multifd.c b/migration/multifd.c index 6ef3a27938..1c992abf53 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -432,9 +432,9 @@ static int multifd_send_pages(QEMUFile *f) p->pages =3D pages; transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); - ram_counters.multifd_bytes +=3D transferred; qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, transferred); + stat64_add(&ram_counters.multifd_bytes, transferred); qemu_sem_post(&p->sem); =20 return 1; @@ -627,9 +627,9 @@ int multifd_send_sync_main(QEMUFile *f) p->flags |=3D MULTIFD_FLAG_SYNC; p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); - ram_counters.multifd_bytes +=3D p->packet_len; qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, p->packet_len); + stat64_add(&ram_counters.multifd_bytes, p->packet_len); qemu_sem_post(&p->sem); } for (i =3D 0; i < migrate_multifd_channels(); i++) { --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921540; cv=none; d=zohomail.com; s=zohoarc; b=IFjZg0qzkcUIOoI8VzWj4cYme53VaimP7OiakMicV2K8EVufIox3b8mK5EBkJ7tVW2Euh2khCH64JBg++o+wH0ZM8QokfCGYy0gI3ZHu+Tr/C4UEHhTDaY66K07ppA9Ds00cREFwse6beBC+tCKlRihkk50up7JjUBJxP3K6zRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921540; 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=tsDG2E/frgQwEevwdrvRlNa3eZnaPjMHmNCGRZX3XSI=; b=XqltBNKXmA+YEG1G3eZZbJMS/O2dBacspzG8sRnHI5OZVh4sR1ONpPYggaWVuQUvOSS8/bRBmB8QCfnEM3T/PDc0HfDJAyiTPmAoRU/n96h67FNGsSNBu/p2xLhWuVKLrdVYbPvtKEJmYawz3GvNomVBBFC80TMN8IOkYiNGjaM= 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 1681921540391753.5179069528072; Wed, 19 Apr 2023 09:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbe-0000YB-CO; Wed, 19 Apr 2023 12:24: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 1ppAba-0000XS-Cy for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:26 -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 1ppAbY-0008E4-V9 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:26 -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-542-eGH5ukFdOb2QKB1rcKXg-Q-1; Wed, 19 Apr 2023 12:24:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 428D710146EE for ; Wed, 19 Apr 2023 16:24:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 767D91121314; Wed, 19 Apr 2023 16:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921464; 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=tsDG2E/frgQwEevwdrvRlNa3eZnaPjMHmNCGRZX3XSI=; b=EiKekZrMDsQCqZX8qhT/RQwiiDXMiuoc8DxlinZR8hVMT8xP5sy2MuseUkD9LhTd4zU/vU gReY/KSgq6MgwPrd9WO69uJpL7gJT481wDJB1USsDaZ7jq3KM99U0NVBH2Ose8b1e12r5R zjjoDIupgO19mZotw0BIhhNO9+gCwBE= X-MC-Unique: eGH5ukFdOb2QKB1rcKXg-Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 04/12] migration: Make dirty_sync_missed_zero_copy atomic Date: Wed, 19 Apr 2023 18:24:07 +0200 Message-Id: <20230419162415.16260-5-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921540946100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 4 +--- migration/migration.c | 2 +- migration/multifd.c | 2 +- migration/ram.c | 5 ----- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index ed70391317..2170c55e67 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -43,7 +43,7 @@ typedef struct { int64_t dirty_pages_rate; int64_t dirty_sync_count; - uint64_t dirty_sync_missed_zero_copy; + Stat64 dirty_sync_missed_zero_copy; uint64_t downtime_bytes; Stat64 duplicate; Stat64 multifd_bytes; @@ -114,6 +114,4 @@ void ram_write_tracking_prepare(void); int ram_write_tracking_start(void); void ram_write_tracking_stop(void); =20 -void dirty_sync_missed_zero_copy(void); - #endif diff --git a/migration/migration.c b/migration/migration.c index c3debe71f6..66e5197b77 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1150,7 +1150,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; info->ram->dirty_sync_missed_zero_copy =3D - ram_counters.dirty_sync_missed_zero_copy; + stat64_get(&ram_counters.dirty_sync_missed_zero_copy); info->ram->postcopy_requests =3D ram_counters.postcopy_requests; info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); diff --git a/migration/multifd.c b/migration/multifd.c index 1c992abf53..903df2117b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -576,7 +576,7 @@ static int multifd_zero_copy_flush(QIOChannel *c) return -1; } if (ret =3D=3D 1) { - dirty_sync_missed_zero_copy(); + stat64_add(&ram_counters.dirty_sync_missed_zero_copy, 1); } =20 return ret; diff --git a/migration/ram.c b/migration/ram.c index 95ba5ea0c5..72e3d78589 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -472,11 +472,6 @@ void ram_transferred_add(uint64_t bytes) stat64_add(&ram_counters.transferred, bytes); } =20 -void dirty_sync_missed_zero_copy(void) -{ - ram_counters.dirty_sync_missed_zero_copy++; -} - struct MigrationOps { int (*ram_save_target_page)(RAMState *rs, PageSearchStatus *pss); }; --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921537; cv=none; d=zohomail.com; s=zohoarc; b=cnUEl4kBXr+t9+QJot6nnAd74UunUzdf8ODPYZCaQKnpusTVDbCNtyMoDO+Ydl07tuV0EJF+5cKmWFCMpiy9wUiAUuTvEuHhR9iMoWcOcMXjxK0QMLRczLx8AnNuEN1kifETceke48NsgZsrUKJPC5NqsYiU6cezwqgKE4IHm9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921537; 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=+pYz+EwP9YUqkmlP8WWjx29w1PcvxjnUd6BPUOal8Ho=; b=LnmlraEZc6Mj1zTGwFm6BcM30tLlWxss3+5oyg6nYV0vLMLvzPPZHwmknB8ywErRIvCTNb3EwUhVN/OvGiMj3YX5ccevIGlpU+m2qSEnR8lfu+G+Lg50Zyig/B9CS+AQ9jR5kic9Xm5Wxab2Kys8vT/YRWI8WRpx4aQHoYO2tSc= 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 1681921537486685.942981718402; Wed, 19 Apr 2023 09:25:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbi-0000c1-EH; Wed, 19 Apr 2023 12:24:34 -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 1ppAbb-0000Xa-Lk for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:28 -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 1ppAbZ-0008EC-MU for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:27 -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-439-VIT20bCtNcywgVmjJwF0fw-1; Wed, 19 Apr 2023 12:24:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E53B381D4C8 for ; Wed, 19 Apr 2023 16:24:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89880112131B; Wed, 19 Apr 2023 16:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921465; 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=+pYz+EwP9YUqkmlP8WWjx29w1PcvxjnUd6BPUOal8Ho=; b=Iv5kuSZutAfjSVLJJ1TExZtfqP+uAEoRq6YUsBtaWngIsiveBH4Y7yexSxsubEuPXD8sbr nBmLM5Y3iLaihe6Q5bBm45JmMWBZQ/VV1EzcH9M+aGrngQOi/S4m9yQNfzKLbflys/k2ac fQuYXY4WPefoeV4Q0iH/GWO9JbBYbog= X-MC-Unique: VIT20bCtNcywgVmjJwF0fw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 05/12] migration: Make precopy_bytes atomic Date: Wed, 19 Apr 2023 18:24:08 +0200 Message-Id: <20230419162415.16260-6-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, 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: 1681921539457100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 2 +- migration/ram.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 2170c55e67..a766b895fa 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -50,7 +50,7 @@ typedef struct { Stat64 normal; Stat64 postcopy_bytes; int64_t postcopy_requests; - uint64_t precopy_bytes; + Stat64 precopy_bytes; int64_t remaining; Stat64 transferred; } RAMStats; diff --git a/migration/migration.c b/migration/migration.c index 66e5197b77..cbd6f6f235 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1155,7 +1155,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; - info->ram->precopy_bytes =3D ram_counters.precopy_bytes; + info->ram->precopy_bytes =3D stat64_get(&ram_counters.precopy_bytes); info->ram->downtime_bytes =3D ram_counters.downtime_bytes; info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 diff --git a/migration/ram.c b/migration/ram.c index 72e3d78589..14529fe928 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -463,7 +463,7 @@ RAMStats ram_counters; void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { - ram_counters.precopy_bytes +=3D bytes; + stat64_add(&ram_counters.precopy_bytes, bytes); } else if (migration_in_postcopy()) { stat64_add(&ram_counters.postcopy_bytes, bytes); } else { --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921552; cv=none; d=zohomail.com; s=zohoarc; b=KL4VAOl3+z+8Bgtf09Gu3u3T9aknpouho1nkpYfim+NAcMNuMa8A+ira1QnnULvaduqS7gGyLSYHreVL5yd7HD3ciKjI4/EXkSUdfPzbXjNwn+9yTqdHo3Ld+Fl5m5sgvcwa7nbOCHG0mlv80rs6d8AkMcuOuJDEETaKumwcK1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921552; 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=4Rnz0JrKgh4/xM54GZNiJjPVjtOZSS1ncPXEcKD5Tuw=; b=b4Pn1HwoaFYRsIiON1lwA2x60sBVWMLgboFtjTaXLgEyVR0brlVh4Fn54CMG2IdUipmgHCm6gJ4s7dH4Sv8ThTzUhlwCPAsGQYaXQTgkJiUjEY06oSxI+AX8iA9yUv4tstebjfH9Vt1fv49VG3ruCdAILpyRxNC3m6gDKeJnXu0= 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 1681921552691653.0372233454644; Wed, 19 Apr 2023 09:25:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbf-0000Yw-Ms; Wed, 19 Apr 2023 12:24:31 -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 1ppAbc-0000Xk-9z for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:28 -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 1ppAba-0008EQ-Ou for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:28 -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-558-CvMGMWDKOWezmEhBnOYOBQ-1; Wed, 19 Apr 2023 12:24:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7241684AECA for ; Wed, 19 Apr 2023 16:24:24 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5B341121314; Wed, 19 Apr 2023 16:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921466; 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=4Rnz0JrKgh4/xM54GZNiJjPVjtOZSS1ncPXEcKD5Tuw=; b=UPyM8QbpGNt0H6Z7DcfJb5CpMb2af6uZEJGXyQ/U2Totz3TQC0BlCkFPvk4qhD+bLOXeRJ qH9MB5FZ+H35N5/xuO+FWLytxYr7A9Ifh3p6xhQ+JSJsOdq73s6V0N2BKQ3fIFaHUY/r0+ N/Sr3iSn+3rQrE1PcUNNUrZKBwPBuaM= X-MC-Unique: CvMGMWDKOWezmEhBnOYOBQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 06/12] migration: Make downtime_bytes atomic Date: Wed, 19 Apr 2023 18:24:09 +0200 Message-Id: <20230419162415.16260-7-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921553406100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 2 +- migration/ram.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index a766b895fa..bb52632424 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -44,7 +44,7 @@ typedef struct { int64_t dirty_pages_rate; int64_t dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; - uint64_t downtime_bytes; + Stat64 downtime_bytes; Stat64 duplicate; Stat64 multifd_bytes; Stat64 normal; diff --git a/migration/migration.c b/migration/migration.c index cbd6f6f235..4ca2173d85 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1156,7 +1156,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D stat64_get(&ram_counters.precopy_bytes); - info->ram->downtime_bytes =3D ram_counters.downtime_bytes; + info->ram->downtime_bytes =3D stat64_get(&ram_counters.downtime_bytes); info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 if (migrate_use_xbzrle()) { diff --git a/migration/ram.c b/migration/ram.c index 14529fe928..35abbcda02 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -467,7 +467,7 @@ void ram_transferred_add(uint64_t bytes) } else if (migration_in_postcopy()) { stat64_add(&ram_counters.postcopy_bytes, bytes); } else { - ram_counters.downtime_bytes +=3D bytes; + stat64_add(&ram_counters.downtime_bytes, bytes); } stat64_add(&ram_counters.transferred, bytes); } --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921590; cv=none; d=zohomail.com; s=zohoarc; b=VIkrRN2PbS35UpcURjeljhaboGihugcR7KKXiC14xCAXIzaIsfGEt/6T0AvJACSRABD1gvDfu1qSNhJ2jA0jzZoRacqe7IPDegAQ0eYt/DBWTkrHJ6beQnPWl/VsXpX+zr2weKcYcwrw8kOsTbdTf6CJbdAazTBH8BpPMG8YGK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921590; 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=HkbjSBUwOmIaRullc4SjxxrgOzU+jkLxAJ0q5tOVLHM=; b=T08E7rysVBI1uq0McsNE/OxLOaJaMoIUYfMnkhFYG8MPux5xGXfPyU9UhWpjhpRRHFgtmsKjZH65axdqH2I09fVmGAqUKkGQkOzSLKCoXtRcieq/Gb0mzOrhxP/Pf6zbi4kHe/0mOsNbeDFEvEufpJ9j23PNF6YSfvWy56mHV/E= 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 1681921590294262.3592499502074; Wed, 19 Apr 2023 09:26:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbi-0000c4-GN; Wed, 19 Apr 2023 12:24:34 -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 1ppAbd-0000YC-Ml for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:30 -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 1ppAbc-0008Et-6E for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:29 -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-3-7Wg7qcEQMveQtTCCbWWJEQ-1; Wed, 19 Apr 2023 12:24:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 83B39381D4CB for ; Wed, 19 Apr 2023 16:24:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id B88861121314; Wed, 19 Apr 2023 16:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921467; 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=HkbjSBUwOmIaRullc4SjxxrgOzU+jkLxAJ0q5tOVLHM=; b=NXfK+A7hqcqJ8pBKSMCRVCD3VVXP7pzq2dsGlwydQunAewxHDhfGrQoNHDEe1tH+w4Sjvk u9qbrRvxi3xrs9H8MXeXrkO5JRPPeSEZj1hyoNHNpxLLGzwqo2SpWfKz7ZmMs6xd/pnbSc Zou+UBtliEF4v7mxFqQE06DblVAosIQ= X-MC-Unique: 7Wg7qcEQMveQtTCCbWWJEQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 07/12] migration: Make dirty_sync_count atomic Date: Wed, 19 Apr 2023 18:24:10 +0200 Message-Id: <20230419162415.16260-8-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, 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: 1681921591786100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 3 ++- migration/ram.c | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index bb52632424..8c0d07c43a 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -42,7 +42,7 @@ */ typedef struct { int64_t dirty_pages_rate; - int64_t dirty_sync_count; + Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; Stat64 duplicate; diff --git a/migration/migration.c b/migration/migration.c index 4ca2173d85..97c227aa85 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1148,7 +1148,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->normal =3D stat64_get(&ram_counters.normal); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; - info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; + info->ram->dirty_sync_count =3D + stat64_get(&ram_counters.dirty_sync_count); info->ram->dirty_sync_missed_zero_copy =3D stat64_get(&ram_counters.dirty_sync_missed_zero_copy); info->ram->postcopy_requests =3D ram_counters.postcopy_requests; diff --git a/migration/ram.c b/migration/ram.c index 35abbcda02..b391546020 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -764,7 +764,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_ad= dr_t current_addr) /* We don't care if this fails to allocate a new cache page * as long as it updated an old one */ cache_insert(XBZRLE.cache, current_addr, XBZRLE.zero_target_page, - ram_counters.dirty_sync_count); + stat64_get(&ram_counters.dirty_sync_count)); } =20 #define ENCODING_FLAG_XBZRLE 0x1 @@ -790,13 +790,13 @@ static int save_xbzrle_page(RAMState *rs, PageSearchS= tatus *pss, int encoded_len =3D 0, bytes_xbzrle; uint8_t *prev_cached_page; QEMUFile *file =3D pss->pss_channel; + uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); =20 - if (!cache_is_cached(XBZRLE.cache, current_addr, - ram_counters.dirty_sync_count)) { + if (!cache_is_cached(XBZRLE.cache, current_addr, generation)) { xbzrle_counters.cache_miss++; if (!rs->last_stage) { if (cache_insert(XBZRLE.cache, current_addr, *current_data, - ram_counters.dirty_sync_count) =3D=3D -1) { + generation) =3D=3D -1) { return -1; } else { /* update *current_data when the page has been @@ -1209,7 +1209,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBlock *block; int64_t end_time; =20 - ram_counters.dirty_sync_count++; + stat64_add(&ram_counters.dirty_sync_count, 1); =20 if (!rs->time_last_bitmap_sync) { rs->time_last_bitmap_sync =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E); @@ -1246,7 +1246,8 @@ static void migration_bitmap_sync(RAMState *rs) rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } if (migrate_use_events()) { - qapi_event_send_migration_pass(ram_counters.dirty_sync_count); + uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); + qapi_event_send_migration_pass(generation); } } =20 --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921540; cv=none; d=zohomail.com; s=zohoarc; b=EDZmcXv1KZKbsB32snG9zw+lz5b1+HGhsO4hXYhFlOmVWLrtDIST69H8bdzEyLF3t27QnSTxy1QmpzOeBvotItIdBsvn6hq/ibfDLHc/tPtuCRI7Jw6EApgVOEqHlvWrUiHU1zj8UrW2VG6o1qvZSZhfQRE5ikgH2NkF9Mv97vU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921540; 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=oa9scpZGQykHfaaH/GTNyys8hMeHjQmpuuDLILcUghs=; b=QYsPv03yyqpc9qpWyycQZco/rGfWfDKJRu0M/xHaYCrY8AGOTdWFETiod9dym2whEdkyL+JYXxJioKNpiFs4sM0TbGV+xa8hiiDfa2/9VqsHikNldOb6s9zzVmwb0OD85zSUQARznpkLpcSFnTDvVzjs08yl9uHiBy/Ifhc5aE4= 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 1681921540658892.9507104120743; Wed, 19 Apr 2023 09:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbh-0000bQ-Qd; Wed, 19 Apr 2023 12:24:33 -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 1ppAbe-0000YE-7m for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:30 -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 1ppAbc-0008F2-Ri for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:29 -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-604-Br7_dBd2OWaU2o86bMhsDQ-1; Wed, 19 Apr 2023 12:24:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97219381D4C8 for ; Wed, 19 Apr 2023 16:24:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id C92221121318; Wed, 19 Apr 2023 16:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921468; 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=oa9scpZGQykHfaaH/GTNyys8hMeHjQmpuuDLILcUghs=; b=DoJQ4PQld9cRX8bNfbuvXolnB8cMChtee1eMmCYNQy0RBHaPwLVtALkZusk0wQ98dFKMLi a+qmLLrjUQIzGhNCHU5FBv/6oTHVtR5q8V2/H3zId23jizDzm+GSG3PY7Yq2UkqllTunTB YIAcUhUfcALZAjLwj4GRDFtNT2nw9R8= X-MC-Unique: Br7_dBd2OWaU2o86bMhsDQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 08/12] migration: Make postcopy_requests atomic Date: Wed, 19 Apr 2023 18:24:11 +0200 Message-Id: <20230419162415.16260-9-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921540966100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 3 ++- migration/ram.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 8c0d07c43a..afa68521d7 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -49,7 +49,7 @@ typedef struct { Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; - int64_t postcopy_requests; + Stat64 postcopy_requests; Stat64 precopy_bytes; int64_t remaining; Stat64 transferred; diff --git a/migration/migration.c b/migration/migration.c index 97c227aa85..09b37a6603 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1152,7 +1152,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) stat64_get(&ram_counters.dirty_sync_count); info->ram->dirty_sync_missed_zero_copy =3D stat64_get(&ram_counters.dirty_sync_missed_zero_copy); - info->ram->postcopy_requests =3D ram_counters.postcopy_requests; + info->ram->postcopy_requests =3D + stat64_get(&ram_counters.postcopy_requests); info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; diff --git a/migration/ram.c b/migration/ram.c index b391546020..b4aa07118a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2169,7 +2169,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr= _t start, ram_addr_t len) RAMBlock *ramblock; RAMState *rs =3D ram_state; =20 - ram_counters.postcopy_requests++; + stat64_add(&ram_counters.postcopy_requests, 1); RCU_READ_LOCK_GUARD(); =20 if (!rbname) { --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921553; cv=none; d=zohomail.com; s=zohoarc; b=TyJET/yeok1PxXpRd/FLP3bIbpwkV2tMxVyqA0hASkRY18TJmAG4h/j0KFiogjMyTVhTPVFe2vUv7ToVH11Vvs35g5y+Poj2PHsOhpCPFvT1iXFKKjko4+xhjZrUwC1GVCxnX5rFSMj+li0G9Fn3WfwKBeOoKQ8UR/ykvF5682c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921553; 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=pC2LGq6+QDEf0aHkuLf6bNTqtzLZczHX1MUZPTrB2jU=; b=dK9EkwT/qQv2ye5DAsHxUZnaME/clj9CoZ8HVNqOeaXnSaCxQHF2/nLKHAoFDb3huvaHD2hRar+a7OVMGZACWeBu2SzutWSpNG0zXlxuyu5FkYlqHtpVmWdplcvVAOF2VrmqSkQY0cceUy57zpw09D2dvzFbE0EKVQkt+V70L74= 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 168192155349313.528396596096513; Wed, 19 Apr 2023 09:25:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbk-0000cB-8T; Wed, 19 Apr 2023 12:24:36 -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 1ppAbf-0000Yz-Mw for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:31 -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 1ppAbe-0008Fn-7Z for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:31 -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-381-CzPlUjeGOyC3ID93Mz5OFw-1; Wed, 19 Apr 2023 12:24:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2C8B857FBB for ; Wed, 19 Apr 2023 16:24:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6E861121314; Wed, 19 Apr 2023 16:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921469; 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=pC2LGq6+QDEf0aHkuLf6bNTqtzLZczHX1MUZPTrB2jU=; b=BNUFGSxZck86YRVylTTBzcZXk2ydcHaF7ZnwXgqU+6wpIsxcg3ap3wHrbfvM+uNyE9ajPP PpmsbRK26eOXk8k9Xd4bvJU8KXy56WVoBBmJv1gZk4TB6c8zMbm9ANhaeAUeF3TYXqR/6u AAV1EWHdWoxB0uWd4dcw3xNBBkfgE94= X-MC-Unique: CzPlUjeGOyC3ID93Mz5OFw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 09/12] migration: Make dirty_pages_rate atomic Date: Wed, 19 Apr 2023 18:24:12 +0200 Message-Id: <20230419162415.16260-10-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, 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: 1681921554444100005 Content-Type: text/plain; charset="utf-8" In this case we use qatomic operations instead of Stat64 wrapper because there is no stat64_set(). Defining the 64 bit wrapper is trivial. The one without atomics is more interesting. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 6 ++++-- migration/ram.c | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index afa68521d7..574a604b72 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,7 +41,7 @@ * one thread). */ typedef struct { - int64_t dirty_pages_rate; + aligned_uint64_t dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; diff --git a/migration/migration.c b/migration/migration.c index 09b37a6603..50eae2fbcd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1190,7 +1190,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) =20 if (s->state !=3D MIGRATION_STATUS_COMPLETED) { info->ram->remaining =3D ram_bytes_remaining(); - info->ram->dirty_pages_rate =3D ram_counters.dirty_pages_rate; + info->ram->dirty_pages_rate =3D + qatomic_read__nocheck(&ram_counters.dirty_pages_rate); } } =20 @@ -3844,7 +3845,8 @@ static void migration_update_counters(MigrationState = *s, * if we haven't sent anything, we don't want to * recalculate. 10000 is a small enough number for our purposes */ - if (ram_counters.dirty_pages_rate && transferred > 10000) { + if (qatomic_read__nocheck(&ram_counters.dirty_pages_rate) && + transferred > 10000) { s->expected_downtime =3D ram_counters.remaining / bandwidth; } =20 diff --git a/migration/ram.c b/migration/ram.c index b4aa07118a..55fabec1fe 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1129,8 +1129,9 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) double compressed_size; =20 /* calculate period counters */ - ram_counters.dirty_pages_rate =3D rs->num_dirty_pages_period * 1000 - / (end_time - rs->time_last_bitmap_sync); + qatomic_set__nocheck(&ram_counters.dirty_pages_rate, + rs->num_dirty_pages_period * 1000 / + (end_time - rs->time_last_bitmap_sync)); =20 if (!page_count) { return; --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921531; cv=none; d=zohomail.com; s=zohoarc; b=g6T3U53z6EmUP/TkObIWGc9G8oMiwMha+tl7MmM3u9Tf8rhypAkyaPP0UqmIxvAxdO+bp4UqzuUyRd90XWcF8WNJC+N8OIpyoFMwjXRwbTuXjq1/A0hY8tNEgqnFL/5MU6+X8NN0YJSj9SI9JYbyDMh5LDBkfXrnT8WN2nEronE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921531; 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=6d2LxQy3SvmuAqnXfuczyTRLJPXdqjEoeRC4eEPZKAI=; b=S/c3h7RkoG9UWcAdpZ9xKBrQuTLZH+eAAwl0JTb5P++wqaJ/rTRUeUz4fWlAx9KNY5uaYr7gxxn2rrxIUuWuz6/lutX3qESwECoyRUpO2K3Qnkfq0gCKYiTC4QzWZn/bp20T+Ktm8QUVE19WVK/7BC/L1uAXUifeJkxZ/SBS4Eo= 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 1681921531163582.8149968349614; Wed, 19 Apr 2023 09:25:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbl-0000cw-36; Wed, 19 Apr 2023 12:24:37 -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 1ppAbh-0000b4-B1 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:33 -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 1ppAbf-0008G9-Oh for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:33 -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-534-ZTQ0kg3rNZawhQxVINFykA-1; Wed, 19 Apr 2023 12:24:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3E193C10C6E for ; Wed, 19 Apr 2023 16:24:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 035621121314; Wed, 19 Apr 2023 16:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921471; 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=6d2LxQy3SvmuAqnXfuczyTRLJPXdqjEoeRC4eEPZKAI=; b=CQXuOLz3y+IiAQ3Cb105nVH/ZvPeh8guenNAZenaPghkHJzeIuKpKvhvEtSysw99LhhTKz Kr5QgCHyrJFjDVf8xa4tAyRn7aM8xC3fDIJmxovrla4s+K/aV6h9mKqj2N9fkp6olX5wtK Vj74lvjr4r2TkFa0bItX8+DP43umlAc= X-MC-Unique: ZTQ0kg3rNZawhQxVINFykA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 10/12] migration: Make dirty_bytes_last_sync atomic Date: Wed, 19 Apr 2023 18:24:13 +0200 Message-Id: <20230419162415.16260-11-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1681921532924100003 Content-Type: text/plain; charset="utf-8" As we set its value, it needs to be operated with atomics. We rename it from remaining to better reflect its meaning. Statistics always return the real reamaining bytes. This was used to store how much pages where dirty on the previous generation, so we can calculate the expected downtime as: dirty_bytes_last_sync / current_bandwith. If we use the actual remaining bytes, we would see a very small value at the end of the iteration. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- I am open to use ram_bytes_remaining() in its only use and be more "optimistic" about the downtime. --- migration/ram.h | 2 +- migration/migration.c | 4 +++- migration/ram.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 574a604b72..8093ebc210 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,6 +41,7 @@ * one thread). */ typedef struct { + aligned_uint64_t dirty_bytes_last_sync; aligned_uint64_t dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; @@ -51,7 +52,6 @@ typedef struct { Stat64 postcopy_bytes; Stat64 postcopy_requests; Stat64 precopy_bytes; - int64_t remaining; Stat64 transferred; } RAMStats; =20 diff --git a/migration/migration.c b/migration/migration.c index 50eae2fbcd..83d3bfbf62 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3847,7 +3847,9 @@ static void migration_update_counters(MigrationState = *s, */ if (qatomic_read__nocheck(&ram_counters.dirty_pages_rate) && transferred > 10000) { - s->expected_downtime =3D ram_counters.remaining / bandwidth; + s->expected_downtime =3D + qatomic_read__nocheck(&ram_counters.dirty_bytes_last_sync) / + bandwidth; } =20 qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/ram.c b/migration/ram.c index 55fabec1fe..771596d377 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1224,7 +1224,8 @@ static void migration_bitmap_sync(RAMState *rs) RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(rs, block); } - ram_counters.remaining =3D ram_bytes_remaining(); + qatomic_set__nocheck(&ram_counters.dirty_bytes_last_sync, + ram_bytes_remaining()); } qemu_mutex_unlock(&rs->bitmap_mutex); =20 --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921540; cv=none; d=zohomail.com; s=zohoarc; b=IAcyLBfr8bD/dLgySubMaXG+xaJ3GLIJu7UiNewQC624f14h/o8xkMDkBBcLvrBezwzGnRGyd0yejuJO+dcZBKhmdBP9yVvyifL7GNpAXCqQrs29RTI1g7P5SdiId/CSxjL3EuJOLSmExug82WyAwhpT+D9NDhtgdj8v19QCUYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921540; 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=OoUJC3CVvRvVa9qoex7/S8MB1BQMGM4BM0RBbqteMsY=; b=e4WY5G6RhQnl6Z5rTrOL/oZAXbtCV5GOIhfx1RS86dLVQo39yhbDEM37H4yp6PKbfDyOV8ZnRA68MU9c59aX6Sx++IgCtggQc/uTwkJ954CrOU1Fr83hfl/rf5zRbwas3twOE3yfo7V8ieuE2Ab5CECMi5yoQ+DXOVkOsDb+MGs= 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 1681921540219592.9622058684048; Wed, 19 Apr 2023 09:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbk-0000cI-DP; Wed, 19 Apr 2023 12:24:36 -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 1ppAbh-0000b8-KT for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:33 -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 1ppAbg-0008GG-3P for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24: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-261-Z_XncdQmPC-uddiQzU0m5w-1; Wed, 19 Apr 2023 12:24:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D871E88B7AA for ; Wed, 19 Apr 2023 16:24:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16B411121314; Wed, 19 Apr 2023 16:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921471; 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=OoUJC3CVvRvVa9qoex7/S8MB1BQMGM4BM0RBbqteMsY=; b=A7m3JocE//laILeich7Ai5a5Sgf/m9N2PeHpuM5GQ45WcwxQPyO8/SxeOFFIA2DAIEkWWP WTpXZAefyvIdCvzZxM0erWqU59SjzIq2LLTETBeh2s7N7yU0BOxQ0MAfqg4uxA3jHuNcZB GGtk6c81MsXcrddoDhxYngcYHcOd7aI= X-MC-Unique: Z_XncdQmPC-uddiQzU0m5w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 11/12] migration: Rename duplicate to zero_pages Date: Wed, 19 Apr 2023 18:24:14 +0200 Message-Id: <20230419162415.16260-12-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, 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: 1681921542297100015 Content-Type: text/plain; charset="utf-8" Rest of counters that refer to pages has a _pages suffix. And historically, this showed the number of pages composed of the same character, here comes the name "duplicated". But since years ago, it refers to the number of zero_pages. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 2 +- migration/ram.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index 8093ebc210..b27ce01f2e 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -46,7 +46,7 @@ typedef struct { Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; - Stat64 duplicate; + Stat64 zero_pages; Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; diff --git a/migration/migration.c b/migration/migration.c index 83d3bfbf62..20ef5b683b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1142,7 +1142,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram =3D g_malloc0(sizeof(*info->ram)); info->ram->transferred =3D stat64_get(&ram_counters.transferred); info->ram->total =3D ram_bytes_total(); - info->ram->duplicate =3D stat64_get(&ram_counters.duplicate); + info->ram->duplicate =3D stat64_get(&ram_counters.zero_pages); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; info->ram->normal =3D stat64_get(&ram_counters.normal); diff --git a/migration/ram.c b/migration/ram.c index 771596d377..34126f0274 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1119,7 +1119,7 @@ uint64_t ram_pagesize_summary(void) uint64_t ram_get_total_transferred_pages(void) { return stat64_get(&ram_counters.normal) + - stat64_get(&ram_counters.duplicate) + + stat64_get(&ram_counters.zero_pages) + compression_counters.pages + xbzrle_counters.pages; } =20 @@ -1322,7 +1322,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMU= File *f, RAMBlock *block, int len =3D save_zero_page_to_file(pss, f, block, offset); =20 if (len) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); ram_transferred_add(len); return 1; } @@ -1361,7 +1361,7 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, if (bytes_xmit > 0) { stat64_add(&ram_counters.normal, 1); } else if (bytes_xmit =3D=3D 0) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); } =20 return true; @@ -1488,7 +1488,7 @@ update_compress_thread_counts(const CompressParam *pa= ram, int bytes_xmit) ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); return; } =20 @@ -2623,7 +2623,7 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) uint64_t pages =3D size / TARGET_PAGE_SIZE; =20 if (zero) { - stat64_add(&ram_counters.duplicate, pages); + stat64_add(&ram_counters.zero_pages, pages); } else { stat64_add(&ram_counters.normal, pages); ram_transferred_add(size); --=20 2.39.2 From nobody Fri May 17 02:03:26 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=1681921595; cv=none; d=zohomail.com; s=zohoarc; b=ZjgpD8eVGRB9nkQbFdIt3amPHo9BvJZI81+3ymAGarBNmuVZsJJ38/47ZTyNr6EBh8JzAOnI9jExlVXNJ+5yQG66wW2ceL/i23yGoL9YITi/KRuInpVtkBoF8YxzgsH9NbUqNu8BMzh77PloDREadwYTmJds8KTjQgrzlITP/Fk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681921595; 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=ehQkTo3bnLllD+yH5cNQq51We/l5X/OxurIXrcO/NLg=; b=ToOQcVc5jICyZH9vFqQ7Uz8wYJa9ZGk86Sgri10J3VCnbj76jSpR3SyfJONDpjEK1LWDYyz1o0jBdN1ypOQylQuEeAZdDDwXzYJVrpVvqkK5zhxcHcC1VTPFzqIR+qvQ2FB7RrfjNm+eLw+6mg3b2+pTEnS4znMyKHVY8vud29U= 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 1681921595113715.0032842031334; Wed, 19 Apr 2023 09:26:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAbt-0000hW-8J; Wed, 19 Apr 2023 12:24:45 -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 1ppAbr-0000hL-N7 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:43 -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 1ppAbl-0008Gk-01 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:24:43 -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-91-8_ffTTKFPti26h3pIFmTMA-1; Wed, 19 Apr 2023 12:24:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 178918279CB for ; Wed, 19 Apr 2023 16:24:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 292961121319; Wed, 19 Apr 2023 16:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921475; 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=ehQkTo3bnLllD+yH5cNQq51We/l5X/OxurIXrcO/NLg=; b=U2myWXBF3Pvcos/UboZgM2PI0xZ7EA9xQgVmIrUaHVju8uz3ImiqUGtqwMUQ0tr2PKzOaq Q2MRXnH5+Yd2/MCck0gYnF6R2dcCD06w3cvYkAJnS//D0PIVbp6Qh0qHr54DsOdaO+MH2t 5V8HMJLMnPL4/yazcUVDisbOjJzebpc= X-MC-Unique: 8_ffTTKFPti26h3pIFmTMA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v3 12/12] migration: Rename normal to full_pages Date: Wed, 19 Apr 2023 18:24:15 +0200 Message-Id: <20230419162415.16260-13-quintela@redhat.com> In-Reply-To: <20230419162415.16260-1-quintela@redhat.com> References: <20230419162415.16260-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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, 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: 1681921595842100001 Content-Type: text/plain; charset="utf-8" Rest of counters that refer to pages has a _pages suffix. And historically, this showed the number of full pages transferred. The name "normal" refered to the fact that they were sent without any optimization (compression, xbzrle, zero_page, ...). Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 2 +- migration/ram.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index b27ce01f2e..421673aa26 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -48,7 +48,7 @@ typedef struct { Stat64 downtime_bytes; Stat64 zero_pages; Stat64 multifd_bytes; - Stat64 normal; + Stat64 full_pages; Stat64 postcopy_bytes; Stat64 postcopy_requests; Stat64 precopy_bytes; diff --git a/migration/migration.c b/migration/migration.c index 20ef5b683b..26c61ece55 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1145,7 +1145,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->duplicate =3D stat64_get(&ram_counters.zero_pages); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; - info->ram->normal =3D stat64_get(&ram_counters.normal); + info->ram->normal =3D stat64_get(&ram_counters.full_pages); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D diff --git a/migration/ram.c b/migration/ram.c index 34126f0274..09ed5cdf27 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1118,7 +1118,7 @@ uint64_t ram_pagesize_summary(void) =20 uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_counters.normal) + + return stat64_get(&ram_counters.full_pages) + stat64_get(&ram_counters.zero_pages) + compression_counters.pages + xbzrle_counters.pages; } @@ -1359,7 +1359,7 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, } =20 if (bytes_xmit > 0) { - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.full_pages, 1); } else if (bytes_xmit =3D=3D 0) { stat64_add(&ram_counters.zero_pages, 1); } @@ -1393,7 +1393,7 @@ static int save_normal_page(PageSearchStatus *pss, RA= MBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.full_pages, 1); return 1; } =20 @@ -1449,7 +1449,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMB= lock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.full_pages, 1); =20 return 1; } @@ -2625,7 +2625,7 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) if (zero) { stat64_add(&ram_counters.zero_pages, pages); } else { - stat64_add(&ram_counters.normal, pages); + stat64_add(&ram_counters.full_pages, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } --=20 2.39.2