From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328597; cv=none; d=zohomail.com; s=zohoarc; b=bO/u+0m7IiktYV1RdWzBZuz650kYtsdSQUAVm0MCtrJvwEyLrJwhd7h7OF7uJX2JCFvrHnpKQHVAqoyZ9EXXH+lzySzPCcf8liedE7JLH8bVSCpIohc7a90JcQDgYJr8WiJLpOmt8tWBl60s1QY6cTO1qJxMZRxOjZhYP86WAYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328597; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l4BC263GXH0zaGK8Pbl+OQ+YsY3HK/MeO9mZ0YwB/IA=; b=KYmCDLdALE7BptlqcS/3tBe6GKjcc03AVo6ZBKIS8AHMDwYnyypmodrk6M+kOBzVFBLO2e33V7XLRiWzEbeVMZgvFCtMOP7HLWMcfwCZIQ8fqpLMq/wOeZcTTKUXzAkvi+jMAgN2XCO9W1EdNJVNieP9MAjS0uwJTOhIRMQA198= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328597522476.8636150329871; Wed, 27 Aug 2025 14:03:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNIW-0002ms-IK; Wed, 27 Aug 2025 17:03:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNIT-0002Qi-J6 for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:03:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNIR-00079N-RL for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:03:09 -0400 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-b_PqM8UaPI-aa0wsOcnoqA-1; Wed, 27 Aug 2025 16:59:54 -0400 Received: by mail-yb1-f199.google.com with SMTP id 3f1490d57ef6-e950984545fso286913276.0 for ; Wed, 27 Aug 2025 13:59:54 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.13.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 13:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328583; 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=l4BC263GXH0zaGK8Pbl+OQ+YsY3HK/MeO9mZ0YwB/IA=; b=APXf5tvAlo9tUqbAh01xeJZFoRHxlbwABS5jDILwc8eqId2JnFujwKGdrMGoDKiwD5hyAx NFhIDwyvnA+tdoL3eIxNJP1p3HxI3CuWN1uhOHvTOz1asq1j92GrSE+i2OXsVDHIkAW6th HIk9yfK4V6LXG9ibmwIHbpdDklHmVXU= X-MC-Unique: b_PqM8UaPI-aa0wsOcnoqA-1 X-Mimecast-MFC-AGG-ID: b_PqM8UaPI-aa0wsOcnoqA_1756328394 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328394; x=1756933194; 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=l4BC263GXH0zaGK8Pbl+OQ+YsY3HK/MeO9mZ0YwB/IA=; b=fvdMxYl/+YhJmiRcPa/Xn800KiFxwbwf3ATc6q1JNsDjwOg6WSDXLI5Wcjkz18q3UO w1/UI5jat6N92OGykwamKl0YdZouFoK/rBmCXASv1RzY5XszA/WIS9SAgkM/moi5pCYz mqckBYk2dyveeAVtfAQ439J6JaPpILmvHYwLR0Sz0BTJbxQkxJAQwcEdnlS5TTZCb5w5 u3bbYQ7EZTtoirFp23sngcIEwETcN4FD1ntf+D/xYxXUfT5Z9f0NnQmDhtuGSQU+bwmT F+hwcHmIJ7idq7V2jg5aLsJIy1shTj4SahqfbaaXKSD31T9GVzznuSi5pt7yKMaJPHER WJ1A== X-Gm-Message-State: AOJu0YwcnrATHShj9FsygqSQqiVdLhHXWiQsXv/fGRNkLReTg551PmWT o0DiKb8pgq8NERrJKLASGR9Wzf0f5ysaeywzDdrL9swxgxJ9+tevuUk7ggASWuyVrnSozFOn9mq 2HoGkjBJAw+rHYNRbPoWx7V3KsxAnL5+dGkN9JhguCWFSNGbcG2YjxkufJfXED2lYBPE7HEG583 fcwfRv1mSmE5Ku4zXBBqJLba5yL3BZ9x4CJnOkdg== X-Gm-Gg: ASbGncswB6q2S0+j8NWZqRl9Vm0ve0jVffQbyTZSR46z4hWo+DFEEkiFOSHrD7+Htrl Mb+wtAcKhgVmTWcc49iRoH2noz8Yyc3CWm2cuoM6qfS6o8p+JfN+JdtBIfCirAZhpAP/2t6pULJ v8JJxq09AjfKu2uX+ntdIqm9uE8n1Wni1SgyufYDUYTPHA18HuF5KnU77bNLxK+2F0TKSJoR+wY grkn3Pf+aT6EtWVThrdNozlZWKuick7we/b+Y3jAx9whfih6sYg6xcjhb1m8G0c1TnB0hXKf7zO gIBnRv9Bii4LSTQ6tdngAAwkTq+vgq2MzZfo/AsgXERfJm3RppNyxuGClbdkCBCA5h4J1WKTsu0 cSpXOrwZnHgorEMQvA2w= X-Received: by 2002:a05:6902:1243:b0:e96:c325:9775 with SMTP id 3f1490d57ef6-e96c3262d5amr13385987276.48.1756328394090; Wed, 27 Aug 2025 13:59:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIgpJsamo7OoZBWxMJDrXBYPl0qpshQX7BvBfgYY4kZlgP8SwZiqltR8WgNxKmKaUkBwgBiw== X-Received: by 2002:a05:6902:1243:b0:e96:c325:9775 with SMTP id 3f1490d57ef6-e96c3262d5amr13385943276.48.1756328393631; Wed, 27 Aug 2025 13:59:53 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "Maciej S. Szmigiero" Subject: [PATCH RFC 1/9] migration/vfio: Remove BQL implication in vfio_multifd_switchover_start() Date: Wed, 27 Aug 2025 16:59:40 -0400 Message-ID: <20250827205949.364606-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-1-peterx@redhat.com> MIME-Version: 1.0 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=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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328599454124100 We may switch to a BQL-free loadvm model. Be prepared with it. Cc: C=C3=A9dric Le Goater Cc: Maciej S. Szmigiero Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas --- hw/vfio/migration-multifd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/vfio/migration-multifd.c b/hw/vfio/migration-multifd.c index e4785031a7..8dc8444f0d 100644 --- a/hw/vfio/migration-multifd.c +++ b/hw/vfio/migration-multifd.c @@ -763,16 +763,21 @@ int vfio_multifd_switchover_start(VFIODevice *vbasede= v) { VFIOMigration *migration =3D vbasedev->migration; VFIOMultifd *multifd =3D migration->multifd; + bool bql_is_locked =3D bql_locked(); =20 assert(multifd); =20 /* The lock order is load_bufs_mutex -> BQL so unlock BQL here first */ - bql_unlock(); + if (bql_is_locked) { + bql_unlock(); + } WITH_QEMU_LOCK_GUARD(&multifd->load_bufs_mutex) { assert(!multifd->load_bufs_thread_running); multifd->load_bufs_thread_running =3D true; } - bql_lock(); + if (bql_is_locked) { + bql_lock(); + } =20 qemu_loadvm_start_load_thread(vfio_load_bufs_thread, vbasedev); =20 --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328588; cv=none; d=zohomail.com; s=zohoarc; b=P8vLOaxdo5Z7SPlf0ScXHGV2+dwUtsS5lxWjhNn6maMwV77JV8y5JolJLFObVHIdDHbYtqt9lkWBNPsL6AyijqjtOgiUCEO9iAyZIlgR+niJ+63Vth2StFCqHAZq4z4/rKAtd7QKujXQ61qZ66z23vDQmlpFRpWhsD3qVwwijzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328588; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QJAr3TebO8J8PikwvNWprOvIsh2tZfg1cE20LO3lM7Y=; b=j71cFeUeMmBBhF9am0zk+K7agqkZtZHVIyNiYikoI5URNZgSt0zAshYdij6eeHebcnPZrDxEebU3UKT+7exNkhTeu65HcDHE1xuSNrN+FZXP7BUfwQ3eb5cuXiv5I5pgUQ5Y6m8v2ruH/fsBFUCd30G7YfyoLwzFaB6x4YLupLU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328588881514.2331075198512; Wed, 27 Aug 2025 14:03:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNI1-0001TF-0o; Wed, 27 Aug 2025 17:02:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNHc-0000wR-AM for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:02:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNHV-00073c-LF for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:02:14 -0400 Received: from mail-yx1-f72.google.com (74.125.224.72 [74.125.224.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-2UFGrEGRPECKYoBnm9IgFw-1; Wed, 27 Aug 2025 16:59:56 -0400 Received: by mail-yx1-f72.google.com with SMTP id 956f58d0204a3-5f3562a16fbso437951d50.0 for ; Wed, 27 Aug 2025 13:59:56 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.13.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 13:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QJAr3TebO8J8PikwvNWprOvIsh2tZfg1cE20LO3lM7Y=; b=h2KUKO079Wa1O8FbS7mkZCfqp+GeIeEALZR9YyZ96JrMjdEeZ0VsOAt42yxtlwfonTjH/u MdjZ5eXFnaSWbKDxf/XzsVpbmx8h2s+L+u9y/I6cq+2xgPohWHjY3JjknDNY78k6Cfb2nW XCQOOSmDhwLywpuanXoICaKhssDIJkU= X-MC-Unique: 2UFGrEGRPECKYoBnm9IgFw-1 X-Mimecast-MFC-AGG-ID: 2UFGrEGRPECKYoBnm9IgFw_1756328396 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328396; x=1756933196; 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=QJAr3TebO8J8PikwvNWprOvIsh2tZfg1cE20LO3lM7Y=; b=s98lyjl8oNZ3gMCUb5zi16iz3k7r7T7e5ijc0TfvF80EO5ypehLB1FeLKxLacZu0Bf CBwlp5TTybgZ8Zq22QQMBl3IO+nvO+iXs8MKNWTnuLp7xJ5/KARt7coR27btoyp2TzK4 3XspVAL3kIdGg/mYnX3PaGwa8C1iT+M+IyjznQX5kS9Qsf52iPtzrw1G6FER+4IJ/cQE hoeOTEvhjqOt1sTW8h5MEf+wpDnMd+GUAYpalFLSrTVvjmakmxczQ6yZNIZAoxyDx2lh oeCqYc4AJi3EpR9AdT37ngY9mAkEicWmUCjzICSTUYoGmdgIfSd9p1BGdoWRueELOZXZ ycNA== X-Gm-Message-State: AOJu0Yz2/cy7Pxj75KjOgi1JRnlhE6yLms2VwTG2EvW7xPL18UOyCA2R D9nd4ltqxqzLBJIcrA9+0Ra8mVdwNXwx8FrmroXocNHu0kq/ARQfIjiks4KPS6jdZak3qWgObWq U4RmfsEjydQRfPDaXwfxNv0YPpW4+4UjJTTsAsPtdJub/j/0VkG4R2ry+xj5Y5xpP2tdrH7M9Up BKGmkOk1Dq6/uJmFNeenOdudOkm+aUPsYxOEVjBw== X-Gm-Gg: ASbGnctESYGDC+gCqAd0yiUWJDjhCDx8LVCPwaLm2ijZG5HrBmdSjnKUrgChjHKPa1R MeR4buM3eoBDD5+Lk0xhTCSZzArPkwJw5C+Xhz2gm3QQSwp/Wf1c9vbPbXlW9M8b59b5QPS50lA UqdVPrC+CVche3OpIH7RAN0pAORF5ERqE7NT6t855z26lH4K87dX0yEjka5HwzfFPBPpjFrTqQa 2vD2nCFL9kp5ruDOb/B1+22tBlLPoGgY8VP0b3ibm0jRSoyAH7Ix0CMpwWcAPipnmZvkuG5SQ3A o75iqOTWUerU1TsRk3C3mWiy2+r27OIU4DgUbcd/uK6BJAHXa50WZKdlmH2IMaW9OlbFcaJrWwX 9F8UkqD8hGoXDvlLiwAQ= X-Received: by 2002:a05:6902:1145:b0:e95:3636:fec7 with SMTP id 3f1490d57ef6-e953637041bmr14362446276.3.1756328395872; Wed, 27 Aug 2025 13:59:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWuQxOKR+8wJOK0/TNbn7hTa6ZZbpCFF+H/RmQjalGCt0MH0LE5+RvkPGQaBYReAhzsoSjYA== X-Received: by 2002:a05:6902:1145:b0:e95:3636:fec7 with SMTP id 3f1490d57ef6-e953637041bmr14362396276.3.1756328395326; Wed, 27 Aug 2025 13:59:55 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin , Lidong Chen Subject: [PATCH RFC 2/9] migration/rdma: Fix wrong context in qio_channel_rdma_shutdown() Date: Wed, 27 Aug 2025 16:59:41 -0400 Message-ID: <20250827205949.364606-3-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1756328590899116600 Content-Type: text/plain; charset="utf-8" The rdmaout should be a cache of rioc->rdmaout, not rioc->rdmain. Cc: Zhijian Li (Fujitsu) Cc: Lidong Chen Fixes: 54db882f07 ("migration: implement the shutdown for RDMA QIOChannel") Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Reviewed-by: Li Zhijian --- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 2d839fce6c..e6837184c8 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2986,7 +2986,7 @@ qio_channel_rdma_shutdown(QIOChannel *ioc, RCU_READ_LOCK_GUARD(); =20 rdmain =3D qatomic_rcu_read(&rioc->rdmain); - rdmaout =3D qatomic_rcu_read(&rioc->rdmain); + rdmaout =3D qatomic_rcu_read(&rioc->rdmaout); =20 switch (how) { case QIO_CHANNEL_SHUTDOWN_READ: --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328470; cv=none; d=zohomail.com; s=zohoarc; b=VEP9VN/q85EuH4+X5smQGq+nW86ZJw1daQB1371k8CxO+SLUbAhQ2XO9ZEzn9uz6zKD+pVi8e+zvedwsbJRD0resNtpZGGoZeb4zuCN0pEUVq03fYQFoJvyOX8QRXH38t/ra4F13BRjoXXRyzgb2/I24DpINrKJTl8tGd/0SB04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328470; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lgqJPN7aMT2upZfDjHff1MVnZ1qbYFY8iDyxM8FtLrk=; b=gXX4r1BhqjB/yBHJ2JoOdjK8e844jvGbWOEXgFf6NkcK78O4zrJtW6VDl9x1G+/cMjHwY9Fm2Eao1OVN1GuneU73l3f3xQCdTsZv7TPCXnMBeX95Rn4OTCZM2rnN16CwIro3K8ldHJf+7luJZwzb/P+WdhQRemQYiI2scle1w6k= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328470936518.9779226594932; Wed, 27 Aug 2025 14:01:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFy-0006rx-R5; Wed, 27 Aug 2025 17:00:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFd-0006iw-Da for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFX-0006fI-G5 for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:10 -0400 Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-nnNDcbpJMj21VLrImjL7qQ-1; Wed, 27 Aug 2025 16:59:58 -0400 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-e96dc0032cfso287171276.1 for ; Wed, 27 Aug 2025 13:59:58 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.13.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 13:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lgqJPN7aMT2upZfDjHff1MVnZ1qbYFY8iDyxM8FtLrk=; b=fFQ97OlF865J7pr9tEGHl/J78mmwCL/tghQJYgGxsRLszYutK/yTzyShiD3ISMfNtsV0Q4 xK7sy4n7SDtBgynE/LALdgrdL9W81rePgT7YnaGVk/2AGYXa9sg5sCYta5mJru69w1IO2u 13d6sn26oLPuHVT8WD3oA94YIQIaxQs= X-MC-Unique: nnNDcbpJMj21VLrImjL7qQ-1 X-Mimecast-MFC-AGG-ID: nnNDcbpJMj21VLrImjL7qQ_1756328398 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328397; x=1756933197; 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=lgqJPN7aMT2upZfDjHff1MVnZ1qbYFY8iDyxM8FtLrk=; b=YvuHlCOWOy+4M7ocsAo0Hnqid601isQeM+2hH3nBFh7FkrVwXm5yZ2lhI53ZuEvBW4 Al6RDJ/xjkfuOviUBxedwITvgadNbtlKorxWXbIJ+l74eu34D5vE/3NPuHada6I/lYS8 U0VCZXp5vHqFVVHYSUDYKX1QZwSGRBEv4/ts0WGtIqxaSHqqaxOL4vgDAPHf5NLlXCn1 gXA9daeZVev/gaf/jSiXsZZstM3GOcNrEne5Ei3GTc5YPJXdVe7LFWz1f85xWPGh+DYS I7wXrP3WogPsM1monLg7qwVxz3YDm9cSnMb76JYs/PJ/pBOyQlTzb0s2CPnEzeWZc5tS U/FQ== X-Gm-Message-State: AOJu0Yxz3dl6+WA9u76wtM+/O6CTXVaqJYHzn/1D81mCjJYtY8W6oLW5 Twq86J/kkXT8g2XhsCe+DEcrpHnqOg0M/TkrH7p7PRb+K8jBI1LaajhPZYgicRZ5bA1xkWRu/Qb t+ps/VwiyF20VJ93sYPfQvAbTIfVOrqSbQWAJw68JBzadharn0W0zEAhSrRs1Bd9wAHIZSEw9Ml QBrqQ2TUhNKL06UxqVF31PH7EB9jQ5V0JMe6JuIA== X-Gm-Gg: ASbGncvZAg787DiPw692KVAJUcUam31bRWq9A1dd3seHkux3uDhS6yFj6ZdfC4DtHZL 9hWFzufuCOnE6yj+CGBv+/pVFmgHkluWqUlACcOxfElyX1xzm83j1WxPNu44hcWozbnia7DqqgA 5R+wOLGIjrv/hLpSss3gK0nX4AJ6MIYbYTm9RSZbAeYSxITWv/cZRSjGh9G/u86TLonJhNCuB7O lyXM/xupdH9aOJ6NLhmMVluKMRRN3PgwAxYqOOFkrdtiAYGZ5HF+xHoHAEIA6+H+BPsXWYobdwM LELZHKSY+V2Zb4BjFKGmIJu653LjobPR1g0sByfxd2xWCBgJNYepzt+NO1qchDpfI6J5oxh9nca nCY54VJ9Qa8/OEpL2xWE= X-Received: by 2002:a05:6902:c04:b0:e96:e4ad:6b2b with SMTP id 3f1490d57ef6-e96e4ad9cadmr7536444276.48.1756328397474; Wed, 27 Aug 2025 13:59:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAr5CipU6Ky6rmqgAJt5iinXKwsMuOhPMhYGFj7Cf2kJ2Rz/3H5ko4FTMYm8S+KpzZV6e39g== X-Received: by 2002:a05:6902:c04:b0:e96:e4ad:6b2b with SMTP id 3f1490d57ef6-e96e4ad9cadmr7536390276.48.1756328396987; Wed, 27 Aug 2025 13:59:56 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 3/9] migration/rdma: Allow qemu_rdma_wait_comp_channel work with thread Date: Wed, 27 Aug 2025 16:59:42 -0400 Message-ID: <20250827205949.364606-4-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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.129.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328473990124100 Content-Type: text/plain; charset="utf-8" It's almost there, except that currently it relies on a global flag showing that it's in incoming migration. Change it to detect coroutine instead. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Reviewed-by: Li Zhijian --- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index e6837184c8..ed4e20b988 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1357,7 +1357,8 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *r= dma, * so don't yield unless we know we're running inside of a coroutine. */ if (rdma->migration_started_on_destination && - migration_incoming_get_current()->state =3D=3D MIGRATION_STATUS_AC= TIVE) { + migration_incoming_get_current()->state =3D=3D MIGRATION_STATUS_AC= TIVE && + qemu_in_coroutine()) { yield_until_fd_readable(comp_channel->fd); } else { /* This is the source side, we're in a separate thread --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328568; cv=none; d=zohomail.com; s=zohoarc; b=DsizdX7wrnTPRxlWMEcHkWblTC2Nmz2cRn3FRTMxNzUsiC6uH9bHarXuW2ZzGSiDZ2ViYFOmlDW4H/UgHwnt/Nba+VRp+Bqbf2hJCfm/XgumiRLJGd26KM6efsKOD7DN/0HrgxVO+0mSwW7GM3D/rQfjY527sCsQv8IG/6/S/ZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328568; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ots0mbGToMDfMjNgyHf67gn8Hoqcw759JCa7SUjENtQ=; b=nL47TbZLjZki1K4W7pOx7GYkyXsRQud0p3q+fbwuD2GlriMS6KdItxwKQVFtdk78xCHX9hWXr1w9awec5uO+xqK0Ze6Vo7CbTSpBpBLMJX8ksyMMWICn/oNnSHtgiUy9Dp57rE1QKNXqjhCtB/0BEYC/ajE9//G1/fwraVshgao= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328568866139.86249511403582; Wed, 27 Aug 2025 14:02:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFx-0006qX-Ew; Wed, 27 Aug 2025 17:00:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFe-0006je-Ob for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFZ-0006rq-CU for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:13 -0400 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-127-f-85Goz_NoSC8B3FF1O4ww-1; Wed, 27 Aug 2025 17:00:00 -0400 Received: by mail-yb1-f199.google.com with SMTP id 3f1490d57ef6-e95391965d7so259332276.1 for ; Wed, 27 Aug 2025 14:00:00 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.13.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 13:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ots0mbGToMDfMjNgyHf67gn8Hoqcw759JCa7SUjENtQ=; b=SB/OkPFzTslBK1eILqIk2nvdEGCQyWp2FOFBziCFyFnqyIoZ7zVQBb0nWp5mGLGoQSWm3+ nBAzJMt6osSdMiaKGdEjt/aUvP0c04T1Loh+2Yu/mIoyj/mjreRBzW03/dY/vJUgucrAnB 5wWpxOyFoOnczaMyvQkaxffZN8TGRYg= X-MC-Unique: f-85Goz_NoSC8B3FF1O4ww-1 X-Mimecast-MFC-AGG-ID: f-85Goz_NoSC8B3FF1O4ww_1756328399 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328399; x=1756933199; 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=Ots0mbGToMDfMjNgyHf67gn8Hoqcw759JCa7SUjENtQ=; b=OTVcao8pa9Oo4Zj2KZCPObR39YpUYmSMmW3VUnPAY+sG7b9Q0gJ7gy18S1s85hlhZC TK64VOx3x/qqAN9Besyf4i6qg9yo2oExYEdF1xvpSf+EAUDeUTGoLYPr8jbxzMIqzErq UNd/oCJX3UNXappeoyNd4sDMnI0liRK/3b6wf6RnycpyjMkKPuUn1bzlpa2mTxPpwqa8 iNjsrhagsEZZsLLRR/Ei5RDo7FziiWppoVnebPvIzkv+rG55qTMHf0QXByOP3SsezkNx AQgRAqLvjk/ep1suGnihdHvFlnbiz9zwvgmtxIbyQ/Xjc5BXmgzDoHa8tvL48hluqsWn PXLA== X-Gm-Message-State: AOJu0Yyo53L88JPxIMG9zGMKzztqFdb1w5to+FFhWYLqMQf9guSdK6vj Ex54TsjEoW5MKUmbasu48yOVDPLb8Z9KSg3VZZb3IcpwLt8iBybhn5KksuUisHYdVkD5QLmiS4e atrA5QziBoDENIk0dWbnxF5PnyQOMVjtJ1PZY7e37NDkl/UABFELN0jEW4xp+cSizBPkDQcn3L0 7Zd+D1c2kOsYlQFJ57pRAST5zODBKvaVnh1sUthg== X-Gm-Gg: ASbGnctp08TXexxIwl9NzBBLxVzBwd7LSXv0A2fdZYGZjzrdaliceOivTRV/qcdwWV7 2eTvoVqt+AckT5kn7kSYYRvQ7T4PMLmVS+ke07kONvOKvj48Q8Sz9AVq9bdFDADJkdDcBLxSb4e xVkSM7hSsAUFRdOh743tYQFJwvuZsRE9vaWhCg7rCApC7ApI10jw1NR5IJC9jR7WsWOlpMDQWLZ cpSZVjxx81dxEpfXVOqz7NYblLwHG1qKYcGsTtuRF7c/EgyEXOj8X3e33K1U98e08j6/r2uD8OD tMOZdWNAirQM7c8j9IBGiBNdjWp1TkgYWWbNcGRyZrBUQJDgUsRnGFEa5MhIU0iZa16wctbqZ7P p/7TajesE8xoBnfjDPJo= X-Received: by 2002:a05:6902:2b07:b0:e90:685e:bbd1 with SMTP id 3f1490d57ef6-e951c22d377mr20976266276.17.1756328399190; Wed, 27 Aug 2025 13:59:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEs3leWXEt4Ya1ej3Ts5nJZ9ue7DC4FVdskZXgOfIRYf7NXnKA3osSQ714KktHySUnqQrcvXw== X-Received: by 2002:a05:6902:2b07:b0:e90:685e:bbd1 with SMTP id 3f1490d57ef6-e951c22d377mr20976210276.17.1756328398592; Wed, 27 Aug 2025 13:59:58 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 4/9] migration/rdma: Change io_create_watch() to return immediately Date: Wed, 27 Aug 2025 16:59:43 -0400 Message-ID: <20250827205949.364606-5-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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.129.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328570824116600 Content-Type: text/plain; charset="utf-8" The old RDMA's io_create_watch() isn't really doing much work anyway. For G_IO_OUT, it already does return immediately. For G_IO_IN, it will try to detect some RDMA context length however normally nobody will be able to set it at all. Simplify the code so that RDMA iochannels simply always rely on synchronous reads and writes. It is highly likely what 6ddd2d76ca6f86f was talking about, that the async model isn't really working well. This helps because this is almost the only dependency that the migration core would need a coroutine for rdma channels. Signed-off-by: Peter Xu Tested-by: Li Zhijian --- migration/rdma.c | 69 +++--------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index ed4e20b988..bcd7aae2f2 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2789,56 +2789,14 @@ static gboolean qio_channel_rdma_source_prepare(GSource *source, gint *timeout) { - QIOChannelRDMASource *rsource =3D (QIOChannelRDMASource *)source; - RDMAContext *rdma; - GIOCondition cond =3D 0; *timeout =3D -1; - - RCU_READ_LOCK_GUARD(); - if (rsource->condition =3D=3D G_IO_IN) { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmain); - } else { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmaout); - } - - if (!rdma) { - error_report("RDMAContext is NULL when prepare Gsource"); - return FALSE; - } - - if (rdma->wr_data[0].control_len) { - cond |=3D G_IO_IN; - } - cond |=3D G_IO_OUT; - - return cond & rsource->condition; + return TRUE; } =20 static gboolean qio_channel_rdma_source_check(GSource *source) { - QIOChannelRDMASource *rsource =3D (QIOChannelRDMASource *)source; - RDMAContext *rdma; - GIOCondition cond =3D 0; - - RCU_READ_LOCK_GUARD(); - if (rsource->condition =3D=3D G_IO_IN) { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmain); - } else { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmaout); - } - - if (!rdma) { - error_report("RDMAContext is NULL when check Gsource"); - return FALSE; - } - - if (rdma->wr_data[0].control_len) { - cond |=3D G_IO_IN; - } - cond |=3D G_IO_OUT; - - return cond & rsource->condition; + return TRUE; } =20 static gboolean @@ -2848,29 +2806,8 @@ qio_channel_rdma_source_dispatch(GSource *source, { QIOChannelFunc func =3D (QIOChannelFunc)callback; QIOChannelRDMASource *rsource =3D (QIOChannelRDMASource *)source; - RDMAContext *rdma; - GIOCondition cond =3D 0; - - RCU_READ_LOCK_GUARD(); - if (rsource->condition =3D=3D G_IO_IN) { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmain); - } else { - rdma =3D qatomic_rcu_read(&rsource->rioc->rdmaout); - } - - if (!rdma) { - error_report("RDMAContext is NULL when dispatch Gsource"); - return FALSE; - } - - if (rdma->wr_data[0].control_len) { - cond |=3D G_IO_IN; - } - cond |=3D G_IO_OUT; =20 - return (*func)(QIO_CHANNEL(rsource->rioc), - (cond & rsource->condition), - user_data); + return (*func)(QIO_CHANNEL(rsource->rioc), rsource->condition, user_da= ta); } =20 static void --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328566; cv=none; d=zohomail.com; s=zohoarc; b=e2oAafyZ8PFqXGslMgVWmbfyPyx4zD6uHJvIeVg8ldLPz7LSY9NG/Xv4FYiDb50NAn8sdetcVWw+dxmZu1/puUT3wt3bbeGvPNwnbU1khZwPesfVKmdL4k+WbnhkjIUbvrbEmneBefXCPlwK9l/dO01OzdDFFR14CSpJMhymesU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328566; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=282FDB8FZ2OxZDBvgsY7roTey3+zXO4yp0CLMrwMEn0=; b=n9VTJ3ST5XiuPwJkpmz3bzawneXiSyZDh1g3/OaGNc6QK4V1KxAVa7DRx26D3VPBhlrmjUnaoKnCWAuqIhEpZKgTVy6Vl4J1SNYGmanJY6MmsQL7AM2QiPBP3aiXmx0Y+g0i6EXdEEtD+p2gk6SiStKRQz+8Yg9bVrt0mgOHoE4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328566872724.8572254592253; Wed, 27 Aug 2025 14:02:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFx-0006qT-Cp; Wed, 27 Aug 2025 17:00:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFd-0006ix-Dz for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFX-0006rF-Gn for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:12 -0400 Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-9W0XBszLO6eZEMwAdrNyoQ-1; Wed, 27 Aug 2025 17:00:02 -0400 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-e951ec54a4dso275375276.0 for ; Wed, 27 Aug 2025 14:00:02 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.13.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 13:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=282FDB8FZ2OxZDBvgsY7roTey3+zXO4yp0CLMrwMEn0=; b=MwcNJb6xzINS/+KzJGlHcWSiaBeEXeLrA1yGZQ3o/NVIkhQATfngvXiFS2GMhEsdxXXfPx dy3/IdRYuIApmwffdFXZNUTzs03B7seE/VswleAdyDnXMlP0PxhYDlvQrI2h2fffHDlYod xkCgQ5jcwN0TELp20bbAmGfnuwrMVfg= X-MC-Unique: 9W0XBszLO6eZEMwAdrNyoQ-1 X-Mimecast-MFC-AGG-ID: 9W0XBszLO6eZEMwAdrNyoQ_1756328402 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328402; x=1756933202; 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=282FDB8FZ2OxZDBvgsY7roTey3+zXO4yp0CLMrwMEn0=; b=GFiK1YEIDiTRl0NPehaTdj2E9Qcb4ZlzxBX8tw9/EkanczbDngQOmjfAtVo/IJBL1U Ea9kpdKvkEsr/q0EOxwtK34BO5zah3N3dRQkq6uCfZzWQ/p3Zh7Ebdw8y9oOcCRiyiUj kVpIVA1fVDVIhB4aAr9zlZlwjIrc/XbJ8sBGDRtmy6aqdNB1nv0sHLONq9anASUIx7x+ pqiddYwOGYhybonDLlB3MZS4rkW5ZJZrST2Qc7aVqWUsZ8egH3/d67Ng/Nh/9U8nfyVF ezZ46kL1sw/8uDJcdzdoMyFRug7Md4oZazfuiqf0pFkS6YS66X2/GNaXOf63/9P168fc kbag== X-Gm-Message-State: AOJu0YxEq758chcXWB27qW3BjTGiZVB/NwWo/qqwa1ZvWv/QtMo53wzm MJzdEWGuwJ5QAlGcUZ4bhPTxASq1TSyfD6dWbRaA6ASqUnjDaIymQ5mUUOyDcM0E0Mm2xrn7PU3 YnIYy0kypjSCKmd46bIaIUhtPS6KdmpMjmb70lam9VIwmXfhh81xHSrv43J6b16lNsQid42nDTM VmNqqeWW9cDevGVVacVVh1P2TDAfWBWbdteVZbDg== X-Gm-Gg: ASbGncvsov5K/HIl7cRq99sXuEzCmGsCpz5b8My2ef94kkym/kKfRjgIuO2/c7ugmEJ 7KL6v5c+u3uxUBmPX7NKgqeFU2lxtfT8Afphp8Mp+1nV9GNSWWTxAXcbYxWLorSLE+GL2uM7Cgi tTsub9t9UZLANdel8TsoGyw1deC+SfYn62TpzaIP+XEmyBliCXrSINSJ7C5M0Ym6zFTCqaugyDk 4tmRkdOAtthGlNzrgYq2ff6lDSB+0XcblWyBBdWQJg9CQbJoNjtHUFmcKr41weCZ8l1CLuYXDpm J/3wlK/1PGGS5MlWVcgc5DmOdAqqIG8rjck3GBH1WFx5ZlS5ovBLBCGptL/QIhe1azbMpFSBR+t sDtT0VdzSK0hTqZ8SO2o= X-Received: by 2002:a05:6902:725:b0:e96:f14a:6b59 with SMTP id 3f1490d57ef6-e96f14a6fcfmr4642825276.20.1756328401363; Wed, 27 Aug 2025 14:00:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVISFXAPzfChrftidGV71llgGZXY26gr4nvhJMEZiqx5Bo2hswQSY/+H6ftBbS7923L0y5FQ== X-Received: by 2002:a05:6902:725:b0:e96:f14a:6b59 with SMTP id 3f1490d57ef6-e96f14a6fcfmr4642760276.20.1756328400443; Wed, 27 Aug 2025 14:00:00 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 5/9] migration: Thread-ify precopy vmstate load process Date: Wed, 27 Aug 2025 16:59:44 -0400 Message-ID: <20250827205949.364606-6-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328568922116600 Content-Type: text/plain; charset="utf-8" Migration module was there for 10+ years. Initially, it was in most cases based on coroutines. As more features were added into the framework, like postcopy, multifd, etc.. it became a mixture of threads and coroutines. I'm guessing coroutines just can't fix all issues that migration want to resolve. After all these years, migration is now heavily based on a threaded model. Now there's still a major part of migration framework that is still not thread-based, which is precopy load. We do load in a separate thread in postcopy since the 1st day postcopy was introduced, however that requires a separate state transition from precopy loading all devices first, which still happens in the main thread of a coroutine. This patch tries to move the migration incoming side to be run inside a separate thread (mig/dst/main) just like the src (mig/src/main). The entrance to be migration_incoming_thread(). Quite a few things are needed to make it fly.. BQL Analysis =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Firstly, when moving it over to the thread, it means the thread cannot take BQL during the whole process of loading anymore, because otherwise it can block main thread from using the BQL for all kinds of other concurrent tasks (for example, processing QMP / HMP commands). Here the first question to ask is: what needs BQL during precopy load, and what doesn't? Most of the load process shouldn't need BQL, especially when it's about RAM. After all, RAM is still the major chunk of data to move for a live migration process. VFIO started to change that, though, but still, VFIO is per-device so that shouldn't need BQL either in most cases. Generic device loads will need BQL, likely not when receiving VMSDs, but when applying them. One example is any post_load() could potentially inject memory regions causing memory transactions to happen. That'll need to update the global address spaces, hence requires BQL. The other one is CPU sync operations, even if the sync alone may not need BQL (which is still to be further justified), run_on_cpu() will need it. For that, qemu_loadvm_state() and qemu_loadvm_state_main() functions need to now take a "bql_held" parameter saying whether bql is held. We could use things like BQL_LOCK_GUARD(), but this patch goes with explicit lockings rather than relying on bql_locked TLS variable. In case of migration, we always know whether BQL is held in different context as long as we can still pass that information downwards. COLO =3D=3D=3D=3D COLO assumed the dest VM load happens in a coroutine. After this patch, it's not anymore. Change that by invoking colo_incoming_co() directly from the migration_incoming_thread(). The name (colo_incoming_co()) isn't proper anymore. Change it to colo_incoming_wait(), removing the coroutine annotation alongside. Remove all the bql_lock() implications in COLO, e.g., colo_incoming_co() used to release the lock for a short period while join(). Now it's not needed. At the meantime, there's colo_incoming_co variable that used to store the COLO incoming coroutine, only to be kicked off when a secondary failover happens. To recap, what should happen for such failover should be (taking example of a QMP command x-colo-lost-heartbeat triggering on dest QEMU): - The QMP command will kick off both the coroutine and the COLO thread (colo_process_incoming_thread()), with something like: /* Notify COLO incoming thread that failover work is finished */ qemu_event_set(&mis->colo_incoming_event); qemu_coroutine_enter(mis->colo_incoming_co); - The coroutine, which yielded itself before, now resumes after enter(), then it'll wait for the join(): mis->colo_incoming_co =3D qemu_coroutine_self(); qemu_coroutine_yield(); mis->colo_incoming_co =3D NULL; /* Wait checkpoint incoming thread exit before free resource */ qemu_thread_join(&th); Here, when switching to a thread model, it should be fine removing colo_incoming_co variable completely, because if so, the incoming thread will (instead of yielding the coroutine) wait at qemu_thread_join() until the colo thread completes execution (after receiving colo_incoming_event). RDMA =3D=3D=3D=3D With the prior patch making sure io_watch won't block for RDMA iochannels, RDMA threads should only block at its io_readv/io_writev functions. When a disconnection is detected (as in rdma_cm_poll_handler()), the update to "errored" field will be immediately reflected in the migration incoming thread. Hence the coroutine for RDMA is not needed anymore to kick the thread out. TODO =3D=3D=3D=3D Currently the BQL is taken during loading of a START|FULL section. When the IO hangs (e.g. network issue) during this process, it could potentially block others like the monitor servers. One solution is breaking BQL to smaller granule and leave IOs to be always BQL-free. That'll need more justifications. For example, there are at least four things that need some closer attention: - SaveVMHandlers's load_state(): this likely DO NOT need BQL, but we need to justify all of them (not to mention, some of them look like prone to be rewritten as VMSDs..) - VMSD's pre_load(): in most cases, this DO NOT really need BQL, but sometimes maybe it will! Double checking on this will be needed. - VMSD's post_load(): in many cases, this DO need BQL, for example on address space operations. Likely we should just take it for any post_load(). - VMSD field's get(): this is tricky! It could internally be anything even if it was only a field. E.g. there can be users to use a SINGLE field to load a whole VMSD, which can further introduce more possibilities. In general, QEMUFile IOs should not need BQL, that is when receiving the VMSD data and waiting for e.g. the socket buffer to get refilled. But that's the easy part. Signed-off-by: Peter Xu --- include/migration/colo.h | 6 ++-- migration/migration.h | 52 ++++++++++++++++++++++++++------ migration/savevm.h | 5 ++-- migration/channel.c | 7 ++--- migration/colo-stubs.c | 2 +- migration/colo.c | 23 ++++----------- migration/migration.c | 62 ++++++++++++++++++++++++++++---------- migration/rdma.c | 5 ---- migration/savevm.c | 64 ++++++++++++++++++++++++---------------- migration/trace-events | 4 +-- 10 files changed, 142 insertions(+), 88 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index 43222ef5ae..bfb30eccf0 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -44,12 +44,10 @@ void colo_do_failover(void); void colo_checkpoint_delay_set(void); =20 /* - * Starts COLO incoming process. Called from process_incoming_migration_co= () + * Starts COLO incoming process. Called from migration_incoming_thread() * after loading the state. - * - * Called with BQL locked, may temporary release BQL. */ -void coroutine_fn colo_incoming_co(void); +void colo_incoming_wait(void); =20 void colo_shutdown(void); #endif diff --git a/migration/migration.h b/migration/migration.h index 01329bf824..c4a626eed4 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -42,6 +42,44 @@ #define MIGRATION_THREAD_DST_LISTEN "mig/dst/listen" #define MIGRATION_THREAD_DST_PREEMPT "mig/dst/preempt" =20 +/** + * WITH_BQL_HELD(): Run a task, making sure BQL is held + * + * @bql_held: Whether BQL is already held + * @task: The task to run within BQL held + */ +#define WITH_BQL_HELD(bql_held, task) \ + do { \ + if (!bql_held) { \ + bql_lock(); \ + } else { \ + assert(bql_locked()); \ + } \ + task; \ + if (!bql_held) { \ + bql_unlock(); \ + } \ + } while (0) + +/** + * WITHOUT_BQL_HELD(): Run a task, making sure BQL is released + * + * @bql_held: Whether BQL is already held + * @task: The task to run making sure BQL released + */ +#define WITHOUT_BQL_HELD(bql_held, task) \ + do { \ + if (bql_held) { \ + bql_unlock(); \ + } else { \ + assert(!bql_locked()); \ + } \ + task; \ + if (bql_held) { \ + bql_lock(); \ + } \ + } while (0) + struct PostcopyBlocktimeContext; typedef struct ThreadPool ThreadPool; =20 @@ -119,6 +157,10 @@ struct MigrationIncomingState { bool have_listen_thread; QemuThread listen_thread; =20 + /* Migration main recv thread */ + bool have_recv_thread; + QemuThread recv_thread; + /* For the kernel to send us notifications */ int userfault_fd; /* To notify the fault_thread to wake, e.g., when need to quit */ @@ -177,15 +219,7 @@ struct MigrationIncomingState { =20 MigrationStatus state; =20 - /* - * The incoming migration coroutine, non-NULL during qemu_loadvm_state= (). - * Used to wake the migration incoming coroutine from rdma code. How m= uch is - * it safe - it's a question. - */ - Coroutine *loadvm_co; - - /* The coroutine we should enter (back) after failover */ - Coroutine *colo_incoming_co; + /* Notify secondary VM to move on */ QemuEvent colo_incoming_event; =20 /* Optional load threads pool and its thread exit request flag */ diff --git a/migration/savevm.h b/migration/savevm.h index 2d5e9c7166..c07e14f61a 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -64,9 +64,10 @@ void qemu_savevm_send_colo_enable(QEMUFile *f); void qemu_savevm_live_state(QEMUFile *f); int qemu_save_device_state(QEMUFile *f); =20 -int qemu_loadvm_state(QEMUFile *f); +int qemu_loadvm_state(QEMUFile *f, bool bql_held); void qemu_loadvm_state_cleanup(MigrationIncomingState *mis); -int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis); +int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis, + bool bql_held); int qemu_load_device_state(QEMUFile *f); int qemu_loadvm_approve_switchover(void); int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, diff --git a/migration/channel.c b/migration/channel.c index a547b1fbfe..621f8a4a2a 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -136,11 +136,8 @@ int migration_channel_read_peek(QIOChannel *ioc, } =20 /* 1ms sleep. */ - if (qemu_in_coroutine()) { - qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000); - } else { - g_usleep(1000); - } + assert(!qemu_in_coroutine()); + g_usleep(1000); } =20 return 0; diff --git a/migration/colo-stubs.c b/migration/colo-stubs.c index e22ce65234..ef77d1ab4b 100644 --- a/migration/colo-stubs.c +++ b/migration/colo-stubs.c @@ -9,7 +9,7 @@ void colo_shutdown(void) { } =20 -void coroutine_fn colo_incoming_co(void) +void colo_incoming_wait(void) { } =20 diff --git a/migration/colo.c b/migration/colo.c index e0f713c837..f5722d9d9d 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -147,11 +147,6 @@ static void secondary_vm_do_failover(void) } /* Notify COLO incoming thread that failover work is finished */ qemu_event_set(&mis->colo_incoming_event); - - /* For Secondary VM, jump to incoming co */ - if (mis->colo_incoming_co) { - qemu_coroutine_enter(mis->colo_incoming_co); - } } =20 static void primary_vm_do_failover(void) @@ -686,7 +681,7 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, =20 bql_lock(); cpu_synchronize_all_states(); - ret =3D qemu_loadvm_state_main(mis->from_src_file, mis); + ret =3D qemu_loadvm_state_main(mis->from_src_file, mis, true); bql_unlock(); =20 if (ret < 0) { @@ -854,10 +849,8 @@ static void *colo_process_incoming_thread(void *opaque) goto out; } /* - * Note: the communication between Primary side and Secondary side - * should be sequential, we set the fd to unblocked in migration incom= ing - * coroutine, and here we are in the COLO incoming thread, so it is ok= to - * set the fd back to blocked. + * Here we are in the COLO incoming thread, so it is ok to set the fd + * to blocked. */ qemu_file_set_blocking(mis->from_src_file, true); =20 @@ -930,26 +923,20 @@ out: return NULL; } =20 -void coroutine_fn colo_incoming_co(void) +/* Wait for failover */ +void colo_incoming_wait(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); QemuThread th; =20 - assert(bql_locked()); assert(migration_incoming_colo_enabled()); =20 qemu_thread_create(&th, MIGRATION_THREAD_DST_COLO, colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); =20 - mis->colo_incoming_co =3D qemu_coroutine_self(); - qemu_coroutine_yield(); - mis->colo_incoming_co =3D NULL; - - bql_unlock(); /* Wait checkpoint incoming thread exit before free resource */ qemu_thread_join(&th); - bql_lock(); =20 /* We hold the global BQL, so it is safe here */ colo_release_ram_cache(); diff --git a/migration/migration.c b/migration/migration.c index 10c216d25d..7e4d25b15c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -494,6 +494,11 @@ void migration_incoming_state_destroy(void) mis->postcopy_qemufile_dst =3D NULL; } =20 + if (mis->have_recv_thread) { + qemu_thread_join(&mis->recv_thread); + mis->have_recv_thread =3D false; + } + cpr_set_incoming_mode(MIG_MODE_NONE); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } @@ -864,30 +869,46 @@ static void process_incoming_migration_bh(void *opaqu= e) migration_incoming_state_destroy(); } =20 -static void coroutine_fn -process_incoming_migration_co(void *opaque) +static void migration_incoming_state_destroy_bh(void *opaque) +{ + struct MigrationIncomingState *mis =3D opaque; + + if (mis->exit_on_error) { + /* + * NOTE: this exit() should better happen in the main thread, as + * the exit notifier may require BQL which can deadlock. See + * commit e7bc0204e57836 for example. + */ + exit(EXIT_FAILURE); + } + + migration_incoming_state_destroy(); +} + +static void *migration_incoming_thread(void *opaque) { MigrationState *s =3D migrate_get_current(); - MigrationIncomingState *mis =3D migration_incoming_get_current(); + MigrationIncomingState *mis =3D opaque; PostcopyState ps; int ret; Error *local_err =3D NULL; =20 + rcu_register_thread(); + assert(mis->from_src_file); + assert(!bql_locked()); =20 mis->largest_page_size =3D qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_ACTIVE); =20 - mis->loadvm_co =3D qemu_coroutine_self(); - ret =3D qemu_loadvm_state(mis->from_src_file); - mis->loadvm_co =3D NULL; + ret =3D qemu_loadvm_state(mis->from_src_file, false); =20 trace_vmstate_downtime_checkpoint("dst-precopy-loadvm-completed"); =20 ps =3D postcopy_state_get(); - trace_process_incoming_migration_co_end(ret, ps); + trace_process_incoming_migration_end(ret, ps); if (ps !=3D POSTCOPY_INCOMING_NONE) { if (ps =3D=3D POSTCOPY_INCOMING_ADVISE) { /* @@ -901,7 +922,7 @@ process_incoming_migration_co(void *opaque) * Postcopy was started, cleanup should happen at the end of t= he * postcopy thread. */ - trace_process_incoming_migration_co_postcopy_end_main(); + trace_process_incoming_migration_postcopy_end_main(); goto out; } /* Else if something went wrong then just fall out of the normal e= xit */ @@ -913,8 +934,8 @@ process_incoming_migration_co(void *opaque) } =20 if (migration_incoming_colo_enabled()) { - /* yield until COLO exit */ - colo_incoming_co(); + /* wait until COLO exits */ + colo_incoming_wait(); } =20 migration_bh_schedule(process_incoming_migration_bh, mis); @@ -926,19 +947,24 @@ fail: migrate_set_error(s, local_err); error_free(local_err); =20 - migration_incoming_state_destroy(); - if (mis->exit_on_error) { WITH_QEMU_LOCK_GUARD(&s->error_mutex) { error_report_err(s->error); s->error =3D NULL; } - - exit(EXIT_FAILURE); } + + /* + * There's some step of the destroy process that will need to happen in + * the main thread (e.g. joining this thread itself). Leave to a BH. + */ + migration_bh_schedule(migration_incoming_state_destroy_bh, (void *)mis= ); + out: /* Pairs with the refcount taken in qmp_migrate_incoming() */ migrate_incoming_unref_outgoing_state(); + rcu_unregister_thread(); + return NULL; } =20 /** @@ -956,8 +982,12 @@ static void migration_incoming_setup(QEMUFile *f) =20 void migration_incoming_process(void) { - Coroutine *co =3D qemu_coroutine_create(process_incoming_migration_co,= NULL); - qemu_coroutine_enter(co); + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + mis->have_recv_thread =3D true; + qemu_thread_create(&mis->recv_thread, "mig/dst/main", + migration_incoming_thread, mis, + QEMU_THREAD_JOINABLE); } =20 /* Returns true if recovered from a paused migration, otherwise false */ diff --git a/migration/rdma.c b/migration/rdma.c index bcd7aae2f2..2b995513aa 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3068,7 +3068,6 @@ static void rdma_cm_poll_handler(void *opaque) { RDMAContext *rdma =3D opaque; struct rdma_cm_event *cm_event; - MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 if (rdma_get_cm_event(rdma->channel, &cm_event) < 0) { error_report("get_cm_event failed %d", errno); @@ -3087,10 +3086,6 @@ static void rdma_cm_poll_handler(void *opaque) } } rdma_ack_cm_event(cm_event); - if (mis->loadvm_co) { - qemu_coroutine_enter(mis->loadvm_co); - } - return; } rdma_ack_cm_event(cm_event); } diff --git a/migration/savevm.c b/migration/savevm.c index fabbeb296a..ad606c5425 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -154,11 +154,10 @@ static void qemu_loadvm_thread_pool_destroy(Migration= IncomingState *mis) } =20 static bool qemu_loadvm_thread_pool_wait(MigrationState *s, - MigrationIncomingState *mis) + MigrationIncomingState *mis, + bool bql_held) { - bql_unlock(); /* Let load threads do work requiring BQL */ - thread_pool_wait(mis->load_threads); - bql_lock(); + WITHOUT_BQL_HELD(bql_held, thread_pool_wait(mis->load_threads)); =20 return !migrate_has_error(s); } @@ -2091,14 +2090,11 @@ static void *postcopy_ram_listen_thread(void *opaqu= e) trace_postcopy_ram_listen_thread_start(); =20 rcu_register_thread(); - /* - * Because we're a thread and not a coroutine we can't yield - * in qemu_file, and thus we must be blocking now. - */ + /* Because we're a thread, making sure to use blocking mode */ qemu_file_set_blocking(f, true); =20 /* TODO: sanity check that only postcopiable data will be loaded here = */ - load_res =3D qemu_loadvm_state_main(f, mis); + load_res =3D qemu_loadvm_state_main(f, mis, false); =20 /* * This is tricky, but, mis->from_src_file can change after it @@ -2392,13 +2388,14 @@ static int loadvm_postcopy_handle_resume(MigrationI= ncomingState *mis) * Immediately following this command is a blob of data containing an embe= dded * chunk of migration stream; read it and load it. * - * @mis: Incoming state - * @length: Length of packaged data to read + * @mis: Incoming state + * @bql_held: Whether BQL is held already * * Returns: Negative values on error * */ -static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis) +static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis, + bool bql_held) { int ret; size_t length; @@ -2449,7 +2446,7 @@ static int loadvm_handle_cmd_packaged(MigrationIncomi= ngState *mis) qemu_coroutine_yield(); } while (1); =20 - ret =3D qemu_loadvm_state_main(packf, mis); + ret =3D qemu_loadvm_state_main(packf, mis, bql_held); trace_loadvm_handle_cmd_packaged_main(ret); qemu_fclose(packf); object_unref(OBJECT(bioc)); @@ -2539,7 +2536,7 @@ static int loadvm_postcopy_handle_switchover_start(vo= id) * LOADVM_QUIT All good, but exit the loop * <0 Error */ -static int loadvm_process_command(QEMUFile *f) +static int loadvm_process_command(QEMUFile *f, bool bql_held) { MigrationIncomingState *mis =3D migration_incoming_get_current(); uint16_t cmd; @@ -2609,7 +2606,7 @@ static int loadvm_process_command(QEMUFile *f) break; =20 case MIG_CMD_PACKAGED: - return loadvm_handle_cmd_packaged(mis); + return loadvm_handle_cmd_packaged(mis, bql_held); =20 case MIG_CMD_POSTCOPY_ADVISE: return loadvm_postcopy_handle_advise(mis, len); @@ -3028,7 +3025,8 @@ static bool postcopy_pause_incoming(MigrationIncoming= State *mis) return true; } =20 -int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis) +int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis, + bool bql_held) { uint8_t section_type; int ret =3D 0; @@ -3046,7 +3044,15 @@ retry: switch (section_type) { case QEMU_VM_SECTION_START: case QEMU_VM_SECTION_FULL: - ret =3D qemu_loadvm_section_start_full(f, section_type); + /* + * FULL should normally require BQL, e.g. during post_load() + * there can be memory region updates. START may or may not + * require it, but just to keep it simple to always hold BQL + * for now. + */ + WITH_BQL_HELD( + bql_held, + ret =3D qemu_loadvm_section_start_full(f, section_type)); if (ret < 0) { goto out; } @@ -3059,7 +3065,11 @@ retry: } break; case QEMU_VM_COMMAND: - ret =3D loadvm_process_command(f); + /* + * Be careful; QEMU_VM_COMMAND can embed FULL sections, so it + * may internally need BQL. + */ + ret =3D loadvm_process_command(f, bql_held); trace_qemu_loadvm_state_section_command(ret); if ((ret < 0) || (ret =3D=3D LOADVM_QUIT)) { goto out; @@ -3103,7 +3113,7 @@ out: return ret; } =20 -int qemu_loadvm_state(QEMUFile *f) +int qemu_loadvm_state(QEMUFile *f, bool bql_held) { MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); @@ -3131,9 +3141,10 @@ int qemu_loadvm_state(QEMUFile *f) qemu_loadvm_state_switchover_ack_needed(mis); } =20 - cpu_synchronize_all_pre_loadvm(); + /* run_on_cpu() requires BQL */ + WITH_BQL_HELD(bql_held, cpu_synchronize_all_pre_loadvm()); =20 - ret =3D qemu_loadvm_state_main(f, mis); + ret =3D qemu_loadvm_state_main(f, mis, bql_held); qemu_event_set(&mis->main_thread_load_event); =20 trace_qemu_loadvm_state_post_main(ret); @@ -3149,7 +3160,7 @@ int qemu_loadvm_state(QEMUFile *f) /* When reaching here, it must be precopy */ if (ret =3D=3D 0) { if (migrate_has_error(migrate_get_current()) || - !qemu_loadvm_thread_pool_wait(s, mis)) { + !qemu_loadvm_thread_pool_wait(s, mis, bql_held)) { ret =3D -EINVAL; } else { ret =3D qemu_file_get_error(f); @@ -3196,7 +3207,8 @@ int qemu_loadvm_state(QEMUFile *f) } } =20 - cpu_synchronize_all_post_init(); + /* run_on_cpu() requires BQL */ + WITH_BQL_HELD(bql_held, cpu_synchronize_all_post_init()); =20 return ret; } @@ -3207,7 +3219,7 @@ int qemu_load_device_state(QEMUFile *f) int ret; =20 /* Load QEMU_VM_SECTION_FULL section */ - ret =3D qemu_loadvm_state_main(f, mis); + ret =3D qemu_loadvm_state_main(f, mis, true); if (ret < 0) { error_report("Failed to load device state: %d", ret); return ret; @@ -3438,7 +3450,7 @@ void qmp_xen_load_devices_state(const char *filename,= Error **errp) f =3D qemu_file_new_input(QIO_CHANNEL(ioc)); object_unref(OBJECT(ioc)); =20 - ret =3D qemu_loadvm_state(f); + ret =3D qemu_loadvm_state(f, true); qemu_fclose(f); if (ret < 0) { error_setg(errp, "loading Xen device state failed"); @@ -3512,7 +3524,7 @@ bool load_snapshot(const char *name, const char *vmst= ate, ret =3D -EINVAL; goto err_drain; } - ret =3D qemu_loadvm_state(f); + ret =3D qemu_loadvm_state(f, true); migration_incoming_state_destroy(); =20 bdrv_drain_all_end(); diff --git a/migration/trace-events b/migration/trace-events index 706db97def..eeb41e03f1 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -193,8 +193,8 @@ source_return_path_thread_resume_ack(uint32_t v) "%"PRI= u32 source_return_path_thread_switchover_acked(void) "" migration_thread_low_pending(uint64_t pending) "%" PRIu64 migrate_transferred(uint64_t transferred, uint64_t time_spent, uint64_t ba= ndwidth, uint64_t avail_bw, uint64_t size) "transferred %" PRIu64 " time_sp= ent %" PRIu64 " bandwidth %" PRIu64 " switchover_bw %" PRIu64 " max_size %"= PRId64 -process_incoming_migration_co_end(int ret, int ps) "ret=3D%d postcopy-stat= e=3D%d" -process_incoming_migration_co_postcopy_end_main(void) "" +process_incoming_migration_end(int ret, int ps) "ret=3D%d postcopy-state= =3D%d" +process_incoming_migration_postcopy_end_main(void) "" postcopy_preempt_enabled(bool value) "%d" migration_precopy_complete(void) "" =20 --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328473; cv=none; d=zohomail.com; s=zohoarc; b=c6QPRO/Fmyu2Y8fr5ARt1waAAvulCMUH4VYZwv0GPMX9vAhCssPKC1y2SZ1if4OHvwJm+n4ukylTOnyY3FRy/+IQeQcRHzTKDprOvuK/spDB5G20j0F2LH+N5u9BV2MYC7VFEdd+qAfQNIKVcuu3kS3UTBYrFYcPf7OO8nmR5nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328473; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LWSJYlk138FmAFVvxr4mdnjck2zH0Iu2R9tmAoocuGM=; b=JiRB98QvgIl0kC0SeI+t33Jk7dXXcT7RQd3WcdzxSXOADiLqe7UOGOuy0J2hQ+nlAvAjWpOpRWRJCcKqo529XDirV8cJ/D9GRIi47SL/G+gCrEnk6GFnij4jlMBDn8in3VH4e9pBj6fMtWrvbCC2rkB2ZNPdpiCPnCc4T4i/ECw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328473484782.17782525992; Wed, 27 Aug 2025 14:01:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFz-0006sP-70; Wed, 27 Aug 2025 17:00:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFd-0006iu-Da for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFX-0006rO-7M for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:09 -0400 Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-s1_5xZwVPLKBQ71b0HpkYA-1; Wed, 27 Aug 2025 17:00:04 -0400 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-71d605339dbso3010507b3.2 for ; Wed, 27 Aug 2025 14:00:04 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.14.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 14:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LWSJYlk138FmAFVvxr4mdnjck2zH0Iu2R9tmAoocuGM=; b=JEFdfcYujQTCEfl8hxb/qZ+FiXKjGt99cyDqqYl26dDsWanwmj5zMQb67LiHoITcHuCs9c lurzh2ziYebVUHyRikFKeUuwrWExcxakk7w0Oo5Urbnc5F5npyvJbZRdQuQAgamPcGBzGy pGSxO62/oKrXcyQTJBqPByytaWUyQns= X-MC-Unique: s1_5xZwVPLKBQ71b0HpkYA-1 X-Mimecast-MFC-AGG-ID: s1_5xZwVPLKBQ71b0HpkYA_1756328404 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328403; x=1756933203; 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=LWSJYlk138FmAFVvxr4mdnjck2zH0Iu2R9tmAoocuGM=; b=Et2hHt3zautpasWgBYWDbZKcebA5YEASGK2SfZv7CJXhr/g08qO8uT/SDAKif+uvHD YyJ7EdgxVncOMQjb+Ji6HD/cJuF3pWOnI8Yso0rH7Hh/tu993SiUqfFSZZI5wzjLca2R SG6EQPu/ape+SRst0BFYVvvrNfSAxikKORIbEKicksoo3M6XJTkTvM4vPUq8/uk6Hxg7 /btSv3/ldw9OChYjhuOkNVogh9AKoPMuW09eY+0YDSx/v1lQP9fjVecXhWXQTfj1pR7l JP2zw75lOz/rQLirLbeIE6iAIjZc4EclTtOaNo5A6+9AMorPR5bf95wE79czxLpLRrVR 0K/g== X-Gm-Message-State: AOJu0YwGZtcWqyFgBN7J4O8c3sK0taEmhZgTrmfFe5pfNr6gNYdYgpeL uc39UqDvdnohjRXV+VU+vjkkfjsfwKkeh/k1t3/cSfyHFxzqN7zjZIUeR81J6+qckdxvaxRwGe+ Y7J3vq+S4WG0JYkXStnmPQB4YsEiwoMnw1ZKPhG4NixH0/VlSyRBlUxmLk4QqIiQtg3IulpFGKC OITCEd7xcyHo3vpOXsirUMEMTOlwNembb3HEV0GQ== X-Gm-Gg: ASbGncukBQ5uU8GunxYL4adu+j6Yniicjl5hMkrIyVjZ1KZA9P4ZKeqh2X4dhALyW/3 18JdiVGC4gzl+4BgfqP1PsUfSBCmA35KHWHGKZ1HCng3XEbXjvusQqN2+4o57bix8UIUX1tEeJI nWEM9KNLXOTsclUFIfXpdTA4tbaj4A7+KHORx3uMaUV37qSdqmvbao+T976Ev3C40Da+XxiZ7L+ YalX6kJXdirolDuIV9CbHLfTD/Qxd8JkooUkNtbmWn5jWSKXd/aomzmZPR2TAJ/BZEBUv0/IrzQ JCVpulh0j2fxksZAGwQmsf4rTXTDkLiuPqPyy49VrcIVtAMZFPIGQQJoKcdOyQT2REvZh5DoBR0 1PDqqsXsGRLqBmgcnIvg= X-Received: by 2002:a05:6902:110e:b0:e95:34cf:9b55 with SMTP id 3f1490d57ef6-e9534cfa905mr19201920276.12.1756328403472; Wed, 27 Aug 2025 14:00:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkpx0budwaHrDidhF7vzeiefKfIffbE7jmdijfNTP7rqs5nhQI/GsOctMgsj45yLrZwawenQ== X-Received: by 2002:a05:6902:110e:b0:e95:34cf:9b55 with SMTP id 3f1490d57ef6-e9534cfa905mr19201850276.12.1756328402854; Wed, 27 Aug 2025 14:00:02 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 6/9] migration/rdma: Remove coroutine path in qemu_rdma_wait_comp_channel Date: Wed, 27 Aug 2025 16:59:45 -0400 Message-ID: <20250827205949.364606-7-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328476061116600 Content-Type: text/plain; charset="utf-8" Now after threadified dest VM load during precopy, we will always in a thread context rather than within a coroutine. We can remove this path now. With that, migration_started_on_destination can go away too. Signed-off-by: Peter Xu Reviewed-by: Li Zhijian --- migration/rdma.c | 102 +++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 61 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 2b995513aa..7751262460 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -29,7 +29,6 @@ #include "qemu/rcu.h" #include "qemu/sockets.h" #include "qemu/bitmap.h" -#include "qemu/coroutine.h" #include "system/memory.h" #include #include @@ -357,13 +356,6 @@ typedef struct RDMAContext { /* Index of the next RAMBlock received during block registration */ unsigned int next_src_index; =20 - /* - * Migration on *destination* started. - * Then use coroutine yield function. - * Source runs in a thread, so we don't care. - */ - int migration_started_on_destination; - int total_registrations; int total_writes; =20 @@ -1353,66 +1345,55 @@ static int qemu_rdma_wait_comp_channel(RDMAContext = *rdma, struct rdma_cm_event *cm_event; =20 /* - * Coroutine doesn't start until migration_fd_process_incoming() - * so don't yield unless we know we're running inside of a coroutine. + * This is the source or dest side, either during precopy or + * postcopy. We're always in a separate thread when reaching here. + * Poll the fd. We need to be able to handle 'cancel' or an error + * without hanging forever. */ - if (rdma->migration_started_on_destination && - migration_incoming_get_current()->state =3D=3D MIGRATION_STATUS_AC= TIVE && - qemu_in_coroutine()) { - yield_until_fd_readable(comp_channel->fd); - } else { - /* This is the source side, we're in a separate thread - * or destination prior to migration_fd_process_incoming() - * after postcopy, the destination also in a separate thread. - * we can't yield; so we have to poll the fd. - * But we need to be able to handle 'cancel' or an error - * without hanging forever. - */ - while (!rdma->errored && !rdma->received_error) { - GPollFD pfds[2]; - pfds[0].fd =3D comp_channel->fd; - pfds[0].events =3D G_IO_IN | G_IO_HUP | G_IO_ERR; - pfds[0].revents =3D 0; - - pfds[1].fd =3D rdma->channel->fd; - pfds[1].events =3D G_IO_IN | G_IO_HUP | G_IO_ERR; - pfds[1].revents =3D 0; - - /* 0.1s timeout, should be fine for a 'cancel' */ - switch (qemu_poll_ns(pfds, 2, 100 * 1000 * 1000)) { - case 2: - case 1: /* fd active */ - if (pfds[0].revents) { - return 0; - } + while (!rdma->errored && !rdma->received_error) { + GPollFD pfds[2]; + pfds[0].fd =3D comp_channel->fd; + pfds[0].events =3D G_IO_IN | G_IO_HUP | G_IO_ERR; + pfds[0].revents =3D 0; + + pfds[1].fd =3D rdma->channel->fd; + pfds[1].events =3D G_IO_IN | G_IO_HUP | G_IO_ERR; + pfds[1].revents =3D 0; + + /* 0.1s timeout, should be fine for a 'cancel' */ + switch (qemu_poll_ns(pfds, 2, 100 * 1000 * 1000)) { + case 2: + case 1: /* fd active */ + if (pfds[0].revents) { + return 0; + } =20 - if (pfds[1].revents) { - if (rdma_get_cm_event(rdma->channel, &cm_event) < 0) { - return -1; - } + if (pfds[1].revents) { + if (rdma_get_cm_event(rdma->channel, &cm_event) < 0) { + return -1; + } =20 - if (cm_event->event =3D=3D RDMA_CM_EVENT_DISCONNECTED = || - cm_event->event =3D=3D RDMA_CM_EVENT_DEVICE_REMOVA= L) { - rdma_ack_cm_event(cm_event); - return -1; - } + if (cm_event->event =3D=3D RDMA_CM_EVENT_DISCONNECTED || + cm_event->event =3D=3D RDMA_CM_EVENT_DEVICE_REMOVAL) { rdma_ack_cm_event(cm_event); + return -1; } - break; + rdma_ack_cm_event(cm_event); + } + break; =20 - case 0: /* Timeout, go around again */ - break; + case 0: /* Timeout, go around again */ + break; =20 - default: /* Error of some type - - * I don't trust errno from qemu_poll_ns - */ - return -1; - } + default: /* Error of some type - + * I don't trust errno from qemu_poll_ns + */ + return -1; + } =20 - if (migrate_get_current()->state =3D=3D MIGRATION_STATUS_CANCE= LLING) { - /* Bail out and let the cancellation happen */ - return -1; - } + if (migrate_get_current()->state =3D=3D MIGRATION_STATUS_CANCELLIN= G) { + /* Bail out and let the cancellation happen */ + return -1; } } =20 @@ -3817,7 +3798,6 @@ static void rdma_accept_incoming_migration(void *opaq= ue) return; } =20 - rdma->migration_started_on_destination =3D 1; migration_fd_process_incoming(f); } =20 --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328567; cv=none; d=zohomail.com; s=zohoarc; b=E+uFaQ1ueWtYHpqTTjfJhMKNTIhXPDub9H2It+wvuMBahZxwb9tot5tIM+lPdslQLvWN+wOgu/DBYJgqat/PBL+ewh0GKlwc3BxLNoiTLDVxMyScSvh1TbGkFmghr25TnAmRHFlwMgCHRIeGX2OkVV1+FSZO9P3Q/v8SpJFz8Bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328567; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i0rL3mXXfqHBhyeJ127a2ssZ77MbnTaaoR6sQ91RNEU=; b=edK8FC0aXuezhTs6dTezclbPYf9XKtaA+RjZXUYnqQ0Wy8lqN89sbVErEBDcNaFkYYpwLbEvfWX0h2nfifroz4OvGXD/YtYB+JOFIfvr2Ix+QvwjQUXwxfGYcsgpTCl/+sv9fyVqQdJ5QtGHiftVZikZQpEZ9hvrso8vTcP1VHI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328566963269.92483658758397; Wed, 27 Aug 2025 14:02:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNG0-0006tQ-Ly; Wed, 27 Aug 2025 17:00:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFh-0006kE-4n for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFd-0006s6-5m for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:15 -0400 Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-354-FOWu-MbGPKmTpdOJDxDmIw-1; Wed, 27 Aug 2025 17:00:06 -0400 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-e96d57eb1d0so242233276.3 for ; Wed, 27 Aug 2025 14:00:06 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.14.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 14:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0rL3mXXfqHBhyeJ127a2ssZ77MbnTaaoR6sQ91RNEU=; b=CA+vNVi4QFuH4BEvr/MmzEvOZlmuOhPZqVeCnrTrF/eSkMtr/biHz+MoAB3ZN9Xs6FTViW 967a5hyySpdkYX2LON9pNarGMx2wpImLCQzH86M3NfJgBobF8MIeknkVVUn5TozvxHKKxQ B2mMqGqhgJXBu3JyAHxjn6mhGKuk12I= X-MC-Unique: FOWu-MbGPKmTpdOJDxDmIw-1 X-Mimecast-MFC-AGG-ID: FOWu-MbGPKmTpdOJDxDmIw_1756328406 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328406; x=1756933206; 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=i0rL3mXXfqHBhyeJ127a2ssZ77MbnTaaoR6sQ91RNEU=; b=sH1R1y7xGr2xgvXd6Tx70rzhZSp9xNPa49zFTbAcXkfQo7zXxXUC7lzeH9chFTaBMr 7Xvm7NnPDCrfuj/PCeBQDy012sbSU0aa8FKC77cii22fYj7wrsgjLWE0CgUTFt25f2fM k6LsAEaQyNjdImC59innHIYV6Cd5xKF0mDhhu3NlZiGWzsqNuQ0xX6HPS6Xdg01s5CYY EXWtOG1FxFS5rnpVBKake+NQ8PeAq9WFiSfB5Nfeejio7sqbxEO9//qDTXOA8+WL3xNd z5ZNPYjS5dSxNP3i1AOntAlvj0s03Y/8o6Mr/UFrOELIp1PiKCp0Yz7bfCA40WsScCoo CCOw== X-Gm-Message-State: AOJu0Yw4HDHgqj/+dhk+jqZh4MJ37icwafR5BbYLpTmqDmyK1TPtdRcD /HSpIbmV8XTfUmA/ioY6sHKBoBf8+3sdV1nFHBoF+RnYGq5PRxnKJWtvv7ZTfdFVhXK5fWUsQ6O HKgBifBiIqxkwVclU9We2CRH6uOB14BOa0P+OyuAeY/KmRKjJmFk/Vn/Jw01W9RzVk8+qjqqOvP IGdaS3ki+u1r0oeBAfns4WvNIKNqk+owbhkVADMg== X-Gm-Gg: ASbGncuJO8K9g9CsstLlvZYntvZploNXrUFuSOcu/pVlxXMy81qNOT4yVRqDHhqyvUZ 7zqoLcjZFce4Sr7dx4G0qDm448Lp1FfGtPrTo5tFcZ1gdHILJ6xyClyUX8vhwYZXBcE1lHbbgBg 3FkQqAez4/8SYzgbVte9Ywlvck3K9VyNEWjhiS6Xk2V8bcip/NYhrx29YAZhz6CYAzj5CXbg8ub xnPZndg8Z64mOymkPrfcc4BlAHDnnNupc0UKig4s7/UtEnng7LBb4ws5RIrlXIo7sdsfRxQbTO5 jfU6FvCMdhr4kB7jATu9JKD6UVXe/h39SC9LOXy/N4SjgYlL9ezwpSLtkjf5M36Xyrt2jUSHETT YZYwZXBRdIbd2++atUt0= X-Received: by 2002:a05:6902:1145:b0:e95:3636:fec7 with SMTP id 3f1490d57ef6-e953637041bmr14363086276.3.1756328405695; Wed, 27 Aug 2025 14:00:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpI/rLDdMeIg/XupM0lqAJf/9rUSqM2ymCzFKJaxl/Wt2t7IMda1Z5qm8Qk4hX+9j5vihTlw== X-Received: by 2002:a05:6902:1145:b0:e95:3636:fec7 with SMTP id 3f1490d57ef6-e953637041bmr14363024276.3.1756328405060; Wed, 27 Aug 2025 14:00:05 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 7/9] migration/postcopy: Remove workaround on wait preempt channel Date: Wed, 27 Aug 2025 16:59:46 -0400 Message-ID: <20250827205949.364606-8-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328568696116600 Content-Type: text/plain; charset="utf-8" This reverts commit 7afbdada7effbc2b97281bfbce0c6df351a3cf88. Now after switching to a thread in loadvm process, the main thread should be able to accept() even if loading the package could cause a page fault in userfaultfd path. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas --- migration/savevm.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index ad606c5425..8018f7ad31 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2425,27 +2425,6 @@ static int loadvm_handle_cmd_packaged(MigrationIncom= ingState *mis, =20 QEMUFile *packf =3D qemu_file_new_input(QIO_CHANNEL(bioc)); =20 - /* - * Before loading the guest states, ensure that the preempt channel has - * been ready to use, as some of the states (e.g. via virtio_load) mig= ht - * trigger page faults that will be handled through the preempt channe= l. - * So yield to the main thread in the case that the channel create eve= nt - * hasn't been dispatched. - * - * TODO: if we can move migration loadvm out of main thread, then we - * won't block main thread from polling the accept() fds. We can drop - * this as a whole when that is done. - */ - do { - if (!migrate_postcopy_preempt() || !qemu_in_coroutine() || - mis->postcopy_qemufile_dst) { - break; - } - - aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_sel= f()); - qemu_coroutine_yield(); - } while (1); - ret =3D qemu_loadvm_state_main(packf, mis, bql_held); trace_loadvm_handle_cmd_packaged_main(ret); qemu_fclose(packf); --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328540; cv=none; d=zohomail.com; s=zohoarc; b=CUhIWwerCGhvzbny14r5k8zW5DAIVZYzzfdbj+1EE6rUTsrVGnjCcPhUm3WFgPHEMnxPSkAE3VNgB99LXyZsSU7BG0qVU6eC+uXtZO1379tRkiWbNZyy5akfgx1wp0Xu6fwzQOS0MJUHFnOFfzDzRagNEnRR9NpFmF8NUBCXeHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328540; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lRJ8eE7rheNIp6zO98qNHCY36RqYoQUzbq48qUhyxQg=; b=DkZdjk9AL2lepo9bKp38R8XUNHDCCHmCSzDoX+seAV8TYICjJ+4s4mMBDqU2oicF37ZI0TdT3YyN9qH0tN+R3HvV5TnBCIGfTLBif5ynmt95NvPM2iscaA8b9dO9g1YdmVMgp6wsT6Brqqvb1zmRK6did5oABz0emIu0JlAcTOc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328540098919.6017003126874; Wed, 27 Aug 2025 14:02:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFw-0006pa-In; Wed, 27 Aug 2025 17:00:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFj-0006lU-IW for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFf-0006t9-E4 for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:18 -0400 Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78--hpwgCisOE6M8iAoK7lvUA-1; Wed, 27 Aug 2025 17:00:12 -0400 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-e96c3f851dcso270659276.2 for ; Wed, 27 Aug 2025 14:00:08 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.14.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 14:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRJ8eE7rheNIp6zO98qNHCY36RqYoQUzbq48qUhyxQg=; b=D/oFLSpOuK0Au5IwunR9Od9jfPe4h7/uEBbvGmoplw3MsEgGf8/QCfqWL39P5hukECVqGm VfDQ50ShQJ4mrYXnXSUTGlCGOYdnA4I+021s/amFyeWNo7nrkCwmW8k0Q0ITXxV0j/LOqm 5oaNG9G3KIkHbreo2zVESyPGVA821/A= X-MC-Unique: -hpwgCisOE6M8iAoK7lvUA-1 X-Mimecast-MFC-AGG-ID: -hpwgCisOE6M8iAoK7lvUA_1756328408 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328408; x=1756933208; 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=lRJ8eE7rheNIp6zO98qNHCY36RqYoQUzbq48qUhyxQg=; b=ASk7wfKrfkjG14FxnR6g/WOfhP8SemtWT0sFm25KwGECFanC5cGDYIZ3tU3MDZd0PD G4FAc2wcfMlQGn7gcr1fgUX19kCj1X/MKRVt7gRqEOLtX4uV4ioBlHaLyPy6wTOU3w/8 nH1dUmYwblFEMP5HwLeV60xRN6cBXqv8114X2mwPzU+7JCRIsZ3KpL6kUkEmsKHc4wzq qHP7SYlAH7YLAymXKBHo/eXb8jlLVFfhsSgjxFCmpJpYAQ9T2sg9VtUBcUEGwP+EOu0U +QA1sw9G2/vDheAwuoM6y3mLOGg2/QSmNpbrnhnQu4lD7W3xGClVO7wqptirLoZFOMtm XXEA== X-Gm-Message-State: AOJu0Yy0N8Lnx2jP+wF8s6qtCaK8bsVh5aHkq8IFSDUHG1nu7bKriDeE nddBbIM2yDtZDcimhIMXxxcOtSF8g1H3q/NMyEYZfrY38sO3zyxtaKkFiPRBTq/xQk+7ItgftZO 5cqjI+R58u0zf4cJA1Nw4guofnSRzl1PgdvpE47Ac7FfNDFV1LLIqmNGIKeeZV2dEz6byzkRr+x JoLauzu6Te0dOv1G7cVw+83HZbPrM+qopb27Li/Q== X-Gm-Gg: ASbGncvi92rOBNhZXezqpP2kNZh2Rtekq16atQtntg8KPZQqKdeKZ5jVLd/p2yXbDJ5 J9NJ3imh1T+v4p0+2/QZoF9Vx3Z9OoFohE0+sDbnRf09FAALjVjFkiWm/0g/reEZvehjRu/NVai XnA7wsHniQSE38rECx9Z+TlUSFRuh626lVfTY6Xtz5aWygGYmKWtuE4KPMdLaSWOozAsvihxz4O R7NczVl/xXD5I3XCpVhGSAhGgyGEbmD9pR01ZziRwSRIBe7S/VVt/RHcVUfLFBeofNXL9WmL/rG StMtIg2QuiUGTJjUkUHsIc3KQST7/sqYhj64cEjiRarsl/AjFNtWWmfABxTpAQOSfW2EhmVXCCp BSnSQv7IArXMhYJh3P3A= X-Received: by 2002:a05:6902:1249:b0:e95:3d8c:f10e with SMTP id 3f1490d57ef6-e953d8cf2a4mr14597214276.13.1756328407709; Wed, 27 Aug 2025 14:00:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7gYZeSf/0Wf68bolNu0vksd3GOyhSqE61MyVfEdSnmecJOe2S3VaqtQjKAUOLLVKbkU3+/A== X-Received: by 2002:a05:6902:1249:b0:e95:3d8c:f10e with SMTP id 3f1490d57ef6-e953d8cf2a4mr14597146276.13.1756328407102; Wed, 27 Aug 2025 14:00:07 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 8/9] migration/ram: Remove workaround on ram yield during load Date: Wed, 27 Aug 2025 16:59:47 -0400 Message-ID: <20250827205949.364606-9-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328542711124100 Content-Type: text/plain; charset="utf-8" This reverts e65cec5e5d97927d22b39167d3e8edeffc771788. RAM load path had a hack in the past explicitly yield the thread to the main coroutine when RAM load spinning in a tight loop. Not needed now because precopy RAM load now happens without the main thread. Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas --- migration/ram.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7208bc114f..2d9a6d1095 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4168,7 +4168,7 @@ static int parse_ramblocks(QEMUFile *f, ram_addr_t to= tal_ram_bytes) static int ram_load_precopy(QEMUFile *f) { MigrationIncomingState *mis =3D migration_incoming_get_current(); - int flags =3D 0, ret =3D 0, invalid_flags =3D 0, i =3D 0; + int flags =3D 0, ret =3D 0, invalid_flags =3D 0; =20 if (migrate_mapped_ram()) { invalid_flags |=3D (RAM_SAVE_FLAG_HOOK | RAM_SAVE_FLAG_MULTIFD_FLU= SH | @@ -4181,17 +4181,6 @@ static int ram_load_precopy(QEMUFile *f) void *host =3D NULL, *host_bak =3D NULL; uint8_t ch; =20 - /* - * Yield periodically to let main loop run, but an iteration of - * the main loop is expensive, so do it each some iterations - */ - if ((i & 32767) =3D=3D 0 && qemu_in_coroutine()) { - aio_co_schedule(qemu_get_current_aio_context(), - qemu_coroutine_self()); - qemu_coroutine_yield(); - } - i++; - addr =3D qemu_get_be64(f); ret =3D qemu_file_get_error(f); if (ret) { --=20 2.50.1 From nobody Sun Sep 28 15:30:18 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756328469; cv=none; d=zohomail.com; s=zohoarc; b=Bvn0jzqbaC8/EOjQJMYgH1Z+3gcc/mflBWKswSN2Y/VCGhJ6FWqg62TTNcy9RVWPN/sThpioNjRWMAGERXKrCK7lWpg2Yg1nuooRtkQCubRoWWVqFWIXicFCFJOGxdDARvSejOE8BlBzfn1iCNnQsizwJB7oWddvTXSwsnmbcW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756328469; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hgrB5bLxHrm1xpnWIfBaM4kPp921Ztrd8kQ2hHRTta4=; b=iUOfYIvXmlx4vPdezDFqIQUUUwEyITPthcevXLGIV3oVq2T5IW+00GpGbCAvZXRZWFnJEs7ewb58TA1vAIKvg8HGzCq8DVDnxwq1LadidqOPlLQyXFa9Ah3Vlq7rBm/OD9p8zQcvnW/6F8CJjAl4U5N75XDEwuHba8YXcOELg2U= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756328469091515.0345426590548; Wed, 27 Aug 2025 14:01:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urNFz-0006sb-Oj; Wed, 27 Aug 2025 17:00:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFk-0006lb-SI for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urNFg-0006tH-UW for qemu-devel@nongnu.org; Wed, 27 Aug 2025 17:00:19 -0400 Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-37-y9YDj2vaMLirSRHdE5yEMg-1; Wed, 27 Aug 2025 17:00:11 -0400 Received: by mail-yb1-f197.google.com with SMTP id 3f1490d57ef6-e96f22abfdbso284988276.3 for ; Wed, 27 Aug 2025 14:00:10 -0700 (PDT) Received: from x1.com (bras-base-aurron9134w-grc-11-174-89-135-121.dsl.bell.ca. [174.89.135.121]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e96e5530a32sm1389846276.17.2025.08.27.14.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 14:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756328414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hgrB5bLxHrm1xpnWIfBaM4kPp921Ztrd8kQ2hHRTta4=; b=RhUUZX5PwqwwR/W0x53k8gLLeinoypKUgjpS+VsWqmNJpJYudWuSnT0nmeHdbOJ5mM0+mN 44OhGmjHgXeA8YFF94nJosu7xGgJgwbJQ6wVbIR9iAbMTv8mAjqnAIEDoZRBx5w13m6PB1 PMwtaU1oLXJxisrE/W+dvPG2/K3Lu+I= X-MC-Unique: y9YDj2vaMLirSRHdE5yEMg-1 X-Mimecast-MFC-AGG-ID: y9YDj2vaMLirSRHdE5yEMg_1756328410 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756328410; x=1756933210; 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=hgrB5bLxHrm1xpnWIfBaM4kPp921Ztrd8kQ2hHRTta4=; b=ZXTU5RdwrAxpmTKp73DFIdMO7j3salVNHixHMRAzIRskRLXOUM+8xvyWXcNa4BvyYe U3ZhUedBji94QsJLURReqgVpkwtkM25k/YDYy0kLPj0jZIiWScCUTncxbcMfdDq0dpHb G/5ka2cFMu6TTg8TQF5/PdGV8q7NpWUVk1fNj0f1xuip7WKebFjv2C4pmKMp9kuOVZZ1 6LPsRsJHXsdcadjiwHeh4s8vpTjHNVLwt2k9SeE3cgz641blgEG64iSlklR3F7gvLDVG jnXGLws//ucAjsI+MgWjOkFgpXFVs4broN5RB2wPwgWItu0BOKhmexRSgZHiuIxDLNKT cDXw== X-Gm-Message-State: AOJu0YyDd4dYHDiYGaUBFpw3Xkj9z8EkdLn8/ng6rUouuPBNoulNHjH0 UE/KHAx7DV/LgUqqQ+qOgikFF3wZ0CS+nWl9pGtlVIO628KNCr3sAR8t+QbdDbvjNT7SkOjRGrl BhE6fIyOJjjMXaaJKoFx3tkcqNsu1tSzlGF/AI/QbX5g5QkZ0z7dRfYKczAVq0ILWFpsl3RB+H8 A/Lqc7bcxqWN6S1UEyDdRrvrEAwK8+BMgoiDFSIA== X-Gm-Gg: ASbGncthRPLAQWY8SeuNHdTl+eq3uuGWHRWph0qR5J2iKmdYB5Q79/rm2NvDH64d2sW kD2UI+D2UzFMMLSIby8j8157NmQ9rOCHSJIM2v9G8KGhL4p4v7ivz0C1v13A+6S25VWAS1M6i8U 93hL32TWnoUj095qrHx/xLJwXbNxCTTGsSHfHfU6LJTpxLkzoJWhSfftQqbYnQ+q935GsloayTc 7QL4VmfG17vCPPFbxI6/PapOC69gyM1pYA61xfXwgUj9Sl3C9KBCj+lagEvDHuBGK3i9iyyiCYe D5A4lX9hZL9ENp3pHlOE6uI7V/ZcyKSXNF6uTdma05EqinUi4Dsjqk18ZFXeZjQWGLUXZjjkFMq 1OgmwcBd5Oa6jw4AFB/g= X-Received: by 2002:a05:6902:6103:b0:e96:cc86:35c6 with SMTP id 3f1490d57ef6-e96cc863ea7mr11007142276.4.1756328409702; Wed, 27 Aug 2025 14:00:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0o+nCqM+esQ8D3PwolNaoc+8hlRauEMCjg08XSw4QO+27kXbVKe+KKeiN3J2VoDB1h/X/CA== X-Received: by 2002:a05:6902:6103:b0:e96:cc86:35c6 with SMTP id 3f1490d57ef6-e96cc863ea7mr11007070276.4.1756328409085; Wed, 27 Aug 2025 14:00:09 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: "Dr . David Alan Gilbert" , peterx@redhat.com, Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Fabiano Rosas , Hailiang Zhang , Yury Kotov , Vladimir Sementsov-Ogievskiy , Prasad Pandit , Zhang Chen , Li Zhijian , Juraj Marcin Subject: [PATCH RFC 9/9] migration/rdma: Remove rdma_cm_poll_handler Date: Wed, 27 Aug 2025 16:59:48 -0400 Message-ID: <20250827205949.364606-10-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250827205949.364606-1-peterx@redhat.com> References: <20250827205949.364606-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.129.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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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: 1756328472053116600 Content-Type: text/plain; charset="utf-8" This almost reverts commit 923709896b1b01fb982c93492ad01b233e6b6023. It was needed because the RDMA iochannel on dest QEMU used to only yield without monitoring the fd. Now it should be monitored by the same poll() similarly on the src QEMU in qemu_rdma_wait_comp_channel(). So even without the fd handler, dest QEMU should be able to receive the events. I tested this by initiating an RDMA migration, then do two things: - Either does migrate_cancel on src, or, - Directly kill destination QEMU In both cases, the other side of QEMU will be able to receive the disconnect event in qemu_rdma_wait_comp_channel() and properly cancel or fail the migration. Signed-off-by: Peter Xu Reviewed-by: Li Zhijian --- migration/rdma.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 7751262460..da7fd48bf3 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3045,32 +3045,6 @@ int rdma_control_save_page(QEMUFile *f, ram_addr_t b= lock_offset, =20 static void rdma_accept_incoming_migration(void *opaque); =20 -static void rdma_cm_poll_handler(void *opaque) -{ - RDMAContext *rdma =3D opaque; - struct rdma_cm_event *cm_event; - - if (rdma_get_cm_event(rdma->channel, &cm_event) < 0) { - error_report("get_cm_event failed %d", errno); - return; - } - - if (cm_event->event =3D=3D RDMA_CM_EVENT_DISCONNECTED || - cm_event->event =3D=3D RDMA_CM_EVENT_DEVICE_REMOVAL) { - if (!rdma->errored && - migration_incoming_get_current()->state !=3D - MIGRATION_STATUS_COMPLETED) { - error_report("receive cm event, cm event is %d", cm_event->eve= nt); - rdma->errored =3D true; - if (rdma->return_path) { - rdma->return_path->errored =3D true; - } - } - rdma_ack_cm_event(cm_event); - } - rdma_ack_cm_event(cm_event); -} - static int qemu_rdma_accept(RDMAContext *rdma) { Error *err =3D NULL; @@ -3188,8 +3162,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) NULL, (void *)(intptr_t)rdma->return_path); } else { - qemu_set_fd_handler(rdma->channel->fd, rdma_cm_poll_handler, - NULL, rdma); + qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL); } =20 ret =3D rdma_accept(rdma->cm_id, &conn_param); --=20 2.50.1