From nobody Mon Sep 28 00:10:22 2026 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=1786998319; cv=none; d=zohomail.com; s=zohoarc; b=lAE2+X6oviXXP36vFG/aRB+abN/DFAeu/HTvoH/DW/fl3XtYzmHsKHtoZ1/ysjGLO4goDmbsAa0KgKY+wV7RvH1mPHxlPqmmDJLuPPFgyhWOTXF1tY0QxJ5xPBRHlKhrZOGq3IJjjkZVSQ1R9nSB/HKpUBujgfuTWpxB7T+0W4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998319; 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=ZgBbw+t3RVlz7upZwL/XQcgod2d9abAa1FIZVPanRhc=; b=klb/Io5WPbtfLzXWVyQcndstDN3Hy/1lUZfE12f9JcSGpSsJmUVz0sDDPklBKFDO1JLhDr8aySKsD+9S6WQfdBfEMw/h6ywJiwmI5KESf212vu4ezzhD8PL4Pnma7aSk6yCnpxD7ZW8oqKrAOGKxRcpn+b3RLKvDVcSpYhEDXc0= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998319452272.8170947920099; Mon, 17 Aug 2026 13:25:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3t0-0003rB-2O; Mon, 17 Aug 2026 16:24:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3sy-0003r3-Uz for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:44 -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 1ww3sx-0002mu-Fj for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:44 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-9Fs4cQZ6O5uay0nqTVveZg-1; Mon, 17 Aug 2026 16:24:40 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-52769fc3f2eso49752051cf.0 for ; Mon, 17 Aug 2026 13:24:40 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998281; 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=ZgBbw+t3RVlz7upZwL/XQcgod2d9abAa1FIZVPanRhc=; b=CW7GP741Q/4LoNxWhsinlA4QvlMhXw/64Vaeq0HyQqSADwFKngSGDsh4/Kio8h64sxE36J KBGdnq55WeF7CpYDCW3VktJGO3/yJdKC2JtRH2PVlTG6AVFdSkdd0nGhUVbug7BLp4bKl+ 4Jem0OoD2SZCM/Hj0xpCmb/4g56jC4M= X-MC-Unique: 9Fs4cQZ6O5uay0nqTVveZg-1 X-Mimecast-MFC-AGG-ID: 9Fs4cQZ6O5uay0nqTVveZg_1786998280 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998280; x=1787603080; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZgBbw+t3RVlz7upZwL/XQcgod2d9abAa1FIZVPanRhc=; b=RquZTUSbGVA7tAyDwSDLFl+XNhldKp64Nw3UahAyYUtDJMdHVaDt5Kr0oB8BiZ4jrt RzqBeYCUM9sdSBof+Td7vdFlDqnrPdwXtRL8YV20uFjDS650DHJL8YGwRQ8L3JO3xVd4 tY5f9SEe537Wr60iRwM6q16py/RfWYYtNwnlNwkKKzhmBh+Yv7jy1xoO+ae0InVdwiWM cvl6C51N2tvOrBUBeaXJaxQTZ1GY6J8VYdyBQY/utkdMH+6pAJjWdkMBQpYfdFMZu7vP xNnCcqrtkIku83LE9KgjGnGUA37Qoq+7iK/XziIlszICE+Tk7WSYqwu2p4FkIJYZghlu 4qaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998280; x=1787603080; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZgBbw+t3RVlz7upZwL/XQcgod2d9abAa1FIZVPanRhc=; b=qIgRbPsIZW1MI7pNtJYVaf//j+2mUpicvv4EnrsZYnaGcQP/uM3IpGZ0UmNfk7rNDA Vm+mX4EsfygIOSmWptA2dAUTiIp4vpcwP+g5YDFEnoYgzG0h9OG9/kIkxHBCHjuphbhs jpBseiUC/Sdb8Df93NyAlzx/VdJqlhs+qqYEYdVRA2VgV+glIyrSehXU4r3iihfUks+2 W2kZ1942gEXu5Nk8bfTIm1j7OhzuKrWjo1l28wlEk+5kKiND7P2yOivKeC4RoYe4SzrM 5++c0Guedv6r6HXfjtKNIBYopswjRFtEiKF5Mr34VrYOfU9hONlO25xY8ZL10DlrSQcu UM3g== X-Gm-Message-State: AOJu0YxobpL35Z3eK0/rzVgsXYn741zakdI/dO/nJldBHmoQlMbTn0A6 Tlwf4vUfCR6n35hbypTB+X+zLgjWoQDi3opTnucMZ5g1LLjpOr6GUz0nclV6GJn4Hsv5XyIbDxH lQCe0mcgUetpT2mtaGnpv4YcehBEkrS9a/cRJ5yd0LB1pjYTVCpMzjh+DVqDIYmgEP4/5CEEIyS OcXkjKfWqe4kMO/uQMvECWZUcIz2xEp3E0c2ACbg== X-Gm-Gg: AR+sD12XCfPSzMNfk/syzV6lNSfjwAbJfUXGk8k6L7DZZCNUScCsyYG1xswU83v28Oc GKEhTXZqrsgZ+TGV97nHKuhFVCq1nij6sGVHvmWkfvBWfvNdhZI8xQaGtthhtKKGvMLNo3aLyNk o+HbvYifajMrfPo1o1ungSHNUsrtGIUK16KHtSjZBPW9Q/BbSxxFDzkqLvNZlprAYwhiIv+bWf1 5Q7GcDyxYGKphT7HO8gPUeaBxdpQXXDqQ7UDCfa42vLr//N9GsZHRO/CkdOoZnYJK89kDi8pajY orMaO2bZIpyLDBdeuBAEsvx0fU3qVPQoqeSFm6KBPizrTbEo2oAU1PZPZAdZgTa4rw== X-Received: by 2002:a05:622a:181d:b0:516:d699:a99b with SMTP id d75a77b69052e-52dbd76c23fmr36195911cf.40.1786998279709; Mon, 17 Aug 2026 13:24:39 -0700 (PDT) X-Received: by 2002:a05:622a:181d:b0:516:d699:a99b with SMTP id d75a77b69052e-52dbd76c23fmr36195151cf.40.1786998279118; Mon, 17 Aug 2026 13:24:39 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 01/10] migration/rdma: Introduce RDMA_CONTROL_NUM Date: Mon, 17 Aug 2026 16:24:15 -0400 Message-ID: <20260817202424.2901438-2-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_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: qemu development 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: 1786998321257158500 Content-Type: text/plain; charset="utf-8" Introduce this to say how many control messages we have. We did it because we're going to remove the last one (RDMA_CONTROL_UNREGISTER_FINISHED) soon. Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 438419d189..62a509b236 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -144,6 +144,7 @@ enum { RDMA_CONTROL_REGISTER_FINISHED, /* current iteration finished */ RDMA_CONTROL_UNREGISTER_REQUEST, /* dynamic UN-registration */ RDMA_CONTROL_UNREGISTER_FINISHED, /* unpinning finished */ + RDMA_CONTROL_NUM, }; =20 =20 @@ -235,7 +236,7 @@ static const char *control_desc(unsigned int rdma_contr= ol) [RDMA_CONTROL_UNREGISTER_FINISHED] =3D "UNREGISTER FINISHED", }; =20 - if (rdma_control > RDMA_CONTROL_UNREGISTER_FINISHED) { + if (rdma_control >=3D RDMA_CONTROL_NUM) { return "??BAD CONTROL VALUE??"; } =20 --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998338; cv=none; d=zohomail.com; s=zohoarc; b=lLYoleDE/S6JGcsGMNk1enlqRQsW47ayfZV8+JIwZ/yBerrHRCL7Phui/PvQ82RWeRiTvr/sbcQ9gTqxGr17QRWG8SHlJYWabWMsX5dXzTAeEDYUdg1h5VgbycVGTiK/j0lEBLiZ3RK5MlgHxK/TZBigZqmMMh0GvyLy7DLdUdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998338; 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=AxFMx68HiZkg/5ZsboY7tWGZAkM5LcruXgOrrhMnrcI=; b=UGYo3lA8aG6XYvK0dof2zbTeAN/guO6Ipzj6vEcaf0lnhLYJjVY0sdXSrTPd6sse6QrhGd67IvE8OwbcIP43kToW2vZwC4xEibvOLkr3be+m2oXb/EX3mYP8LRc5U7rFmZvfnWTGhjUrKTKUqCDPDFpvVTp14jZFvLnKhYTuq5M= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998338965172.86581323439407; Mon, 17 Aug 2026 13:25:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tC-0003uU-Hd; Mon, 17 Aug 2026 16:24:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3tA-0003te-C8 for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:56 -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 1ww3t8-0002ov-4t for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:56 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-wb5LXDniPxuBh0DC6NDRWg-1; Mon, 17 Aug 2026 16:24:42 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51c07f25de2so31423691cf.3 for ; Mon, 17 Aug 2026 13:24:42 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998293; 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=AxFMx68HiZkg/5ZsboY7tWGZAkM5LcruXgOrrhMnrcI=; b=AX973TBpeEh6WbgrYRGZlo1pcD/29jKciLRd4gPZumv8XnUtdANLBnCOFyMLcrgRpSW01Q k4m5gQ4j2nAU1y36Y1aT06Rvpq9zs9qdGW25AiFr0tFTQ2TLI3d1uyDDoqNb28hi3GHQyf ZWv/LILJhoOhy5RntwRBa/UZJZfM30g= X-MC-Unique: wb5LXDniPxuBh0DC6NDRWg-1 X-Mimecast-MFC-AGG-ID: wb5LXDniPxuBh0DC6NDRWg_1786998281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998281; x=1787603081; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AxFMx68HiZkg/5ZsboY7tWGZAkM5LcruXgOrrhMnrcI=; b=c8uMwTS51rpGdf2bZmwBCIbxLeXsyBswHMy/kiNPXlJrIhGcPNYgx5Kr5nM6RiRJu+ +m1OusR5UTc0qa8Ntc775VjXsQ7Sf50VXePj/P1nM5cl/xRdQMnbgtoAp7rA6JpreJBc eTctsBD4M5vktz6q0X3JcVSoSK8rohxEU9yl1bnnGG3falOU/wkmbgeIUfoB/wmMGaCL 0pA7aouY/84vYIYf4z4vEpSGbEu9ak6aRJIFyrg0kHJ0oYBTjt+3u2a8t4wtz5GKoOmd vNf0bm0DcNtNB1Zulj6GFXrNms4uVjYejnHRNuvZFWMkME/YoCGR2X1edLZ1R3a8OREJ 8auQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998281; x=1787603081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AxFMx68HiZkg/5ZsboY7tWGZAkM5LcruXgOrrhMnrcI=; b=GW7ukiO3qv/YIulbkCXWfJGAvSTCiagPC7b/nRscoowD0CM2fdWy7nPKwBd9diFn/I HJWlxSMRRf4xmMjMmwd0COJIXuslaJfUyl6y/DLkz3OS9quEsgnys0SEHVdcLywCxKHK gk6k3EFAeRx2fO83tyAOblfTU1wMLLVUYd+LYEnpLfgCFPMjVn03M5FXg826QJnHeKWa j9eKj2hGw/tCaCYuHKjNtQA2xzgm/W4fRHdnQjhPFM3LinOFJneK5L4j1jraF3Gzl8vP EQA8XUhZ0Oy+VPT5d8P/hgbJkcmq15S3hYkLOOrvUkHOfmyMU0sFaiR2qiRxUFKAnRVU 0/vQ== X-Gm-Message-State: AOJu0Ywf7urQmH5/5Qvr41I173/Wyq3nErW0TRn1RGs8QjVXmn4MJcgH r0k/Tw342d/PYkiTvjjtExMqECVhk0N3gTqcBHWfkEBNmOsQVsjdkT9v/TJPD1DmUc4CibzE/Z5 PGtur6s7ebwzp2UL87JWDjxMUvOGnvVAk4uB/aK4nyxInYXKjHd8FY9rpW6mEjlTLhF4KGJ3Ssb LjqpmcVgWkNzUAitiynKK9lLxesQtsYqcjTEaX8Q== X-Gm-Gg: AR+sD10AtLdnaEBRi6fXjdoEfIVM+MBzOSxDI0Gg3Rle/2HhmCXFVXEeAyMsWUZ+V3q e87f5gQDh4LRIk+sHGoecx9j+R4y1tlGqBAdaMyUNzAsAWN+LF/iNeDCcUCx8ULaW8orwW3yHFv Wtph88YHTzHVrGe3z73jwRG40OYluA5u//71lGwdaB0BytRcK0ezffn/m6J/LFdRvMmnNATfA/M eWYuNULawmyPIu0ewf5QpEndrqAUOKfo9Dpb2CZKFwI6ZRGHhqeMy5sSDS8hvbdEUG22HaebGZm TsY60iUH3PPXZfPOiXfw0DPy92PZ7LMCu8SOsQzADz78tov4IX7lGG/vQTZZmCaopA== X-Received: by 2002:a05:622a:4c15:b0:51c:805:1be3 with SMTP id d75a77b69052e-52d8556685bmr329388951cf.31.1786998281295; Mon, 17 Aug 2026 13:24:41 -0700 (PDT) X-Received: by 2002:a05:622a:4c15:b0:51c:805:1be3 with SMTP id d75a77b69052e-52d8556685bmr329388341cf.31.1786998280721; Mon, 17 Aug 2026 13:24:40 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 02/10] migration/rdma: Remove unregister code Date: Mon, 17 Aug 2026 16:24:16 -0400 Message-ID: <20260817202424.2901438-3-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_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: qemu development 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: 1786998340437158500 Content-Type: text/plain; charset="utf-8" The unregister code was there since the first commit RDMA migration was merged, but it was never functioning. Remove the dead code. Since the two control messages are the last ones, we don't even need to worry about compatibility of legacy RDMA control commands, we can directly remove the messages too. As a side effect, this patch closes a report by removing the code completely. Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4003 Signed-off-by: Peter Xu Reviewed-by: Jinpu Wang --- migration/rdma.c | 133 ----------------------------------------- migration/trace-events | 7 --- 2 files changed, 140 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 62a509b236..eae4afd6df 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -142,8 +142,6 @@ enum { RDMA_CONTROL_REGISTER_REQUEST, /* dynamic page registration */ RDMA_CONTROL_REGISTER_RESULT, /* key to use after registration */ RDMA_CONTROL_REGISTER_FINISHED, /* current iteration finished */ - RDMA_CONTROL_UNREGISTER_REQUEST, /* dynamic UN-registration */ - RDMA_CONTROL_UNREGISTER_FINISHED, /* unpinning finished */ RDMA_CONTROL_NUM, }; =20 @@ -232,8 +230,6 @@ static const char *control_desc(unsigned int rdma_contr= ol) [RDMA_CONTROL_REGISTER_REQUEST] =3D "REGISTER REQUEST", [RDMA_CONTROL_REGISTER_RESULT] =3D "REGISTER RESULT", [RDMA_CONTROL_REGISTER_FINISHED] =3D "REGISTER FINISHED", - [RDMA_CONTROL_UNREGISTER_REQUEST] =3D "UNREGISTER REQUEST", - [RDMA_CONTROL_UNREGISTER_FINISHED] =3D "UNREGISTER FINISHED", }; =20 if (rdma_control >=3D RDMA_CONTROL_NUM) { @@ -370,9 +366,6 @@ typedef struct RDMAContext { int total_registrations; int total_writes; =20 - int unregister_current, unregister_next; - uint64_t unregistrations[RDMA_SIGNALED_SEND_MAX]; - GHashTable *blockmap; =20 /* the RDMAContext for return path */ @@ -1186,91 +1179,6 @@ static int qemu_rdma_reg_control(RDMAContext *rdma, = int idx) return -1; } =20 -/* - * Perform a non-optimized memory unregistration after every transfer - * for demonstration purposes, only if pin-all is not requested. - * - * Potential optimizations: - * 1. Start a new thread to run this function continuously - - for bit clearing - - and for receipt of unregister messages - * 2. Use an LRU. - * 3. Use workload hints. - */ -static int qemu_rdma_unregister_waiting(RDMAContext *rdma) -{ - Error *err =3D NULL; - - while (rdma->unregistrations[rdma->unregister_current]) { - int ret; - uint64_t wr_id =3D rdma->unregistrations[rdma->unregister_current]; - uint64_t chunk =3D - (wr_id & RDMA_WRID_CHUNK_MASK) >> RDMA_WRID_CHUNK_SHIFT; - uint64_t index =3D - (wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT; - RDMALocalBlock *block =3D - &(rdma->local_ram_blocks.block[index]); - RDMARegister reg =3D { .current_index =3D index }; - RDMAControlHeader resp =3D { .type =3D RDMA_CONTROL_UNREGISTER_FIN= ISHED, - }; - RDMAControlHeader head =3D { .len =3D sizeof(RDMARegister), - .type =3D RDMA_CONTROL_UNREGISTER_REQUE= ST, - .repeat =3D 1, - }; - - trace_qemu_rdma_unregister_waiting_proc(chunk, - rdma->unregister_current); - - rdma->unregistrations[rdma->unregister_current] =3D 0; - rdma->unregister_current++; - - if (rdma->unregister_current =3D=3D RDMA_SIGNALED_SEND_MAX) { - rdma->unregister_current =3D 0; - } - - - /* - * Unregistration is speculative (because migration is single-thre= aded - * and we cannot break the protocol's inifinband message ordering). - * Thus, if the memory is currently being used for transmission, - * then abort the attempt to unregister and try again - * later the next time a completion is received for this memory. - */ - clear_bit(chunk, block->unregister_bitmap); - - if (test_bit(chunk, block->transit_bitmap)) { - trace_qemu_rdma_unregister_waiting_inflight(chunk); - continue; - } - - trace_qemu_rdma_unregister_waiting_send(chunk); - - ret =3D ibv_dereg_mr(block->pmr[chunk]); - block->pmr[chunk] =3D NULL; - block->remote_keys[chunk] =3D 0; - - if (ret !=3D 0) { - error_report("unregistration chunk failed: %s", - strerror(ret)); - return -1; - } - rdma->total_registrations--; - - reg.key.chunk =3D chunk; - register_to_network(rdma, ®); - ret =3D qemu_rdma_exchange_send(rdma, &head, (uint8_t *) ®, - &resp, NULL, NULL, &err); - if (ret < 0) { - error_report_err(err); - return -1; - } - - trace_qemu_rdma_unregister_waiting_complete(chunk); - } - - return 0; -} - static uint64_t qemu_rdma_make_wrid(uint64_t wr_id, uint64_t index, uint64_t chunk) { @@ -2757,8 +2665,6 @@ static int qemu_rdma_drain_cq(RDMAContext *rdma) } } =20 - qemu_rdma_unregister_waiting(rdma); - return 0; } =20 @@ -3336,10 +3242,6 @@ int rdma_registration_handle(QEMUFile *f) .type =3D RDMA_CONTROL_REGISTER_RESULT, .repeat =3D 0, }; - RDMAControlHeader unreg_resp =3D { .len =3D 0, - .type =3D RDMA_CONTROL_UNREGISTER_FINISHED, - .repeat =3D 0, - }; RDMAControlHeader blocks =3D { .type =3D RDMA_CONTROL_RAM_BLOCKS_RESUL= T, .repeat =3D 1 }; QIOChannelRDMA *rioc; @@ -3552,41 +3454,6 @@ int rdma_registration_handle(QEMUFile *f) ret =3D qemu_rdma_post_send_control(rdma, (uint8_t *) results, ®_resp, &err); =20 - if (ret < 0) { - error_report_err(err); - goto err; - } - break; - case RDMA_CONTROL_UNREGISTER_REQUEST: - trace_rdma_registration_handle_unregister(head.repeat); - unreg_resp.repeat =3D head.repeat; - registers =3D (RDMARegister *) rdma->wr_data[idx].control_curr; - - for (int count =3D 0; count < head.repeat; count++) { - reg =3D ®isters[count]; - network_to_register(reg); - - trace_rdma_registration_handle_unregister_loop(count, - reg->current_index, reg->key.chunk); - - block =3D &(rdma->local_ram_blocks.block[reg->current_inde= x]); - - ret =3D ibv_dereg_mr(block->pmr[reg->key.chunk]); - block->pmr[reg->key.chunk] =3D NULL; - - if (ret !=3D 0) { - error_report("rdma unregistration chunk failed: %s", - strerror(errno)); - goto err; - } - - rdma->total_registrations--; - - trace_rdma_registration_handle_unregister_success(reg->key= .chunk); - } - - ret =3D qemu_rdma_post_send_control(rdma, NULL, &unreg_resp, &= err); - if (ret < 0) { error_report_err(err); goto err; diff --git a/migration/trace-events b/migration/trace-events index af0e784535..d1fe8f1382 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -244,10 +244,6 @@ qemu_rdma_advise_mr(const char *name, uint32_t len, ui= nt64_t addr, const char *r qemu_rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s= =3D> %s" qemu_rdma_signal_unregister_append(uint64_t chunk, int pos) "Appending unr= egister chunk %" PRIu64 " at position %d" qemu_rdma_signal_unregister_already(uint64_t chunk) "Unregister chunk %" P= RIu64 " already in queue" -qemu_rdma_unregister_waiting_inflight(uint64_t chunk) "Cannot unregister i= nflight chunk: %" PRIu64 -qemu_rdma_unregister_waiting_proc(uint64_t chunk, int pos) "Processing unr= egister for chunk: %" PRIu64 " at position %d" -qemu_rdma_unregister_waiting_send(uint64_t chunk) "Sending unregister for = chunk: %" PRIu64 -qemu_rdma_unregister_waiting_complete(uint64_t chunk) "Unregister for chun= k: %" PRIu64 " complete." qemu_rdma_write_flush(int sent) "sent total: %d" qemu_rdma_write_one_block(int count, int block, uint64_t chunk, uint64_t c= urrent, uint64_t len, int nb_sent, int nb_chunks) "(%d) Not clobbering: blo= ck: %d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d %d" qemu_rdma_write_one_post(uint64_t chunk, long addr, long remote, uint32_t = len) "Posting chunk: %" PRIu64 ", addr: 0x%lx remote: 0x%lx, bytes %" PRIu32 @@ -266,9 +262,6 @@ rdma_registration_handle_ram_blocks_loop(const char *na= me, uint64_t offset, uint rdma_registration_handle_register(int requests) "%d requests" rdma_registration_handle_register_loop(int req, int index, uint64_t addr, = uint64_t chunks) "Registration request (%d): index %d, current_addr %" PRIu= 64 " chunks: %" PRIu64 rdma_registration_handle_register_rkey(int rkey) "0x%x" -rdma_registration_handle_unregister(int requests) "%d requests" -rdma_registration_handle_unregister_loop(int count, int index, uint64_t ch= unk) "Unregistration request (%d): index %d, chunk %" PRIu64 -rdma_registration_handle_unregister_success(uint64_t chunk) "%" PRIu64 rdma_registration_handle_wait(void) "" rdma_registration_start(uint64_t flags) "%" PRIu64 rdma_registration_stop(uint64_t flags) "%" PRIu64 --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998382; cv=none; d=zohomail.com; s=zohoarc; b=kCKC434rSm/XGKHD3e91xsUtiACNekNdSCyOakUlTpqi2bqJO1dmneRnqJR7smBxEtWAbowf873eHHFR7yu0bS06oUdB0ZyR3n5I145SLIZNv2KUR4kC/O77FLLN3RtLxM/FdLyepTwFp5f6FSZb+TAaTD2OZoNoKWi1L708Jx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998382; 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=o+ci/QG3fZnrXPNd50j1trpSFb+2ZXVy1cWz8dr7lUk=; b=mVJGhSDL1Y/jY2YZjiDskr4SVByaybJEDSHKcEUNIb3JM7BHSV1h+P5PEQPbwFSHT8JE02uZBFkZdVNByDLyiEAKO7TEc72NRin4snwWjGHwLSd8LJvx8nxTtxTItZTcVkahtlIXpP/aRxpgTvDsMvDT5gZgGTIg57HG47TQh7w= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998382691790.1957178150013; Mon, 17 Aug 2026 13:26:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tA-0003tt-Or; Mon, 17 Aug 2026 16:24:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3t9-0003tF-4d for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:55 -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 1ww3t6-0002oZ-Ac for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:54 -0400 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308-wn20YGmmPQmvUUeEP5X3Mw-1; Mon, 17 Aug 2026 16:24:44 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-52d33c89a29so48388921cf.1 for ; Mon, 17 Aug 2026 13:24:44 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998291; 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=o+ci/QG3fZnrXPNd50j1trpSFb+2ZXVy1cWz8dr7lUk=; b=hPq+9jcXX7f0TPeHBC1YtVwLEj07sT6ZJGK5rV1nWo8HKZXZjmRGwBs4o1wer9NOcelk/g yaV6333+OrGUTgUXuir8VPjzOJBD5dDKnB8YFmrBQxUAVnJ4wLXoay/u9EvdlHFHwmeG1O 0yEyQUR6wxHhfyS7l5ne1vb8/btUmUo= X-MC-Unique: wn20YGmmPQmvUUeEP5X3Mw-1 X-Mimecast-MFC-AGG-ID: wn20YGmmPQmvUUeEP5X3Mw_1786998284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998284; x=1787603084; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=o+ci/QG3fZnrXPNd50j1trpSFb+2ZXVy1cWz8dr7lUk=; b=LNN0k+dnZM9WZVs3xtzRgv/9wdwue6UpIpAr1MVFWpMXXeneteaitpPEfRV0srwAFI QNwZ9IBHUj3Q4flgLA1NMPZnwta8qh5PPWRq4o309BQYC2kx+xmFR6rHmKZiiQ2u7ltm RyJdv2E4p4MZn+TuVXgO9LETGWyTJeaL8dEmqEJRIyQ7lhLfayAAVf+jMlbDGeXQb/kN 5ayr9ARHa0ErH4FkRg/mPInDD5d2l31Z+z7yrkzfd9KeiLqj2kmsn0TClU//yavMSMgb unrXGRA+vbHSYnlX/mrJI4Ci2CUECgStjMLAb5aYArqtOG6UAS+i1yJiYz8yBd4a1nQZ vTcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998284; x=1787603084; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=o+ci/QG3fZnrXPNd50j1trpSFb+2ZXVy1cWz8dr7lUk=; b=IlFB761J1EGONs//GzFAGvrLBftsp44dZyAqJCoZ4+oKt8RAOZtkTRh6EbN1MUCS8H Kt8OSG5PgcJJnsIR1N/swaXkFVoMpP1XZsPKVpgSqbIWCiK6M2mEtKaoAO2a2gFnQ4Zi NUvtCcZLytxHUHHJ/6TSAMPsOjFjtnndrvL3+m4BbihaJ7fc3XIsdotHFyh24z7VEbk7 D8zcYpw+aCVD/qATqKupEePOJ8REZHvCluRZND4aKDR0rwV+Ytztn+hEEGbjxJsKjhW+ bB3yTom/N6zMYG0pcMa7Mk8NyKit70wRh69jantq+t/Vg5Bu+coI6o/j5yB0/YGEM7YF ktOw== X-Gm-Message-State: AOJu0Yw6bjsF3u9wvRzFa73Ub93TwSg9Tmwn/axnpIsy05JDQNWnDsgW HyTmYnoWeikkKpdAfbuUbLev+Df9leKAUzBmCNT2WI4w/SHtBxjhPcTNOdVhfkZ+1QTfmB3e7Yk YeuykBj1oollztp/OMHx6SeLrVvt/r2al4f30DF/43aM6zlBVouUbHLrZmI9TWlD6Rlk45LLbn8 MqfNviXykyaMnnZDyrpZkTsZznzFBfoQeOg7wd6Q== X-Gm-Gg: AR+sD12n2BZuZ3x4+oy7exWEozBRIUH+t0HqnNMAyk5E0lZ8KNNUZqHLtBbGXs9nWkx 0NvQ0IGieu7snD9CI098P+Iz/upCS3c7BfWEjPmIhicNg1X4jC8xgHhT2kGn1NMqG0MiX0TWU/e 4Ul4U3mio5GFdxt3K2NtWnn4Pu6x9G6Rne5+Odv9DXmBu96pE7Xs5bSJVVG0M1rC64FgVpsQ1CR oegFcB34/TLD/XAOuIpzPATakoK4KfBGE+zkOsrivxCHkQs8tK+zyMHb87LgBDOsqfYobk9R6v4 m+E1/TtIEQbht3KVR1zK9NIr1dUHopp56g4dVUqZuAnIU96XhRqVaTTLTmgoPqIiww== X-Received: by 2002:a05:622a:164f:b0:52d:7b88:dbdd with SMTP id d75a77b69052e-52dbd7419c9mr37588041cf.31.1786998283252; Mon, 17 Aug 2026 13:24:43 -0700 (PDT) X-Received: by 2002:a05:622a:164f:b0:52d:7b88:dbdd with SMTP id d75a77b69052e-52dbd7419c9mr37587221cf.31.1786998282541; Mon, 17 Aug 2026 13:24:42 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 03/10] migration/rdma: Stick with rdma_ prefix for all tracepoints Date: Mon, 17 Aug 2026 16:24:17 -0400 Message-ID: <20260817202424.2901438-4-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998384616158500 Content-Type: text/plain; charset="utf-8" There're a bunch of RDMA tracepoints that are prefixed with "rdma_*", most of the rest with "qemu_rdma_*". Align them up. The "qemu_" prefix isn't helping. Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 76 +++++++++++++++++++++--------------------- migration/trace-events | 76 +++++++++++++++++++++--------------------- 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index eae4afd6df..ffae0a887f 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -631,7 +631,7 @@ static void qemu_rdma_init_ram_blocks(RDMAContext *rdma) memset(local, 0, sizeof *local); ret =3D foreach_not_ignored_block(qemu_rdma_init_one_block, rdma); assert(!ret); - trace_qemu_rdma_init_ram_blocks(local->nb_blocks); + trace_rdma_init_ram_blocks(local->nb_blocks); rdma->dest_blocks =3D g_new0(RDMADestBlock, rdma->local_ram_blocks.nb_blocks); local->init =3D true; @@ -734,11 +734,11 @@ static void qemu_rdma_dump_id(const char *who, struct= ibv_context *verbs) struct ibv_port_attr port; =20 if (ibv_query_port(verbs, 1, &port)) { - trace_qemu_rdma_dump_id_failed(who); + trace_rdma_dump_id_failed(who); return; } =20 - trace_qemu_rdma_dump_id(who, + trace_rdma_dump_id(who, verbs->device->name, verbs->device->dev_name, verbs->device->dev_path, @@ -759,7 +759,7 @@ static void qemu_rdma_dump_gid(const char *who, struct = rdma_cm_id *id) char dgid[33]; inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.sgid, sgid, sizeof sgi= d); inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.dgid, dgid, sizeof dgi= d); - trace_qemu_rdma_dump_gid(who, sgid, dgid); + trace_rdma_dump_gid(who, sgid, dgid); } =20 /* @@ -809,7 +809,7 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Er= ror **errp) =20 inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof= ip); - trace_qemu_rdma_resolve_host_trying(rdma->host, ip); + trace_rdma_resolve_host_trying(rdma->host, ip); =20 ret =3D rdma_resolve_addr(rdma->cm_id, NULL, e->ai_dst_addr, RDMA_RESOLVE_TIMEOUT_MS); @@ -998,7 +998,7 @@ static void qemu_rdma_advise_prefetch_mr(struct ibv_pd = *pd, uint64_t addr, ret =3D ibv_advise_mr(pd, advice, IBV_ADVISE_MR_FLAG_FLUSH, &sg_list, 1); /* ignore the error */ - trace_qemu_rdma_advise_mr(name, len, addr, strerror(ret)); + trace_rdma_advise_mr(name, len, addr, strerror(ret)); #endif } =20 @@ -1029,7 +1029,7 @@ static int qemu_rdma_reg_whole_ram_blocks(RDMAContext= *rdma, Error **errp) ibv_reg_mr(rdma->pd, local->block[i].local_host_addr, local->block[i].length, access); - trace_qemu_rdma_register_odp_mr(local->block[i].block_name= ); + trace_rdma_register_odp_mr(local->block[i].block_name); =20 if (local->block[i].mr) { qemu_rdma_advise_prefetch_mr(rdma->pd, @@ -1125,7 +1125,7 @@ static int qemu_rdma_register_and_get_keys(RDMAContex= t *rdma, int access =3D rkey ? IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_W= RITE : 0; =20 - trace_qemu_rdma_register_and_get_keys(len, chunk_start); + trace_rdma_register_and_get_keys(len, chunk_start); =20 block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, chunk_start, len, acces= s); /* @@ -1139,7 +1139,7 @@ static int qemu_rdma_register_and_get_keys(RDMAContex= t *rdma, access |=3D IBV_ACCESS_ON_DEMAND; /* register ODP mr */ block->pmr[chunk] =3D ibv_reg_mr(rdma->pd, chunk_start, len, a= ccess); - trace_qemu_rdma_register_odp_mr(block->block_name); + trace_rdma_register_odp_mr(block->block_name); =20 if (block->pmr[chunk]) { qemu_rdma_advise_prefetch_mr(rdma->pd, (uintptr_t)chunk_st= art, @@ -1221,7 +1221,7 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct i= bv_cq *cq, =20 if (rdma->control_ready_expected && (wr_id >=3D RDMA_WRID_RECV_CONTROL)) { - trace_qemu_rdma_poll_recv(wr_id - RDMA_WRID_RECV_CONTROL, wr_id, + trace_rdma_poll_recv(wr_id - RDMA_WRID_RECV_CONTROL, wr_id, rdma->nb_sent); rdma->control_ready_expected =3D 0; } @@ -1233,7 +1233,7 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct i= bv_cq *cq, (wc.wr_id & RDMA_WRID_BLOCK_MASK) >> RDMA_WRID_BLOCK_SHIFT; RDMALocalBlock *block =3D &(rdma->local_ram_blocks.block[index]); =20 - trace_qemu_rdma_poll_write(wr_id, rdma->nb_sent, + trace_rdma_poll_write(wr_id, rdma->nb_sent, index, chunk, block->local_host_addr, (void *)(uintptr_t)block->remote_host_a= ddr); =20 @@ -1243,7 +1243,7 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct i= bv_cq *cq, rdma->nb_sent--; } } else { - trace_qemu_rdma_poll_other(wr_id, rdma->nb_sent); + trace_rdma_poll_other(wr_id, rdma->nb_sent); } =20 *wr_id_out =3D wc.wr_id; @@ -1378,7 +1378,7 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, break; } if (wr_id !=3D wrid_requested) { - trace_qemu_rdma_block_for_wrid_miss(wrid_requested, wr_id); + trace_rdma_block_for_wrid_miss(wrid_requested, wr_id); } } =20 @@ -1415,7 +1415,7 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, break; } if (wr_id !=3D wrid_requested) { - trace_qemu_rdma_block_for_wrid_miss(wrid_requested, wr_id); + trace_rdma_block_for_wrid_miss(wrid_requested, wr_id); } } =20 @@ -1463,7 +1463,7 @@ static int qemu_rdma_post_send_control(RDMAContext *r= dma, uint8_t *buf, .num_sge =3D 1, }; =20 - trace_qemu_rdma_post_send_control(control_desc(head->type)); + trace_rdma_post_send_control(control_desc(head->type)); =20 /* * We don't actually need to do a memcpy() in here if we used @@ -1546,10 +1546,10 @@ static int qemu_rdma_exchange_get_response(RDMACont= ext *rdma, network_to_control((void *) rdma->wr_data[idx].control); memcpy(head, rdma->wr_data[idx].control, sizeof(RDMAControlHeader)); =20 - trace_qemu_rdma_exchange_get_response_start(control_desc(expecting)); + trace_rdma_exchange_get_response_start(control_desc(expecting)); =20 if (expecting =3D=3D RDMA_CONTROL_NONE) { - trace_qemu_rdma_exchange_get_response_none(control_desc(head->type= ), + trace_rdma_exchange_get_response_none(control_desc(head->type), head->type); } else if (head->type !=3D expecting || head->type =3D=3D RDMA_CONTROL= _ERROR) { error_setg(errp, "Was expecting a %s (%d) control message" @@ -1659,14 +1659,14 @@ static int qemu_rdma_exchange_send(RDMAContext *rdm= a, RDMAControlHeader *head, */ if (resp) { if (callback) { - trace_qemu_rdma_exchange_send_issue_callback(); + trace_rdma_exchange_send_issue_callback(); ret =3D callback(rdma, errp); if (ret < 0) { return -1; } } =20 - trace_qemu_rdma_exchange_send_waiting(control_desc(resp->type)); + trace_rdma_exchange_send_waiting(control_desc(resp->type)); ret =3D qemu_rdma_exchange_get_response(rdma, resp, resp->type, RDMA_WRID_DATA, errp); @@ -1679,7 +1679,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma,= RDMAControlHeader *head, if (resp_idx) { *resp_idx =3D RDMA_WRID_DATA; } - trace_qemu_rdma_exchange_send_received(control_desc(resp->type)); + trace_rdma_exchange_send_received(control_desc(resp->type)); } =20 rdma->control_ready_expected =3D 1; @@ -1782,7 +1782,7 @@ retry: } } =20 - trace_qemu_rdma_write_one_top(chunks + 1, + trace_rdma_write_one_top(chunks + 1, (chunks + 1) * chunk_size / 1024 / 1024); =20 chunk_end =3D ram_chunk_end(block, chunk + chunks); @@ -1790,7 +1790,7 @@ retry: =20 while (test_bit(chunk, block->transit_bitmap)) { (void)count; - trace_qemu_rdma_write_one_block(count++, current_index, chunk, + trace_rdma_write_one_block(count++, current_index, chunk, sge.addr, length, rdma->nb_sent, block->nb_chunks); =20 ret =3D qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL); @@ -1823,7 +1823,7 @@ retry: head.len =3D sizeof(comp); head.type =3D RDMA_CONTROL_COMPRESS; =20 - trace_qemu_rdma_write_one_zero(chunk, sge.length, + trace_rdma_write_one_zero(chunk, sge.length, current_index, current_addr= ); =20 compress_to_network(rdma, &comp); @@ -1860,7 +1860,7 @@ retry: } reg.chunks =3D chunks; =20 - trace_qemu_rdma_write_one_sendreg(chunk, sge.length, current_i= ndex, + trace_rdma_write_one_sendreg(chunk, sge.length, current_index, current_addr); =20 register_to_network(rdma, ®); @@ -1883,7 +1883,7 @@ retry: =20 network_to_result(reg_result); =20 - trace_qemu_rdma_write_one_recvregres(block->remote_keys[chunk], + trace_rdma_write_one_recvregres(block->remote_keys[chunk], reg_result->rkey, chunk); =20 block->remote_keys[chunk] =3D reg_result->rkey; @@ -1926,7 +1926,7 @@ retry: send_wr.wr.rdma.remote_addr =3D block->remote_host_addr + (current_addr - block->offset); =20 - trace_qemu_rdma_write_one_post(chunk, sge.addr, send_wr.wr.rdma.remote= _addr, + trace_rdma_write_one_post(chunk, sge.addr, send_wr.wr.rdma.remote_addr, sge.length); =20 /* @@ -1936,7 +1936,7 @@ retry: ret =3D ibv_post_send(rdma->qp, &send_wr, &bad_wr); =20 if (ret =3D=3D ENOMEM) { - trace_qemu_rdma_write_one_queue_full(); + trace_rdma_write_one_queue_full(); ret =3D qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL); if (ret < 0) { error_setg(errp, "rdma migration: failed to make " @@ -1993,7 +1993,7 @@ static int qemu_rdma_write_flush(RDMAContext *rdma, E= rror **errp) =20 if (ret =3D=3D 0) { rdma->nb_sent++; - trace_qemu_rdma_write_flush(rdma->nb_sent); + trace_rdma_write_flush(rdma->nb_sent); } =20 rdma->current_length =3D 0; @@ -2109,7 +2109,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) } =20 rdma_disconnect(rdma->cm_id); - trace_qemu_rdma_cleanup_disconnect(); + trace_rdma_cleanup_disconnect(); rdma->connected =3D false; } =20 @@ -2292,7 +2292,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, bool = return_path, * on the source first requested the capability. */ if (rdma->pin_all) { - trace_qemu_rdma_connect_pin_all_requested(); + trace_rdma_connect_pin_all_requested(); cap.flags |=3D RDMA_CAPABILITY_PIN_ALL; } =20 @@ -2343,7 +2343,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, bool = return_path, rdma->pin_all =3D false; } =20 - trace_qemu_rdma_connect_pin_all_outcome(rdma->pin_all); + trace_rdma_connect_pin_all_outcome(rdma->pin_all); =20 rdma_ack_cm_event(cm_event); =20 @@ -2412,7 +2412,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Err= or **errp) =20 inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof= ip); - trace_qemu_rdma_dest_init_trying(rdma->host, ip); + trace_rdma_dest_init_trying(rdma->host, ip); ret =3D rdma_bind_addr(listen_id, e->ai_dst_addr); if (ret < 0) { continue; @@ -2547,7 +2547,7 @@ static size_t qemu_rdma_fill(RDMAContext *rdma, uint8= _t *buf, size_t len =3D 0; =20 if (rdma->wr_data[idx].control_len) { - trace_qemu_rdma_fill(rdma->wr_data[idx].control_len, size); + trace_rdma_fill(rdma->wr_data[idx].control_len, size); =20 len =3D MIN(size, rdma->wr_data[idx].control_len); memcpy(buf, rdma->wr_data[idx].control_curr, len); @@ -2859,7 +2859,7 @@ static int qio_channel_rdma_close(QIOChannel *ioc, RDMAContext *rdmain, *rdmaout; struct rdma_close_rcu *rcu =3D g_new(struct rdma_close_rcu, 1); =20 - trace_qemu_rdma_close(); + trace_rdma_close(); =20 rdmain =3D rioc->rdmain; if (rdmain) { @@ -3132,11 +3132,11 @@ static int qemu_rdma_accept(RDMAContext *rdma) =20 rdma_ack_cm_event(cm_event); =20 - trace_qemu_rdma_accept_pin_state(rdma->pin_all); + trace_rdma_accept_pin_state(rdma->pin_all); =20 caps_to_network(&cap); =20 - trace_qemu_rdma_accept_pin_verbsc(verbs); + trace_rdma_accept_pin_verbsc(verbs); =20 if (!rdma->verbs) { rdma->verbs =3D verbs; @@ -3727,13 +3727,13 @@ static void rdma_accept_incoming_migration(void *op= aque) RDMAContext *rdma =3D opaque; QIOChannel *ioc; =20 - trace_qemu_rdma_accept_incoming_migration(); + trace_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { error_report("RDMA ERROR: Migration initialization failed"); return; } =20 - trace_qemu_rdma_accept_incoming_migration_accepted(); + trace_rdma_accept_incoming_migration_accepted(); =20 if (rdma->is_return_path) { return; diff --git a/migration/trace-events b/migration/trace-events index d1fe8f1382..d0ad736c8c 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -214,44 +214,44 @@ migrate_global_state_post_load(const char *state) "lo= aded state: %s" migrate_global_state_pre_save(const char *state) "saved state: %s" =20 # rdma.c -qemu_rdma_accept_incoming_migration(void) "" -qemu_rdma_accept_incoming_migration_accepted(void) "" -qemu_rdma_accept_pin_state(bool pin) "%d" -qemu_rdma_accept_pin_verbsc(void *verbs) "Verbs context after listen: %p" -qemu_rdma_block_for_wrid_miss(uint64_t wcomp, uint64_t req) "A Wanted wrid= %" PRIu64 " but got %" PRIu64 -qemu_rdma_cleanup_disconnect(void) "" -qemu_rdma_close(void) "" -qemu_rdma_connect_pin_all_requested(void) "" -qemu_rdma_connect_pin_all_outcome(bool pin) "%d" -qemu_rdma_dest_init_trying(const char *host, const char *ip) "%s =3D> %s" -qemu_rdma_dump_id_failed(const char *who) "%s RDMA Device opened, but can'= t query port information" -qemu_rdma_dump_id(const char *who, const char *name, const char *dev_name,= const char *dev_path, const char *ibdev_path, int transport, const char *t= ransport_name) "%s RDMA Device opened: kernel name %s uverbs device name %s= , infiniband_verbs class device path %s, infiniband class device path %s, t= ransport: (%d) %s" -qemu_rdma_dump_gid(const char *who, const char *src, const char *dst) "%s = Source GID: %s, Dest GID: %s" -qemu_rdma_exchange_get_response_start(const char *desc) "CONTROL: %s recei= ving..." -qemu_rdma_exchange_get_response_none(const char *desc, int type) "Surprise= : got %s (%d)" -qemu_rdma_exchange_send_issue_callback(void) "" -qemu_rdma_exchange_send_waiting(const char *desc) "Waiting for response %s" -qemu_rdma_exchange_send_received(const char *desc) "Response %s received." -qemu_rdma_fill(size_t control_len, size_t size) "RDMA %zd of %zd bytes alr= eady in buffer" -qemu_rdma_init_ram_blocks(int blocks) "Allocated %d local ram block struct= ures" -qemu_rdma_poll_recv(uint64_t comp, int64_t id, int sent) "completion %" PR= Iu64 " received (%" PRId64 ") left %d" -qemu_rdma_poll_write(uint64_t comp, int left, uint64_t block, uint64_t chu= nk, void *local, void *remote) "completions %" PRIu64 " left %d, block %" P= RIu64 ", chunk: %" PRIu64 " %p %p" -qemu_rdma_poll_other(uint64_t comp, int left) "other completion %" PRIu64 = " received left %d" -qemu_rdma_post_send_control(const char *desc) "CONTROL: sending %s.." -qemu_rdma_register_and_get_keys(uint64_t len, void *start) "Registering %"= PRIu64 " bytes @ %p" -qemu_rdma_register_odp_mr(const char *name) "Try to register On-Demand Pag= ing memory region: %s" -qemu_rdma_advise_mr(const char *name, uint32_t len, uint64_t addr, const c= har *res) "Try to advise block %s prefetch at %" PRIu32 "@0x%" PRIx64 ": %s" -qemu_rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s= =3D> %s" -qemu_rdma_signal_unregister_append(uint64_t chunk, int pos) "Appending unr= egister chunk %" PRIu64 " at position %d" -qemu_rdma_signal_unregister_already(uint64_t chunk) "Unregister chunk %" P= RIu64 " already in queue" -qemu_rdma_write_flush(int sent) "sent total: %d" -qemu_rdma_write_one_block(int count, int block, uint64_t chunk, uint64_t c= urrent, uint64_t len, int nb_sent, int nb_chunks) "(%d) Not clobbering: blo= ck: %d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d %d" -qemu_rdma_write_one_post(uint64_t chunk, long addr, long remote, uint32_t = len) "Posting chunk: %" PRIu64 ", addr: 0x%lx remote: 0x%lx, bytes %" PRIu32 -qemu_rdma_write_one_queue_full(void) "" -qemu_rdma_write_one_recvregres(int mykey, int theirkey, uint64_t chunk) "R= eceived registration result: my key: 0x%x their key 0x%x, chunk %" PRIu64 -qemu_rdma_write_one_sendreg(uint64_t chunk, int len, int index, int64_t of= fset) "Sending registration request chunk %" PRIu64 " for %d bytes, index: = %d, offset: %" PRId64 -qemu_rdma_write_one_top(uint64_t chunks, uint64_t size) "Writing %" PRIu64= " chunks, (%" PRIu64 " MB)" -qemu_rdma_write_one_zero(uint64_t chunk, int len, int index, int64_t offse= t) "Entire chunk is zero, sending compress: %" PRIu64 " for %d bytes, index= : %d, offset: %" PRId64 +rdma_accept_incoming_migration(void) "" +rdma_accept_incoming_migration_accepted(void) "" +rdma_accept_pin_state(bool pin) "%d" +rdma_accept_pin_verbsc(void *verbs) "Verbs context after listen: %p" +rdma_block_for_wrid_miss(uint64_t wcomp, uint64_t req) "A Wanted wrid %" P= RIu64 " but got %" PRIu64 +rdma_cleanup_disconnect(void) "" +rdma_close(void) "" +rdma_connect_pin_all_requested(void) "" +rdma_connect_pin_all_outcome(bool pin) "%d" +rdma_dest_init_trying(const char *host, const char *ip) "%s =3D> %s" +rdma_dump_id_failed(const char *who) "%s RDMA Device opened, but can't que= ry port information" +rdma_dump_id(const char *who, const char *name, const char *dev_name, cons= t char *dev_path, const char *ibdev_path, int transport, const char *transp= ort_name) "%s RDMA Device opened: kernel name %s uverbs device name %s, inf= iniband_verbs class device path %s, infiniband class device path %s, transp= ort: (%d) %s" +rdma_dump_gid(const char *who, const char *src, const char *dst) "%s Sourc= e GID: %s, Dest GID: %s" +rdma_exchange_get_response_start(const char *desc) "CONTROL: %s receiving.= .." +rdma_exchange_get_response_none(const char *desc, int type) "Surprise: got= %s (%d)" +rdma_exchange_send_issue_callback(void) "" +rdma_exchange_send_waiting(const char *desc) "Waiting for response %s" +rdma_exchange_send_received(const char *desc) "Response %s received." +rdma_fill(size_t control_len, size_t size) "RDMA %zd of %zd bytes already = in buffer" +rdma_init_ram_blocks(int blocks) "Allocated %d local ram block structures" +rdma_poll_recv(uint64_t comp, int64_t id, int sent) "completion %" PRIu64 = " received (%" PRId64 ") left %d" +rdma_poll_write(uint64_t comp, int left, uint64_t block, uint64_t chunk, v= oid *local, void *remote) "completions %" PRIu64 " left %d, block %" PRIu64= ", chunk: %" PRIu64 " %p %p" +rdma_poll_other(uint64_t comp, int left) "other completion %" PRIu64 " rec= eived left %d" +rdma_post_send_control(const char *desc) "CONTROL: sending %s.." +rdma_register_and_get_keys(uint64_t len, void *start) "Registering %" PRIu= 64 " bytes @ %p" +rdma_register_odp_mr(const char *name) "Try to register On-Demand Paging m= emory region: %s" +rdma_advise_mr(const char *name, uint32_t len, uint64_t addr, const char *= res) "Try to advise block %s prefetch at %" PRIu32 "@0x%" PRIx64 ": %s" +rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s =3D>= %s" +rdma_signal_unregister_append(uint64_t chunk, int pos) "Appending unregist= er chunk %" PRIu64 " at position %d" +rdma_signal_unregister_already(uint64_t chunk) "Unregister chunk %" PRIu64= " already in queue" +rdma_write_flush(int sent) "sent total: %d" +rdma_write_one_block(int count, int block, uint64_t chunk, uint64_t curren= t, uint64_t len, int nb_sent, int nb_chunks) "(%d) Not clobbering: block: %= d chunk %" PRIu64 " current %" PRIu64 " len %" PRIu64 " %d %d" +rdma_write_one_post(uint64_t chunk, long addr, long remote, uint32_t len) = "Posting chunk: %" PRIu64 ", addr: 0x%lx remote: 0x%lx, bytes %" PRIu32 +rdma_write_one_queue_full(void) "" +rdma_write_one_recvregres(int mykey, int theirkey, uint64_t chunk) "Receiv= ed registration result: my key: 0x%x their key 0x%x, chunk %" PRIu64 +rdma_write_one_sendreg(uint64_t chunk, int len, int index, int64_t offset)= "Sending registration request chunk %" PRIu64 " for %d bytes, index: %d, o= ffset: %" PRId64 +rdma_write_one_top(uint64_t chunks, uint64_t size) "Writing %" PRIu64 " ch= unks, (%" PRIu64 " MB)" +rdma_write_one_zero(uint64_t chunk, int len, int index, int64_t offset) "E= ntire chunk is zero, sending compress: %" PRIu64 " for %d bytes, index: %d,= offset: %" PRId64 rdma_add_block(const char *block_name, int block, uint64_t addr, uint64_t = offset, uint64_t len, uint64_t end, uint64_t bits, int chunks) "Added Block= : '%s':%d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: = %" PRIu64 " bits %" PRIu64 " chunks %d" rdma_block_notification_handle(const char *name, int index) "%s at %d" rdma_delete_block(void *block, uint64_t addr, uint64_t offset, uint64_t le= n, uint64_t end, uint64_t bits, int chunks) "Deleted Block: %p, addr: %" PR= Iu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PR= Iu64 " chunks %d" --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998376; cv=none; d=zohomail.com; s=zohoarc; b=nWZELyEhI4ygaShN+xe97hJldz00mzpaH8D6BCTS3IdlZb8l0cVPldkafpxPjKpxaRM6XVTlH/jYTT5/AgFluq0Bna5u7tWhy41w1XJxfbKw1uRpKrGj0DRTxpQ12H7bQSJLIAEJnEuaCJJI7BNxttTVUYixLP2K2YDPQGF9o4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998376; 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=E5SAQhGwnMDxads+Ng+Bj5sib/0faYYO8RUGLjuUJBc=; b=H9RR85Itwm7YkmHjVuFe8pMHOjbpX+PCXsPoPgSWupGTo65jdA2V2WvPRfL2LPiBCgkV/N2wA7D9zefcU6wJxNB8RWGlJ4djUJa7tGvK81f4j+KjPhRZ8WyeVQhnVbfPlhDIVUfY18Jn09+m8Cj3kEBJZEHQXRSVyfPoveBDqQ4= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998376590390.24031432051675; Mon, 17 Aug 2026 13:26:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3t6-0003sa-9D; Mon, 17 Aug 2026 16:24:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3t4-0003s1-Go for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:50 -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 1ww3t2-0002no-8t for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:49 -0400 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-gK3bNDFNPWmofi68-F5lRw-1; Mon, 17 Aug 2026 16:24:45 -0400 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-92e63df032bso34748985a.0 for ; Mon, 17 Aug 2026 13:24:45 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998287; 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=E5SAQhGwnMDxads+Ng+Bj5sib/0faYYO8RUGLjuUJBc=; b=YFgw+qiLDBP6FMiN+tM+WRqoGmh1YRBk2igbRX9xO7qsINDkbijzzYsL/GXRb/SI6BqmUb X2hFHW2QUmzrA2d6Ludjtx1QInVGiMsz8iz/tbIbFgUzIALi3jDANdcfolw1aw9DyR0pOh cygKlWy7MJXf58OW2864EmUylzo3RnQ= X-MC-Unique: gK3bNDFNPWmofi68-F5lRw-1 X-Mimecast-MFC-AGG-ID: gK3bNDFNPWmofi68-F5lRw_1786998285 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998285; x=1787603085; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E5SAQhGwnMDxads+Ng+Bj5sib/0faYYO8RUGLjuUJBc=; b=kD2igYjMmLdo6EEgDl6/yZJclZJD77q93EyvAe9NgyKZQax4kWe5GFnAjkvydC3J5J EDut7RJdg5My3VnZ6psuALQgS/J1rBHnnkaIW4CDNmj529Vb1CMKavCNZ0w46BVfDh75 L35XZV1pvUpeXdtKnPI3fZU9ZKqxQP1s23LJQeT/xghKBJlPUYsnECpsvL38Ze95pxP3 OWDDCmn/iEwPDi/7y2qp5y9XBEtK8oWdRhJWbPAt0uXyQLZhdcAhrqeqiV8JKh1e8sH7 K74qokda0vdGf3+lVCHhPlREfZgPpjWc40Fvu5Ba1MICM4ZMvkYqAqQL4TPVW1BMFVY6 rouQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998285; x=1787603085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=E5SAQhGwnMDxads+Ng+Bj5sib/0faYYO8RUGLjuUJBc=; b=R3fIkBriF2gpIJj/MZ+TZ1W9iqWRr3WsSDe89pHGsx7AdbJumKvHGmK6+1rkCqyMR5 zJNqLPwScTqDx6sbSFeyOnSW2LAzAx4+OB1IcmW4t2IklMZGw9ig3/DJk2evh2mgV4ij Khy8DeTBFu/gzQWYvzrKpdIc/X4VXSlKuBNrdShi6goTi/5C2pN9amuR/Bb0XCfyN4hX I05CWpxS6zHnJ+ey8rroaywpW+FtZll7fzaHWXscf+UjtIcD2KRQCrUzbR7351JhsWRO KtVULwes7UwbQi/4TIz/EJl5SgNRtSRVXFkvr8oyDlNpy1oyj5MV2s7CA7L4/Z93cxCD V8Yw== X-Gm-Message-State: AOJu0Yw1oUDaaA2mkDQiveHsSYGvmOsp9mRbHxwAz4mmTudHyTX1hTkt JYyBPOSnSWPZeEa23f9g0M+a7R9RqFfU/bABBuoNKPMfAYRhWlnk7fAILCWB4U1Xc/0JEuw1U5A Z72aQCHNRYwNyg3BOriiWroWCcPrhosUsHUp+peNGwNhiagSlMbd1Ac+XsIkeEzqAzWKIpbX9z2 oXxmZcC55UdQEp4p2ykQ73XU4+YZp9RSy1Kn4BBQ== X-Gm-Gg: AR+sD13zIxhwDx0Q34bbsoVWik+t9qRZd2+KGw+G4wea0A+frv8WSTxf/vY4ad6fYuo VFJXClJzjA12AAyQt7wi6qcG4qaV1N2mqgVr7+QvCD2qxsTaB+QEQ44sKHGB4jaRBYnsvcY+vcC fL11kJY29jWJLg5SFFvfnhFaYwZdSkD+R68Zqq8sslB7R0Yd4oPiehjw9OAIiSA6gG3h7Vkhha/ Z7K1Aub26NT31K2G4dNE8k6hwivrjMYGx5MkQfqsB4VxYlhCT6j7QGaKQ3PAQxFUeYxp2ZQCnFJ mi5OSrpzz8tI/TavQvIPaJPNA2RxBMUfsf4QZLkPqP3AxSa/+ZE/mJj2lNybZC8Rsg== X-Received: by 2002:a05:622a:5815:b0:51c:4f35:81b8 with SMTP id d75a77b69052e-52dbed36031mr20836791cf.7.1786998284786; Mon, 17 Aug 2026 13:24:44 -0700 (PDT) X-Received: by 2002:a05:622a:5815:b0:51c:4f35:81b8 with SMTP id d75a77b69052e-52dbed36031mr20835971cf.7.1786998284142; Mon, 17 Aug 2026 13:24:44 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 04/10] migration/rdma: Drop RDMALocalBlock.is_ram_block Date: Mon, 17 Aug 2026 16:24:18 -0400 Message-ID: <20260817202424.2901438-5-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998378771158500 Content-Type: text/plain; charset="utf-8" This is guaranteed to be true. There seems to have support for some dynamically allocated buffers but it was never really supported. Remove dead code. As a side effect, this patch closes a report by removing the buggy code completely. Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4006 Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 73 ++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 52 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index ffae0a887f..354935433c 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -196,7 +196,6 @@ typedef struct RDMALocalBlock { uint32_t remote_rkey; /* rkeys for non-chunk-level registrat= ion */ int index; /* which block are we */ unsigned int src_index; /* (Only used on dest) */ - bool is_ram_block; int nb_chunks; unsigned long *transit_bitmap; unsigned long *unregister_bitmap; @@ -441,14 +440,12 @@ static void register_to_network(RDMAContext *rdma, RD= MARegister *reg) RDMALocalBlock *local_block; local_block =3D &rdma->local_ram_blocks.block[reg->current_index]; =20 - if (local_block->is_ram_block) { - /* - * current_addr as passed in is an address in the local ram_addr_t - * space, we need to translate this for the destination - */ - reg->key.current_addr -=3D local_block->offset; - reg->key.current_addr +=3D rdma->dest_blocks[reg->current_index].o= ffset; - } + /* + * current_addr as passed in is an address in the local ram_addr_t + * space, we need to translate this for the destination + */ + reg->key.current_addr -=3D local_block->offset; + reg->key.current_addr +=3D rdma->dest_blocks[reg->current_index].offse= t; reg->key.current_addr =3D htonll(reg->key.current_addr); reg->current_index =3D htonl(reg->current_index); reg->chunks =3D htonll(reg->chunks); @@ -585,8 +582,6 @@ static void rdma_add_block(RDMAContext *rdma, const cha= r *block_name, bitmap_clear(block->unregister_bitmap, 0, block->nb_chunks); block->remote_keys =3D g_new0(uint32_t, block->nb_chunks); =20 - block->is_ram_block =3D local->init ? false : true; - if (rdma->blockmap) { g_hash_table_insert(rdma->blockmap, (void *)(uintptr_t)block_offse= t, block); } @@ -1767,19 +1762,10 @@ retry: chunk =3D ram_chunk_index(block->local_host_addr, (uint8_t *)(uintptr_t)sge.addr); chunk_start =3D ram_chunk_start(block, chunk); + chunks =3D length / chunk_size; =20 - if (block->is_ram_block) { - chunks =3D length / chunk_size; - - if (chunks && ((length % chunk_size) =3D=3D 0)) { - chunks--; - } - } else { - chunks =3D block->length / chunk_size; - - if (chunks && ((block->length % chunk_size) =3D=3D 0)) { - chunks--; - } + if (chunks && ((length % chunk_size) =3D=3D 0)) { + chunks--; } =20 trace_rdma_write_one_top(chunks + 1, @@ -1804,7 +1790,7 @@ retry: } } =20 - if (!rdma->pin_all || !block->is_ram_block) { + if (!rdma->pin_all) { if (!block->remote_keys[chunk]) { /* * This chunk has not yet been registered, so first check to s= ee @@ -1853,11 +1839,7 @@ retry: * Otherwise, tell other side to register. */ reg.current_index =3D current_index; - if (block->is_ram_block) { - reg.key.current_addr =3D current_addr; - } else { - reg.key.chunk =3D chunk; - } + reg.key.current_addr =3D current_addr; reg.chunks =3D chunks; =20 trace_rdma_write_one_sendreg(chunk, sge.length, current_index, @@ -3408,30 +3390,17 @@ int rdma_registration_handle(QEMUFile *f) goto err; } block =3D &(rdma->local_ram_blocks.block[reg->current_inde= x]); - if (block->is_ram_block) { - if (block->offset > reg->key.current_addr) { - error_report("rdma: bad register address for block= %s" - " offset: %" PRIx64 " current_addr: %" PRIx64, - block->block_name, block->offset, - reg->key.current_addr); - goto err; - } - host_addr =3D (block->local_host_addr + - (reg->key.current_addr - block->offset)); - chunk =3D ram_chunk_index(block->local_host_addr, - (uint8_t *) host_addr); - } else { - chunk =3D reg->key.chunk; - host_addr =3D block->local_host_addr + - (reg->key.chunk * migrate_rdma_chunk_size()); - /* Check for particularly bad chunk value */ - if (host_addr < (void *)block->local_host_addr) { - error_report("rdma: bad chunk for block %s" - " chunk: %" PRIx64, - block->block_name, reg->key.chunk); - goto err; - } + if (block->offset > reg->key.current_addr) { + error_report("rdma: bad register address for block %s" + " offset: %" PRIx64 " current_addr: %" PRIx64, + block->block_name, block->offset, + reg->key.current_addr); + goto err; } + host_addr =3D (block->local_host_addr + + (reg->key.current_addr - block->offset)); + chunk =3D ram_chunk_index(block->local_host_addr, + (uint8_t *) host_addr); chunk_start =3D ram_chunk_start(block, chunk); chunk_end =3D ram_chunk_end(block, chunk + reg->chunks); /* avoid "-Waddress-of-packed-member" warning */ --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998378; cv=none; d=zohomail.com; s=zohoarc; b=fqo54crBE/Z/lRX1cYGo8PtAEAcVOS2zEQ3cmERAKGkb+Oq5g2N7pYKZbQmVwz2FQ16RUatUHf5HktUPkXSnmOCOwdUyREST2Sb4+MpGDqITNBoZiycZkl5apj7jrpsZhyLTmBYgODjwOBhSE1G8nfBrNlOd/BduHtEFcRWHddg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998378; 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=xTUTn0RPHUSZXgvS7o8vUQppyBBgIvjMwn695xgcoWw=; b=JMpBTZ4ZEFaOXG1SuV4a4tX2KSHZU2v89w0KlglE7AfZ5tAY33kzoPCdbDzEqfJ41hYN8ybOF5Qz1auz/9r+JIidLd84a+blqnaR+xLfYr5hbtqTU6xJ2Ms/Oq2AXdzIX6YEUEhyWnWCc9hbwLi4D8ma7mFPm1GW8BjeB5iRovE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998378143700.7200379586689; Mon, 17 Aug 2026 13:26:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3t6-0003sb-IU; Mon, 17 Aug 2026 16:24:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3t4-0003s2-Gw for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:50 -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 1ww3t2-0002nx-Qe for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:50 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-a-HaiGmvOy-ruCjo1zjn-g-1; Mon, 17 Aug 2026 16:24:46 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-8eac2620cb0so37456136d6.3 for ; Mon, 17 Aug 2026 13:24:46 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998288; 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=xTUTn0RPHUSZXgvS7o8vUQppyBBgIvjMwn695xgcoWw=; b=dTL1Xjng3x4D3ewOquI7yHcdedifBIkp6EqPcnLd1IBiOhegmSYZDioaWxutcpuLEvLjG6 02Da2DU5gezN69hjVFq11s6HNbvr/TqCbXB1MKB+nUABBriId6bggORnDTQckZDInX6xJd IFcxc5sV2kRzXGfhyrjm6PSOoLd0G6s= X-MC-Unique: a-HaiGmvOy-ruCjo1zjn-g-1 X-Mimecast-MFC-AGG-ID: a-HaiGmvOy-ruCjo1zjn-g_1786998286 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998286; x=1787603086; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xTUTn0RPHUSZXgvS7o8vUQppyBBgIvjMwn695xgcoWw=; b=p1RL7TKK1TWIcaTME4MhOMVe22SDYpkv7NJRF6ZI1pTxzuXS6E0PDij+C+bunKUJrw He7e9reAKPns5GfVV4504qYXzhB/FixSnStmkyUbClWxXcdOI+I1ItYmo2ab0O/1P5jE k1q/lZyHUT8nOckmnLjAD2WuBG6SGEyGCIJVCFMNznaK3Yqddl1VwtBNi7NeAD6zLqIR LCBOQvhPQmqIjORQMZE3cKySbDQ7+laNQJMJSfihuIanSxwHuzqfq+2eME2zr6n/Mevh 3eKu1QiBpmvy1ZmDkCYQi3s3U2cNPZbIM30BuiscHyUHHxoF07Yxgcfba4hI3a9FMO/X VBiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998286; x=1787603086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=xTUTn0RPHUSZXgvS7o8vUQppyBBgIvjMwn695xgcoWw=; b=qbtRkPCClwixz4WVaMkn0pgG0rZIHmbylHU4dBkPSmKfY5Nf7vNNzn4RfsqIpODVWG I9kDXoUl/ZJjYvmlYu+4zDZLl3LlvR27I8XG2mMGP6CjAS2umx2fC8hwGcDmPsGDUsk7 XkUDHhC9s1HkUkZfOEwLvl293sNGNySYXeAqUTZmUSjfbyk4avtAhR0boTPczNtnqVLv O7nq1WY5EIfCFdzlQ4FT6bfJlDU4Oml3AsrZmTkg3hyeqn+C4W3wo//HbazyYp83Jq6L LBBKQgn0bTbX62cly9PAWqqHUEY9XTZv9AqU3Gk0Fa3cC1vZJxLhnzUI1bWqsHhsUPjc /hFg== X-Gm-Message-State: AOJu0Yy1Sm638m67OvCvXrCbznOxmH5VWOgEAzg52xY8+vB3C7isLZOd s03pODoF8co4i+SRVu6saGZsISmqptOyUstNb7zups3QuCumQSCWbxIQJOvkYQbRVelL+wHhiVw jERPe4Qa108xmDGTQNFL6JBrogMpOLP390F8mcEU4RPu3R32Z+8A/4MSowhO+HVw+4i7HIRd6lB z8h6iL5re4YHXy+u0E6oN5UBty8trCGQUORLP6NQ== X-Gm-Gg: AR+sD11T2k9+2P67FnnX26BD3hL7SstDkoMI4nmd+wlcR2JMW90tzhNOP/j5Ksi/1nz WSIpVW+vBWyVFgSnEVZCdhhA1Bg7sYM/QlQIgUf9Uv+u3eX8GrvP7LIgFbqVgl/YqM0JKCg0Z7a RjAakMNXrLv5yre8772BWjXV4C2wPX4agMSa2heQN27n++O2w+eDchu6woz0B6fxzYy9dn5L/pB 8nEjcfF/qdQk6FxfbdRHdvVoCA6OQaLFM+us2MxNNkU+sCca1QiMConnzZgt4G1ZY0Ly4Bw44tg Dip7Kouduh1HQ333awGzOEkGrxvHdfe6F1mZu2IcITP1JltuUhJO9PVXBr1cc/6GcA== X-Received: by 2002:a05:622a:c6:b0:51c:15bb:b4f2 with SMTP id d75a77b69052e-52d85501022mr268841631cf.27.1786998286108; Mon, 17 Aug 2026 13:24:46 -0700 (PDT) X-Received: by 2002:a05:622a:c6:b0:51c:15bb:b4f2 with SMTP id d75a77b69052e-52d85501022mr268841001cf.27.1786998285514; Mon, 17 Aug 2026 13:24:45 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 05/10] migration/rdma: Drop RDMALocalBlock.unregister_bitmap Date: Mon, 17 Aug 2026 16:24:19 -0400 Message-ID: <20260817202424.2901438-6-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998378728158500 Content-Type: text/plain; charset="utf-8" Not used anymore. Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 354935433c..c06395a51a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -198,7 +198,6 @@ typedef struct RDMALocalBlock { unsigned int src_index; /* (Only used on dest) */ int nb_chunks; unsigned long *transit_bitmap; - unsigned long *unregister_bitmap; } RDMALocalBlock; =20 /* @@ -578,8 +577,6 @@ static void rdma_add_block(RDMAContext *rdma, const cha= r *block_name, block->nb_chunks =3D ram_chunk_index(host_addr, host_addr + length) + = 1UL; block->transit_bitmap =3D bitmap_new(block->nb_chunks); bitmap_clear(block->transit_bitmap, 0, block->nb_chunks); - block->unregister_bitmap =3D bitmap_new(block->nb_chunks); - bitmap_clear(block->unregister_bitmap, 0, block->nb_chunks); block->remote_keys =3D g_new0(uint32_t, block->nb_chunks); =20 if (rdma->blockmap) { @@ -665,9 +662,6 @@ static void rdma_delete_block(RDMAContext *rdma, RDMALo= calBlock *block) g_free(block->transit_bitmap); block->transit_bitmap =3D NULL; =20 - g_free(block->unregister_bitmap); - block->unregister_bitmap =3D NULL; - g_free(block->remote_keys); block->remote_keys =3D NULL; =20 --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998370; cv=none; d=zohomail.com; s=zohoarc; b=Rnln1cWEscHmIUeiBrcxsAqZ0oAI91NPjY/9qXvPwVjNq4m5WylNbLkTqWGnkT49rTvuQn2fudSXPL5/ZGimpfVov3aHqXWAPSIcgmknbnm3cVJg0I2uqcDMD/JbU4atUXZ7yeQf1UfP4C/EiYg3Og7AJKto111GV+oW2xTNVDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998370; 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=sN6XjJf8SMea6atT3HTmTlXbirCpYZnWKPBQV4NeUL4=; b=mmdyXw4IArmjEERHGIYfGRf8Pe+eeBTlptjJMJexaY+VV4tWBQKvnlb3fkC7pKCtyjMaqKyTS9srIfdPEWWUcNGBKnHEroC7O2VbttTuYSoQUGVM1A8HTpzwV6MizD5fV5ZZjmnyYgNKuOd/CIg3tMvGUw8VZfwVGotFgoa1JMw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998370573748.5707164203133; Mon, 17 Aug 2026 13:26:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tM-0003yZ-TJ; Mon, 17 Aug 2026 16:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3tI-0003xB-6j for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:25:04 -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 1ww3tG-0002qV-L2 for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:25:03 -0400 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541-jkYLcalrMYeXOdsokR1t9w-1; Mon, 17 Aug 2026 16:24:48 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-52b4f6ac06aso69793611cf.1 for ; Mon, 17 Aug 2026 13:24:48 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998300; 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=sN6XjJf8SMea6atT3HTmTlXbirCpYZnWKPBQV4NeUL4=; b=EeoUiPPP67+cZS5W/J5Iy66gXfcfAkHTW/WESK9OveLKwOIevc8+79HS38BgglvHIcR6oZ yYICb2munb/hrNnB/pVU901g8K8fX0vwCqmLiRIRpNpRdT7K+kcosrUR3ZRsB38/udjS2P h1PDJmdjdGgL5w+E0U179VW7nemSCcs= X-MC-Unique: jkYLcalrMYeXOdsokR1t9w-1 X-Mimecast-MFC-AGG-ID: jkYLcalrMYeXOdsokR1t9w_1786998288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998288; x=1787603088; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sN6XjJf8SMea6atT3HTmTlXbirCpYZnWKPBQV4NeUL4=; b=gnPhPlRJlL4bATjBGuyF3Q5n1IEN8WInWyWfnzcaj6K4luK+q88rHCKxi3FXd5jlGd HML61hd8P+TDJYYOEE9VM0dcKwE44dZuzdV8PLOcjJxf+0mdnhqAcvDA9ja7Fm371E89 3Jvscl3gxhGEJuwDIcwreEXUPEm89wEnUtWx4UbGomobK5HnU0yZmPNyyQXEvPXyNt51 sZp2AtZ/Up6n3fG2edIIHYYwzyniqMsN705QedJ0iHRPIP3+TfJBlWc83IFnK5EFeAKM +VD7nnh4yKECZ84p2FV2fG5RVIwr/VyW9/6BBxAGcRT9w2gLWiWLwTdPWzKVWVl8a51U utrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998288; x=1787603088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sN6XjJf8SMea6atT3HTmTlXbirCpYZnWKPBQV4NeUL4=; b=TSWNSu6vl/ZwFXdd9c4pJuIxRuwStEdMBSk8pn+Qtp5cwEVvLtECp5NozfL+49QNDv TlpNR05oDrJ8epWr299vyIPulST3cJLrQoM5dt6JPn1MugEIfgjzYiAw9JvI9HI9zg8q Jqi0eqF4ywLMGIlCGWXj6bfCU4TWYle6ADqSoh14ibzX0Dh+rX0BER6yX3S1il01fq78 Y2PIpO4iZG1FZbj9vyOBzxl++9ntqNfuNVgvY8TLRXoOh1uOQXEuPpsHmocge+VxxKxM HocJI1MNacS4KGIWlzjVLTRbRSU7Ryp83gtJ/a+XPnx+0oKPcS/QsnpH/7Sti20WwHPA 1fzA== X-Gm-Message-State: AOJu0YyEiDKcasgws0uWNpZKymdfN4cy2cc+dFOJZKjC4VCszBRuVb70 V+s60c7K/J0WcYO+p15bY6vaVIJKsW+Q3slgS6UkRBEehZvf22LE9UcDdnHxJjb4INJJSWRVefq 7ajIDYVrMAMJOdvKzhstKBJFkgb0GXugYquodZXxhhmFQco8zSnIyV/ILVSUGiSfDR99Z5300bt 8c9hAHYUgRo87j0D/0ZBWU8MGTBbOohd15rnAozQ== X-Gm-Gg: AR+sD10ax309Vlpo7H5g0vKKZza6Z64/uANG9gg/RkognUIDv3WJlZGIobGRs2zevzO QYZ7IleNdIcVo27pvrZtfpZoL7cTuDaikFYOMTot1s2MORPwxel6R/JjXrrZHp+bKBVmna3MCcY nuWc+AvjZ1rObWgz9C2DS0Yju3i5XoVr2eofVJEzyeFguw4iSrcVCbVuzVRNMQ6twTjeh3IBokS KysAM2VLT3nXyTTx95iJ+dBz3hRRafd4QeG1C8lwMzeBER0IIfv6r4hF2wgs8JVlEqL/3hqJD3K hp8Iu4SMsjhM9zzZkpfflxDOLfeu/KkTFw+Mz3clBwiXIyEeJD+fbojwkqeycNrLpg== X-Received: by 2002:a05:622a:5c1a:b0:51c:1fa1:80da with SMTP id d75a77b69052e-52d854e54femr318430991cf.40.1786998287962; Mon, 17 Aug 2026 13:24:47 -0700 (PDT) X-Received: by 2002:a05:622a:5c1a:b0:51c:1fa1:80da with SMTP id d75a77b69052e-52d854e54femr318430271cf.40.1786998287399; Mon, 17 Aug 2026 13:24:47 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 06/10] migration/rdma: Drop RDMARegister.key.chunk Date: Mon, 17 Aug 2026 16:24:20 -0400 Message-ID: <20260817202424.2901438-7-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_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: qemu development 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: 1786998372493158500 Content-Type: text/plain; charset="utf-8" Not used anymore. Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index c06395a51a..f64bcee418 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -415,10 +415,7 @@ static void network_to_control(RDMAControlHeader *cont= rol) * the actual RDMA operation. */ typedef struct QEMU_PACKED { - union QEMU_PACKED { - uint64_t current_addr; /* offset into the ram_addr_t space */ - uint64_t chunk; /* chunk to lookup if unregistering */ - } key; + uint64_t current_addr; /* offset into the ram_addr_t space */ uint32_t current_index; /* which ramblock the chunk belongs to */ uint32_t padding; uint64_t chunks; /* how many sequential chunks to register = */ @@ -443,16 +440,16 @@ static void register_to_network(RDMAContext *rdma, RD= MARegister *reg) * current_addr as passed in is an address in the local ram_addr_t * space, we need to translate this for the destination */ - reg->key.current_addr -=3D local_block->offset; - reg->key.current_addr +=3D rdma->dest_blocks[reg->current_index].offse= t; - reg->key.current_addr =3D htonll(reg->key.current_addr); + reg->current_addr -=3D local_block->offset; + reg->current_addr +=3D rdma->dest_blocks[reg->current_index].offset; + reg->current_addr =3D htonll(reg->current_addr); reg->current_index =3D htonl(reg->current_index); reg->chunks =3D htonll(reg->chunks); } =20 static void network_to_register(RDMARegister *reg) { - reg->key.current_addr =3D ntohll(reg->key.current_addr); + reg->current_addr =3D ntohll(reg->current_addr); reg->current_index =3D ntohl(reg->current_index); reg->chunks =3D ntohll(reg->chunks); } @@ -1833,7 +1830,7 @@ retry: * Otherwise, tell other side to register. */ reg.current_index =3D current_index; - reg.key.current_addr =3D current_addr; + reg.current_addr =3D current_addr; reg.chunks =3D chunks; =20 trace_rdma_write_one_sendreg(chunk, sge.length, current_index, @@ -3375,7 +3372,7 @@ int rdma_registration_handle(QEMUFile *f) reg_result =3D &results[count]; =20 trace_rdma_registration_handle_register_loop(count, - reg->current_index, reg->key.current_addr, reg->c= hunks); + reg->current_index, reg->current_addr, reg->chunk= s); =20 if (reg->current_index >=3D rdma->local_ram_blocks.nb_bloc= ks) { error_report("rdma: 'register' bad block index %u (vs = %d)", @@ -3384,15 +3381,15 @@ int rdma_registration_handle(QEMUFile *f) goto err; } block =3D &(rdma->local_ram_blocks.block[reg->current_inde= x]); - if (block->offset > reg->key.current_addr) { + if (block->offset > reg->current_addr) { error_report("rdma: bad register address for block %s" " offset: %" PRIx64 " current_addr: %" PRIx64, block->block_name, block->offset, - reg->key.current_addr); + reg->current_addr); goto err; } host_addr =3D (block->local_host_addr + - (reg->key.current_addr - block->offset)); + (reg->current_addr - block->offset)); chunk =3D ram_chunk_index(block->local_host_addr, (uint8_t *) host_addr); chunk_start =3D ram_chunk_start(block, chunk); --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998319; cv=none; d=zohomail.com; s=zohoarc; b=OOU1Nw7KSPiEtss+8lenaVinOegbw8F6KqT8mgIjTatV20oL8mSkLGd+y2jNB6O8fJ1BQGrs+8BYyyTDfutRTQZh2eT+8Ucmzh7Aec5ktJI5GuwRCjaxluk7ktUuRTuFNo0+Xrpnn0jDusLcH4x3OkMBlXL3CzKmnjXoiuwkMN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998319; 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=HwPNBAsVyZnQYazdHmHIZ1jujVvi0DPnF4lKOqhqlLk=; b=BSvdrIS90np6zpRF3PIYA8RDihxBj11E6auyBXZk87EbHFGWJAsX5TeB+uILcO5dbs2woFuHFVHZVnzdysh5lcwaq+B0/TrIMFjsuGjdNUWXT5pd31P3MYoBqBhzcwvZ8CFPxSmXmx3TorIRKUlu940bZyGLr9Jgr9OiZOvQyzE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17869983195151003.5711825918949; Mon, 17 Aug 2026 13:25:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3t9-0003tP-Vp; Mon, 17 Aug 2026 16:24:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3t8-0003t5-Ci for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:54 -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 1ww3t6-0002oh-L9 for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:54 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-5pCqHLvoMVuJWe6rDMPIxA-1; Mon, 17 Aug 2026 16:24:50 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-51c1d137a68so35699191cf.3 for ; Mon, 17 Aug 2026 13:24:50 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998292; 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=HwPNBAsVyZnQYazdHmHIZ1jujVvi0DPnF4lKOqhqlLk=; b=GAe1GyBgjaUHR2t3m9lAbGCRvkTbIH+aUh3XzLKeXsNnUugIAXXLuaSrvldeVH2rkk8l99 OyuIEutRXmvzxdQAze3sQB6Kh32NWnHy+rP0BbN26Jz7uj5W4//gRAKSX5QIh57QrCwv6U 9/ZQJQkeOWLQzFhjgc022y4I1a0s2yA= X-MC-Unique: 5pCqHLvoMVuJWe6rDMPIxA-1 X-Mimecast-MFC-AGG-ID: 5pCqHLvoMVuJWe6rDMPIxA_1786998290 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998290; x=1787603090; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HwPNBAsVyZnQYazdHmHIZ1jujVvi0DPnF4lKOqhqlLk=; b=SwlP6H2wBW7dNrx4t2z7YJxmQmTs8XPUu8ar5xOKmsrYHbirdfuJqTUsahBpOjJldF KepU46UqctGH4xZHeSo19txubTJe+K7cujDfVhbF6A7trGssczMGrXLsNCi9MFl5xnvr V2KKnROHDJxbnqRl6uVKc0iGP5vCaziIUn1VJPrmY2mgfabEnVMbb/rqDA6PAgOb7N3+ 7dtq5dCEWMSttM84WSwuDY9LEUWqE3w8/w8vzwt4bIRe9jqU+HjdoTRtvoFn//wIMJsg 7ZYiZc7QzF7/PzR/oSvYMbUlHyE/zKCDIFpp1psv8kdr0gsXSUQAX+6VN1yZh26UQbQL mV3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998290; x=1787603090; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=HwPNBAsVyZnQYazdHmHIZ1jujVvi0DPnF4lKOqhqlLk=; b=W7sPDJV4c54187kYunJAuyw2w9sibTDbpcYpuNnkF1DZg060Fr7kfh5ImD3qrTKT4g GOMlQg30t++JaDa0NMF4oBNZYZE+J2jOcEPnIhm/3Fa+X4Fptf3x631L2l6pRQW16mKS dXYw5W89ygJ1rotV5qEG2AEhPdbeiliZbhTx4nf2nW3b90mWXzHd/FWrZxNcbPs1l2Tm p1gi5hEQKnv025+vfexncAaMCUHDkI/nO9GdeANfi2qAj3U4ZtL8ZuQFVKDdtrfmSJ7K b2YEqrPArEg/n5LA24UMZoxqhbrfOU9fEh4BOrrcWN2OdJUchsnS94m+oNbR/i7+hVHc +Z9A== X-Gm-Message-State: AOJu0YzlG9LvqQtzGt+lZhss8scgrPJ9qgPpNA+iWa/HU1GUle0Lhia+ RthnyqDV/0WOwOsxMa3XtrGhqUaF5xY2RBZzHiBXEa0A77Ft9ljNjJBYtyHVO6nt6HeL7mPuvSO h4X14xJxgJEKAMGxmdeO+dImfNcw0CzdQhaP1gFGDJS9DiPpzeXXr8OejFhsfummt82wOnY0j6R C6oetSTLQpLu1MISB5m4eG1QTsFh+e74WL65lMcg== X-Gm-Gg: AR+sD12NO4tMm2jb+XRsJmtf/8bDLKUqb4FtLFELlChTHJSL9iWqknYGGWZTF3kb6pk WTriVdw7Q5g742TZvpxiUcvweKWNa+MGrno/p3GIndSIqoP1PalbtiphLG2QILktRfGPBed9bj+ R5UWgc/dIzwk4wIXNOmK8kWRktYtumKqS3Ol/oIqh4vSNS6P9J6PkoHOlMaxdLeRd8aPP6Qpd2L e0z42ywG1ax1Nq/JuZbTGe8KpsoGgtAWCGYEORx9laWcVlpPwHGPqOm/+yC3KfBLaje480uGSD/ BN4kPBMcU50VH3vsJV/kcHZr7q6ImBZBcey/7mvZ6z+Lz/DuAKQUcLFYMY3NpnxW3g== X-Received: by 2002:a05:622a:58cf:b0:517:9570:c1bd with SMTP id d75a77b69052e-52d854c2d90mr322450631cf.25.1786998289888; Mon, 17 Aug 2026 13:24:49 -0700 (PDT) X-Received: by 2002:a05:622a:58cf:b0:517:9570:c1bd with SMTP id d75a77b69052e-52d854c2d90mr322449901cf.25.1786998289306; Mon, 17 Aug 2026 13:24:49 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 07/10] migration/rdma: Sanity check RDMA_CONTROL_REGISTER_REQUEST on buflen Date: Mon, 17 Aug 2026 16:24:21 -0400 Message-ID: <20260817202424.2901438-8-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998321271158500 Content-Type: text/plain; charset="utf-8" RDMA header supports head.repeat on RDMA_CONTROL_REGISTER_REQUEST, which can include >1 memory registrations. The current code did check over head.repeat to guard against RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE, however it didn't further check the buffer size (head.len) to make sure the received data is large enough to include the repeated entries. Check it. This is almost only to harden this piece of code, in reality on source side QEMU never uses repeat>1.. However since it's a protocol, still keep it. Check the buffer size instead. In case it's not obvious to new RDMA readers: head.len should be the size RDMA has last received, as qemu_rdma_exchange_get_response() checked on it against byte_len (which was further fetched from ibv_wc.byte_len in qemu_rdma_poll()). Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4028 Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index f64bcee418..5ce8b06818 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3362,6 +3362,14 @@ int rdma_registration_handle(QEMUFile *f) reg_resp.repeat =3D head.repeat; registers =3D (RDMARegister *) rdma->wr_data[idx].control_curr; =20 + /* Making sure the register buffers to read are valid */ + if (head.len !=3D head.repeat * sizeof(RDMARegister)) { + error_report("%s: Invalid RDMA_CONTROL_REGISTER_REQUEST " + "(head.repeat=3D%"PRIu32", head.len=3D%"PRIu3= 2")", + __func__, head.repeat, head.len); + goto err; + } + for (int count =3D 0; count < head.repeat; count++) { uint64_t chunk; uint8_t *chunk_start, *chunk_end; --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998367; cv=none; d=zohomail.com; s=zohoarc; b=Tr+FUrsaWrvBpqT5S20s79OxjCDX+ShyT5P4/f2fcfWNhb+ojpkM9LHuJBfx7miWZi5f+ZT2/LJ2vXuwfvalZXVIYXDeA0xm5WmoPl5ob4Qkk9Gdsw6D4YmrvppXxSAL98rOeW2VOupMoCikG3s0T9dmHQPMAnuevzFCXdPSOJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998367; 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=f3ohXdIr8fhrUcLg1b1Cl433ZNfz2EPC8poOBiY/Wac=; b=YP1T0u7Y1VyG2d1+nvEKn0KBUS10GlwSBovPQlHJ5AdKF3MVmYdRGlH/CRNoajR7vvpQJHSjGB7+AN+Plp1sF8BFRnh7u61mbcLTUtyQQSQKY8elL4Iy0q1WM8ZTNIgKbQt0J3FUYixQ25bg8eoL2evtdAeTNqvldgLORQ3QQDA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998367283368.4859088942262; Mon, 17 Aug 2026 13:26:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tB-0003tz-89; Mon, 17 Aug 2026 16:24:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3tA-0003tg-F3 for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:56 -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 1ww3t8-0002ox-7N for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:56 -0400 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-YO1HpuwdObqz5RbGzXyrOQ-1; Mon, 17 Aug 2026 16:24:52 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-52b4f6ac06aso69794281cf.1 for ; Mon, 17 Aug 2026 13:24:51 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998293; 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=f3ohXdIr8fhrUcLg1b1Cl433ZNfz2EPC8poOBiY/Wac=; b=hFZ0BPULkrOsMZPtXT/asct+UvMDRSyl1xFo2JcwptINEMeuiHePOV8rx3e7BB/Jbicl7f cLAIOzogY/pKrxcQqRGugFbxaaNiAt84GDV32kU9tKi/DTvmf3fl0RtevswY0GHR1BPWVT KGBh0KNWnlamextXDS1TUOIX5Qb/jYw= X-MC-Unique: YO1HpuwdObqz5RbGzXyrOQ-1 X-Mimecast-MFC-AGG-ID: YO1HpuwdObqz5RbGzXyrOQ_1786998291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998291; x=1787603091; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=f3ohXdIr8fhrUcLg1b1Cl433ZNfz2EPC8poOBiY/Wac=; b=OZS+b/7UnlLt3nPZVUccNJXAJYOVwySLMhDVcHmXnV7yIqLuBcYGt2kkeKLB59tUke F8QFUoskrUwuh1Ltfub9W0cph4krArIsBZMKT8hQEHJgYOmA3sx1UzexzTx2c0VbinOH KTNHKrr/DiKmg6AzfidygMPSPOvRECkWorBTrymhSTSk6WMBGoPKHwXKu8U0QWeFFhtY 7gBMZGUce6L/DCcskGADS0x/VzDfYtUQEOP4zOaoUJe7N/6ZjkcuHJxx5mQMvJMaUHvi BWaAqxsTL2NxAQjvbyry9CLPWseJ+wKv6DZqIKtzH07RkDNz0ek49PWLFiTDZtTmgY0B Fl3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998291; x=1787603091; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=f3ohXdIr8fhrUcLg1b1Cl433ZNfz2EPC8poOBiY/Wac=; b=d4jzzJWQ8uysWyJF2WEkMeAuAkaH16so3vnG71qr/R6RBTiv366wGL9OkF2QK46/9V weQsWa4v4S2Mf88k97Mjoa0AZ8fJOjunAHqPHDgGnEkFrvaNbU/+qifc44qHUwPQMXGV 2OrsDLWBW+GUMp2pbS3qPHfSapNycyVLGrr3JFXI0DXcUGFwQJkuxzy7L16FjufervoG rcPRDyiEb6iZoPJhV8yBeuuLY+4eKTWLCBaozz6IuaTk/3kX+UFwk2NhDi4ihbnRGhKZ 29jUhs2znJtrpw/geXKtoI28RdQawsAC8W9qxoQvoHVCZT6QF9bYEk2yVuN+om5vFxpO dxFg== X-Gm-Message-State: AOJu0YyD7hNrp6ZzYkobAAt/jUukmIo8RDG458bDbylu7VotSIpuCdY/ t1aGM7+aaWJ449oFpMxpf0dFybHPLfTn8EbKNaz/WHB6O2QZ+w8ior+cHI7ALK2DadfCzds13JX gNhSiZNjXOOLRw2qNbRbZJtGOOaTd63kzJalqNMhgQBPg0YoDFgLQR1SboRibNFWFwB6cMBJTyi h/qmSueCnLlWp24P9UMxD9W1cA8YPSq7ImNzCPFw== X-Gm-Gg: AR+sD101ytFUrgyhyxZPTQ0Sp7yqcrRH5mR10cRDcj+mVzghy+y7XVf7b2fqeDnYCuQ 17Wd3ovm0ZXRJPgW/MZOBZgHEyEomTopBEsamPcqnUd/DJM8QAdxMoCxiZKGZoFAlm/2/BQV08T rgfMBrLsN5JdxTMuUPle/NG6A6jOCkP0Wg1CESOhFvQZu1YkEPar+nT3SoUwdAueVjB6zSsTnad QI+INK5HZykwknAvr8QACjIIRLjVZ1n/oBJHJHiG5T/eXk5XN5zi716IrRhZgIieExTvJqArMMk 95zSDleX6w1hIq4SCtybaF4xMB78f71CoYrihm5F9R3+vEkmj3y/K92IFEDdPyzI0A== X-Received: by 2002:ac8:58c1:0:b0:51c:2068:a9f8 with SMTP id d75a77b69052e-52d8530d77dmr261827051cf.5.1786998291317; Mon, 17 Aug 2026 13:24:51 -0700 (PDT) X-Received: by 2002:ac8:58c1:0:b0:51c:2068:a9f8 with SMTP id d75a77b69052e-52d8530d77dmr261826611cf.5.1786998290778; Mon, 17 Aug 2026 13:24:50 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 08/10] migration/rdma: Sanity check RDMA_CONTROL_REGISTER_REQUEST chunks Date: Mon, 17 Aug 2026 16:24:22 -0400 Message-ID: <20260817202424.2901438-9-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_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: qemu development 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: 1786998368420158500 Content-Type: text/plain; charset="utf-8" The value received on wire for head.chunks when registering new RDMA regions is not correctly checked. Logically the value can still make ram_chunk_start() (of ram_chunk_end()) to overflow, having a result pointer very small, smaller than RDMALocalBlock.local_host_addr. Add the sanity check. Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4011 Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index 5ce8b06818..bbbc40ea3b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3401,6 +3401,13 @@ int rdma_registration_handle(QEMUFile *f) chunk =3D ram_chunk_index(block->local_host_addr, (uint8_t *) host_addr); chunk_start =3D ram_chunk_start(block, chunk); + if (chunk + reg->chunks > block->nb_chunks) { + error_report("%s: head.chunks contains illegal value" + " (chunk=3D%"PRIu64", chunks=3D%"PRIu64",= " + "nb_chunks=3D%d)", __func__, chunk, + reg->chunks, block->nb_chunks); + goto err; + } chunk_end =3D ram_chunk_end(block, chunk + reg->chunks); /* avoid "-Waddress-of-packed-member" warning */ uint32_t tmp_rkey =3D 0; --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998366; cv=none; d=zohomail.com; s=zohoarc; b=XmQqg3WbBfxW0u0WOoNyvEvbYHeMVV3rcIorTzSGKBD0NHm4VAd/JHR7Ms+75luHp1wGf7DGuaOyWKatrmKhMuGUO7UXgXj67VZbtXKRCx+BsJQ5rYMJEIzCWebWSMMF1hkAd9WM7Tuim/c+G+si0ls65oRNczcSr5EdqSG9SZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998366; 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=z/2cLEJpVnZtTQYgeKgJJ0gnMiImIuK6URdpvYeWWeE=; b=E0hBwdAsA+XijkXCdJFXLXxFtTPkmRgaJ6WMl3dJU5XRHFrbXjbcsio0A/LLM3QFzex3iAYzDNhP/EFDXol3TOtmDt1ZIekhHOf90+NbqItLmTQ/z/kISmaqEGDTm1ucHzstBaBauqCzuV9RMYM0zM7/l/7zxbaaE3FPwzIU29E= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998366428102.37450986855481; Mon, 17 Aug 2026 13:26:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tC-0003ug-Ld; Mon, 17 Aug 2026 16:24:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3tB-0003u6-Dw for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:57 -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 1ww3t9-0002pM-My for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:57 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-2T8cW8KUO3qTBASzZTDk6w-1; Mon, 17 Aug 2026 16:24:53 -0400 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-51a8db414c7so54110101cf.0 for ; Mon, 17 Aug 2026 13:24:53 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998295; 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=z/2cLEJpVnZtTQYgeKgJJ0gnMiImIuK6URdpvYeWWeE=; b=cQblwkD7Mxyy2nkT7LKQViQvU1nfuwUnaeJ2Nm70rRNvNvk7h+ubpuI435DxLllKYrhHE3 PKJ4+L0N3q1yogE3f6NoTPH1eg4Oiq6FTTF6k1P1BGl9TgT+1BjcIrKb7MU25kdMtEjZbZ mVcACjNjTFLS1GV5H54VjERkW+NDBoM= X-MC-Unique: 2T8cW8KUO3qTBASzZTDk6w-1 X-Mimecast-MFC-AGG-ID: 2T8cW8KUO3qTBASzZTDk6w_1786998293 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998293; x=1787603093; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=z/2cLEJpVnZtTQYgeKgJJ0gnMiImIuK6URdpvYeWWeE=; b=NO1XdFN6w6ojlPN0eQkzXtwWPS8MY9A4XVwwHs5W8jj4F7ZfY1p93B46CroC04CJWO iR2GfWNEUL5CgY63MeWBBX5YdGGVQemGEOlif40xHJqEIN+v4gNoe2ZZm3y3ICAhdu6h KjTgmbxt4EZF8rXQcGvJ49bb3KPfoAzA+WeyP6v8oK4s9anGtFP4ysIUUlApf7pZWMCy 9xs3lF8Tqa2MPcO+2RPYizjm6XXwcYEHwF7HsEEI4g9dtgggW1/yoQjo1c1Be8Rx34+R RkYYRV01uxfL8ErpScltS8wUxoUKjV80IqEHRWq4fuSrFWF+Jhx29HDQTqFbBjB7E8Bb Nyhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998293; x=1787603093; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=z/2cLEJpVnZtTQYgeKgJJ0gnMiImIuK6URdpvYeWWeE=; b=Yqmfc5KJ1ECoBSvyMba5rDKhkjyHRQymC40eG7nRkvPzfJSgoYh87yI3bDlwwCzWQH 1kC7ZmXoq7SvEu8m7eVBEooIHDvxktEwbpX5B85THlZKhnurWwpn4IlGfdTew5flSktx cfATohm+gogh2ikLqffLmYc/uGWd+miPxg+lob3WD4EO/Fps/r0o69lTUm4r7kk0daQB C6rmRjMf7QGNDuAnrxOrNfS6EGj5gwp5/ww0h1YNFwG+bFxZmfSE9VYZWU3vAtBUxIXI 3eLb6F3B/5xWzC7IgLVDx7BCfyFTn8sb0cvB/9OJi5Sv8FnWjW6Jse/5YGrqb5Tjuf+h agqA== X-Gm-Message-State: AOJu0YyPQIlDviGirYshJ9IuH0MUeHUriudxO7CsaOS+82RHxYxqzscw h9L4e1cv4tpSv5c7VsRdYJfrAHtfh+5yW1ujRipUbIui5d4D5OMOEP2L1t5i4vSkjp2YeMRAKOK lpE+JopoLEjLcu26m0afh7NaDXhBKnRHBgU5mgjmmrINDb7ejLbfyX1JF/8x9U0yVAcweKc6iDU 5xaFYucLjLGSkPd+yuAibZvaCRHyHppNYkz4MGiA== X-Gm-Gg: AR+sD10j1xjIl1NFKJMsVYYzvnwa7RhQN6s+PIUduxUPg0sc1Nq6H1xaF4xl506UqGM S8Xaz3m4i4fpxRYuYO1M1BpIW+S6bqOvhx6Ae1aFGtvdz09PhafUPFXeI7TUAHB7S4C+o8VuvEa AQ1QWLVHavNI9gDgM99OxUkFaOZ3DYD0qNx2M9CgSjFKhIuollNCy8hGETs0e0UaUlVDlTq05Gs wcyA3i7pLFv+m2OZYSKGBzOgAEyJH8WrzChvYyzBRHFz0/3e2boAJmTTb1DQaLT7EOpaGk3228E Jit1G55Wjh21lfN5N2XSjE7O1gvT4FgKSmhFq7hswa6HMXxQdLS+Ch1wh+fL0ZfOJg== X-Received: by 2002:a05:622a:292:b0:517:6d82:ceff with SMTP id d75a77b69052e-52d853cbab0mr287656251cf.13.1786998292949; Mon, 17 Aug 2026 13:24:52 -0700 (PDT) X-Received: by 2002:a05:622a:292:b0:517:6d82:ceff with SMTP id d75a77b69052e-52d853cbab0mr287655511cf.13.1786998292314; Mon, 17 Aug 2026 13:24:52 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 09/10] migration/rdma: Sanity check upper bound of register MR address Date: Mon, 17 Aug 2026 16:24:23 -0400 Message-ID: <20260817202424.2901438-10-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998368421158500 Content-Type: text/plain; charset="utf-8" Before registration of RDMA ranges, QEMU destination checks for validity of current_addr no less than the target ramblock's start address. But it didn't check for the upper bound to make sure the address is within the size of the ramblock. Add it. Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4007 Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index bbbc40ea3b..13dd60c11b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3389,7 +3389,8 @@ int rdma_registration_handle(QEMUFile *f) goto err; } block =3D &(rdma->local_ram_blocks.block[reg->current_inde= x]); - if (block->offset > reg->current_addr) { + if (block->offset > reg->current_addr || + block->offset + block->length <=3D reg->current_addr) { error_report("rdma: bad register address for block %s" " offset: %" PRIx64 " current_addr: %" PRIx64, block->block_name, block->offset, --=20 2.54.0 From nobody Mon Sep 28 00:10:22 2026 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=1786998332; cv=none; d=zohomail.com; s=zohoarc; b=XYYLXOmgVvAjgTjWV9BHSPTHMCmduDJDr5ZsebGXlQOOH7XVW3FWREoMqzPIgGzLXKuWlk/+cMAuc3/Fr3chHSFN2sqCpWazTxbl3+i7W2mfMLh25YwNBvJwoLUgu+rJvrk6TZ7qNvt+E5GXUKJQ4lrFT+BXNv/ttOHF1Puoe1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786998332; 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=/RDemstICwUKjxsppJmK9PMzf+f0kzlTt3c0ZIH3UWA=; b=OSmK7OP2Nn4EkcxRyEVZ/ubXrwQPLOWUf8y5IjIWObd1y5IhJrOCLfZ1X29tE6dwUvcbPfYP8lcn3qiymslDkqJk1O5Hft2ENav/FtCdG4gGvnS5ZcxCWyxVas2CR4a01c2Rv3nVl7nbyqUB/xAZSN+DceD8RHkSlR/Hq7EtEuw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786998332260372.38249968136324; Mon, 17 Aug 2026 13:25:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ww3tF-0003vM-7c; Mon, 17 Aug 2026 16:25:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ww3tD-0003uj-Am for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:59 -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 1ww3tB-0002pn-MN for qemu-devel@nongnu.org; Mon, 17 Aug 2026 16:24:59 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-0ZsZ6owmOhKL435AwNegZw-1; Mon, 17 Aug 2026 16:24:55 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-52d91cc174aso59848261cf.2 for ; Mon, 17 Aug 2026 13:24:55 -0700 (PDT) Received: from x1.com ([174.91.117.74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52db6136569sm22865761cf.12.2026.08.17.13.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 13:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786998297; 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=/RDemstICwUKjxsppJmK9PMzf+f0kzlTt3c0ZIH3UWA=; b=IIGnwAYJgfjEX0duyjE6FeyRveeIWdavMqyixx6Wqec2t78WAkI7c78X2U4hber0zMyCv6 P1oWbFjvVNxVZxv9elOVb32MRVpbeGeZVestm9KkPA946fP4aVLgEuRtH/ngYL8rs66mQ9 tb7lxL1Oz51EqeWT4VRID6/y8PAcfaw= X-MC-Unique: 0ZsZ6owmOhKL435AwNegZw-1 X-Mimecast-MFC-AGG-ID: 0ZsZ6owmOhKL435AwNegZw_1786998295 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786998295; x=1787603095; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/RDemstICwUKjxsppJmK9PMzf+f0kzlTt3c0ZIH3UWA=; b=PJAW6vHynWCm6SZyQB1/sHzDM1vWTd59Uhm2xZv0ecfzZ5sEe1RbH+YCy8/uJL0Dht 0riWDxseyjsTDKvsoUh65Kviuj5CKJfg7ur9w+nTB9h7DKqhqiWCZoB3FQdDCkbp0aQT 7dybj7zKQ0rAPlaRAxje2Q6pe8u87lwExY1kU51Hidxk+VmKazGdwJYVHSXHtLyO4ERm rtlIIb0Vyz9UEiLnIyDotBXaeSygN4raAs3Q0ZVo/tRhfL5R2X2CoaX9tMsqGboB6ztU LNz5AcVHyNRsbWVCHRDUz9QB787y5jbNJkhlrTATB32jawuuSSzA1XtKRyVeh4i/mKHR e67g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786998295; x=1787603095; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/RDemstICwUKjxsppJmK9PMzf+f0kzlTt3c0ZIH3UWA=; b=WOz5BxxCYLRnpB1b5Ep8Oat/dhKlnVMSxFMUIHpV6b6D2juHIj8340XxuHWA7U6FZO VTmllIB2TtMhy1jlBRq0NVPWNa8NGKjN7tR/r/jKfaQ4aZeg9jBi4BUCNCZQNpyptBKd h+W45wG9JcAxLtQ5Q2V0F1DF3CHYaPpt6KpMkjBshGrWD2iak32VyorsmDjtzaPtac0o Ml17Yqdl/i4bFND0Xz+gdednEH0LIiwoIm7VgOO4NYKrbry3B6FYPV6QBJXMME/ulPdO 7z3qbMLa2K4d6ViiM5n5A2+C8WG8sYwlIQfLLWJ1tAJS9/4jtjUL22XZ6nV8UfWnXECr 5R0A== X-Gm-Message-State: AOJu0Yw3vN4K8PC4KgAVK5h/KnZEfbqU0qAXLvH7IgizB4tvcgkW+ylC /bs48ToXh0eGS7RxT2cwRSU2ANttaClpSkHs5cQ3LQvL6egLNTOUNQLeLczKFE8dCR4M/XEnfWy S/360iMgNj3wJeNLgD+1B+3HfCIHoUUQvBvTICeOKc+FsRgaqmReONZfv8+ahZfq4OWFvKW3/Tl 1DDn/FCwm9pS3wZI69k/MAc5HWFVDUfyugYjeh2Q== X-Gm-Gg: AR+sD13fEKgHyBn7ozUr2BWMZTWypn/cOBcFHxmFQn6l0/VcsVlO1ASH3x72sCmAJlX NsFMK1v653Dh/SQSTwgmZ81m/VwrukXUzUPwNPQ/3IjLQCQwa3n0ZuiSgrC5LFxFo8lD+9Rr7NU mj1NDaojkX016ibhqEal9e2E+FZZub3TCSDvK16eUs+BsZZU+wa3+TrBwYNBFFlKh3L1uFK2kkK 5Shf/9VV3JnkxdTpaPxjwMPNFf0hWwhdyziv4hsh/nhCnY/0LZ+hu/r/jDKxo8FvBEMG+RmnKsb PA/yWZjsAaUlhDbIm2GxbqScodoFgUFbuyOi8unq8bommEXG9g7sHHHRagU4FZcOeA== X-Received: by 2002:a05:622a:1789:b0:51c:981:94a6 with SMTP id d75a77b69052e-52d8542c250mr285285911cf.23.1786998295115; Mon, 17 Aug 2026 13:24:55 -0700 (PDT) X-Received: by 2002:a05:622a:1789:b0:51c:981:94a6 with SMTP id d75a77b69052e-52d8542c250mr285284631cf.23.1786998293687; Mon, 17 Aug 2026 13:24:53 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Li Zhijian , Samuel Zhang , Fabiano Rosas , peterx@redhat.com, Jack Wang , Juraj Marcin , Yanfei Xu Subject: [PATCH 10/10] migration/rdma: Sanity check compress request ranges Date: Mon, 17 Aug 2026 16:24:24 -0400 Message-ID: <20260817202424.2901438-11-peterx@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260817202424.2901438-1-peterx@redhat.com> References: <20260817202424.2901438-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=lists1p.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.343, 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_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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: 1786998334333158500 Content-Type: text/plain; charset="utf-8" The offset/length ranges are not sanity checked in RDMA requests, add the checks. Reported-by: Tristan (@TristanInSec) Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4005 Signed-off-by: Peter Xu Reviewed-by: Jack Wang --- migration/rdma.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 13dd60c11b..699aaa9903 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3200,6 +3200,28 @@ static int dest_ram_sort_func(const void *a, const v= oid *b) return (a_index < b_index) ? -1 : (a_index !=3D b_index); } =20 +static bool rdma_compress_range_check(RDMALocalBlock *block, + RDMACompress *comp) +{ + uint64_t block_end =3D block->offset + block->length; + uint64_t comp_end; + + if (uadd64_overflow(comp->offset, comp->length, &comp_end)) { + goto fail; + } + + if (comp->offset < block->offset || comp_end > block_end) { + goto fail; + } + + return true; +fail: + error_report("%s: compress request range outside range" + " (block=3D%s, offset=3D%"PRIu64", length=3D%"PRIu64")", + __func__, block->block_name, comp->offset, comp->length); + return false; +} + /* * During each iteration of the migration, we listen for instructions * by the source VM to perform dynamic page registrations before they @@ -3279,7 +3301,9 @@ int rdma_registration_handle(QEMUFile *f) goto err; } block =3D &(rdma->local_ram_blocks.block[comp->block_idx]); - + if (!rdma_compress_range_check(block, comp)) { + goto err; + } host_addr =3D block->local_host_addr + (comp->offset - block->offset); if (comp->value) { --=20 2.54.0