From patchwork Wed Oct 9 12:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E380CEDD93 for ; Wed, 9 Oct 2024 12:43:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1k-0004iW-7R; Wed, 09 Oct 2024 08:42:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1h-0004ho-SK for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:49 -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 1syW1g-0005Qv-2f for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477767; 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=XQt31NpoPy1kBmextgAReCNHDW1SSJ1uheANHNAwqA8=; b=a5Mgr6hna2dB/llbKsX+6O8qlrCwwmLrF/NyPWhXSk9dPO8H8JUo0nr4Ax+uQJdaNaqHut QQuirSKXdVOjmcLdUjGPdC2spEPEjzZQhF/WMhtMYWzNhRHEAai31xOLBZ2gr5RNgZIATS /VVrClXtdIc1rFzxE0azubqHkgoWKMw= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-297-EDqaR26GMfuZOmhGzLohXA-1; Wed, 09 Oct 2024 08:42:44 -0400 X-MC-Unique: EDqaR26GMfuZOmhGzLohXA-1 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-82cd83f0b2eso712611939f.2 for ; Wed, 09 Oct 2024 05:42:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477763; x=1729082563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XQt31NpoPy1kBmextgAReCNHDW1SSJ1uheANHNAwqA8=; b=w2KXdjJ4npJYn6bpBxNEvLLM6GRJPBMvRau/ygXi3/2oZenL9/Z/yxtJcqF5YSllmi n+SwVs8Ya2YQ3sLOb61MMyeP8sftyuBSj1zqHcbUUb4QcO3d/yAqqyuBavErNKXpfCqD 3dRXKerX5XRWxmD2wtZ/vasuPSNIAodD7xyVK/wLGfUCH4i8OsJk/mYsbEQLDgOedy3c n3wVPuf/d0UbIoGIPY3qDeOR3q9f/jKDlZwbioZXPLazMDpkY9CwllGCS3bvdDTAO/Yt un2o11S5zQHdNO1X3crM/Zx5o7BzPrIDbNZef3CNJJVZHYeNgFUABfiTh6QoS3Lf44dA 3zww== X-Gm-Message-State: AOJu0YzVv9bLr8PiCwVmZzX1LkSUJqYKcusuRtrAIHIoF4p6qsg6K3g6 uMD41YtdTCW+dc48G6PEzHaY0RSDqqBwM3HM82/zQwuTBHFuUYgT2fIsCDBXvcfpalKV9wQ+cEj +aUOn1opRpyVrCFiAMAJGSUXMi1iMJSUEPye/vgoGJaxqRFXsrCzdqQMEosPkpe5VqHKSOj5GM/ pM+2WUfn7g/IRVme5u2D6fmYr5VPJ4eDATug== X-Received: by 2002:a05:6602:634c:b0:835:444b:6195 with SMTP id ca18e2360f4ac-835444b6394mr116201839f.14.1728477763149; Wed, 09 Oct 2024 05:42:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMSa2FsTMWN2FK2YGvoOW+MMGKxTusV922goBugNpfYw+prMZ0kJvuRsgvymmt7QWIiva++Q== X-Received: by 2002:a05:6602:634c:b0:835:444b:6195 with SMTP id ca18e2360f4ac-835444b6394mr116199039f.14.1728477762748; Wed, 09 Oct 2024 05:42:42 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:41 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, Ani Sinha , Paolo Bonzini Subject: [PULL 01/12] memory: notify hypervisor of all eventfds during listener (de)registration Date: Wed, 9 Oct 2024 08:42:27 -0400 Message-ID: <20241009124238.371084-2-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Ani Sinha When a new listener for an address space is registered, the hypervisor must be informed of all existing eventfds for that address space by calling eventfd_add() for that listener. Similarly, when a listener is de-registered from an address space, the hypervisor must be informed of all existing eventfds for that address space with a call to eventfd_del(). Same is also true for coalesced io. Send coalesced io add/del listener notifications if any flatrage for the address space registered with the listener intersects with any coalesced io range. Suggested-by: Paolo Bonzini Signed-off-by: Ani Sinha Link: https://lore.kernel.org/r/20240918064853.30678-1-anisinha@redhat.com Signed-off-by: Peter Xu --- system/memory.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/system/memory.c b/system/memory.c index f6f6fee6d8..85f6834cb3 100644 --- a/system/memory.c +++ b/system/memory.c @@ -941,6 +941,38 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) } } +static void +flat_range_coalesced_io_notify_listener_add_del(FlatRange *fr, + MemoryRegionSection *mrs, + MemoryListener *listener, + AddressSpace *as, bool add) +{ + CoalescedMemoryRange *cmr; + MemoryRegion *mr = fr->mr; + AddrRange tmp; + + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { + tmp = addrrange_shift(cmr->addr, + int128_sub(fr->addr.start, + int128_make64(fr->offset_in_region))); + + if (!addrrange_intersects(tmp, fr->addr)) { + return; + } + tmp = addrrange_intersection(tmp, fr->addr); + + if (add && listener->coalesced_io_add) { + listener->coalesced_io_add(listener, mrs, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } else if (!add && listener->coalesced_io_del) { + listener->coalesced_io_del(listener, mrs, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } + } +} + static void address_space_update_topology_pass(AddressSpace *as, const FlatView *old_view, const FlatView *new_view, @@ -3015,8 +3047,10 @@ void memory_global_dirty_log_stop(unsigned int flags) static void listener_add_address_space(MemoryListener *listener, AddressSpace *as) { + unsigned i; FlatView *view; FlatRange *fr; + MemoryRegionIoeventfd *fd; if (listener->begin) { listener->begin(listener); @@ -3041,10 +3075,34 @@ static void listener_add_address_space(MemoryListener *listener, if (listener->region_add) { listener->region_add(listener, §ion); } + + /* send coalesced io add notifications */ + flat_range_coalesced_io_notify_listener_add_del(fr, §ion, + listener, as, true); + if (fr->dirty_log_mask && listener->log_start) { listener->log_start(listener, §ion, 0, fr->dirty_log_mask); } } + + /* + * register all eventfds for this address space for the newly registered + * listener. + */ + for (i = 0; i < as->ioeventfd_nb; i++) { + fd = &as->ioeventfds[i]; + MemoryRegionSection section = (MemoryRegionSection) { + .fv = view, + .offset_within_address_space = int128_get64(fd->addr.start), + .size = fd->addr.size, + }; + + if (listener->eventfd_add) { + listener->eventfd_add(listener, §ion, + fd->match_data, fd->data, fd->e); + } + } + if (listener->commit) { listener->commit(listener); } @@ -3054,8 +3112,10 @@ static void listener_add_address_space(MemoryListener *listener, static void listener_del_address_space(MemoryListener *listener, AddressSpace *as) { + unsigned i; FlatView *view; FlatRange *fr; + MemoryRegionIoeventfd *fd; if (listener->begin) { listener->begin(listener); @@ -3067,10 +3127,33 @@ static void listener_del_address_space(MemoryListener *listener, if (fr->dirty_log_mask && listener->log_stop) { listener->log_stop(listener, §ion, fr->dirty_log_mask, 0); } + + /* send coalesced io del notifications */ + flat_range_coalesced_io_notify_listener_add_del(fr, §ion, + listener, as, false); if (listener->region_del) { listener->region_del(listener, §ion); } } + + /* + * de-register all eventfds for this address space for the current + * listener. + */ + for (i = 0; i < as->ioeventfd_nb; i++) { + fd = &as->ioeventfds[i]; + MemoryRegionSection section = (MemoryRegionSection) { + .fv = view, + .offset_within_address_space = int128_get64(fd->addr.start), + .size = fd->addr.size, + }; + + if (listener->eventfd_del) { + listener->eventfd_del(listener, §ion, + fd->match_data, fd->data, fd->e); + } + } + if (listener->commit) { listener->commit(listener); } From patchwork Wed Oct 9 12:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B44C8CEDD8F for ; Wed, 9 Oct 2024 12:43:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1i-0004i4-VD; Wed, 09 Oct 2024 08:42:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1h-0004hg-Ea for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:49 -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 1syW1f-0005Qs-MC for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477767; 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=3dP5VLpH/CdfMrO+j/wA9qzkuALnn3Rt2eGfiqdxtHY=; b=TMrBt3PJ/7PC5kWdjrw0CZyxhutrCp/6l2LfA7m3modMfjtzKKo4klR9EJorGqNf42DZFB bAHfURCIIgzx/CP3yvIWCS7VkStevktVJD2ATPbCXjR3KW7virSIex+b0mLywMBmLavpIT /vRRcjGcTbtkdssfNWX3mkneV+IqbXw= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-8UTeEMiRN6-_Nh8eELdQCA-1; Wed, 09 Oct 2024 08:42:46 -0400 X-MC-Unique: 8UTeEMiRN6-_Nh8eELdQCA-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-835428b766dso46664839f.2 for ; Wed, 09 Oct 2024 05:42:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477765; x=1729082565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3dP5VLpH/CdfMrO+j/wA9qzkuALnn3Rt2eGfiqdxtHY=; b=DY2h+yPqzTNdClKzYq7qJ7qzs8u/1/nYN0jbYD8F0wuVhle0ihZR5gaFsM5IIMc5q6 vuc9cLctpSstlv8dolHZKStqW/cp5oVtv8cFuhSwEKjGdsg9TTWJdRuGtlsy/ifw7Y3p eKoTkWuXvf/SszdRhSPlpfoTC4wkw3sVF03g7ck1K5smCyGyW/jHsJx1S9lcXaxuJAuq 4kkj52HjNtwgf0FQ5x6rbxCjazsw66Y2OXeZh1D17TmmKPeu2/XvFcRZwfEAARV/2Wre 8oa1gVXdY/gvEDz813q3EUBJOwYQA0ri/t075xmQrzTRz7BSR8NFas0dF4G3gNxQ2eQl 4iFg== X-Gm-Message-State: AOJu0YwCfai2OvqO5HemqTaX92yXhtXSNLrlNtwrm0je1/wihp1OLhOj p5hVl/8C5i5BHHk8fcXzhVT5nXuNfT7s4UzPjjuEx3dPsR7xUEY4vXFaSSUIu41rifFcStjv+L8 Tni64znXN2kiyJuFBAR0M9AneDapOAsTJpg6ewRw5HBDzQ0x8H6tNvyDb9a0AD7ZAX6X1v1U/hg zkXSBMvJEIaggI1EuF7ta3sogZ/NxawCYsgA== X-Received: by 2002:a05:6602:6b07:b0:832:40d0:902a with SMTP id ca18e2360f4ac-8353d4a294bmr302685939f.6.1728477765096; Wed, 09 Oct 2024 05:42:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwjy2fxISajlh32nV/U7MGRfMgnrbid48+PkBRgkRJpAT5yUqjLydvqLrZl7XaxQUUj/xdpg== X-Received: by 2002:a05:6602:6b07:b0:832:40d0:902a with SMTP id ca18e2360f4ac-8353d4a294bmr302683139f.6.1728477764634; Wed, 09 Oct 2024 05:42:44 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:43 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com Subject: [PULL 02/12] migration/multifd: Ensure packet->ramblock is null-terminated Date: Wed, 9 Oct 2024 08:42:28 -0400 Message-ID: <20241009124238.371084-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fabiano Rosas Coverity points out that the current usage of strncpy to write the ramblock name allows the field to not have an ending '\0' in case idstr is already not null-terminated (e.g. if it's larger than 256 bytes). This is currently harmless because the packet->ramblock field is never touched again on the source side. The destination side reads only up to the field's size from the stream and forces the last byte to be 0. We're still open to a programming error in the future in case this field is ever passed into a function that expects a null-terminated string. Change from strncpy to QEMU's pstrcpy, which puts a '\0' at the end of the string and doesn't fill the extra space with zeros. (there's no spillage between iterations of fill_packet because after commit 87bb9e953e ("migration/multifd: Isolate ram pages packet data") the packet is always zeroed before filling) Resolves: Coverity CID 1560071 Reported-by: Peter Maydell Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240919150611.17074-1-farosas@suse.de Signed-off-by: Peter Xu --- migration/multifd-nocomp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/multifd-nocomp.c b/migration/multifd-nocomp.c index 07c63f4a72..55191152f9 100644 --- a/migration/multifd-nocomp.c +++ b/migration/multifd-nocomp.c @@ -17,6 +17,7 @@ #include "multifd.h" #include "options.h" #include "qapi/error.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "trace.h" @@ -201,7 +202,8 @@ void multifd_ram_fill_packet(MultiFDSendParams *p) packet->zero_pages = cpu_to_be32(zero_num); if (pages->block) { - strncpy(packet->ramblock, pages->block->idstr, 256); + pstrcpy(packet->ramblock, sizeof(packet->ramblock), + pages->block->idstr); } for (int i = 0; i < pages->num; i++) { From patchwork Wed Oct 9 12:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828330 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D93CCCEDD8F for ; Wed, 9 Oct 2024 12:44:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1m-0004iv-Kg; Wed, 09 Oct 2024 08:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1k-0004iV-6A for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:52 -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 1syW1i-0005Rc-Lf for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477770; 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=jSrTZ5PyIp+y/7h2oJbsCMlzTXaX6rgV2rodQaLvIWo=; b=LfP0FNGKwqIdzeu09z2AS4p0ZoYtJOQ3hC6n3RZmtr9loCO6FnuDOayRD2x68ha5d17331 7nhq/rkBRH0Prf9OQLexAWTq8LrQAxUlg+qdjI545/pFbh2JRRuefcRlDFIe4SLYfxe87g piFFC76Z3fyK4Ct7ExIYYC7tzvdfHjc= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-41-woXH5DhPOkK0YNbAKJSl_Q-1; Wed, 09 Oct 2024 08:42:48 -0400 X-MC-Unique: woXH5DhPOkK0YNbAKJSl_Q-1 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-8353d85fc5bso90994139f.1 for ; Wed, 09 Oct 2024 05:42:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477767; x=1729082567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jSrTZ5PyIp+y/7h2oJbsCMlzTXaX6rgV2rodQaLvIWo=; b=Km4IrLx5Znxp7FwYH+g6934TujLYmcQ5e8J/LhZg7HeHGhixdfRb65Wbc0ZnMOt5kX 5WbJT3XHQvGdFU7Dp2mNqG1HBfAXpgQnLmUxiPr1+dtG2wntrDFsldhqD6TL2mO2cHLZ yhO60O9O1XhiFpOHafNIIBODvSirdFNeJGxD9MTLnKIpEJRDMP/33j8OnumIRsHmrJRu SRHeEEc6MX2ChAFYeA2QL/L6G9xHnPV0M0X7+Fv7XWpr3bYSvD2m8nU9sAfDCW/Sj3UK YjY40NWDd3gME5nm/X7Avk69M/CQaDTkvxilLdZtj0qOlWXDRA9meGVdrvmDMMp33IC1 Z+aw== X-Gm-Message-State: AOJu0Yzgf0uSFJ5YxqRLOgNyPdteCdxu5eDgB7ftHHoRBO7wt4TrEPqH l4IQkVwP0O4DZgOe78nb6ri61EyJaVfrVoRGCw+9WzxR9YAngWB5/2Z5P1BXOBYanVGapPhhA51 MjRlZm+s5601uDZ3L8Q9v0UNFHynZeYNgnfySKiwQclWb4cnvVDpkMIWsUzN6L9uGWHZnRYyl5a y6+AAruL3GaIxXtOPTA/c+BXxQEcOthsyKtA== X-Received: by 2002:a05:6602:1595:b0:82c:bdec:1c0e with SMTP id ca18e2360f4ac-8353d378d0cmr246749739f.2.1728477766793; Wed, 09 Oct 2024 05:42:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpypbmveO/15wJzQiiV5f8btY+IXUL1ItykcAGCz313DXu/lwvl5Vl1GBnfVOI9x47LbpLaQ== X-Received: by 2002:a05:6602:1595:b0:82c:bdec:1c0e with SMTP id ca18e2360f4ac-8353d378d0cmr246747039f.2.1728477766274; Wed, 09 Oct 2024 05:42:46 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:45 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 03/12] migration: Remove migrate_cap_set Date: Wed, 9 Oct 2024 08:42:29 -0400 Message-ID: <20241009124238.371084-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" migrate_cap_set has been unused since 18d154f575 ("migration: Remove 'blk/-b' option from migrate commands") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240919134626.166183-2-dave@treblig.org Signed-off-by: Peter Xu --- migration/options.h | 1 - migration/options.c | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/migration/options.h b/migration/options.h index a0bd6edc06..36e7b3723f 100644 --- a/migration/options.h +++ b/migration/options.h @@ -58,7 +58,6 @@ bool migrate_tls(void); /* capabilities helpers */ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); -bool migrate_cap_set(int cap, bool value, Error **errp); /* parameters */ diff --git a/migration/options.c b/migration/options.c index 147cd2b8fd..9460c5dee9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -605,26 +605,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) return true; } -bool migrate_cap_set(int cap, bool value, Error **errp) -{ - MigrationState *s = migrate_get_current(); - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running()) { - error_setg(errp, "There's a migration process in progress"); - return false; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - new_caps[cap] = value; - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return false; - } - s->capabilities[cap] = value; - return true; -} - MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL, **tail = &head; From patchwork Wed Oct 9 12:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A0BECEDD89 for ; Wed, 9 Oct 2024 12:44:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1m-0004iu-HN; Wed, 09 Oct 2024 08:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1l-0004ik-MV for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:53 -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 1syW1k-0005Ru-5n for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477771; 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=iNbystHyQfpG9zdYMm/IbZBExIkcr+7+jlbR55DWaDg=; b=bgGa3+edro5C/7V3cxoACOZl4tNlptbfnELZhySUEAvCOSNRRovQmW/we0fHlMoB1Xxg/o ENM8x5Ab5u38UfwvkhuXc73v/4L3Tu/joc9yupT6zvnK4gkrnr0DzDQz5RI49CriP1lShu 6h7klgnOa7KsAHg568J0+QuNI9BaoZQ= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-Vwbz1t1qPsOfcjSys4hjCQ-1; Wed, 09 Oct 2024 08:42:50 -0400 X-MC-Unique: Vwbz1t1qPsOfcjSys4hjCQ-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-835439ecbd3so37324639f.1 for ; Wed, 09 Oct 2024 05:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477768; x=1729082568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iNbystHyQfpG9zdYMm/IbZBExIkcr+7+jlbR55DWaDg=; b=vvUFQHrvZzM3Wbq0NCWuv0VivtbqhQnyfj/JQTo0zM9RUI17jrfuB1k7lIi76RitGm 7MEkXAjpMiyi4ZjMD9BekkI9JOasf1/mcJJiWI/Ah/1QkU+XZ6BeNXAlcKWwv0Is7wVU 8RAsJ/5lPzKOx8JZDzo89x9IaMQc9qNdYzeD8j+cKqIG9kt7yBGBu7GHANTmTJGFdyxQ Aus8qDPyHrpZy1flYBPWn7uCpuNmMEmXJstAmH9jvbRUf0FDRtFkKb2KIGKzIljvQhHZ Tsf697qp8ujHvaos3Ib27gXcCjwnJILFiqftleQ4sGBiKeCVpV/o0pG5UBqZHvqt7vhH JC9w== X-Gm-Message-State: AOJu0YzKnxCNQd0OP23+QsssiTNcethazWGRdAuitmQmZlzvOIFK2Wb+ BKsTgv4wS4axfhqWyxtxGbXIQOipzvT8UfKucVG5QS38QdR2nty1YgGogtkFiZEti1+llTyybs2 DhwVDL2x2wXgEsM3yiVA4ozOBQ91ugXzxSUUpwhvigslHotuD1G8qm3SnBmSRs6EcbuNFayj8Aa JezRD2LgzZclUU3BGFFsLIVI3akLIdfQuTOQ== X-Received: by 2002:a05:6602:148d:b0:81f:75bf:6570 with SMTP id ca18e2360f4ac-8353d4a3b07mr228901939f.5.1728477768375; Wed, 09 Oct 2024 05:42:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENlNaV1R1A1VuGrBVbAxUhZF4hpbLmYToSTtwgeVsAdY+lrDV+0KUmwe0au+/CrpyEeXnQ8g== X-Received: by 2002:a05:6602:148d:b0:81f:75bf:6570 with SMTP id ca18e2360f4ac-8353d4a3b07mr228897639f.5.1728477767895; Wed, 09 Oct 2024 05:42:47 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:47 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 04/12] migration: Remove unused migrate_zero_blocks Date: Wed, 9 Oct 2024 08:42:30 -0400 Message-ID: <20241009124238.371084-5-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" migrate_zero_blocks is unused since eef0bae3a7 ("migration: Remove block migration") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20240919134626.166183-3-dave@treblig.org Signed-off-by: Peter Xu --- migration/options.h | 1 - migration/options.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/migration/options.h b/migration/options.h index 36e7b3723f..79084eed0d 100644 --- a/migration/options.h +++ b/migration/options.h @@ -40,7 +40,6 @@ bool migrate_release_ram(void); bool migrate_return_path(void); bool migrate_validate_uuid(void); bool migrate_xbzrle(void); -bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); /* diff --git a/migration/options.c b/migration/options.c index 9460c5dee9..6f549984cb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -339,13 +339,6 @@ bool migrate_xbzrle(void) return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } -bool migrate_zero_blocks(void) -{ - MigrationState *s = migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; -} - bool migrate_zero_copy_send(void) { MigrationState *s = migrate_get_current(); From patchwork Wed Oct 9 12:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70E31CEDD8F for ; Wed, 9 Oct 2024 12:45:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1o-0004jM-NH; Wed, 09 Oct 2024 08:42:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1n-0004jB-Lw for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:55 -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 1syW1l-0005SI-Uf for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477773; 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=jk0pKj9VCu3al6N68FkKLk/v4exRbcGJT+XXNWXH8Sw=; b=C5xjV+l83RMiEfqfjLBIFIUlY/SRRyIga6QI5pOgYfGV29+pUPKRg6C/V2gcEKk0nYTMmt PwLNoKSl8YyOyjtxwxPRwZO+jI+h2DDvZZoEzql6o+lAAQwQDwosBuW4yisvj9FwqxsdN9 s70bVk77Rc2ejtmOExe40emHVzeazco= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-9w0rMEd-OMic_2vnroH6cA-1; Wed, 09 Oct 2024 08:42:52 -0400 X-MC-Unique: 9w0rMEd-OMic_2vnroH6cA-1 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-82cdb749559so1175908439f.2 for ; Wed, 09 Oct 2024 05:42:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477770; x=1729082570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jk0pKj9VCu3al6N68FkKLk/v4exRbcGJT+XXNWXH8Sw=; b=VzBgTCSMmpQwHpjBrIB8MNFapAfacIBU63/F8Gzvi4PR+cD4xO3IaxGAxQL207HKW+ S0PWwvPuwycMvoT2DC/KZscgL4oGRPEIJQIX7gPkcf3vylapJzYGst/9VQ9Rh0WcNeiU 8baBAc11zEBq2j5vD+0qRiBjt4YrXuuqH7LvLgKREE8bsuUwkuiqDIZ1TnRhjvle+K49 Pu82fgFWTqVs0pT2iZLEwq3OrCsknv3iQ8UhQuAe4D5xFH68nJ7MAqUMHbDscfvrZG+p CotSG3IxPZKi8r8AVaKwQ0b3upBQbn/wAnS5mE3BxBqPCcUL4wLAd2FTz/fAb9jsm5uF dIJQ== X-Gm-Message-State: AOJu0YwmcfAZM98/zBSToX2IOqWeLmd7fa4pdBsEK0MoS9ba5HHaS8Z9 yoYjypGkAD5N3oLJfqVThT07pcuIL0rdD3wr3BNBhyYVmQwvcYoV7ZOuG1QIcyMNnKoz05+tW6S H840j1OhoMmsU18fIQouXgAjWDNlldvAW408zgP60kMG32CKiUY/+tlO4FJ5Q3Be2xNC6xqtYm8 WmQAOYNBihR2VZK2RGbKaak/5o68+5yBZtiA== X-Received: by 2002:a05:6602:6c04:b0:835:42ce:933d with SMTP id ca18e2360f4ac-83542ce9439mr127156239f.1.1728477770594; Wed, 09 Oct 2024 05:42:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPihQ1fnKB662fomcWUObYdo/c2JzIDukLZHlNaqfEiNJJ63s+y5HaNwDhBeNP+6VanGR2mQ== X-Received: by 2002:a05:6602:6c04:b0:835:42ce:933d with SMTP id ca18e2360f4ac-83542ce9439mr127152639f.1.1728477770098; Wed, 09 Oct 2024 05:42:50 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:48 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com Subject: [PULL 05/12] migration: Deprecate zero-blocks capability Date: Wed, 9 Oct 2024 08:42:31 -0400 Message-ID: <20241009124238.371084-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fabiano Rosas The zero-blocks capability was meant to be used along with the block migration, which has been removed already in commit eef0bae3a7 ("migration: Remove block migration"). Setting zero-blocks is currently a noop, but the outright removal of the capability would cause and error in case some users are still setting it. Put the capability through the deprecation process. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20240919134626.166183-4-dave@treblig.org Signed-off-by: Peter Xu --- docs/about/deprecated.rst | 6 ++++++ qapi/migration.json | 5 ++++- migration/options.c | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index c02bbb66f7..33ce4f9536 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -467,3 +467,9 @@ usage of providing a file descriptor to a plain file has been deprecated in favor of explicitly using the ``file:`` URI with the file descriptor being passed as an ``fdset``. Refer to the ``add-fd`` command documentation for details on the ``fdset`` usage. + +``zero-blocks`` capability (since 9.2) +'''''''''''''''''''''''''''''''''''''' + +The ``zero-blocks`` capability was part of the block migration which +doesn't exist anymore since it was removed in QEMU v9.1. diff --git a/qapi/migration.json b/qapi/migration.json index b66cccf107..3af6aa1740 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -479,11 +479,14 @@ # Features: # # @unstable: Members @x-colo and @x-ignore-shared are experimental. +# @deprecated: Member @zero-blocks is deprecated as being part of +# block migration which was already removed. # # Since: 1.2 ## { 'enum': 'MigrationCapability', - 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', + 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', + { 'name': 'zero-blocks', 'features': [ 'deprecated' ] }, 'events', 'postcopy-ram', { 'name': 'x-colo', 'features': [ 'unstable' ] }, 'release-ram', diff --git a/migration/options.c b/migration/options.c index 6f549984cb..ad8d6989a8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -450,6 +450,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) ERRP_GUARD(); MigrationIncomingState *mis = migration_incoming_get_current(); + if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) { + warn_report("zero-blocks capability is deprecated"); + } + #ifndef CONFIG_REPLICATION if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { error_setg(errp, "QEMU compiled without replication module" From patchwork Wed Oct 9 12:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D34AECEDD89 for ; Wed, 9 Oct 2024 12:43:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1p-0004jV-VM; Wed, 09 Oct 2024 08:42:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1p-0004jN-4A for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42: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 1syW1n-0005Sd-2y for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477774; 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=y/0kDNEZEHcHY+mJQf631i4X5DtZp/zqgZgP9eV3P4g=; b=NQ5YuJUQQUMnlDZB3U8pVe9iuqvBZqnh7hkPYKYJxO5wFcYBz6JG4Pn05AfOzbbuVKLov6 Dy9GiIpAnkKcjD45m1a72YEK+S66QEnTxTWSbNwpOdIyfmtT0ZnFJf/IotkrpWGoI9/9du PwCDsvc/1uDyHXOT7rx/pOVbUPsGw6s= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-6TsXy6sfOBa6X7zAQjtOmw-1; Wed, 09 Oct 2024 08:42:53 -0400 X-MC-Unique: 6TsXy6sfOBa6X7zAQjtOmw-1 Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-82ced069d94so638574639f.0 for ; Wed, 09 Oct 2024 05:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477772; x=1729082572; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y/0kDNEZEHcHY+mJQf631i4X5DtZp/zqgZgP9eV3P4g=; b=lQJ3jpAfbJnDWJLYrkHrCWwMWPV5EE9aqaAB06+hEkEv424rXk3nif+8jn1tYBtR7C EJjh8EPpBLG/Gqs5fpO2yYZQlHguVAQdpoS4N9H/NArHoyUmNN+kqh63ZyKNbA523fzc /rDrl31IK/JCY+uMAR/2YUWneTzMclkoQjvdGv/9z0BSOoY1MoT2McAr/iLL+9vQ0skA DX6+W18V0fTVMLcZhQ3dBF7sNZmXjU8vphqn9XCXkKp0dwLxGIetgIEHKBtJyHD8tWx4 8+f041UhZIqfG77fmRb93bAXhMCkJtkD7Lx79TkLniY7d3Xlc4itFv5+TbC9/5aPdyt2 XG7w== X-Gm-Message-State: AOJu0YxT0fbLtYLCjd7+gzYM3IOWaOKP6AoGLlK7NHHXsKILKYUeKra9 COAZt9UOv4kq9CykJciiM+flHCq4iuJyeNhNzktGPY2wprlkJIPIuI5hfoLqhnaHwKrl64h/Y9A H56X6m3Y30/Pp5UzSbGGLbkQFci2XPUkci6v7ais6rFrK5veNTwPmLje3QvuPYFyBoc36YI5kwX AXdVcQ/vtNjueZ8fokIZ2DZdBHv5Oa2+kXUw== X-Received: by 2002:a05:6602:2b83:b0:834:f744:d067 with SMTP id ca18e2360f4ac-8353d4a7cdamr298917939f.8.1728477772430; Wed, 09 Oct 2024 05:42:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6H/uWXP97Zaa7s2yDrynU93ec9ZX+eQE1V3QcJlP4ZilTQQlWrAhVddifAnr37JCd0+MmJg== X-Received: by 2002:a05:6602:2b83:b0:834:f744:d067 with SMTP id ca18e2360f4ac-8353d4a7cdamr298914939f.8.1728477772015; Wed, 09 Oct 2024 05:42:52 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:51 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 06/12] migration: Remove unused socket_send_channel_create_sync Date: Wed, 9 Oct 2024 08:42:32 -0400 Message-ID: <20241009124238.371084-7-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" socket_send_channel_create_sync only use was removed by d0edb8a173 ("migration: Create the postcopy preempt channel asynchronously") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240919134626.166183-5-dave@treblig.org Signed-off-by: Peter Xu --- migration/socket.h | 1 - migration/socket.c | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/migration/socket.h b/migration/socket.h index 46c233ecd2..04ebbe95a1 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -22,7 +22,6 @@ #include "qemu/sockets.h" void socket_send_channel_create(QIOTaskFunc f, void *data); -QIOChannel *socket_send_channel_create_sync(Error **errp); void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); diff --git a/migration/socket.c b/migration/socket.c index 9ab89b1e08..5ec65b8c03 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -42,24 +42,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data) f, data, NULL, NULL); } -QIOChannel *socket_send_channel_create_sync(Error **errp) -{ - QIOChannelSocket *sioc = qio_channel_socket_new(); - - if (!outgoing_args.saddr) { - object_unref(OBJECT(sioc)); - error_setg(errp, "Initial sock address not set!"); - return NULL; - } - - if (qio_channel_socket_connect_sync(sioc, outgoing_args.saddr, errp) < 0) { - object_unref(OBJECT(sioc)); - return NULL; - } - - return QIO_CHANNEL(sioc); -} - struct SocketConnectData { MigrationState *s; char *hostname; From patchwork Wed Oct 9 12:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9332CEDD8F for ; Wed, 9 Oct 2024 12:44:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1u-0004kw-GI; Wed, 09 Oct 2024 08:43:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1r-0004kB-Up for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:00 -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 1syW1q-0005TU-52 for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:42:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477777; 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=EPwjO7n6gAxf8tb/k3NaSmBNEtRkZrTncHigcs6P44U=; b=c0zplawT36t1l84y/EZFVWLT4cUp6KUebMMkh60N140gcjPFS+m6jlJqpSn5aXGkSiKCyY AAawi3+kpRjrPYo5TGkzEGYGmqeV5MwDah09zOg7ugacZlgsLfW9lVEY3YrBTvYHozk/ja 9Xnf7dKJJxNCsTX0eIfe4z7AIUsbzUg= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-vRqT1UQSMoCRoKoz0ZaA1Q-1; Wed, 09 Oct 2024 08:42:56 -0400 X-MC-Unique: vRqT1UQSMoCRoKoz0ZaA1Q-1 Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-83544f524ebso33396839f.3 for ; Wed, 09 Oct 2024 05:42:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477774; x=1729082574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EPwjO7n6gAxf8tb/k3NaSmBNEtRkZrTncHigcs6P44U=; b=GQYAhRU7EEU5aZpTAk0JB6FyVFOuqcZ300AKNzdAvBYBwHhWv3GmxKhs0TGb8bnMkw pZj+HYbtCGQOnxORJkcuqrsPsXGyV2IuVDSjcC/m5VgONH6Eb1G1gwDIoxyRx8HrQiS8 fOGBaAXz0ci61bUsDh4LwHYeYp2NQknPBF8gYlplRGFKFWqoFV/wG4pg/koZrm3ImJaS kQmvgRbWsMfmoM9vqfyhXlFZSpuGkTfsVIkpFzRt7CCih0ZFZDK8iX25wluG8uYqP5zA YNtxlMW3qLbfMyzgChDVdCwztwg9hXkxg1Azl+casMqZ9QeSUedkelyi3eu5LI6LpvVd PttQ== X-Gm-Message-State: AOJu0YxZEHPRS6DoP2XVipUkWKeQlign7QUEQKpcv7eKYDhfnM0QWZiQ Ox6L4AxgX66mekpYFkxzcMNjh84CzTczAKZstbDK+uoh/46eQlzt54eT8NIwkcB3WQEQA6X5DAd 2LKMhTq/AHZnJQVIJgkhYfaqmJU5TL6tGkVPIVLrlOEYhDpxK36eON/6pa/FfnWFvLj8FcPMlRJ ERrsZxkPQfwRgahX5v6MCAZ2rTmmmxWGzHpQ== X-Received: by 2002:a05:6602:1554:b0:82c:f30d:fc72 with SMTP id ca18e2360f4ac-8353d4824demr181280239f.2.1728477774476; Wed, 09 Oct 2024 05:42:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtG12tdST9qX1w8USus5SfYTeOHD396wropQBAOzggQ9fkcTVcO4uKZYA6o/8ZcLVJV5WS3A== X-Received: by 2002:a05:6602:1554:b0:82c:f30d:fc72 with SMTP id ca18e2360f4ac-8353d4824demr181276639f.2.1728477773863; Wed, 09 Oct 2024 05:42:53 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:52 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 07/12] util/userfaultfd: Return -errno on error Date: Wed, 9 Oct 2024 08:42:33 -0400 Message-ID: <20241009124238.371084-8-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" Convert (the currently unused) uffd_wakeup, uffd_copy_page and uffd_zero_page to return -errno on error rather than -1. That will make it easier to reuse in postcopy. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20240919134626.166183-6-dave@treblig.org Signed-off-by: Peter Xu --- util/userfaultfd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/util/userfaultfd.c b/util/userfaultfd.c index 1b2fa949d4..518d5c3586 100644 --- a/util/userfaultfd.c +++ b/util/userfaultfd.c @@ -240,7 +240,7 @@ int uffd_change_protection(int uffd_fd, void *addr, uint64_t length, * Copy range of source pages to the destination to resolve * missing page fault somewhere in the destination range. * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @dst_addr: destination base address @@ -259,10 +259,11 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, uffd_copy.mode = dont_wake ? UFFDIO_COPY_MODE_DONTWAKE : 0; if (ioctl(uffd_fd, UFFDIO_COPY, &uffd_copy)) { + int e = errno; error_report("uffd_copy_page() failed: dst_addr=%p src_addr=%p length=%" PRIu64 " mode=%" PRIx64 " errno=%i", dst_addr, src_addr, - length, (uint64_t) uffd_copy.mode, errno); - return -1; + length, (uint64_t) uffd_copy.mode, e); + return -e; } return 0; @@ -273,7 +274,7 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, * * Fill range pages with zeroes to resolve missing page fault within the range. * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @addr: base address @@ -289,10 +290,11 @@ int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake) uffd_zeropage.mode = dont_wake ? UFFDIO_ZEROPAGE_MODE_DONTWAKE : 0; if (ioctl(uffd_fd, UFFDIO_ZEROPAGE, &uffd_zeropage)) { + int e = errno; error_report("uffd_zero_page() failed: addr=%p length=%" PRIu64 " mode=%" PRIx64 " errno=%i", addr, length, - (uint64_t) uffd_zeropage.mode, errno); - return -1; + (uint64_t) uffd_zeropage.mode, e); + return -e; } return 0; @@ -306,7 +308,7 @@ int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake) * via UFFD-IO IOCTLs with MODE_DONTWAKE flag set, then after that all waits * for the whole memory range are satisfied in a single call to uffd_wakeup(). * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @addr: base address @@ -320,9 +322,10 @@ int uffd_wakeup(int uffd_fd, void *addr, uint64_t length) uffd_range.len = length; if (ioctl(uffd_fd, UFFDIO_WAKE, &uffd_range)) { + int e = errno; error_report("uffd_wakeup() failed: addr=%p length=%" PRIu64 " errno=%i", - addr, length, errno); - return -1; + addr, length, e); + return -e; } return 0; From patchwork Wed Oct 9 12:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22B27CEDD89 for ; Wed, 9 Oct 2024 12:44:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1v-0004lD-IX; Wed, 09 Oct 2024 08:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1t-0004kn-HV for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:01 -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 1syW1r-0005U7-J6 for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477779; 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=c+wIGbgV5H0wjlK7GrUwKudWkLFcFUw55bTCvhh/IyA=; b=OeECgINOBEHukLpBZBGmGq9xBylweEku3whtTflK3TMbVmVy63QHfQOZGBgZbpu83Qmg/E M1wYodYO2KjC6yVGtTWYkOuhg1Pun9Q9ob+EnlJ5hzqpNgdTCNTUylL/zQz65myiFbncm4 DOw6LjtDRdXoR2YHscaGv+OWJaYBlNo= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-532-_7Urry08ONKawkh4quHZ4A-1; Wed, 09 Oct 2024 08:42:58 -0400 X-MC-Unique: _7Urry08ONKawkh4quHZ4A-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-8324396d0abso592609739f.0 for ; Wed, 09 Oct 2024 05:42:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477777; x=1729082577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c+wIGbgV5H0wjlK7GrUwKudWkLFcFUw55bTCvhh/IyA=; b=RiV6zkCjPqDhy9eqTB4g1G8Mb4QOU6X4l7xSKOzQTtulAr0nG0y7i0H1ux2zMQ/VWE ZrXb1R9aTsu/EIJ42K1nAVTCNYEpZUPT8vmJi0XW4nza6xUe60nd6G7gfdlQBqPbbC8o bfl0mpS3eLRAWGSq9pEK7YiLBx1g4bBTpJzNp8aWNtQzay093QSBLiFzVUg+JvqafEAa lQ+ieXFUEc5KQFSCdwu445Mq+SmgycJhA3CtQFapR7gm8QZJQuo/UghsNIRo/wttqYn1 ko4WaRY+yTSoCsqYzUHBBw3A3fHKPZHxOUDbJrTCFlUseZ2H5q2TCRMrVK5SpACL3Pay s2bA== X-Gm-Message-State: AOJu0YzC+LKazoaOBChPJSZlBm5fwRmqQeR9i35WaUkHzf/0XrC5w6zt RE9w5nD/6b+vJh+bH8mthYPySofW1tvW2rw7c32jwcn9V1vFvwd5BgVrbkkOzbTXC2pC5GuuNey M1mrbZYkmZEOyxf+v1msu4ifmmrdi3wcSkFXdDuNYnI6Gl5YVVaYJ3zdCDOdBlLG5qmJDDMm54C suY/kyk89vatM5JEvHI5W16bPGKgkTg0GtWA== X-Received: by 2002:a05:6602:60c7:b0:82a:2a67:9429 with SMTP id ca18e2360f4ac-8353d48688cmr215067439f.5.1728477776712; Wed, 09 Oct 2024 05:42:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGazowKqpzjvhCxeW3v0isqd/4xcwvSuhYSh1LvffTX72nD7KdgCm5y9YpeHx1kngccXPv51A== X-Received: by 2002:a05:6602:60c7:b0:82a:2a67:9429 with SMTP id ca18e2360f4ac-8353d48688cmr215063839f.5.1728477776154; Wed, 09 Oct 2024 05:42:56 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:54 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 08/12] migration/postcopy: Use uffd helpers Date: Wed, 9 Oct 2024 08:42:34 -0400 Message-ID: <20241009124238.371084-9-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" Use the uffd_copy_page, uffd_zero_page and uffd_wakeup helpers rather than calling ioctl ourselves. They return -errno on error, and print an error_report themselves. I think this actually makes postcopy_place_page actually more consistent in it's callers. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20240919134626.166183-7-dave@treblig.org [peterx: fix i386 build] Signed-off-by: Peter Xu --- migration/postcopy-ram.c | 48 ++++++++++++---------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 0fe9d83d44..83f6160a36 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -746,18 +746,10 @@ int postcopy_wake_shared(struct PostCopyFD *pcfd, RAMBlock *rb) { size_t pagesize = qemu_ram_pagesize(rb); - struct uffdio_range range; - int ret; trace_postcopy_wake_shared(client_addr, qemu_ram_get_idstr(rb)); - range.start = ROUND_DOWN(client_addr, pagesize); - range.len = pagesize; - ret = ioctl(pcfd->fd, UFFDIO_WAKE, &range); - if (ret) { - error_report("%s: Failed to wake: %zx in %s (%s)", - __func__, (size_t)client_addr, qemu_ram_get_idstr(rb), - strerror(errno)); - } - return ret; + return uffd_wakeup(pcfd->fd, + (void *)(uintptr_t)ROUND_DOWN(client_addr, pagesize), + pagesize); } static int postcopy_request_page(MigrationIncomingState *mis, RAMBlock *rb, @@ -1275,18 +1267,10 @@ static int qemu_ufd_copy_ioctl(MigrationIncomingState *mis, void *host_addr, int ret; if (from_addr) { - struct uffdio_copy copy_struct; - copy_struct.dst = (uint64_t)(uintptr_t)host_addr; - copy_struct.src = (uint64_t)(uintptr_t)from_addr; - copy_struct.len = pagesize; - copy_struct.mode = 0; - ret = ioctl(userfault_fd, UFFDIO_COPY, ©_struct); + ret = uffd_copy_page(userfault_fd, host_addr, from_addr, pagesize, + false); } else { - struct uffdio_zeropage zero_struct; - zero_struct.range.start = (uint64_t)(uintptr_t)host_addr; - zero_struct.range.len = pagesize; - zero_struct.mode = 0; - ret = ioctl(userfault_fd, UFFDIO_ZEROPAGE, &zero_struct); + ret = uffd_zero_page(userfault_fd, host_addr, pagesize, false); } if (!ret) { qemu_mutex_lock(&mis->page_request_mutex); @@ -1343,18 +1327,16 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, RAMBlock *rb) { size_t pagesize = qemu_ram_pagesize(rb); + int e; /* copy also acks to the kernel waking the stalled thread up * TODO: We can inhibit that ack and only do it if it was requested * which would be slightly cheaper, but we'd have to be careful * of the order of updating our page state. */ - if (qemu_ufd_copy_ioctl(mis, host, from, pagesize, rb)) { - int e = errno; - error_report("%s: %s copy host: %p from: %p (size: %zd)", - __func__, strerror(e), host, from, pagesize); - - return -e; + e = qemu_ufd_copy_ioctl(mis, host, from, pagesize, rb); + if (e) { + return e; } trace_postcopy_place_page(host); @@ -1376,12 +1358,10 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, * but it's not available for everything (e.g. hugetlbpages) */ if (qemu_ram_is_uf_zeroable(rb)) { - if (qemu_ufd_copy_ioctl(mis, host, NULL, pagesize, rb)) { - int e = errno; - error_report("%s: %s zero host: %p", - __func__, strerror(e), host); - - return -e; + int e; + e = qemu_ufd_copy_ioctl(mis, host, NULL, pagesize, rb); + if (e) { + return e; } return postcopy_notify_shared_wake(rb, qemu_ram_block_host_offset(rb, From patchwork Wed Oct 9 12:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE3FECEDD8F for ; Wed, 9 Oct 2024 12:44:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1w-0004lV-UT; Wed, 09 Oct 2024 08:43:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1v-0004lL-KJ for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:03 -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 1syW1u-0005Uo-1d for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477781; 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=152PJdeA3wUbcFf7AgEvngUKCcBOBZ12l6LmuLbUvrQ=; b=GtPtV7cSKor/u3I9P73IidbSWWWlG5XJvfxscaRLWxif+BmtU79oMmFNQU8AaR2yUA2ugu blMorkjCHpSIuc//4inGo2TFHPjeLNXcJCegz4mTAnc8iKeQZdzWE+snozxQcrpQ3Rdwox d+8uO2QYqTyGP9gl+TiGMmwsdrysPy0= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-31-_vnbvDF1OSuzWJsqrO8ZVw-1; Wed, 09 Oct 2024 08:43:00 -0400 X-MC-Unique: _vnbvDF1OSuzWJsqrO8ZVw-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-82cf147a566so624968439f.1 for ; Wed, 09 Oct 2024 05:43:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477779; x=1729082579; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=152PJdeA3wUbcFf7AgEvngUKCcBOBZ12l6LmuLbUvrQ=; b=lh5D3Tm3A7CohqZvR3NRQVQPGm6O1gVBci3UOcifoffmolHhRSheW43Ve1YqkoqAA9 vW7Lt5ki6twHKKx5mYrx+60Be1veH4dIomVEZcIKShVTVIx/+9iUKo8xcX4q8g4wfgtL L4SCTUsdA6VDdSQ3/VsmAD+t1UWjtDgyXSrx91bAyoJU+RUOIt5GqE2KXTRAsgIi3cPU s8liZqzicpHitKcBhmNOT9MyU/m3UQTXrfnxfnnSD247wql3fZEHIwBkU93+FSEkNOf8 exYI+xKGluGhi/DbgfCbbMsOFxrUAsyejCCncGSqdH5K6RjHrDmrNv15GE7BhDngUc8y 6RxQ== X-Gm-Message-State: AOJu0YzDa1Xx0rNn+JV25KlKpiGbAldgfp//VmQW9YNCCuxuw2pvkM7L SY1kfOvhVZnsRUeAzOpi06Pgy/XrDcyYNYvMdxHoA8dtQk9JHvJ5s9x5pKUMacLRRqk0w82wRFN 7pAzmBR1GX9ng5ufcJMldbXWI86wKsJF7r81jPWVf8ChuYr1lDai4SbsRqSpfBJo7NvDV0wdq6q grj0unw25up4NuiZxU4lHokYKTCA8CRFMApg== X-Received: by 2002:a05:6602:6424:b0:835:3957:4f7 with SMTP id ca18e2360f4ac-8353d5464d3mr253259139f.16.1728477778922; Wed, 09 Oct 2024 05:42:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx71HISxuOWC3fSmpuC7qzDSSxBz883ofSayOmMXB/R/v2lDmP9hHbiJulzWiGt76U8f+1Pw== X-Received: by 2002:a05:6602:6424:b0:835:3957:4f7 with SMTP id ca18e2360f4ac-8353d5464d3mr253256739f.16.1728477778472; Wed, 09 Oct 2024 05:42:58 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:57 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" Subject: [PULL 09/12] util/userfaultfd: Remove unused uffd_poll_events Date: Wed, 9 Oct 2024 08:42:35 -0400 Message-ID: <20241009124238.371084-10-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" uffd_poll_events has been unused since it was added; it's also just a wrapper around a plain old poll call, so doesn't add anything. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20240919134626.166183-8-dave@treblig.org Signed-off-by: Peter Xu --- include/qemu/userfaultfd.h | 1 - util/userfaultfd.c | 28 ---------------------------- 2 files changed, 29 deletions(-) diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h index 18a4314212..a1979308d7 100644 --- a/include/qemu/userfaultfd.h +++ b/include/qemu/userfaultfd.h @@ -39,7 +39,6 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake); int uffd_wakeup(int uffd_fd, void *addr, uint64_t length); int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count); -bool uffd_poll_events(int uffd_fd, int tmo); #endif /* CONFIG_LINUX */ diff --git a/util/userfaultfd.c b/util/userfaultfd.c index 518d5c3586..2396104f23 100644 --- a/util/userfaultfd.c +++ b/util/userfaultfd.c @@ -358,31 +358,3 @@ int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count) return (int) (res / sizeof(struct uffd_msg)); } - -/** - * uffd_poll_events: poll UFFD file descriptor for read - * - * Returns true if events are available for read, false otherwise - * - * @uffd_fd: UFFD file descriptor - * @tmo: timeout value - */ -bool uffd_poll_events(int uffd_fd, int tmo) -{ - int res; - struct pollfd poll_fd = { .fd = uffd_fd, .events = POLLIN, .revents = 0 }; - - do { - res = poll(&poll_fd, 1, tmo); - } while (res < 0 && errno == EINTR); - - if (res == 0) { - return false; - } - if (res < 0) { - error_report("uffd_poll_events() failed: errno=%i", errno); - return false; - } - - return (poll_fd.revents & POLLIN) != 0; -} From patchwork Wed Oct 9 12:42:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46D46CEDD91 for ; Wed, 9 Oct 2024 12:44:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW1z-0004rk-Jo; Wed, 09 Oct 2024 08:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW1x-0004o1-O5 for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:05 -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 1syW1v-0005VG-HS for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477782; 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=yUYJvzmDsbGYqRdVrEwQI7vweQrLaFXP18fwBosGfqE=; b=WeVP7Dc6YMZbbdfveulU/EsHAywTpC9eeVwHnaym8vDOUMKhfG6EFvPN3VV2kB+TV9U5GE JvzM/dsoeakepDrcj3Z1AZBQslZXjB3NbLLErOekoQOMMWb3foo9rBx6gFduKK0tdScJkj j8UnvzvmAY8uHjuAm+H8rEwXVluPQ0A= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-83BBomIfMUuWJ6ft7-sXLA-1; Wed, 09 Oct 2024 08:43:01 -0400 X-MC-Unique: 83BBomIfMUuWJ6ft7-sXLA-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-82ad9fca614so891879639f.3 for ; Wed, 09 Oct 2024 05:43:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477780; x=1729082580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yUYJvzmDsbGYqRdVrEwQI7vweQrLaFXP18fwBosGfqE=; b=bplqf2N8Czj9tmYYwVkMBK5Ff+oPHq48MMo0n9iYrTgAxNV3i6/zep/oABSc1Lvlle irjKPMwf3rzh8LI+2bcH9EMwqkagC1fiDI+tA32Q2nT+CjHAyDMROOlM7wvWwNd4Jj5v BNRSqMU3ZxIblOuOqx/RguZe5hwOi4qIHdtQ1sxW/bXP3nkKJsUm/yQPvLvuG3IC4lyM J9B/8m6q84s2FULy+gT2X1j7X2rwmgZLCGnA5712FL1AbUAZ4yB2YrTYN1iStL6Awtao 5YR0xpO2C71qtnXTCqOZpKmcH2BbHCFkz12AkvMh+qFiCJm2pBAUXad14DYaEqvRrx7D HrxA== X-Gm-Message-State: AOJu0YyIg0WZnjYPW80+0iiOi6aP7AYmJvW423fU8vjsTkCore5TB1LP czFmoJ+f2lMPzJBYIQw7hZhou65dcJpQRfC7sWhfR8e/QOIcs/a9xH06oaZUPxWZxns/zdk/UFE JBR6Up1qx14xEcO4+uAmCxqI3kUHNlB2PH33VIiZWq8daEYpkkIgFWjpQVTuDB97bL977Xxy78L WaortBP3EaYWwlWARGfY8exm5mkbbpa0kxWg== X-Received: by 2002:a05:6602:6422:b0:82c:d67d:aa91 with SMTP id ca18e2360f4ac-8353d3755d5mr300247039f.1.1728477780556; Wed, 09 Oct 2024 05:43:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFegXQDOnOHEmm+cTK6FYpgTZ7aLMxJ1N6ar6u4x4PHSJCB1poFE5KRoeApDAVzQgEDiO8C1w== X-Received: by 2002:a05:6602:6422:b0:82c:d67d:aa91 with SMTP id ca18e2360f4ac-8353d3755d5mr300243639f.1.1728477780239; Wed, 09 Oct 2024 05:43:00 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:42:59 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, Juraj Marcin Subject: [PULL 10/12] tests/migration-test: Wait for cancellation sooner in multifd cancel Date: Wed, 9 Oct 2024 08:42:36 -0400 Message-ID: <20241009124238.371084-11-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Juraj Marcin The source QEMU might not finish the cancellation of the migration before we start setting up the next attempt. During the setup, the test_migrate_start() function and others might need to interact with the source in a way that is not possible unless the migration is fully canceled. For example, setting capabilities when the migration is still running leads to an error. By moving the wait before the setup, we ensure this does not happen. Cc: Peter Xu Signed-off-by: Juraj Marcin Link: https://lore.kernel.org/r/20240920161319.2337625-1-jmarcin@redhat.com Signed-off-by: Peter Xu --- tests/qtest/migration-test.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 814ec109a6..95e45b5029 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -3267,6 +3267,16 @@ static void test_multifd_tcp_cancel(void) qtest_wait_qemu(to); qtest_quit(to); + /* + * Ensure the source QEMU finishes its cancellation process before we + * proceed with the setup of the next migration. The test_migrate_start() + * function and others might want to interact with the source in a way that + * is not possible while the migration is not canceled properly. For + * example, setting migration capabilities when the migration is still + * running leads to an error. + */ + wait_for_migration_status(from, "cancelled", NULL); + args = (MigrateStart){ .only_target = true, }; @@ -3282,8 +3292,6 @@ static void test_multifd_tcp_cancel(void) /* Start incoming migration from the 1st socket */ migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}"); - wait_for_migration_status(from, "cancelled", NULL); - migrate_ensure_non_converge(from); migrate_qmp(from, to2, NULL, NULL, "{}"); From patchwork Wed Oct 9 12:42:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33F48CEDD89 for ; Wed, 9 Oct 2024 12:44:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW2I-000530-Vl; Wed, 09 Oct 2024 08:43:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW21-0004sf-EK for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:10 -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 1syW1y-0005Vu-Mh for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477785; 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=ufhUOpepsGW4qLY30+zYqQtKIYZv17OEXI7XMvauCAU=; b=Xpt0lAzE64vOpO6vYI9hRMnsHd0iIjXAA4OE8RPdf+7qiAnFQmDtj0a9T6yU1IJ6XgP5kf hQtS4CHncuatrc3YdKFzLCDy1+/XVfD0ln/06cZoadC0BqXHsTQAs/U4/q/caMQClu/iBc c8lX1UXUR9w//AdLYBzbRiV2m8NtGgg= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-8-u5byBmSxN-Ow4g2Wsg2qHg-1; Wed, 09 Oct 2024 08:43:04 -0400 X-MC-Unique: u5byBmSxN-Ow4g2Wsg2qHg-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-82aa8af04feso684811939f.1 for ; Wed, 09 Oct 2024 05:43:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477783; x=1729082583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ufhUOpepsGW4qLY30+zYqQtKIYZv17OEXI7XMvauCAU=; b=BqzmABID9934gg5juxlKmfy+IeucOJ39IS+9eZodfcGPzrcZ8AedGDbUz3mfVE3xg4 w6hC0x6KV6PbEHkcCZSvjoXLoSnq8UQkIXrYR6DnBzr9W4Dd944+J9+147JVQQ/ahABt L54agPwzfcAO9kONIBfovm3yE08mFkYkzamjB872p+lqSYlOh+IFQHrATdoeYJS648Ic OnExLB0+TOe1jz/kMxDlSsTgYSpEArty1qCrN+D5S8+nprhYamA6PLMfv+r7l9towU5k RvU/noOgcg2lJZr3OxseU1aueM+sA0MoZBwQE7nHmW3IcoUnVYKlHE9S/vq4cHqs9+b8 bZrg== X-Gm-Message-State: AOJu0Yz3WifO4mlDoYqENTvoVWBXZYeFc4HF6XxQmxMwBojq2Lk9MUUm VM8g1+2i0EuGbqt/n4T9mvjTglhuzDDxHd6aE4ZHGzm82p+FxgeDqNtKHxg+uz66YwWiftySCLp ryTCk2X6j5gcnbTmdJYdcWI6XwRjxwcDDwyXkuW2nVLrl80T9LWPktic6uLECSAzQ0AyiWcndap qz02RW1ZBScK69I/gDFJj6h76F2uMexEJcwg== X-Received: by 2002:a05:6602:6101:b0:82a:4c58:e1e0 with SMTP id ca18e2360f4ac-8353d4f11d4mr249867439f.12.1728477782840; Wed, 09 Oct 2024 05:43:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHn5VvcapvqGxQ50KmhJFVnEWT/3/GQA3GxrhLud8Pl+7z+b3QnS8vH1AFWBM5F2i3qzn2l2g== X-Received: by 2002:a05:6602:6101:b0:82a:4c58:e1e0 with SMTP id ca18e2360f4ac-8353d4f11d4mr249862639f.12.1728477782174; Wed, 09 Oct 2024 05:43:02 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:43:01 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Dr. David Alan Gilbert" , Thomas Huth Subject: [PULL 11/12] util/iova-tree: Remove deadcode Date: Wed, 9 Oct 2024 08:42:37 -0400 Message-ID: <20241009124238.371084-12-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" iova_tree_find_address, and iova_tree_foreach have never been used since the code was originally added by: eecf5eedbd ("util: implement simple iova tree") Remove them. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Thomas Huth Link: https://lore.kernel.org/r/20240918142515.153074-1-dave@treblig.org Signed-off-by: Peter Xu --- include/qemu/iova-tree.h | 25 ------------------------- util/iova-tree.c | 23 ----------------------- 2 files changed, 48 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 2a10a7052e..44a45931d5 100644 --- a/include/qemu/iova-tree.h +++ b/include/qemu/iova-tree.h @@ -111,31 +111,6 @@ const DMAMap *iova_tree_find(const IOVATree *tree, const DMAMap *map); */ const DMAMap *iova_tree_find_iova(const IOVATree *tree, const DMAMap *map); -/** - * iova_tree_find_address: - * - * @tree: the iova tree to search from - * @iova: the iova address to find - * - * Similar to iova_tree_find(), but it tries to find mapping with - * range iova=iova & size=0. - * - * Return: same as iova_tree_find(). - */ -const DMAMap *iova_tree_find_address(const IOVATree *tree, hwaddr iova); - -/** - * iova_tree_foreach: - * - * @tree: the iova tree to iterate on - * @iterator: the iterator for the mappings, return true to stop - * - * Iterate over the iova tree. - * - * Return: 1 if found any overlap, 0 if not, <0 if error. - */ -void iova_tree_foreach(IOVATree *tree, iova_tree_iterator iterator); - /** * iova_tree_alloc_map: * diff --git a/util/iova-tree.c b/util/iova-tree.c index 536789797e..06295e2755 100644 --- a/util/iova-tree.c +++ b/util/iova-tree.c @@ -115,13 +115,6 @@ const DMAMap *iova_tree_find_iova(const IOVATree *tree, const DMAMap *map) return args.result; } -const DMAMap *iova_tree_find_address(const IOVATree *tree, hwaddr iova) -{ - const DMAMap map = { .iova = iova, .size = 0 }; - - return iova_tree_find(tree, &map); -} - static inline void iova_tree_insert_internal(GTree *gtree, DMAMap *range) { /* Key and value are sharing the same range data */ @@ -148,22 +141,6 @@ int iova_tree_insert(IOVATree *tree, const DMAMap *map) return IOVA_OK; } -static gboolean iova_tree_traverse(gpointer key, gpointer value, - gpointer data) -{ - iova_tree_iterator iterator = data; - DMAMap *map = key; - - g_assert(key == value); - - return iterator(map); -} - -void iova_tree_foreach(IOVATree *tree, iova_tree_iterator iterator) -{ - g_tree_foreach(tree->tree, iova_tree_traverse, iterator); -} - void iova_tree_remove(IOVATree *tree, DMAMap map) { const DMAMap *overlap; From patchwork Wed Oct 9 12:42:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13828324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58C67CEDD89 for ; Wed, 9 Oct 2024 12:44:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syW28-0004vX-Gl; Wed, 09 Oct 2024 08:43:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syW22-0004si-G3 for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:10 -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 1syW1z-0005WI-U9 for qemu-devel@nongnu.org; Wed, 09 Oct 2024 08:43:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728477787; 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=FjMBCXJg2PmGEwp55y/1gkUv3OpESanW4HCUWzVhmPI=; b=fRsBt1nrDfcK8UJmzYMm/XDjh/dNNciUrAZ4wdI+AWonhDPdjGK7lkY61SaGzTkjRlPhle eNJD4kS9w9N1T9bLKF2B1giIA2VFrZiwj6MJoAoQUXzzvzLPSqJcT48Iz+6ESCcfRldV9r fnd3nt94I6nBl+PUqhilSp2BkFYdHbE= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-372-Z0nW3H_yNUuwVb9c619QwA-1; Wed, 09 Oct 2024 08:43:06 -0400 X-MC-Unique: Z0nW3H_yNUuwVb9c619QwA-1 Received: by mail-io1-f70.google.com with SMTP id ca18e2360f4ac-8353d85fc5bso91031239f.1 for ; Wed, 09 Oct 2024 05:43:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728477785; x=1729082585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FjMBCXJg2PmGEwp55y/1gkUv3OpESanW4HCUWzVhmPI=; b=F+QYL6uZ0U6ig/gqsV7y5D9L3Kt22EZTYF4iUoN4mAm9CSIF5t16kr7fQP5cY/VutW iypoNSyruqqgP+/cUya4maD4mNtNo0QqIHIrdQ4xU24tULWAwu5CsuTQElx+sKzlxtcl 8L9vm1YKFS/+XO7FoLUllt54rECgeBp8w8sMVHtdDeIfr7Ac5SSx+z6/+IwQq+QD0Qoi oGU+Eq6AUI5b0ssstdHXxJ6zabux9rkNzjLAvGgQ5AraW6s/FPRKzFaYEzVUJ+EsyOVH LbpxHVGqxbyPY4tBYZJVALua6ym9J86fKOQs+GsPwclSUPJZlfg9o2MH8oxRSwlJ51qW Hv7Q== X-Gm-Message-State: AOJu0Yzv2ofmq2z6xjiqYJhb9ohd679jAWE1vka9yUVaJDkAwKaCDfRM nqUwpa03+YU3CT7AmFh9pdMXTul+UCheAQbJslvXMxsWx+/b0Ljonk8GRcysvaWTwq/zhHr3xQ4 PHuFHqyQ+i5FpZvQnQ3WBXgw8ry9xE4rjHGc0pjaHVYXjiJRU4uxTVdpMDi8E1Kb+oAWuxh8FSy HbM4DL7QXOd7hKT7ZtMNX7r+K7V6UY986nAg== X-Received: by 2002:a05:6602:2d8a:b0:834:d9ff:123e with SMTP id ca18e2360f4ac-8353d50ff39mr319810839f.13.1728477784705; Wed, 09 Oct 2024 05:43:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIvCXosOt8xAP5lvYldX30CzxM+QGXfDlfoei28oII77deoT7qgign8XXMW5pxmurpkadA0g== X-Received: by 2002:a05:6602:2d8a:b0:834:d9ff:123e with SMTP id ca18e2360f4ac-8353d50ff39mr319807439f.13.1728477784267; Wed, 09 Oct 2024 05:43:04 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83503aacb18sm220272039f.30.2024.10.09.05.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 05:43:03 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Peter Maydell , Fabiano Rosas , peterx@redhat.com, Yuan Liu Subject: [PULL 12/12] migration/multifd: fix build error when qpl compression is enabled Date: Wed, 9 Oct 2024 08:42:38 -0400 Message-ID: <20241009124238.371084-13-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241009124238.371084-1-peterx@redhat.com> References: <20241009124238.371084-1-peterx@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.151, 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Yuan Liu The page_size member has been removed from the MultiFDSendParams and MultiFDRecvParams. The function multifd_ram_page_size is used to provide the page size in the multifd compressor. Fixes: 90fa121c6c ("migration/multifd: Inline page_size and page_count") Signed-off-by: Yuan Liu Link: https://lore.kernel.org/r/20241008104527.3516755-1-yuan1.liu@intel.com Signed-off-by: Peter Xu --- migration/multifd-qpl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/multifd-qpl.c b/migration/multifd-qpl.c index b0f1e2ba46..bbe466617f 100644 --- a/migration/multifd-qpl.c +++ b/migration/multifd-qpl.c @@ -389,7 +389,7 @@ static void multifd_qpl_compress_pages_slow_path(MultiFDSendParams *p) { QplData *qpl = p->compress_data; MultiFDPages_t *pages = &p->data->u.ram; - uint32_t size = p->page_size; + uint32_t size = multifd_ram_page_size(); qpl_job *job = qpl->sw_job; uint8_t *zbuf = qpl->zbuf; uint8_t *buf; @@ -420,7 +420,7 @@ static void multifd_qpl_compress_pages(MultiFDSendParams *p) { QplData *qpl = p->compress_data; MultiFDPages_t *pages = &p->data->u.ram; - uint32_t size = p->page_size; + uint32_t size = multifd_ram_page_size(); QplHwJob *hw_job; uint8_t *buf; uint8_t *zbuf; @@ -560,7 +560,7 @@ static int multifd_qpl_decompress_pages_slow_path(MultiFDRecvParams *p, Error **errp) { QplData *qpl = p->compress_data; - uint32_t size = p->page_size; + uint32_t size = multifd_ram_page_size(); qpl_job *job = qpl->sw_job; uint8_t *zbuf = qpl->zbuf; uint8_t *addr; @@ -598,7 +598,7 @@ static int multifd_qpl_decompress_pages_slow_path(MultiFDRecvParams *p, static int multifd_qpl_decompress_pages(MultiFDRecvParams *p, Error **errp) { QplData *qpl = p->compress_data; - uint32_t size = p->page_size; + uint32_t size = multifd_ram_page_size(); uint8_t *zbuf = qpl->zbuf; uint8_t *addr; uint32_t len; @@ -677,7 +677,7 @@ static int multifd_qpl_recv(MultiFDRecvParams *p, Error **errp) } for (int i = 0; i < p->normal_num; i++) { qpl->zlen[i] = be32_to_cpu(qpl->zlen[i]); - assert(qpl->zlen[i] <= p->page_size); + assert(qpl->zlen[i] <= multifd_ram_page_size()); zbuf_len += qpl->zlen[i]; }