From nobody Fri May 3 04:00:28 2024 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 1631183712395383.7570511308618; Thu, 9 Sep 2021 03:35:12 -0700 (PDT) Received: from localhost ([::1]:42228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHOh-0005dy-9J for importer@patchew.org; Thu, 09 Sep 2021 06:35:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNX-0002wi-JN for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNQ-0002qy-GV for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:58 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-n9AFm4JMMf6zIm7ZuOygJQ-1; Thu, 09 Sep 2021 06:33:50 -0400 Received: by mail-wm1-f69.google.com with SMTP id z18-20020a1c7e120000b02902e69f6fa2e0so589052wmc.9 for ; Thu, 09 Sep 2021 03:33:50 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id i20sm1250030wml.37.2021.09.09.03.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183631; 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=XOX7nqARL3VBZUhOlMwCyMghOR6R49bsh/b43icc/og=; b=Z1Km5uEAhFU9ukgRJsbRE/H8kY6p8XhtAlirn1e1qWzMU3DqKu26NQ+BEqAT7GhH7jL+ho PhktXro71DIh3K4AdTh7DthbKk+3XjZ2NLujM8u3s1j+F4srDGsZ8dTSaviNQiu+i135+c +fpqSboSaZbcGNvcsk8c/KdPBe/SZQE= X-MC-Unique: n9AFm4JMMf6zIm7ZuOygJQ-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=XOX7nqARL3VBZUhOlMwCyMghOR6R49bsh/b43icc/og=; b=I4C3RPSW1XtJhPdtQG0e3fmzITUfsGYrXpj5dpbnZgZU+siQhwBfmfQ0IG/95xlJz3 yBJe69jS0mAfZD9Ez88bLJN2t+D4PUifOHvIf7ORxwIg4mZ+Pse6Z1uacM9lSlvLFkaL yW5C/WjFAZFY1IB2kjhWq73Tzrwslwyc3q5gseIKYzC1tzLDa0vlnXuh37KkS21HBoB1 HEFx3c3q4kyTFKGzzDxY6FhqsugJOrM7/mA9YmhD6JPLTg6UIccV3lJb3QWpYQZGE8fu Ftv03jG3gV1Pmj0nTXbvPW+isaH6YJ4ZOfIP7t6KGdoqFAkhD4n1Bv9Cd1n3RCQI7gmT DOnA== X-Gm-Message-State: AOAM533KxkOv9l4IIKXSGMSMgiX5vXdY6Rp80+D4mvPisSNgR6HH/rr7 8zwlEGSBz2mK0kGksO3Tx6Prx5cYx53yVIBnEIDSQG3SGqQ/6+c+bh32KdX7MONlg9Z2FeuiUGx KEPujUd3eQOHsPQvklKk1W1X6uxA3qGqj42DmvBKeULGU1YUIvAC2H+sthEGjbvhicgw= X-Received: by 2002:adf:c54a:: with SMTP id s10mr2703911wrf.405.1631183629438; Thu, 09 Sep 2021 03:33:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7RCa0i+nu4fk4GP9gNy06w6r/32Un8INqkE2PhvfPb03Pw3XFV532QwKvZtdclpO/HWUeWg== X-Received: by 2002:adf:c54a:: with SMTP id s10mr2703890wrf.405.1631183629198; Thu, 09 Sep 2021 03:33:49 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 1/7] multifd: Implement yank for multifd send side Date: Thu, 9 Sep 2021 12:33:40 +0200 Message-Id: <20210909103346.1990-2-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lukas Straub , "Dr. David Alan Gilbert" , Leonardo Bras , Juan Quintela 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: 1631183714468100001 Content-Type: text/plain; charset="utf-8" From: Lukas Straub To: qemu-devel Cc: "Dr. David Alan Gilbert" , Juan Quintela , Peter Xu , Leonardo Bras Soares Passos Date: Wed, 1 Sep 2021 17:58:57 +0200 (1 week, 15 hours, 17 minutes ago) [[PGP Signed Part:No public key for 35AB0B289C5DB258 created at 2021-09-01T= 17:58:57+0200 using RSA]] When introducing yank functionality in the migration code I forgot to cover the multifd send side. Signed-off-by: Lukas Straub Tested-by: Leonardo Bras Reviewed-by: Leonardo Bras Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/multifd.h | 2 ++ migration/multifd.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/multifd.h b/migration/multifd.h index 8d6751f5ed..16c4d112d1 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -85,6 +85,8 @@ typedef struct { bool running; /* should this thread finish */ bool quit; + /* is the yank function registered */ + bool registered_yank; /* thread has work to do */ int pending_job; /* array of pages to sent */ diff --git a/migration/multifd.c b/migration/multifd.c index 377da78f5b..5a4f158f3c 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -546,6 +546,9 @@ void multifd_save_cleanup(void) MultiFDSendParams *p =3D &multifd_send_state->params[i]; Error *local_err =3D NULL; =20 + if (p->registered_yank) { + migration_ioc_unregister_yank(p->c); + } socket_send_channel_destroy(p->c); p->c =3D NULL; qemu_mutex_destroy(&p->mutex); @@ -813,7 +816,8 @@ static bool multifd_channel_connect(MultiFDSendParams *= p, return false; } } else { - /* update for tls qio channel */ + migration_ioc_register_yank(ioc); + p->registered_yank =3D true; p->c =3D ioc; qemu_thread_create(&p->thread, p->name, multifd_send_thread, p, QEMU_THREAD_JOINABLE); --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631183782898130.51328627842713; Thu, 9 Sep 2021 03:36:22 -0700 (PDT) Received: from localhost ([::1]:45070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHPp-0007eV-UL for importer@patchew.org; Thu, 09 Sep 2021 06:36:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNX-0002wD-Fj for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNU-0002uI-CX for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:58 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-137-zqS2sJayNFiy8xHH1kRg3g-1; Thu, 09 Sep 2021 06:33:51 -0400 Received: by mail-wr1-f70.google.com with SMTP id z1-20020adfec81000000b0015b085dbde3so363875wrn.14 for ; Thu, 09 Sep 2021 03:33:51 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id k17sm1176071wmj.0.2021.09.09.03.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183635; 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=loashz0+j0OcIJRCFBlcKJzh8A8l4zO8lqCJ5F9pqk4=; b=LWE/HlvRNy5ThTpC2X7g5Y6vWzQbIf0z+zqmfMwjmuH76ZRfxRE31XXBw7/xbujHqbmrhj Qz6Jkod2Qv04FNEC+gKE0x8lI1eQsdvBZB0tPC43FX0i93Aptq1HXKzIO4s1KJIj52qCev qJ6+9d5mKMXVGppreQjoGgPlISSx+ps= X-MC-Unique: zqS2sJayNFiy8xHH1kRg3g-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=loashz0+j0OcIJRCFBlcKJzh8A8l4zO8lqCJ5F9pqk4=; b=6abU3KizNPXoMKgMgShxDC3GnPuTeWzUlAnbSSf5olc4jKD35zSqWDKJanXFkU/brx dY/kmwWPxHkmJE7xUpytELtnnuim9HnAfOdkpPbIghtFl18AsZQbfGSwb72zhoc8G2O3 7iY/4lPSEbn+T2iz5v9+P3jZL0qPpfvPZSAUrGyigkQPTw/NQbzQXt9ZbeRQxaRGirxL 7UCYH9uesPtD5YksyvGQX2wGdqOvSxocC+EmtoV2St1OLoFhqMI11r4b5FfrIhRE6abR VKqkdVdZpUO+K81AThOV2xzyRw/Yel7L4Omzs/A8LtAJcuzYY3EG4BP+Djrb4bGx42z7 PAhg== X-Gm-Message-State: AOAM531S1VGcOlHdDp6BP+dPhcCmSTOeMWNtulcHyVG4swyysbywsL3Q BVSsZ/1N0t5uWQShRQMe/kRmvZJKBnz2t4L50AwxNmZfrZ+3Z1ooH4tGWGRB6fL3Rk880QDyJcu r0iSFV3fQNFGN10j40GYW2/xKVqB0UyJyDv2mrffNMyMLPulxxJHtsEP31Ut2L6hbUCI= X-Received: by 2002:a05:600c:230c:: with SMTP id 12mr2193101wmo.41.1631183630499; Thu, 09 Sep 2021 03:33:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGU/FPnT7YcwRvgkNRSAdcMugDOdUDjTf1WOdZt80KSEd45e/t4A75l0dplI4Ok2RlIWls+A== X-Received: by 2002:a05:600c:230c:: with SMTP id 12mr2193077wmo.41.1631183630265; Thu, 09 Sep 2021 03:33:50 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 2/7] multifd: Unconditionally unregister yank function Date: Thu, 9 Sep 2021 12:33:41 +0200 Message-Id: <20210909103346.1990-3-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=216.205.24.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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_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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lukas Straub , "Dr. David Alan Gilbert" , Juan Quintela 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: 1631183784047100001 Content-Type: text/plain; charset="utf-8" From: Lukas Straub To: qemu-devel Cc: "Dr. David Alan Gilbert" , Juan Quintela , Peter Xu , Leonardo Bras Soares Passos Date: Wed, 4 Aug 2021 21:26:32 +0200 (5 weeks, 11 hours, 52 minutes ago) [[PGP Signed Part:No public key for 35AB0B289C5DB258 created at 2021-08-04T= 21:26:32+0200 using RSA]] Unconditionally unregister yank function in multifd_load_cleanup(). If it is not unregistered here, it will leak and cause a crash in yank_unregister_instance(). Now if the ioc is still in use afterwards, it will only lead to qemu not being able to recover from a hang related to that ioc. After checking the code, i am pretty sure that ref is always 1 when arriving here. So all this currently does is remove the unneeded check. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/multifd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 5a4f158f3c..efd424bc97 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -991,10 +991,7 @@ int multifd_load_cleanup(Error **errp) for (i =3D 0; i < migrate_multifd_channels(); i++) { MultiFDRecvParams *p =3D &multifd_recv_state->params[i]; =20 - if (OBJECT(p->c)->ref =3D=3D 1) { - migration_ioc_unregister_yank(p->c); - } - + migration_ioc_unregister_yank(p->c); object_unref(OBJECT(p->c)); p->c =3D NULL; qemu_mutex_destroy(&p->mutex); --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631184032333728.5892139602571; Thu, 9 Sep 2021 03:40:32 -0700 (PDT) Received: from localhost ([::1]:57190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHTr-0007Ng-Bu for importer@patchew.org; Thu, 09 Sep 2021 06:40:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNd-0003CK-87 for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNU-0002tp-Hp for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:05 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-N50eOOwIMuWhtJQGwoHQUQ-1; Thu, 09 Sep 2021 06:33:53 -0400 Received: by mail-wm1-f72.google.com with SMTP id c2-20020a7bc8420000b0290238db573ab7so672857wml.5 for ; Thu, 09 Sep 2021 03:33:53 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id x13sm1340531wrg.62.2021.09.09.03.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183635; 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=+zeSAaNIJ8LGsRizhhQi316gUImulpKF6JrfafoodSk=; b=h/lhVjhTEdmmIvUdy/2FrHYgsi3xvQcIELEPtyRFaqous4dqwyL6hyUmsNimEZOaayf+La 0Fm3MXD8poV6rxSmDhORde9ompAxxOU99dZKsIC2nPdsMeAX2FKlZ3Xmu9D6LatHzahTtd zRdIVdA0JxZ6/oR+GKwIvQJz2sew8iw= X-MC-Unique: N50eOOwIMuWhtJQGwoHQUQ-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=+zeSAaNIJ8LGsRizhhQi316gUImulpKF6JrfafoodSk=; b=FvhAYWW8Tv2Ujl/iJ2J4IE9evMnOpCfWU3n4R1nR0U5TsdHtmOe0s+tpcwDfAyAlCJ Vmk6WOm91/fybSvqM1DsUyFAezVIfGPN20Lx3d6jXzHrcY5KudcXrtsGBLhDTJIo9a9T zl+FuYEWpvk/QibHlLT67aIPNrDsNlZqnVE5NL8jMV7zxlzRGJ+SYDOSZlVxegwkNSbK jVvIHZ3t7/KHuA0A48K7TZD5w6PTDR5MPnTY0Tg6uPn7I4VI5rqsCvdYyfo/ceIR2ayk oANZG+25T08gEgHR+fqdQPqH2SkWDADkBwVhZsupCOK74H0dWT6JHYYJS9zjENxHuyvu BjTA== X-Gm-Message-State: AOAM531vDRiDH6YQ6Y9YXvdn1MdytLHuovvpsGeLBJrdSGhDSo1gf6oz 8M2R9GezITPNmhuYmALIwU8qVmF6YQZpz8JkEbwhI01W3Xnh0S8WpUJpW5zBPKNH1xbbhxy0DCg cYtKES2WhZOmCd+RlmD4txGKx+6RVwAnoFKeUudoXNFp2cX78tpXY6qPP6uXzcadw2TU= X-Received: by 2002:a5d:67c3:: with SMTP id n3mr2732264wrw.201.1631183631799; Thu, 09 Sep 2021 03:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpeSjt+bPW563wgyB0xmBroPmW2z1oubkumNWhpEM9aOFvB8Rdod0qEB4tXZV4cZV0uuDtbQ== X-Received: by 2002:a5d:67c3:: with SMTP id n3mr2732230wrw.201.1631183631493; Thu, 09 Sep 2021 03:33:51 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 3/7] migration/rdma: Try to register On-Demand Paging memory region Date: Thu, 9 Sep 2021 12:33:42 +0200 Message-Id: <20210909103346.1990-4-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=216.205.24.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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_H2=-0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" , Li Zhijian , Juan Quintela 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: 1631184034217100003 Content-Type: text/plain; charset="utf-8" From: Li Zhijian Previously, for the fsdax mem-backend-file, it will register failed with Operation not supported. In this case, we can try to register it with On-Demand Paging[1] like what rpma_mr_reg() does on rpma[2]. [1]: https://community.mellanox.com/s/article/understanding-on-demand-pagin= g--odp-x [2]: http://pmem.io/rpma/manpages/v0.9.0/rpma_mr_reg.3 CC: Marcel Apfelbaum Signed-off-by: Li Zhijian Reviewed-by: Marcel Apfelbaum Signed-off-by: Juan Quintela --- migration/rdma.c | 73 ++++++++++++++++++++++++++++++------------ migration/trace-events | 1 + 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 5c2d113aa9..eb80431aae 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1117,19 +1117,47 @@ static int qemu_rdma_alloc_qp(RDMAContext *rdma) return 0; } =20 +/* Check whether On-Demand Paging is supported by RDAM device */ +static bool rdma_support_odp(struct ibv_context *dev) +{ + struct ibv_device_attr_ex attr =3D {0}; + int ret =3D ibv_query_device_ex(dev, NULL, &attr); + if (ret) { + return false; + } + + if (attr.odp_caps.general_caps & IBV_ODP_SUPPORT) { + return true; + } + + return false; +} + static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma) { int i; RDMALocalBlocks *local =3D &rdma->local_ram_blocks; =20 for (i =3D 0; i < local->nb_blocks; i++) { + int access =3D IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE; + local->block[i].mr =3D ibv_reg_mr(rdma->pd, local->block[i].local_host_addr, - local->block[i].length, - IBV_ACCESS_LOCAL_WRITE | - IBV_ACCESS_REMOTE_WRITE + local->block[i].length, access ); + + if (!local->block[i].mr && + errno =3D=3D ENOTSUP && rdma_support_odp(rdma->verbs)) { + access |=3D IBV_ACCESS_ON_DEMAND; + /* register ODP mr */ + local->block[i].mr =3D + ibv_reg_mr(rdma->pd, + local->block[i].local_host_addr, + local->block[i].length, access); + trace_qemu_rdma_register_odp_mr(local->block[i].block_name= ); + } + if (!local->block[i].mr) { perror("Failed to register local dest ram block!"); break; @@ -1215,28 +1243,33 @@ static int qemu_rdma_register_and_get_keys(RDMACont= ext *rdma, */ if (!block->pmr[chunk]) { uint64_t len =3D chunk_end - chunk_start; + int access =3D rkey ? IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_W= RITE : + 0; =20 trace_qemu_rdma_register_and_get_keys(len, chunk_start); =20 - block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, - chunk_start, len, - (rkey ? (IBV_ACCESS_LOCAL_WRITE | - IBV_ACCESS_REMOTE_WRITE) : 0)); - - if (!block->pmr[chunk]) { - perror("Failed to register chunk!"); - fprintf(stderr, "Chunk details: block: %d chunk index %d" - " start %" PRIuPTR " end %" PRIuPTR - " host %" PRIuPTR - " local %" PRIuPTR " registrations: %d\n", - block->index, chunk, (uintptr_t)chunk_start, - (uintptr_t)chunk_end, host_addr, - (uintptr_t)block->local_host_addr, - rdma->total_registrations); - return -1; + block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, chunk_start, len, acces= s); + if (!block->pmr[chunk] && + errno =3D=3D ENOTSUP && rdma_support_odp(rdma->verbs)) { + access |=3D IBV_ACCESS_ON_DEMAND; + /* register ODP mr */ + block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, chunk_start, len, a= ccess); + trace_qemu_rdma_register_odp_mr(block->block_name); } - rdma->total_registrations++; } + if (!block->pmr[chunk]) { + perror("Failed to register chunk!"); + fprintf(stderr, "Chunk details: block: %d chunk index %d" + " start %" PRIuPTR " end %" PRIuPTR + " host %" PRIuPTR + " local %" PRIuPTR " registrations: %d\n", + block->index, chunk, (uintptr_t)chunk_start, + (uintptr_t)chunk_end, host_addr, + (uintptr_t)block->local_host_addr, + rdma->total_registrations); + return -1; + } + rdma->total_registrations++; =20 if (lkey) { *lkey =3D block->pmr[chunk]->lkey; diff --git a/migration/trace-events b/migration/trace-events index a1c0f034ab..5f6aa580de 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -212,6 +212,7 @@ qemu_rdma_poll_write(const char *compstr, int64_t comp,= int left, uint64_t block qemu_rdma_poll_other(const char *compstr, int64_t comp, int left) "other c= ompletion %s (%" PRId64 ") received left %d" qemu_rdma_post_send_control(const char *desc) "CONTROL: sending %s.." qemu_rdma_register_and_get_keys(uint64_t len, void *start) "Registering %"= PRIu64 " bytes @ %p" +qemu_rdma_register_odp_mr(const char *name) "Try to register On-Demand Pag= ing memory region: %s" qemu_rdma_registration_handle_compress(int64_t length, int index, int64_t = offset) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 qemu_rdma_registration_handle_finished(void) "" qemu_rdma_registration_handle_ram_blocks(void) "" --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631183712309435.493277425461; Thu, 9 Sep 2021 03:35:12 -0700 (PDT) Received: from localhost ([::1]:42136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHOh-0005aG-8w for importer@patchew.org; Thu, 09 Sep 2021 06:35:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNX-0002x6-PK for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNT-0002u8-Ul for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:33:59 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-550-b4XiW1FKPritojYG17PONQ-1; Thu, 09 Sep 2021 06:33:54 -0400 Received: by mail-wm1-f71.google.com with SMTP id z18-20020a1c7e120000b02902e69f6fa2e0so589110wmc.9 for ; Thu, 09 Sep 2021 03:33:54 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id z17sm1464143wrh.66.2021.09.09.03.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183635; 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=Htv2iSTGhHdXCFIgEcI1bqNZV3sh6s2QTPG+t/Ioz6Y=; b=PDK2HSCN+e00y4IxIhspaG+xnP6Q28EG5RDXEvohjFJH577SwW6WwioJtLQSU1lwrlAXQ2 rG0QICHECOdvxQZg0hYPk27H2LmUmE2acaI4vYF3u4LVPAKJpOdtovVSpmX+u4fjLoKaSF 3IL8D/kL5Qgazp1DZs7vLVWSmo+ghuw= X-MC-Unique: b4XiW1FKPritojYG17PONQ-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=Htv2iSTGhHdXCFIgEcI1bqNZV3sh6s2QTPG+t/Ioz6Y=; b=yIiRdHH12fTJ0LcEJnGD19q64151IaiJVr7gukEhpcy2580NiqBXGqMGl7awxGN/F8 IN8+KwdwiblbhaIjhDHmgmqS5rLMLdvlIUxeJcWJLV0T5KmKFpyy6E1DhHCv+GLeU1mW BrRgbRB/9S4+V0NE52QFMzgTSBmzrzS6ZdchcM6e0GCKHSBKgERS/eR6WcJNCCf4Unem JFO2lO3MBZdqo7lP/+WGStsJ9zobLaeZnbT0uwzLVAdEaf6gE35JPlvbmnahIzMkk/cn M8CRN3lZs4kOLLtGA1muBrut8KGZyTDjkhHtzBUIuJHaSbcSqKaRp9nEdpxFFW7iQrJL qzFQ== X-Gm-Message-State: AOAM533R1txlRSZdQIrNKArOjWhAID+Ak7vJ95A7giGd0bUzuJMyBGK7 kiLS+TdaB2v7gLl7coNapvjkggG/fPKpCxSvvpnEGOll8HsGUiGPMVaLr8pnfIWPCvZR0Jys3Ld R2hB9osGT8kdY7kjAjBDfCHWNVPScXyuHSmOdVBpB8cZjH731/dk2+JSyrOV2l/OkqxA= X-Received: by 2002:adf:e387:: with SMTP id e7mr2767377wrm.199.1631183632799; Thu, 09 Sep 2021 03:33:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdngaImCQZdFmf8n+sxpEcxNnVktYIFAuWLa3JX/FysblNMtZX0V9wD/vXq5D3u3Hza6X2cw== X-Received: by 2002:adf:e387:: with SMTP id e7mr2767355wrm.199.1631183632599; Thu, 09 Sep 2021 03:33:52 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 4/7] migration/rdma: advise prefetch write for ODP region Date: Thu, 9 Sep 2021 12:33:43 +0200 Message-Id: <20210909103346.1990-5-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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_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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" , Li Zhijian , Juan Quintela 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: 1631183714482100002 Content-Type: text/plain; charset="utf-8" From: Li Zhijian To: , CC: , Li Zhijian , "Marcel= Apfelbaum" Date: Mon, 23 Aug 2021 11:33:58 +0800 (2 weeks, 3 days, 3 hours ago) The responder mr registering with ODP will sent RNR NAK back to the requester in the face of the page fault. Reviewed-by: Marcel Apfelbaum --------- ibv_poll_cq wc.status=3D13 RNR retry counter exceeded! ibv_poll_cq wrid=3DWRITE RDMA! --------- ibv_advise_mr(3) helps to make pages present before the actual IO is conducted so that the responder does page fault as little as possible. Signed-off-by: Li Zhijian Reviewed-by: Marcel Apfelbaum Signed-off-by: Juan Quintela --- migration/rdma.c | 40 ++++++++++++++++++++++++++++++++++++++++ migration/trace-events | 1 + 2 files changed, 41 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index eb80431aae..6c2cc3f617 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1133,6 +1133,30 @@ static bool rdma_support_odp(struct ibv_context *dev) return false; } =20 +/* + * ibv_advise_mr to avoid RNR NAK error as far as possible. + * The responder mr registering with ODP will sent RNR NAK back to + * the requester in the face of the page fault. + */ +static void qemu_rdma_advise_prefetch_mr(struct ibv_pd *pd, uint64_t addr, + uint32_t len, uint32_t lkey, + const char *name, bool wr) +{ + int ret; + int advice =3D wr ? IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE : + IBV_ADVISE_MR_ADVICE_PREFETCH; + struct ibv_sge sg_list =3D {.lkey =3D lkey, .addr =3D addr, .length = =3D len}; + + ret =3D ibv_advise_mr(pd, advice, + IBV_ADVISE_MR_FLAG_FLUSH, &sg_list, 1); + /* ignore the error */ + if (ret) { + trace_qemu_rdma_advise_mr(name, len, addr, strerror(errno)); + } else { + trace_qemu_rdma_advise_mr(name, len, addr, "successed"); + } +} + static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma) { int i; @@ -1156,6 +1180,15 @@ static int qemu_rdma_reg_whole_ram_blocks(RDMAContex= t *rdma) local->block[i].local_host_addr, local->block[i].length, access); trace_qemu_rdma_register_odp_mr(local->block[i].block_name= ); + + if (local->block[i].mr) { + qemu_rdma_advise_prefetch_mr(rdma->pd, + (uintptr_t)local->block[i].local_host_= addr, + local->block[i].length, + local->block[i].mr->lkey, + local->block[i].block_name, + true); + } } =20 if (!local->block[i].mr) { @@ -1255,6 +1288,13 @@ static int qemu_rdma_register_and_get_keys(RDMAConte= xt *rdma, /* register ODP mr */ block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, chunk_start, len, a= ccess); trace_qemu_rdma_register_odp_mr(block->block_name); + + if (block->pmr[chunk]) { + qemu_rdma_advise_prefetch_mr(rdma->pd, (uintptr_t)chunk_st= art, + len, block->pmr[chunk]->lkey, + block->block_name, rkey); + + } } } if (!block->pmr[chunk]) { diff --git a/migration/trace-events b/migration/trace-events index 5f6aa580de..a8ae163707 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -213,6 +213,7 @@ qemu_rdma_poll_other(const char *compstr, int64_t comp,= int left) "other complet qemu_rdma_post_send_control(const char *desc) "CONTROL: sending %s.." qemu_rdma_register_and_get_keys(uint64_t len, void *start) "Registering %"= PRIu64 " bytes @ %p" qemu_rdma_register_odp_mr(const char *name) "Try to register On-Demand Pag= ing memory region: %s" +qemu_rdma_advise_mr(const char *name, uint32_t len, uint64_t addr, const c= har *res) "Try to advise block %s prefetch at %" PRIu32 "@0x%" PRIx64 ": %s" qemu_rdma_registration_handle_compress(int64_t length, int index, int64_t = offset) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 qemu_rdma_registration_handle_finished(void) "" qemu_rdma_registration_handle_ram_blocks(void) "" --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631183866549611.1803526551321; Thu, 9 Sep 2021 03:37:46 -0700 (PDT) Received: from localhost ([::1]:49938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHRB-0002Wy-BT for importer@patchew.org; Thu, 09 Sep 2021 06:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNc-000397-5F for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNU-0002vW-Vp for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:03 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-ZLbDSfPFNxacrlNsrPMQhw-1; Thu, 09 Sep 2021 06:33:55 -0400 Received: by mail-wr1-f71.google.com with SMTP id u2-20020adfdd42000000b001579f5d6779so364393wrm.8 for ; Thu, 09 Sep 2021 03:33:55 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id d9sm1714852wrb.36.2021.09.09.03.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183636; 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=xiin61qQHRQJuFfJtZIvj/8PDAv1mtm9Lzc4rxWOruY=; b=MWYfXL/E5lT6gNEvt+I+1Hb2jD8Vd4KvcHKSOlhtvQ4xojjQdCozZjhArSZHRU3QGcuv0d 7m/yn3Cr9bnvLEjTyZgjmqkNNQnvUTSa/khBKXX1lfdldXk93vPxvfe61cHWspw45jZhhv UVuiYb6sf1NOmaMkuxN3ltYFcGHbjUo= X-MC-Unique: ZLbDSfPFNxacrlNsrPMQhw-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=xiin61qQHRQJuFfJtZIvj/8PDAv1mtm9Lzc4rxWOruY=; b=mJeYxq7HXY09oLxmQ7x2Xdkrf7AdYCXqhYk0pcFW9/1cx/IPQRejBGNm2bOjFXDL8S rGhY9fjagMfZ/YUj/JkK+P6GFT5grMVFbWvWqGz2XkYt1tLC9SaWjDcdklLpeptwmrZS ahNcX3/PFQSVMe+35DHi5hWhgNigQ5WR9xl6Zaq6uJSlFGQedEjwWg9L+Bf614jw1hIY Sg6pXiZcQSZ/B5YlWY8LgC2MME3D0i93VB/nQ19gA5dZNGgSjrHMLp/ih++GngvKsWHQ 7YlxWXLKEhEJ998ZXJEBdinMtG6VOk81ZiOkEXbzySY4GbTvTWMGg9ELUpidVp0ogGQP rDCA== X-Gm-Message-State: AOAM532jNMa0qGR3ymkH3wOp32C4RvpOmTe39aCw8NVhSF8d1b2p30CJ 8FX6oOESOOu3lBAZNaZ6MaQPA6LsRZ1iEC20iUVOy+AcIAdi9IDuGJm134+aWuVNm3Uyiz+VuPY ws32I9YSKVLwFz9+7GehfgckFldqdZreAe16ADNJBtIacLSexmZEdGpIiY3shbHIcT4w= X-Received: by 2002:adf:e40b:: with SMTP id g11mr1041071wrm.313.1631183634025; Thu, 09 Sep 2021 03:33:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD/X/bIM2THfPYJFbhDVOR3Wo3k23zLVsZ00dQz2tG9BNnglYqzmZofyjdxgkwGJZ5yHFFJw== X-Received: by 2002:adf:e40b:: with SMTP id g11mr1041040wrm.313.1631183633704; Thu, 09 Sep 2021 03:33:53 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 5/7] migration/ram: Don't passs RAMState to migration_clear_memory_region_dirty_bitmap_*() Date: Thu, 9 Sep 2021 12:33:44 +0200 Message-Id: <20210909103346.1990-6-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) 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_H2=-0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Peter Xu , Juan Quintela 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: 1631183866877100001 From: David Hildenbrand The parameter is unused, let's drop it. Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Signed-off-by: David Hildenbrand Signed-off-by: Juan Quintela --- migration/ram.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7a43bfd7af..bb908822d5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -789,8 +789,7 @@ unsigned long migration_bitmap_find_dirty(RAMState *rs,= RAMBlock *rb, return find_next_bit(bitmap, size, start); } =20 -static void migration_clear_memory_region_dirty_bitmap(RAMState *rs, - RAMBlock *rb, +static void migration_clear_memory_region_dirty_bitmap(RAMBlock *rb, unsigned long page) { uint8_t shift; @@ -818,8 +817,7 @@ static void migration_clear_memory_region_dirty_bitmap(= RAMState *rs, } =20 static void -migration_clear_memory_region_dirty_bitmap_range(RAMState *rs, - RAMBlock *rb, +migration_clear_memory_region_dirty_bitmap_range(RAMBlock *rb, unsigned long start, unsigned long npages) { @@ -832,7 +830,7 @@ migration_clear_memory_region_dirty_bitmap_range(RAMSta= te *rs, * exclusive. */ for (i =3D chunk_start; i < chunk_end; i +=3D chunk_pages) { - migration_clear_memory_region_dirty_bitmap(rs, rb, i); + migration_clear_memory_region_dirty_bitmap(rb, i); } } =20 @@ -850,7 +848,7 @@ static inline bool migration_bitmap_clear_dirty(RAMStat= e *rs, * the page in the chunk we clear the remote dirty bitmap for all. * Clearing it earlier won't be a problem, but too late will. */ - migration_clear_memory_region_dirty_bitmap(rs, rb, page); + migration_clear_memory_region_dirty_bitmap(rb, page); =20 ret =3D test_and_clear_bit(page, rb->bmap); if (ret) { @@ -2777,8 +2775,7 @@ void qemu_guest_free_page_hint(void *addr, size_t len) * are initially set. Otherwise those skipped pages will be sent in * the next round after syncing from the memory region bitmap. */ - migration_clear_memory_region_dirty_bitmap_range(ram_state, block, - start, npages); + migration_clear_memory_region_dirty_bitmap_range(block, start, npa= ges); ram_state->migration_dirty_pages -=3D bitmap_count_one_with_offset(block->bmap, start, npa= ges); bitmap_clear(block->bmap, start, npages); --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631183893466337.39277172022537; Thu, 9 Sep 2021 03:38:13 -0700 (PDT) Received: from localhost ([::1]:51870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHRc-0003oL-6t for importer@patchew.org; Thu, 09 Sep 2021 06:38:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNe-0003Ed-9D for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNb-00030s-Dv for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:05 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-m-5b0dtcO5y1c5LO3scyLg-1; Thu, 09 Sep 2021 06:33:56 -0400 Received: by mail-wm1-f72.google.com with SMTP id m22-20020a7bcb96000000b002f7b840d9dcso545810wmi.1 for ; Thu, 09 Sep 2021 03:33:56 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id u16sm1244491wmc.41.2021.09.09.03.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183642; 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=V0IiYJgceGFKra1MpkcY1f/vJ1kfm2MN13eOCaGsi14=; b=PxnVq243lHJFZvWDaqFQGRsW/bQCxk8GiLEnmndVvq1H4GzseDAs3qrxmNMg2JGkZYwliu qi01qDSaOX/qeToRLtcWwbeMWRs7p2bYqQ/XeVvvynPU1nV3kXqloNI8+5wFMiEClJpGck ejPJPL49LZXJLyie2T9Lg9EYNHeAkO8= X-MC-Unique: m-5b0dtcO5y1c5LO3scyLg-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=V0IiYJgceGFKra1MpkcY1f/vJ1kfm2MN13eOCaGsi14=; b=QtRZBUCOfeknhOCLgHJpev4GYsYZ0ic7PH4h2Jv0i+mVIaIXQUrnZMhYc+s1gHjcSc Yk+/c/2UR0/OCl9kLuPTvLanjjAJw3Uk3ZYuboOkWYuOusOA2HoMrXVkgqHG1SeUbGl4 yjr7LhdX0TTB68r6i7quYF31sHuNKCzujPMb68pQxOTKcpwvJ8kytAMie+iCvuI7eoYV hyYq7ucuHIJ+nUIv80F8tjWz9BwEvcHdtOGT+mzquRzPdrpg80t+NdWosPYKtOlKZbKD q8XsqjtT66x02IJEJ6Qthunu6MUapshSOKp2fxyKzJvzSc4d9Ko828kCyWK2Hok+eVwg 7GSg== X-Gm-Message-State: AOAM532PdASWklLlp+TSiNFy5FJJia8Sw1QuHCt9CwO2jf/DDhQAyHdx A0lw6XXT8knxXJS4FJ6MZMxdj9sbaQK4+ScyXaC77SPGsEYXDT/IX8QHMAuqTAnaXML4TDRd/FT Lsk3GoiaiWRdbg+wnyheyIIcA+6yq6lLpwN9S31hrSjZUKMIAM+3HBteC143qYhahTWY= X-Received: by 2002:adf:80e2:: with SMTP id 89mr2690085wrl.43.1631183635226; Thu, 09 Sep 2021 03:33:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfD6mPeewXMMmYQjstEU2inzL0CR5yuvHq7Qm6kBICM2Dgmge6pWRHRKCQlD/DuKqdVOYwAA== X-Received: by 2002:adf:80e2:: with SMTP id 89mr2690063wrl.43.1631183634930; Thu, 09 Sep 2021 03:33:54 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 6/7] migration: allow multifd for socket protocol only Date: Thu, 9 Sep 2021 12:33:45 +0200 Message-Id: <20210909103346.1990-7-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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_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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" , Li Zhijian , Juan Quintela 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: 1631183895341100001 Content-Type: text/plain; charset="utf-8" From: Li Zhijian To: , , CC: Li Zhijian Date: Sat, 31 Jul 2021 22:05:51 +0800 (5 weeks, 4 days, 17 hours ago) multifd with unsupported protocol will cause a segment fault. (gdb) bt #0 0x0000563b4a93faf8 in socket_connect (addr=3D0x0, errp=3D0x7f7f0267541= 0) at ../util/qemu-sockets.c:1190 #1 0x0000563b4a797a03 in qio_channel_socket_connect_sync (ioc=3D0x563b4d16e8c0, addr=3D0x0, errp=3D0x7f7f02675410) at ../io/channel-socket.c:145 #2 0x0000563b4a797abf in qio_channel_socket_connect_worker (task=3D0x563b= 4cd86c30, opaque=3D0x0) at ../io/channel-socket.c:168 #3 0x0000563b4a792631 in qio_task_thread_worker (opaque=3D0x563b4cd86c30)= at ../io/task.c:124 #4 0x0000563b4a91da69 in qemu_thread_start (args=3D0x563b4c44bb80) at ../= util/qemu-thread-posix.c:541 #5 0x00007f7fe9b5b3f9 in ?? () #6 0x0000000000000000 in ?? () It's enough to check migrate_multifd_is_allowed() in multifd cleanup() and multifd setup() though there are so many other places using migrate_use_mul= tifd(). Signed-off-by: Li Zhijian Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/multifd.h | 2 ++ migration/migration.c | 4 ++++ migration/multifd.c | 24 ++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 16c4d112d1..15c50ca0b2 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -13,6 +13,8 @@ #ifndef QEMU_MIGRATION_MULTIFD_H #define QEMU_MIGRATION_MULTIFD_H =20 +bool migrate_multifd_is_allowed(void); +void migrate_protocol_allow_multifd(bool allow); int multifd_save_setup(Error **errp); void multifd_save_cleanup(void); int multifd_load_setup(Error **errp); diff --git a/migration/migration.c b/migration/migration.c index bb909781b7..10e7616a48 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -453,10 +453,12 @@ static void qemu_start_incoming_migration(const char = *uri, Error **errp) { const char *p =3D NULL; =20 + migrate_protocol_allow_multifd(false); /* reset it anyway */ qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || strstart(uri, "vsock:", NULL)) { + migrate_protocol_allow_multifd(true); socket_start_incoming_migration(p ? p : uri, errp); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { @@ -2280,9 +2282,11 @@ void qmp_migrate(const char *uri, bool has_blk, bool= blk, } } =20 + migrate_protocol_allow_multifd(false); if (strstart(uri, "tcp:", &p) || strstart(uri, "unix:", NULL) || strstart(uri, "vsock:", NULL)) { + migrate_protocol_allow_multifd(true); socket_start_outgoing_migration(s, p ? p : uri, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { diff --git a/migration/multifd.c b/migration/multifd.c index efd424bc97..283f672bf0 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -531,7 +531,7 @@ void multifd_save_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_use_multifd() || !migrate_multifd_is_allowed()) { return; } multifd_send_terminate_threads(NULL); @@ -868,6 +868,17 @@ cleanup: multifd_new_send_channel_cleanup(p, sioc, local_err); } =20 +static bool migrate_allow_multifd; +void migrate_protocol_allow_multifd(bool allow) +{ + migrate_allow_multifd =3D allow; +} + +bool migrate_multifd_is_allowed(void) +{ + return migrate_allow_multifd; +} + int multifd_save_setup(Error **errp) { int thread_count; @@ -878,6 +889,11 @@ int multifd_save_setup(Error **errp) if (!migrate_use_multifd()) { return 0; } + if (!migrate_multifd_is_allowed()) { + error_setg(errp, "multifd is not supported by current protocol"); + return -1; + } + s =3D migrate_get_current(); thread_count =3D migrate_multifd_channels(); multifd_send_state =3D g_malloc0(sizeof(*multifd_send_state)); @@ -971,7 +987,7 @@ int multifd_load_cleanup(Error **errp) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_use_multifd() || !migrate_multifd_is_allowed()) { return 0; } multifd_recv_terminate_threads(NULL); @@ -1120,6 +1136,10 @@ int multifd_load_setup(Error **errp) if (!migrate_use_multifd()) { return 0; } + if (!migrate_multifd_is_allowed()) { + error_setg(errp, "multifd is not supported by current protocol"); + return -1; + } thread_count =3D migrate_multifd_channels(); multifd_recv_state =3D g_malloc0(sizeof(*multifd_recv_state)); multifd_recv_state->params =3D g_new0(MultiFDRecvParams, thread_count); --=20 2.31.1 From nobody Fri May 3 04:00:28 2024 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 1631183895159393.8372099413117; Thu, 9 Sep 2021 03:38:15 -0700 (PDT) Received: from localhost ([::1]:52024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOHRe-0003uM-65 for importer@patchew.org; Thu, 09 Sep 2021 06:38:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNb-00037G-Mp for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53279) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOHNa-0002zw-6t for qemu-devel@nongnu.org; Thu, 09 Sep 2021 06:34:03 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525--JrM6JlqMkKVtE4yQwx_qg-1; Thu, 09 Sep 2021 06:33:57 -0400 Received: by mail-wr1-f69.google.com with SMTP id d10-20020adffbca000000b00157bc86d94eso361493wrs.20 for ; Thu, 09 Sep 2021 03:33:57 -0700 (PDT) Received: from localhost (static-201-64-63-95.ipcom.comunitel.net. [95.63.64.201]) by smtp.gmail.com with ESMTPSA id t14sm1336953wrw.59.2021.09.09.03.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 03:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631183641; 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=nvh/cZGPWcsWthM5PmY0X5hm0ltlTZ94U+LQczMd7kY=; b=SX6sssU4X/fanLf4aYLWXdjiijWPlUFAWIAyqxGSh85nbZj4KhyZfYtIfQTVHwlfkZeKfq 95ca1NzhHh38vxCI6l21oJzFHyMh/7p97lIuVKWe6xuj8lRoP/J0ezrhq6RV942S4YurHx EhapAvc4eKIRt3tXXUWvo8514ybfAWo= X-MC-Unique: -JrM6JlqMkKVtE4yQwx_qg-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=nvh/cZGPWcsWthM5PmY0X5hm0ltlTZ94U+LQczMd7kY=; b=2C5e6ZrzAeAtFEyHyMBjoTm4s8ughtfPHdY/s+HOoZYeIb54j79qHSfYiytxs4wIrT kFKCr8ZenTjgbepkeEuRJXXOVFecD+5NTVbvND0ReEmNHQtzFKydldp3O7ovrgc1cVc1 Gsmq7o/Fl2C9hkEYNrE5zJEI5DXkzQj+FlIBM5bDHKQIYQ03SmzR16U9YCJ42WwTm6fa Y/BAm0WLMqbUdKycMpEnyoI5Erjniz68dxKcfE8mFZ0C+auaxYMEu45StedPoIXwvEUG P9F74/D+dJ1tpddUoU6TuqxyEPaFF6UHEe9xDvnJ31S5g8IxZwd8VdZnxv0KvL78GnuE UNZg== X-Gm-Message-State: AOAM533hKOXQitWRDXWTY1VPF2RyFCm9Fev1p5wahIQZqezpdalrJX1f PoWh0DYAdh0dbb+W24hwUvhEZSsgcqwLGXPadLQOC8YgOFQUQfwNubfXA4PadmCt/fD8IjA+3LP HN7hoTOs/Xqp6x+FMvATjJvWgJzFWrHSs5psPSZpK4wLTfZqCa8Jmf/PG1gKfZ3tRB/8= X-Received: by 2002:a7b:ce93:: with SMTP id q19mr2172637wmj.195.1631183636497; Thu, 09 Sep 2021 03:33:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQl9WwKms+3Jw/ckwC3lSSgEtVHDeDZBk4XTJN0Cwx3jNrdeEkWmWBWdyPPOmtCCLRqtXkkA== X-Received: by 2002:a7b:ce93:: with SMTP id q19mr2172619wmj.195.1631183636321; Thu, 09 Sep 2021 03:33:56 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 7/7] migration: allow enabling mutilfd for specific protocol only Date: Thu, 9 Sep 2021 12:33:46 +0200 Message-Id: <20210909103346.1990-8-quintela@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909103346.1990-1-quintela@redhat.com> References: <20210909103346.1990-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@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=216.205.24.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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_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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" , Li Zhijian , Juan Quintela 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: 1631183895373100002 Content-Type: text/plain; charset="utf-8" From: Li Zhijian To: , , CC: Li Zhijian Date: Sat, 31 Jul 2021 22:05:52 +0800 (5 weeks, 4 days, 17 hours ago) And change the default to true so that in '-incoming defer' case, user is a= ble to change multifd capability. Signed-off-by: Li Zhijian Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 8 ++++++++ migration/multifd.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 10e7616a48..77f9a3cfd3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1237,6 +1237,14 @@ static bool migrate_caps_check(bool *cap_list, } } =20 + /* incoming side only */ + if (runstate_check(RUN_STATE_INMIGRATE) && + !migrate_multifd_is_allowed() && + cap_list[MIGRATION_CAPABILITY_MULTIFD]) { + error_setg(errp, "multifd is not supported by current protocol"); + return false; + } + return true; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index 283f672bf0..7c9deb1921 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -868,7 +868,7 @@ cleanup: multifd_new_send_channel_cleanup(p, sioc, local_err); } =20 -static bool migrate_allow_multifd; +static bool migrate_allow_multifd =3D true; void migrate_protocol_allow_multifd(bool allow) { migrate_allow_multifd =3D allow; --=20 2.31.1