From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640017970471920.1252050116403; Mon, 20 Dec 2021 08:32:50 -0800 (PST) Received: from localhost ([::1]:59978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzLaj-0005QO-BC for importer@patchew.org; Mon, 20 Dec 2021 11:32:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKSK-0002NQ-E2 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:20:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKSC-000766-2r for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:20:01 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186-U7QJhaRqOhW6UwNm1GcgDA-1; Mon, 20 Dec 2021 03:54:12 -0500 Received: by mail-wm1-f71.google.com with SMTP id l20-20020a05600c1d1400b003458e02cea0so1593243wms.7 for ; Mon, 20 Dec 2021 00:54:12 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ecah2F3ip++NB/Ieyt+yzJHuIzEQ9K69zd4gUhkv1A4=; b=WutGfJX82imiYdCghYl2kLRZH02cra+ghUR+fcxSM0n7v7ZSALJaCq4yfOd6gd3yF9T8k6 GMwT0jL7P4wo1u9+PRNXr6z+mmPBkbbaAHvHE9s2MzPjwU+H+7BfSCJG4yVccEM1ViJzbz id7Q8vBVVRwMq3fz6510zuYF/4bMe2Y= X-MC-Unique: U7QJhaRqOhW6UwNm1GcgDA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ecah2F3ip++NB/Ieyt+yzJHuIzEQ9K69zd4gUhkv1A4=; b=HpHvB2QpBBlhOhXmS1COVhYdvRo/ZepaIYkTy6kk0QF/4RoPMN91MachCSaDV/eAAm x3sKnhRTOFNy0U5XaKtSXjVGRgJ6LvpQKNJJu1opo3n3GVwZZSscWqOQAfabnzFItxry h/QquBe+Wxm3BEtgThoyI1u2FVvDactHfqMmwuVVCNQ6dCdy+S/cZtJZAoA3zv3AUZcp 9/8oCxEI+NRJVRlX4TJ3hx6G2swo9Tz0M8f77qEDA94K4VIEc7DFBPdiBkCnUqUkW065 zlciZWLFYNS7dB3hJWC6Q4zZTw3q+n6wlY7LxHRUEdAtUyfipAgNN3YhVEhUNTPBpno3 fsWg== X-Gm-Message-State: AOAM531xAtP4Ib3WpL+gDefANsc+eYSFZi4byTcXi4kU4enGJDRULL1U 8bVrnDrLlCWAmU6iGo4PEdDbpHD/esItny0Dmg5/iyIdBcUs5SL1iiqTl5wmBxCJdX++YLsWVHw Tgz6rrQoZyBqLtts484WI40FuNZ9Vz/s1DPeNfK4qmx7TDOC53WW9PjhsbWbYNL6j X-Received: by 2002:a7b:cd07:: with SMTP id f7mr19896340wmj.6.1639990450931; Mon, 20 Dec 2021 00:54:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA0tbCTQkTMniaWYaW+fpNosyR5mg9qIwK+BApN1y5w0HzSG2LU9d2wlx+iaPQINDH5ZPZNw== X-Received: by 2002:a7b:cd07:: with SMTP id f7mr19896326wmj.6.1639990450713; Mon, 20 Dec 2021 00:54:10 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 1/8] migration: Drop dead code of ram_debug_dump_bitmap() Date: Mon, 20 Dec 2021 16:53:48 +0800 Message-Id: <20211220085355.2284-2-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640017972411100001 Content-Type: text/plain; charset="utf-8" I planned to add "#ifdef DEBUG_POSTCOPY" around the function too because otherwise it'll be compiled into qemu binary even if it'll never be used. = Then I found that maybe it's easier to just drop it for good.. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/ram.c | 39 --------------------------------------- migration/ram.h | 2 -- 2 files changed, 41 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 57efa67f20..7d9c8a508b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2408,40 +2408,6 @@ static void ram_state_reset(RAMState *rs) =20 #define MAX_WAIT 50 /* ms, half buffered_file limit */ =20 -/* - * 'expected' is the value you expect the bitmap mostly to be full - * of; it won't bother printing lines that are all this value. - * If 'todump' is null the migration bitmap is dumped. - */ -void ram_debug_dump_bitmap(unsigned long *todump, bool expected, - unsigned long pages) -{ - int64_t cur; - int64_t linelen =3D 128; - char linebuf[129]; - - for (cur =3D 0; cur < pages; cur +=3D linelen) { - int64_t curb; - bool found =3D false; - /* - * Last line; catch the case where the line length - * is longer than remaining ram - */ - if (cur + linelen > pages) { - linelen =3D pages - cur; - } - for (curb =3D 0; curb < linelen; curb++) { - bool thisbit =3D test_bit(cur + curb, todump); - linebuf[curb] =3D thisbit ? '1' : '.'; - found =3D found || (thisbit !=3D expected); - } - if (found) { - linebuf[curb] =3D '\0'; - fprintf(stderr, "0x%08" PRIx64 " : %s\n", cur, linebuf); - } - } -} - /* **** functions for postcopy ***** */ =20 void ram_postcopy_migrated_memory_release(MigrationState *ms) @@ -2669,11 +2635,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) if (ret) { return ret; } - -#ifdef DEBUG_POSTCOPY - ram_debug_dump_bitmap(block->bmap, true, - block->used_length >> TARGET_PAGE_BITS); -#endif } trace_ram_postcopy_send_discard_bitmap(); =20 diff --git a/migration/ram.h b/migration/ram.h index c515396a9a..f543e25765 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -55,8 +55,6 @@ void mig_throttle_counter_reset(void); uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t = len); void acct_update_position(QEMUFile *f, size_t size, bool zero); -void ram_debug_dump_bitmap(unsigned long *todump, bool expected, - unsigned long pages); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ int ram_postcopy_send_discard_bitmap(MigrationState *ms); --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640015495147175.54158687958352; Mon, 20 Dec 2021 07:51:35 -0800 (PST) Received: from localhost ([::1]:51892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzKwo-0000Lt-4Z for importer@patchew.org; Mon, 20 Dec 2021 10:51:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQK-0001ws-Hx for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:49755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKPm-0005xM-7k for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:17:41 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-VHHvIJZ4OeOMedpFaW22lQ-1; Mon, 20 Dec 2021 03:54:15 -0500 Received: by mail-wm1-f69.google.com with SMTP id v23-20020a05600c215700b0034566adb612so1707398wml.0 for ; Mon, 20 Dec 2021 00:54:15 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VoMC7RjlqJ2CSRkrxYjUsH/v97JY1NqZo29Zh/Eb8IM=; b=EK6OoOXPlu85t+3bP2SbHhTZNm/5KGuNqE3SFo7+7WBxC8MnoOg8uG1FcCqv+6s4YP25CY Zyh3xOyyew40cWyL9J39/P5nDqEKYbWDpOgyPC1iNIc55Kss3iwoR9PefR8Rbf9RX/9KpE Kx2VjEbYbyifc5HjgpA+uR99S0wrt7Y= X-MC-Unique: VHHvIJZ4OeOMedpFaW22lQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VoMC7RjlqJ2CSRkrxYjUsH/v97JY1NqZo29Zh/Eb8IM=; b=ijnb7SlXJVfgoZUmhVfDmSAvYGVOJCatwoy1UpRrpyGroeFD+fgYxE0WqcEThlkYql AyTfeoY6Bf530JQblSTNbsZugEaQ6oT0udzzc2b0EwUjVV+fAjvoHfEWwVH3cmNJLP+X rTwUXalPTsTYznbPSW0D5MBrYLO+qSjGJx/SAhX2TcHGNNqqqfIhYvCECpqUJ1kA+OBJ q/1MaapoSv8WLNRFEsEvIlqnuONjLJ/kpwqTRIFe+x1oEoe2EzSoQJdTw/caJYiAOrLU Fch54sJeb+97odR8U2kSVcHjX1N8p0HKFd1jNwtbYdN9WJ2vuou8oUR0AkoT9Og9zg6q qD2w== X-Gm-Message-State: AOAM531f+nFk7ynjkljN5POrxG8Kb6qyGdEacF4bnIIMs8QtSZo2cHYa n/4/wKfysDlo6Lp0eNWJ/weZD/yP5c0xJJQVq6M7awzXo/qagHHLFFMbvR+1k0OVvnDv83Os1N6 NWpRPhB7HOjXzfiObOPo+M/4uMu9U2FqaEvnux/aSIEKmBq65WS305SwQdjoQIrPD X-Received: by 2002:a5d:59af:: with SMTP id p15mr2491028wrr.237.1639990454330; Mon, 20 Dec 2021 00:54:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJziIHEk1aUaOi2ms9QjExZuzRnqS1Gr2FBISOYWn21PTU3ezGbX5JR4caGECfaSZ2iJ1C0Ihg== X-Received: by 2002:a5d:59af:: with SMTP id p15mr2490984wrr.237.1639990454015; Mon, 20 Dec 2021 00:54:14 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 2/8] migration: Don't return for postcopy_chunk_hostpages() Date: Mon, 20 Dec 2021 16:53:49 +0800 Message-Id: <20211220085355.2284-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640015496089100001 Content-Type: text/plain; charset="utf-8" It always return zero, because it just can't go wrong so far. Simplify the code with no functional change. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/ram.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7d9c8a508b..0ed0f51a09 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2580,12 +2580,10 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, RAMBlock *block) * dirty host-page size chunks as all dirty. In this case the host-page * is the host-page for the particular RAMBlock, i.e. it might be a huge p= age * - * Returns zero on success - * * @ms: current migration state * @block: block we want to work with */ -static int postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) +static void postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) { postcopy_discard_send_init(ms, block->idstr); =20 @@ -2595,7 +2593,6 @@ static int postcopy_chunk_hostpages(MigrationState *m= s, RAMBlock *block) postcopy_chunk_hostpages_pass(ms, block); =20 postcopy_discard_send_finish(ms); - return 0; } =20 /** @@ -2617,7 +2614,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState *= ms) { RAMState *rs =3D ram_state; RAMBlock *block; - int ret; =20 RCU_READ_LOCK_GUARD(); =20 @@ -2631,10 +2627,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { /* Deal with TPS !=3D HPS and huge pages */ - ret =3D postcopy_chunk_hostpages(ms, block); - if (ret) { - return ret; - } + postcopy_chunk_hostpages(ms, block); } trace_ram_postcopy_send_discard_bitmap(); =20 --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640019767032518.3164243516659; Mon, 20 Dec 2021 09:02:47 -0800 (PST) Received: from localhost ([::1]:36434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzM3h-0005k8-UD for importer@patchew.org; Mon, 20 Dec 2021 12:02:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKPr-0001jI-Dt for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:17:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKPM-0004ui-N5 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:17:30 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-rzeIZf81OUaZrPE-vcXvNQ-1; Mon, 20 Dec 2021 03:54:19 -0500 Received: by mail-wm1-f71.google.com with SMTP id 205-20020a1c00d6000000b003335d1384f1so6171077wma.3 for ; Mon, 20 Dec 2021 00:54:19 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rrllebeXjhwn2QrPCOBd7fyW3DoTWKpL8HkzryqB5PE=; b=gMZZr/Oy9Nu0pCv6BeUuxUJ9qGwP4Z237fJVTQvlRNkavAmz57KuyLlWMTb5eAkNCnVPve fnx9hDz3+ypvmPuVZlsnDOnKpDo1u0eUvXyIWs3FOcTB8FbOQj3Q3ZHAEuYLeiHrpGUU/5 6ZtJo+erchcLFLjhmcXXpcGR/tF5jkI= X-MC-Unique: rzeIZf81OUaZrPE-vcXvNQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rrllebeXjhwn2QrPCOBd7fyW3DoTWKpL8HkzryqB5PE=; b=fIwVqAvTAinE6iKutG0pNeIxHTu+zJuHzNCWoFYryO+cM8xOsIc3wfNRRWNI0Ez/m1 1pNxqbc3PYBVvrflTGt7qoOFH0nhk0E55tRet1TlnCgOTEqWBYTLxNoyfPVKWkYM0hog K7aCwlPEw6xO5WPMjJOt1+ltZ+a7F2LDjlmLNTlPgj5of3OszPVR8uIE8MWDqqWUGuMF nALt3P6WSL1XxORpGsb9dR8iV5PRXv8LzYyYXf2Noomo3T74WRRinSvLP+Ce+s1yKjEo XppxZYzrAQ9RUnJZk/xWq8au31pfGeBK3QuN4lkTB9zYT9rweiq+ZYPbDVPd1D/ByM5F rg6w== X-Gm-Message-State: AOAM531oCikeVc+nbRyV3NgccXaU8QVnqU5rtLNyKtffFk4NJEX+/SOY ipwh9zWqhdHB7/Udb78MH44+WJ4vV81SpHUdiRMbTijI/iUptUzjwGbzbPQsclmxq/h78xVgvBF eNQudGOOYo9i5MKuGmxHrqv9yNT+mzIj21hw/0OY+nbQyYcX0W1RJBBTCxyjON17E X-Received: by 2002:a1c:9851:: with SMTP id a78mr4382704wme.181.1639990457782; Mon, 20 Dec 2021 00:54:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjghb4H4Dp9iY9wlG6Denvub5R2zsUIRBSgY6SFvlxptPOWE1JVoPA2AYi6TNIN8C5IjXl5A== X-Received: by 2002:a1c:9851:: with SMTP id a78mr4382692wme.181.1639990457562; Mon, 20 Dec 2021 00:54:17 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 3/8] migration: Drop postcopy_chunk_hostpages() Date: Mon, 20 Dec 2021 16:53:50 +0800 Message-Id: <20211220085355.2284-4-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640019768269100001 Content-Type: text/plain; charset="utf-8" This function calls three functions: - postcopy_discard_send_init(ms, block->idstr); - postcopy_chunk_hostpages_pass(ms, block); - postcopy_discard_send_finish(ms); However only the 2nd function call is meaningful. It's major role is to ma= ke sure dirty bits are applied in host-page-size granule, so there will be no partial dirty bits set for a whole host page if huge pages are used. The 1st/3rd call are for latter when we want to send the disgard ranges. They're mostly no-op here besides some tracepoints (which are misleading!). Drop them, then we can directly drop postcopy_chunk_hostpages() as a whole because we can call postcopy_chunk_hostpages_pass() directly. There're still some nice comments above postcopy_chunk_hostpages() that exp= lain what it does. Copy it over to the caller's site. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/ram.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 0ed0f51a09..b22c9e7432 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2571,30 +2571,6 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, RAMBlock *block) } } =20 -/** - * postcopy_chunk_hostpages: discard any partially sent host page - * - * Utility for the outgoing postcopy code. - * - * Discard any partially sent host-page size chunks, mark any partially - * dirty host-page size chunks as all dirty. In this case the host-page - * is the host-page for the particular RAMBlock, i.e. it might be a huge p= age - * - * @ms: current migration state - * @block: block we want to work with - */ -static void postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) -{ - postcopy_discard_send_init(ms, block->idstr); - - /* - * Ensure that all partially dirty host pages are made fully dirty. - */ - postcopy_chunk_hostpages_pass(ms, block); - - postcopy_discard_send_finish(ms); -} - /** * ram_postcopy_send_discard_bitmap: transmit the discard bitmap * @@ -2626,8 +2602,13 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) rs->last_page =3D 0; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { - /* Deal with TPS !=3D HPS and huge pages */ - postcopy_chunk_hostpages(ms, block); + /* + * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent + * host-page size chunks, mark any partially dirty host-page size + * chunks as all dirty. In this case the host-page is the host-pa= ge + * for the particular RAMBlock, i.e. it might be a huge page. + */ + postcopy_chunk_hostpages_pass(ms, block); } trace_ram_postcopy_send_discard_bitmap(); =20 --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640016044928144.05067763912507; Mon, 20 Dec 2021 08:00:44 -0800 (PST) Received: from localhost ([::1]:40710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzL5C-0003qA-Pv for importer@patchew.org; Mon, 20 Dec 2021 11:00:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQR-0001xt-6R for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQ5-0006II-GQ for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:01 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-314-mucASLFFNLO79QeLlXWkWg-1; Mon, 20 Dec 2021 03:54:27 -0500 Received: by mail-wm1-f69.google.com with SMTP id z200-20020a1c7ed1000000b0034574ef8356so1683554wmc.5 for ; Mon, 20 Dec 2021 00:54:27 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cyB9NjacjlViYjX38NHa/38VGrRySbWUkQ8f+Gv2qv8=; b=Baff0i1QVwE77syejy8jgw6+/SIhKVOALCdNbff8L8QuGYVXIIcoZR2yiNm71JHBGzaIm4 c4sOSDoMuQN/PG5uxw6eFzV+OWW89Gw5rboSlLtuRIZUutwgERarS35dT52gRp333Qh3y2 /fSgFf1y2vakgZ9c0zjoujcjOVd3H70= X-MC-Unique: mucASLFFNLO79QeLlXWkWg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cyB9NjacjlViYjX38NHa/38VGrRySbWUkQ8f+Gv2qv8=; b=JEoWTATSeRqxeRHTOiuChpDDrfqG6EACQ5EXHcDYJR1HFNel/oLm27dqVbAD7VbXE/ 9dtiHPJ/JFLkcTcQAgnxeWPY69rfZEZD+b7cMcID1lPuqo7PhF1e9cY6uI6yg2oyoLmV PkGnpHl7JsMVEKOYQASiMQE6XCqit9UG0h5InQbNHPcx+QUFMmHJGQ0wnm054qhe5J40 KA6WOLoMcRpae5gnP10Rbx/nWQOi3WA6pqqKF8uP7lNDLC/WFSCusqYe5/PjCrQA4QzG EyxF7LEaCS2BM303OJ/uiQ2h9/s3k2u2sa2qSz0yU07a+Jr1EEFUc0NHsSAipXran+Lh ZHJQ== X-Gm-Message-State: AOAM531/lN0ttY4/yAMc17NcAWd90u+Ef98wBBl1sUwNvCEkibAsuOx+ VOe349I/ad6pB+SKPp44BcOAFKW2WlCKNl15828ytTZayk8y73Fi1e4dkDz96kRfxdWUCjMW/eU /I9l0pH4rlNWz2Su/a3+2daMOrJO0kEF5/1hBTf7evY6NhIYn7cnbF/af9gl1H3cg X-Received: by 2002:adf:dbd2:: with SMTP id e18mr12391595wrj.478.1639990466096; Mon, 20 Dec 2021 00:54:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpxh8lWor6VLVjc4x5sg9UIBWowjNAnarBmWJnGJKKg3dSg7YZEBl81EBFH59caGOKvxFkhA== X-Received: by 2002:adf:dbd2:: with SMTP id e18mr12391574wrj.478.1639990465818; Mon, 20 Dec 2021 00:54:25 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 4/8] migration: Do chunk page in postcopy_each_ram_send_discard() Date: Mon, 20 Dec 2021 16:53:51 +0800 Message-Id: <20211220085355.2284-5-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640016048356000001 Content-Type: text/plain; charset="utf-8" Right now we loop ramblocks for twice, the 1st time chunk the dirty bits wi= th huge page information; the 2nd time we send the discard ranges. That's not necessary - we can do them in a single loop. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/ram.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index b22c9e7432..e7107b9790 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2468,6 +2468,8 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, RAMBlock *block) return 0; } =20 +static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *bl= ock); + /** * postcopy_each_ram_send_discard: discard all RAMBlocks * @@ -2489,6 +2491,14 @@ static int postcopy_each_ram_send_discard(MigrationS= tate *ms) RAMBLOCK_FOREACH_NOT_IGNORED(block) { postcopy_discard_send_init(ms, block->idstr); =20 + /* + * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent + * host-page size chunks, mark any partially dirty host-page size + * chunks as all dirty. In this case the host-page is the host-pa= ge + * for the particular RAMBlock, i.e. it might be a huge page. + */ + postcopy_chunk_hostpages_pass(ms, block); + /* * Postcopy sends chunks of bitmap over the wire, but it * just needs indexes at this point, avoids it having @@ -2589,7 +2599,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) int ram_postcopy_send_discard_bitmap(MigrationState *ms) { RAMState *rs =3D ram_state; - RAMBlock *block; =20 RCU_READ_LOCK_GUARD(); =20 @@ -2601,15 +2610,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) rs->last_sent_block =3D NULL; rs->last_page =3D 0; =20 - RAMBLOCK_FOREACH_NOT_IGNORED(block) { - /* - * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent - * host-page size chunks, mark any partially dirty host-page size - * chunks as all dirty. In this case the host-page is the host-pa= ge - * for the particular RAMBlock, i.e. it might be a huge page. - */ - postcopy_chunk_hostpages_pass(ms, block); - } trace_ram_postcopy_send_discard_bitmap(); =20 return postcopy_each_ram_send_discard(ms); --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640019981721371.6006980789367; Mon, 20 Dec 2021 09:06:21 -0800 (PST) Received: from localhost ([::1]:45430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzM7A-0003Wi-Hk for importer@patchew.org; Mon, 20 Dec 2021 12:06:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQR-0001y0-B6 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQG-0006Id-CA for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:06 -0500 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-TBPFK3wFPDGFKBH_69ScYQ-1; Mon, 20 Dec 2021 03:54:34 -0500 Received: by mail-wm1-f72.google.com with SMTP id 144-20020a1c0496000000b003305ac0e03aso6148627wme.8 for ; Mon, 20 Dec 2021 00:54:34 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mZYsCQpjeEG9tGgHYJCXcDdGhjCJacpRXo7DIarhcFM=; b=JaWHtMdtcz8sYtmIwYl4PDT/6R/WtEETc2exOhnzaoNMtxV+y03fIARNNTuPJJsMFaKGaS 9OfLQagyyJWiC6aw2BDlzCWgklkwlZQDgaWUVuhMuZNaH1YShXlR8lYOIOLE4XGd1g5zyT 1IQOcbW/drUo4zafL33Y/FygPF1oY+o= X-MC-Unique: TBPFK3wFPDGFKBH_69ScYQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mZYsCQpjeEG9tGgHYJCXcDdGhjCJacpRXo7DIarhcFM=; b=eFLcbv6cwhP+vmc/JgJjNy5mOGXxIxfPCod7mrwQlHU7tTBPjz96J3tFxI/PiN3B3V ZGkGWb2is0kAXDH+gwn63LPAySfMH85mCG1r6qAzot9k5Rf6IbGTW8WJqZWOz+DEIYta TeN1Xc5vKviLc2GkCAwDen3iXQ28Xrq0HecyMFCYrTUgGgb7l7EN0PPJEopDTH3ybCP1 JsANFmP52bl0M4S9etBZmnrjBHbyYc6TUtu4TFn6mDReqTASCl9t573PkufaFQfenX1l 1gLMaMUwu6XTzQi0YJJvIlBibB/D7IbUbHZifLtzPhdqqBG50E2gzMM7pbVFDF06wuqU rlCA== X-Gm-Message-State: AOAM532QlqFBn6IWWpEslqCncJB1u9MgwIs8fwi2VXy6xtlZz0fICwC8 0sXZZiHm10NyRiZk2LHSdK0YEdtFnaUp2DjbFVzlC1qcdmf675PFVqd9Dg/IGHYuBelfJutMEPK NofO6KoqD88l/1dlYf9GhesZocu/bxNTvERADt46H6ebbwHSjs9qiJFom6sRgKkls X-Received: by 2002:a7b:c007:: with SMTP id c7mr20160156wmb.82.1639990471382; Mon, 20 Dec 2021 00:54:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE6qb+1KboeOeXFZ+RwPE5cBIOcp3hfULEWGbDgqRiJv7iOf29H5AA4ZqZ6gQ9xrlseL9qKA== X-Received: by 2002:a7b:c007:: with SMTP id c7mr20160130wmb.82.1639990470988; Mon, 20 Dec 2021 00:54:30 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 5/8] migration: Drop return code for disgard ram process Date: Mon, 20 Dec 2021 16:53:52 +0800 Message-Id: <20211220085355.2284-6-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640019984207100001 Content-Type: text/plain; charset="utf-8" It will just never fail. Drop those return values where they're constantly zeros. A tiny touch-up on the tracepoint so trace_ram_postcopy_send_discard_bitmap= () is called after the logic itself (which sounds more reasonable). Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- migration/migration.c | 5 +---- migration/ram.c | 20 +++++--------------- migration/ram.h | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3de11ae921..beeb162a1a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2990,10 +2990,7 @@ static int postcopy_start(MigrationState *ms) * that are dirty */ if (migrate_postcopy_ram()) { - if (ram_postcopy_send_discard_bitmap(ms)) { - error_report("postcopy send discard bitmap failed"); - goto fail; - } + ram_postcopy_send_discard_bitmap(ms); } =20 /* diff --git a/migration/ram.c b/migration/ram.c index e7107b9790..5234d1ece1 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2473,8 +2473,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block); /** * postcopy_each_ram_send_discard: discard all RAMBlocks * - * Returns 0 for success or negative for error - * * Utility for the outgoing postcopy code. * Calls postcopy_send_discard_bm_ram for each RAMBlock * passing it bitmap indexes and name. @@ -2483,10 +2481,9 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, RAMBlock *block); * * @ms: current migration state */ -static int postcopy_each_ram_send_discard(MigrationState *ms) +static void postcopy_each_ram_send_discard(MigrationState *ms) { struct RAMBlock *block; - int ret; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { postcopy_discard_send_init(ms, block->idstr); @@ -2504,14 +2501,9 @@ static int postcopy_each_ram_send_discard(MigrationS= tate *ms) * just needs indexes at this point, avoids it having * target page specific code. */ - ret =3D postcopy_send_discard_bm_ram(ms, block); + postcopy_send_discard_bm_ram(ms, block); postcopy_discard_send_finish(ms); - if (ret) { - return ret; - } } - - return 0; } =20 /** @@ -2584,8 +2576,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) /** * ram_postcopy_send_discard_bitmap: transmit the discard bitmap * - * Returns zero on success - * * Transmit the set of pages to be discarded after precopy to the target * these are pages that: * a) Have been previously transmitted but are now dirty again @@ -2596,7 +2586,7 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) * * @ms: current migration state */ -int ram_postcopy_send_discard_bitmap(MigrationState *ms) +void ram_postcopy_send_discard_bitmap(MigrationState *ms) { RAMState *rs =3D ram_state; =20 @@ -2610,9 +2600,9 @@ int ram_postcopy_send_discard_bitmap(MigrationState *= ms) rs->last_sent_block =3D NULL; rs->last_page =3D 0; =20 - trace_ram_postcopy_send_discard_bitmap(); + postcopy_each_ram_send_discard(ms); =20 - return postcopy_each_ram_send_discard(ms); + trace_ram_postcopy_send_discard_bitmap(); } =20 /** diff --git a/migration/ram.h b/migration/ram.h index f543e25765..2c6dc3675d 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -57,7 +57,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t s= tart, ram_addr_t len); void acct_update_position(QEMUFile *f, size_t size, bool zero); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ -int ram_postcopy_send_discard_bitmap(MigrationState *ms); +void ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ int ram_discard_range(const char *block_name, uint64_t start, size_t lengt= h); int ram_postcopy_incoming_init(MigrationIncomingState *mis); --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640019226987657.935452963938; Mon, 20 Dec 2021 08:53:46 -0800 (PST) Received: from localhost ([::1]:43826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzLuz-0008KX-Uq for importer@patchew.org; Mon, 20 Dec 2021 11:53:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQR-0001xw-6n for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQF-0006IL-NY for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:01 -0500 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-216-SCkgulAHOvChhymcvAVpkQ-1; Mon, 20 Dec 2021 03:54:36 -0500 Received: by mail-wm1-f72.google.com with SMTP id z199-20020a1c7ed0000000b003456affcffaso6170635wmc.2 for ; Mon, 20 Dec 2021 00:54:36 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f7+IaUs/ri/bBQ3wmEyPeRxPM6SAsBS5ON+zrdwGBIM=; b=Am11d2mt0b+x1aoSVShHHEJOMnmBZdsriFSuisnbyjsX6DuRtTBcOZU0soLaVUPp6jio1c eVuiFNXj1OklghNzhYxebMYmxZOMs2eRNDz4K3412ycfN0r2tap3VbWsFCgVtU1A9j/PSn vVkbNQSXgbfkTcalavBNQUoSo6VBZSo= X-MC-Unique: SCkgulAHOvChhymcvAVpkQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f7+IaUs/ri/bBQ3wmEyPeRxPM6SAsBS5ON+zrdwGBIM=; b=dwtllxSYLt6fAC4o+xG0jH8zhHLhxY/gh8oJ8CWsDTb4l1K7ws4XQeDnqoxLe56a7H LJUoM2zdMsd2dJDxSvq4ttshkdsvX4GdaqTsAZ9cqoB4oeloPdMv6TyRqWcW3v7niJTu VRNhJm1DKI6GEFa+Ge+fayuYFH9FMQUscerXPDdHhJOmztBuirN1bz8za5bDvExZAyfr x5JK42s/0hA+qDAXIqDjIuwkiTVTNmSiYDlhWoUI6X8lhsPRMLCUPUo+IjVv3fptZ8vG 3wmUf2uok2h+HldezMzKIpD6aDaoKyF0L2B/q4uIi30/6wJnNoq6BqEp93UI/imefZtD +neg== X-Gm-Message-State: AOAM5331n1nfZp2ohX9tirMw1on3DhoTwhl3bDKSUM8KO1J/l3JO1soz pEjHRE7WOEkFkA56ii8FwlvWQUhfk9JjBnXa33/gW60Tm4QuKNgkz1AFT5rOD0cZgCW3vlk4sxP WJ8mghFO23pfi6HaMNEBUT3NU9gXotX73VtTqf5CF39c8qG7v5FUaIEnaHEugbflt X-Received: by 2002:a05:600c:4ed2:: with SMTP id g18mr13149475wmq.25.1639990475136; Mon, 20 Dec 2021 00:54:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuytwfdUQ70lhg2tLyUKIEqe9z5I+QDObRkK/Sn0PIFGOC1i/tswUIK2tZPH5XFaAXanwkXA== X-Received: by 2002:a05:600c:4ed2:: with SMTP id g18mr13149457wmq.25.1639990474831; Mon, 20 Dec 2021 00:54:34 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 6/8] migration: Dump sub-cmd name in loadvm_process_command tp Date: Mon, 20 Dec 2021 16:53:53 +0800 Message-Id: <20211220085355.2284-7-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640019228526100001 Content-Type: text/plain; charset="utf-8" It'll be easier to read the name rather than index of sub-cmd when debuggin= g. Signed-off-by: Peter Xu --- migration/savevm.c | 3 ++- migration/trace-events | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 0bef031acb..7f7af6f750 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2272,12 +2272,13 @@ static int loadvm_process_command(QEMUFile *f) return qemu_file_get_error(f); } =20 - trace_loadvm_process_command(cmd, len); if (cmd >=3D MIG_CMD_MAX || cmd =3D=3D MIG_CMD_INVALID) { error_report("MIG_CMD 0x%x unknown (len 0x%x)", cmd, len); return -EINVAL; } =20 + trace_loadvm_process_command(mig_cmd_args[cmd].name, len); + if (mig_cmd_args[cmd].len !=3D -1 && mig_cmd_args[cmd].len !=3D len) { error_report("%s received with bad length - expecting %zu, got %d", mig_cmd_args[cmd].name, diff --git a/migration/trace-events b/migration/trace-events index b48d873b8a..d63a5915f5 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -22,7 +22,7 @@ loadvm_postcopy_handle_resume(void) "" loadvm_postcopy_ram_handle_discard(void) "" loadvm_postcopy_ram_handle_discard_end(void) "" loadvm_postcopy_ram_handle_discard_header(const char *ramid, uint16_t len)= "%s: %ud" -loadvm_process_command(uint16_t com, uint16_t len) "com=3D0x%x len=3D%d" +loadvm_process_command(const char *s, uint16_t len) "com=3D%s len=3D%d" loadvm_process_command_ping(uint32_t val) "0x%x" postcopy_ram_listen_thread_exit(void) "" postcopy_ram_listen_thread_start(void) "" --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640020379990145.11405213911644; Mon, 20 Dec 2021 09:12:59 -0800 (PST) Received: from localhost ([::1]:36012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzMDb-0007pj-3K for importer@patchew.org; Mon, 20 Dec 2021 12:12:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKSK-0002NR-FM for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:20:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKSC-0006u3-2Y for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:20:00 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-375-O9Jn6OSyNL2QQeCs3kFatQ-1; Mon, 20 Dec 2021 03:54:40 -0500 Received: by mail-wm1-f71.google.com with SMTP id z200-20020a1c7ed1000000b0034574ef8356so1683785wmc.5 for ; Mon, 20 Dec 2021 00:54:40 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+sN7W53wSKdSW7/EO825rGSschix/KpNiUHAV/bcBZA=; b=VNJafoDWrpOyCBjwq9juExzNrhjzwwqSfEgGO0D1nmCPqJpHYOYJm5SaE5/z3NJamMVIH4 RTAU/SAqbaw6RudtSw0sWpB1/O0xnyzlR5jq9jTPfFFIitFCUyFcK4lUL9qIvsTbBSKt/m pWLNTyFdgynpNNqZoGQpNyy7yBRFJq8= X-MC-Unique: O9Jn6OSyNL2QQeCs3kFatQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+sN7W53wSKdSW7/EO825rGSschix/KpNiUHAV/bcBZA=; b=J1k3bYIk4jaKUwgDcvDzPFmb1mK5tfUbyoBZUb4pVMUqTLe09mSRAdMaJkiVmrpBnW fEKFHk3UzeWXl0V0tlMujm+lUPxHEO+vA40VGOHJeVVCebhneYkPq/Auw0JlUVMhYwvd CMe3S0MjycppqhXCefHP6Ary0syup8c6TXo45dXpUGSyAsPvSCd8Tdaq09b2EpXgaSXO Fki982ItvS7n451m9nTU39iA81ZJJG0qIbt0gISStvQpvRZPV2A4YAFsFX/WhZB8Ac/g MYJhyPy5DE2uUosbp62CbdFkYQGgWGMErb2c91WAv4ryjYyhVZ9wzgiPaY5LQkxLvFbQ ygEg== X-Gm-Message-State: AOAM532coiw4rve9XmxxT4+vlUOQ2JfNe4I5XUQYd0bxWYALLnFLqAOj jA+fhzUt3Tg9v0x+3HxEDqqXh9RsGwYXN7WatomtT76XIo2zNPMHoeOilGNUcYtfWutqKGEcAV1 N9RppoH/M94i5ImzUIl1mkdGCc0X4uorDh3CHutdgPJ8z2hMlOEPwWuzYRxo7Pbqw X-Received: by 2002:adf:d841:: with SMTP id k1mr10340023wrl.396.1639990479199; Mon, 20 Dec 2021 00:54:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2XCTvpAyB6n8OBSGXQBVmI52qgg0I/tyHoGwDui0lngR5L7M+Tgc8iinQwwBG8hzvRgDbGw== X-Received: by 2002:adf:d841:: with SMTP id k1mr10340003wrl.396.1639990479010; Mon, 20 Dec 2021 00:54:39 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 7/8] migration: Finer grained tracepoints for POSTCOPY_LISTEN Date: Mon, 20 Dec 2021 16:53:54 +0800 Message-Id: <20211220085355.2284-8-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640020381397000001 Content-Type: text/plain; charset="utf-8" The enablement of postcopy listening has a few steps, add a few tracepoints= to be there ready for some basic measurements for them. Signed-off-by: Peter Xu --- migration/savevm.c | 9 ++++++++- migration/trace-events | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 7f7af6f750..25face6de0 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1947,9 +1947,10 @@ static void *postcopy_ram_listen_thread(void *opaque) static int loadvm_postcopy_handle_listen(MigrationIncomingState *mis) { PostcopyState ps =3D postcopy_state_set(POSTCOPY_INCOMING_LISTENING); - trace_loadvm_postcopy_handle_listen(); Error *local_err =3D NULL; =20 + trace_loadvm_postcopy_handle_listen("enter"); + if (ps !=3D POSTCOPY_INCOMING_ADVISE && ps !=3D POSTCOPY_INCOMING_DISC= ARD) { error_report("CMD_POSTCOPY_LISTEN in wrong postcopy state (%d)", p= s); return -1; @@ -1964,6 +1965,8 @@ static int loadvm_postcopy_handle_listen(MigrationInc= omingState *mis) } } =20 + trace_loadvm_postcopy_handle_listen("after disgard"); + /* * Sensitise RAM - can now generate requests for blocks that don't exi= st * However, at this point the CPU shouldn't be running, and the IO @@ -1976,6 +1979,8 @@ static int loadvm_postcopy_handle_listen(MigrationInc= omingState *mis) } } =20 + trace_loadvm_postcopy_handle_listen("after uffd"); + if (postcopy_notify(POSTCOPY_NOTIFY_INBOUND_LISTEN, &local_err)) { error_report_err(local_err); return -1; @@ -1990,6 +1995,8 @@ static int loadvm_postcopy_handle_listen(MigrationInc= omingState *mis) qemu_sem_wait(&mis->listen_thread_sem); qemu_sem_destroy(&mis->listen_thread_sem); =20 + trace_loadvm_postcopy_handle_listen("exit"); + return 0; } =20 diff --git a/migration/trace-events b/migration/trace-events index d63a5915f5..77d1237d89 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -14,7 +14,7 @@ loadvm_handle_cmd_packaged_main(int ret) "%d" loadvm_handle_cmd_packaged_received(int ret) "%d" loadvm_handle_recv_bitmap(char *s) "%s" loadvm_postcopy_handle_advise(void) "" -loadvm_postcopy_handle_listen(void) "" +loadvm_postcopy_handle_listen(const char *str) "%s" loadvm_postcopy_handle_run(void) "" loadvm_postcopy_handle_run_cpu_sync(void) "" loadvm_postcopy_handle_run_vmstart(void) "" --=20 2.32.0 From nobody Sun Feb 8 11:59:37 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640019033580697.3895585142158; Mon, 20 Dec 2021 08:50:33 -0800 (PST) Received: from localhost ([::1]:34334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzLrq-0001sY-VV for importer@patchew.org; Mon, 20 Dec 2021 11:50:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKQJ-0001wn-R5 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:18:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKPm-0005xS-3I for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:17:40 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-DK7jrdjXO8eLeZ1AITsk1g-1; Mon, 20 Dec 2021 03:54:45 -0500 Received: by mail-wm1-f69.google.com with SMTP id j71-20020a1c234a000000b00342f418ae7cso6173680wmj.1 for ; Mon, 20 Dec 2021 00:54:45 -0800 (PST) Received: from localhost.localdomain ([85.203.46.164]) by smtp.gmail.com with ESMTPSA id h2sm14439713wrz.23.2021.12.20.00.54.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Dec 2021 00:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640013441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vvt65GNMhXWNnjoGzsAV1uOCUvMNn6K3raOIWgUMeGU=; b=Pz850oS7Edr/yF5ER+u3m/i1aVQNmjKlVaz0/2/koS2IFxhXyeKEV4dIS5sN0A+IhEnO/n k7XK5W/RWHXPfiY0w9uADZoyUwMRLfqJduVHzps3BFNSVjDJ2SbVUyykPHi854acLFaA0B rPOfoNV6tSp4iFS4MIqszIikFHYyDs8= X-MC-Unique: DK7jrdjXO8eLeZ1AITsk1g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vvt65GNMhXWNnjoGzsAV1uOCUvMNn6K3raOIWgUMeGU=; b=XXd1AG+VeHZEt5ghRztlQSvfP8tmICZjNw8mPnGfuIw+FiHGO/ZL8d+k7DelnOpYaj o7wSr0NRgSlOrGMcfO1ojy9dyWEAz6OwLPtVDx9j/TZIA5QdyGWuMSUFiMDxr+XFUMJ8 unpPBlupWxM9ED/yoPfpl/U3nBCGgH67yVGTJwugEeJyTcWbfEALOCkboZ76g3ZYX2EG 6HyERcwYk4guBKXsjtC8XX575oKWJxecSyMww+ZsO6h2IyKjFS97M/uswivNgkYWTrxB rF330E5AHgYfHGi8VBtVAwJsYnDPfMdwP0x5kAMY8rGT/d+kNMyIlDDHfmYGTDatBk0B PRkA== X-Gm-Message-State: AOAM532gjUSePpuzJIwUGiRshTDIMuZNmSwCXDFKhUV4bNUbXrtpVgQT l86cu6slzaiaGtK+xbkF2VRMCfQRbmr33wtntbY+TmmL4jLhCvOY7uP82Pb3AsGlGgUTjG1mpgG y+sI4bWTJJ+ADMjMX43Gyrygfm3I+GR+6huXfBoiJ8PJ+pP1K+r5UP4sD0s6T/TVW X-Received: by 2002:adf:804f:: with SMTP id 73mr11919546wrk.476.1639990484010; Mon, 20 Dec 2021 00:54:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxmcmnHxpwHoX6aw6Yp3xNKhlU2xhFj1r50ALe+GqoJAOUXLIFJ2qw3EVcgWw9eCegXIdzrA== X-Received: by 2002:adf:804f:: with SMTP id 73mr11919525wrk.476.1639990483713; Mon, 20 Dec 2021 00:54:43 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH v2 8/8] migration: Tracepoint change in postcopy-run bottom half Date: Mon, 20 Dec 2021 16:53:55 +0800 Message-Id: <20211220085355.2284-9-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211220085355.2284-1-peterx@redhat.com> References: <20211220085355.2284-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Leonardo Bras Soares Passos Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1640019035418100003 Content-Type: text/plain; charset="utf-8" Remove the old two tracepoints and they're even near each other: trace_loadvm_postcopy_handle_run_cpu_sync() trace_loadvm_postcopy_handle_run_vmstart() Add trace_loadvm_postcopy_handle_run_bh() with a finer granule trace. Signed-off-by: Peter Xu --- migration/savevm.c | 12 +++++++++--- migration/trace-events | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 25face6de0..de2577c251 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2005,13 +2005,19 @@ static void loadvm_postcopy_handle_run_bh(void *opa= que) Error *local_err =3D NULL; MigrationIncomingState *mis =3D opaque; =20 + trace_loadvm_postcopy_handle_run_bh("enter"); + /* TODO we should move all of this lot into postcopy_ram.c or a shared= code * in migration.c */ cpu_synchronize_all_post_init(); =20 + trace_loadvm_postcopy_handle_run_bh("after cpu sync"); + qemu_announce_self(&mis->announce_timer, migrate_announce_params()); =20 + trace_loadvm_postcopy_handle_run_bh("after announce"); + /* Make sure all file formats flush their mutable metadata. * If we get an error here, just don't restart the VM yet. */ bdrv_invalidate_cache_all(&local_err); @@ -2021,9 +2027,7 @@ static void loadvm_postcopy_handle_run_bh(void *opaqu= e) autostart =3D false; } =20 - trace_loadvm_postcopy_handle_run_cpu_sync(); - - trace_loadvm_postcopy_handle_run_vmstart(); + trace_loadvm_postcopy_handle_run_bh("after invalidate cache"); =20 dirty_bitmap_mig_before_vm_start(); =20 @@ -2036,6 +2040,8 @@ static void loadvm_postcopy_handle_run_bh(void *opaqu= e) } =20 qemu_bh_delete(mis->bh); + + trace_loadvm_postcopy_handle_run_bh("exit"); } =20 /* After all discards we can start running and asking for pages */ diff --git a/migration/trace-events b/migration/trace-events index 77d1237d89..e165687af2 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -16,8 +16,7 @@ loadvm_handle_recv_bitmap(char *s) "%s" loadvm_postcopy_handle_advise(void) "" loadvm_postcopy_handle_listen(const char *str) "%s" loadvm_postcopy_handle_run(void) "" -loadvm_postcopy_handle_run_cpu_sync(void) "" -loadvm_postcopy_handle_run_vmstart(void) "" +loadvm_postcopy_handle_run_bh(const char *str) "%s" loadvm_postcopy_handle_resume(void) "" loadvm_postcopy_ram_handle_discard(void) "" loadvm_postcopy_ram_handle_discard_end(void) "" --=20 2.32.0