From nobody Sat Sep 27 02:05:27 2025 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=1670967789; cv=none; d=zohomail.com; s=zohoarc; b=eer9OX1lOmYZcZC6hmcYfBT9NhdQ6rNi/Hwoh5y6ePa287zC40dH6goeHGUnv32oZITEI2d1AaK/ZEMAqHCMJRrsZEBUG9G5RbGHrmLG0MgkNXprGfbeV/l73tMnmasM+TNXZoxghWUNrNLD7Z3MGv31zC4H2sARfaeWbvkVd+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670967789; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nlUuDhuH2MYPNNQx7CecYXVPXua+Kg8ijPATqs4gGgU=; b=a1r7XlBI76GAm6vlwoegIDtyFVycVKQcXkHgEuCkK1aCeplWUlw1fgBoAWzEhpJsq0Vp12RcxBQNlWSBZTuJDEGDBabQucQhgYqUmo2YgDQ8U8KWXAo4eaNmea3Q4eDZt2r3wldIjiO0XtFAl4D9MqT48N2AYKeZIlO2Je2tV+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1670967789621627.4344972572142; Tue, 13 Dec 2022 13:43:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5Czd-0000Im-Le; Tue, 13 Dec 2022 16:39:17 -0500 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 1p5CzT-0000G6-EM for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:39:09 -0500 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 1p5CzR-0007fK-UF for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:39:07 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-74-D5H7ta-ZMf62xi-O5xsKcQ-1; Tue, 13 Dec 2022 16:39:04 -0500 Received: by mail-qk1-f197.google.com with SMTP id h13-20020a05620a244d00b006fb713618b8so1194554qkn.0 for ; Tue, 13 Dec 2022 13:39:04 -0800 (PST) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id j12-20020a05620a288c00b006feb158e5e7sm8607487qkp.70.2022.12.13.13.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 13:39:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670967545; 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=nlUuDhuH2MYPNNQx7CecYXVPXua+Kg8ijPATqs4gGgU=; b=cughDSN0hEDd/x3k1BAMV8DtdXUl5KpvR1/jk/64xJss+AMfPHQuSZW0/PxIzmWHbQ6+AA z//DiuKYhwU0p2KBuN0aicds8+9V2cyCyRKWRGal3jrSl8QoXy44WyjKBf7QuTceCuHsDM IMc4GPi5N2hVOaiHhpu5QbjqEW/tLbE= X-MC-Unique: D5H7ta-ZMf62xi-O5xsKcQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nlUuDhuH2MYPNNQx7CecYXVPXua+Kg8ijPATqs4gGgU=; b=PQEQH/WBKWxFCFdO8jCWRysICrYMvz/paExiXzrXgKTTFzbZA+J2AJW/evL4B1lwMc aE9SBsyTlQyjNMD9n9N7c+gTyzswUL65qiQE1mzdDIcMH1X/zhuN2nz98xYLmyLRsZlu tf3qXibyJ4p9DBsfP7Zj1kLhP+2KLbG4uxtMuXrQcnzZFMdNI8DxmIHGJ/hBqMv7s92q UhJ5umiW+4rlxNtQU6jOHrdD484yjNdavy5SylSLObxwz4jdPbxcDGehIPdvQTaImKM8 gwUdukQqoUsi1na25sWA4pdnllWohrH1nR0Y5+bCMUIYiSZjpSrgLY1mQXzgltFkn65g 8TGQ== X-Gm-Message-State: ANoB5plxp+9xFuNyEdYmXu4xfsp38AvTniEdMjvNqshEEhqzk7jXJo55 3EBkbzXRoRIA0TJvkjq21PTP/xqGEhAVOmR+bP5xouVgLoDILjnSXekd6rcRQplyJ26rN34FfDE oBLejRW52NeTBieVTfIBGqdim/GoKAd/Sd/7taA6MN9RSUP+90UqklDxIQhUVbjHI X-Received: by 2002:ad4:4d45:0:b0:4c7:6ee5:257c with SMTP id m5-20020ad44d45000000b004c76ee5257cmr27167296qvm.51.1670967542522; Tue, 13 Dec 2022 13:39:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PW7bY76+Q43XHeZnrplCcueI5UZbYMCnFFWCoZOU/XqabFTNB/atFGT3l+7/PIbfpgqgChg== X-Received: by 2002:ad4:4d45:0:b0:4c7:6ee5:257c with SMTP id m5-20020ad44d45000000b004c76ee5257cmr27167272qvm.51.1670967542238; Tue, 13 Dec 2022 13:39:02 -0800 (PST) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juan Quintela , "Daniel P . Berrange" , Leonardo Bras Soares Passos , Manish Mishra , "Dr . David Alan Gilbert" , peterx@redhat.com Subject: [PATCH 4/5] migration: Add a semaphore to count PONGs Date: Tue, 13 Dec 2022 16:38:49 -0500 Message-Id: <20221213213850.1481858-5-peterx@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221213213850.1481858-1-peterx@redhat.com> References: <20221213213850.1481858-1-peterx@redhat.com> MIME-Version: 1.0 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: -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 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: 1670967790966100003 Content-Type: text/plain; charset="utf-8" This is mostly useless, but useful for us to know whether the main channel is correctly established without changing the migration protocol. Signed-off-by: Peter Xu --- migration/migration.c | 3 +++ migration/migration.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 898bc9fe5c..fa59846717 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2981,6 +2981,7 @@ retry: case MIG_RP_MSG_PONG: tmp32 =3D ldl_be_p(buf); trace_source_return_path_thread_pong(tmp32); + qemu_sem_post(&ms->rp_state.rp_pong_acks); break; =20 case MIG_RP_MSG_REQ_PAGES: @@ -4470,6 +4471,7 @@ static void migration_instance_finalize(Object *obj) qemu_sem_destroy(&ms->postcopy_pause_sem); qemu_sem_destroy(&ms->postcopy_pause_rp_sem); qemu_sem_destroy(&ms->rp_state.rp_sem); + qemu_sem_destroy(&ms->rp_state.rp_pong_acks); qemu_sem_destroy(&ms->postcopy_qemufile_src_sem); error_free(ms->error); } @@ -4519,6 +4521,7 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->postcopy_pause_rp_sem, 0); qemu_sem_init(&ms->rp_state.rp_sem, 0); + qemu_sem_init(&ms->rp_state.rp_pong_acks, 0); qemu_sem_init(&ms->rate_limit_sem, 0); qemu_sem_init(&ms->wait_unplug_sem, 0); qemu_sem_init(&ms->postcopy_qemufile_src_sem, 0); diff --git a/migration/migration.h b/migration/migration.h index ea8d083a51..61dc2c81df 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -275,6 +275,12 @@ struct MigrationState { */ bool rp_thread_created; QemuSemaphore rp_sem; + /* + * We post to this when we got one PONG from dest. So far it's an + * easy way to know the main channel has successfully established + * on dest QEMU. + */ + QemuSemaphore rp_pong_acks; } rp_state; =20 double mbps; --=20 2.37.3