From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684400; cv=none; d=zohomail.com; s=zohoarc; b=IqGcNyvOzYoDztLnL9OaajFZviY2S7TbjB7VT3xZPhNBtQ8LC5CpiBzglxjSOzU1Y+Wbu6QzhDi7ZDNYEkzTKpArXqXSQASdelI+eSZjyDPmJOwVj9B9nfHAAaa/1FPMr9MzBGRmpl0N0C/zyJVHbF6Z+AaVLDh5/uGTcU0Hv+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684400; 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=uETirslRtXhm+HFuN3lM3k4dcuoD9xd+DaieOslfWmM=; b=fj8lkCF5Blu3TH9rrGQteut5ItYZ5SF02PJMdt36AbxYa/Fp53BNOhJq5diQWB21SiHAqdby37IwKLzS9vFsjB4id4xvANi6WQGpE6haBPwGtUp1A05ha61vfa9C1ft/Q6WQWMUmKo0TWv0bEWhcWN8o5MJC93DFJmO5Y2ALM3Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172668440012980.67744797361604; Wed, 18 Sep 2024 11:33:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTF-0001up-5p; Wed, 18 Sep 2024 14:32:09 -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 1sqzTA-0001iM-LI for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32: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 1sqzT8-0001zu-Vp for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:04 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-wmar7DSVNKKYN-9stHlkfw-1; Wed, 18 Sep 2024 14:31:57 -0400 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6c5bd369336so15068796d6.2 for ; Wed, 18 Sep 2024 11:31:57 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684318; 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=uETirslRtXhm+HFuN3lM3k4dcuoD9xd+DaieOslfWmM=; b=HevbksN63CUp+QI+rSuOWZHmHH7Kfpugyyx6xrPBzAyhCXQOf6FrZPT60BWhiBI2dEH+0o XVX/2Au5mgS7tCpmsSyE8xNFqW0X7aE0hmdBFXI8JokkXoI7+SvWaIbI/oDgDfLFNiF8Zf gewbB7M8ASrxBIKt0zi1MJK1+aO+0UM= X-MC-Unique: wmar7DSVNKKYN-9stHlkfw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684316; x=1727289116; 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=uETirslRtXhm+HFuN3lM3k4dcuoD9xd+DaieOslfWmM=; b=Dd0I8tnQjrL9lc2w6UStDNUTTOLs4LiPdJBuyPuJgMv/FIQOXJ7O+WAHiUwFL9nUAK uXPju1p0Y0SuR4GpsWD1X43NRI0JshOFyE0tNn4OgeXh6fmd1+l+ZNmkKNpDjCCe5fbc uNcOBtfZZ0GNX/92WzO3BJOCbAHIeH7XtedxeMoHn0rZVeAJxf8IuDqcOgdy+CBLfGc7 31ymPDGJ4mKlinZ+wjZIdYkH2jGZ0jpHvyS+3LiEAswD+qvxPBDIbyR6hAt0D5X2NabC XWZz+uZUIr+Cj/wsMXRxLZgFhUMBo76FeMbMvf0nKDodYqM0gpjqZANBHNOfNtfE4pWi Wsdg== X-Gm-Message-State: AOJu0YzCK01OlJcd3EagOePQILOZpBtgw0cdjRGnBXG33kYm1tOLcekp sYtBGq6I/vpj0WuaokvzqYnFfdXraoJXXCWap38bY3HkC1aWMQ56FdOBQcscTvzEW5rxLii3ONT 2kGYWC/aParL4NhbSfo5SCchgk5qiYtUNg6dJBBJ2mJL61en3regYkIjRMK1OjFuX/fluhuDjWr +wjz3TqGFAaXUFc620UCfHaO8GS4kBMulBTQ== X-Received: by 2002:a05:6214:3287:b0:6c5:537a:ce43 with SMTP id 6a1803df08f44-6c573539d30mr283695866d6.26.1726684315938; Wed, 18 Sep 2024 11:31:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPGA/4cJDt3GPNtANhhFUTyElR/0b5sIbrd0sFs7rsYtic57E5PyKvNHw5ZKsFSx0/lG4xgw== X-Received: by 2002:a05:6214:3287:b0:6c5:537a:ce43 with SMTP id 6a1803df08f44-6c573539d30mr283695596d6.26.1726684315543; Wed, 18 Sep 2024 11:31:55 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com Subject: [PULL v2 1/6] tests/qtest/migration: Move a couple of slow tests under g_test_slow Date: Wed, 18 Sep 2024 14:31:46 -0400 Message-ID: <20240918183151.6413-2-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684400716116600 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas The xbzrel and vcpu_dirty_limit are the two slowest tests from migration-test. Move them under g_test_slow() to save about 40s per run. Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240911145204.17692-1-farosas@suse.de Signed-off-by: Peter Xu --- tests/qtest/migration-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d6768d5d71..814ec109a6 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -3803,8 +3803,10 @@ int main(int argc, char **argv) =20 migration_test_add("/migration/precopy/unix/plain", test_precopy_unix_plain); - migration_test_add("/migration/precopy/unix/xbzrle", - test_precopy_unix_xbzrle); + if (g_test_slow()) { + migration_test_add("/migration/precopy/unix/xbzrle", + test_precopy_unix_xbzrle); + } migration_test_add("/migration/precopy/file", test_precopy_file); migration_test_add("/migration/precopy/file/offset", @@ -3979,7 +3981,7 @@ int main(int argc, char **argv) if (g_str_equal(arch, "x86_64") && has_kvm && kvm_dirty_ring_supported= ()) { migration_test_add("/migration/dirty_ring", test_precopy_unix_dirty_ring); - if (qtest_has_machine("pc")) { + if (qtest_has_machine("pc") && g_test_slow()) { migration_test_add("/migration/vcpu_dirty_limit", test_vcpu_dirty_limit); } --=20 2.45.0 From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684396; cv=none; d=zohomail.com; s=zohoarc; b=YdVZQtVdnnEv62HP766mnQQ3DAkmnkPBk4HsS5HbgkPBo1E5UIZRgb+J26Unz8GW2c7rx/AxDRXqkJTrUn/+8zU1+NSNu8Hz9MZAdDCNQI0+UJPlZhFzJF61nCEk70RgXUIkBU64u0nf4Xb7YN0dGDUKUNHRdwgWx+2IUnXJpbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684396; 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=TdTM1Vy8cJBfZl/IClQA3wFNSuuJkD9Zb5WcgYw2HVw=; b=HENTZGtDKaYB0PvZxZFr3xCajIn4/11jZMBPagxMKr2YstnK3RS6GLxoO9AWyfACosxMmRN7oLfZbdAgkppqRL6RTetmhjjycasJSrhQV9JaStEnZIwZE0oIeDr/lkaeOWnG/aUB7ISuWEW86029ddpAUhZgEnK8p7OPdeB0snU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726684396050323.7532671182796; Wed, 18 Sep 2024 11:33:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTG-00021G-Pi; Wed, 18 Sep 2024 14:32:11 -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 1sqzTE-0001pX-PT for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqzTB-00020S-5l for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:07 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-252-OF9vlQI8M3ORIEFMblEuPQ-1; Wed, 18 Sep 2024 14:32:03 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a99d13efafso5762985a.0 for ; Wed, 18 Sep 2024 11:32:03 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684324; 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=TdTM1Vy8cJBfZl/IClQA3wFNSuuJkD9Zb5WcgYw2HVw=; b=il/YVGS+DhfhvIfqtzwGEiuMwTV8A+O98woWg9/JlPREIg8Hcq74Lq12S7cO7iab5FflnD p7iNI/KZOWH+ZYP9hBjve4478Q+8o9EQM9tTgv2B0gF89FOd973bb0bsIASJt1FaAt07Eq fEzkRBXCgYEP1qw9cPHirKaFUGPPlKk= X-MC-Unique: OF9vlQI8M3ORIEFMblEuPQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684321; x=1727289121; 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=TdTM1Vy8cJBfZl/IClQA3wFNSuuJkD9Zb5WcgYw2HVw=; b=iOYKn/Gz/OXd0JmLQxKC67o+jBrLSO6DhOFg53PV8eEUL6hHbbZgRmXZoQkLcTKTzG TF/I7Eulea+uzTP0TEejkUXxSJ37QXTFMJiJaDnsKFr9pmjt+xZzhZnq+fMXqVXbLujq mytepUIx0+5OFU4UroeowylpZTLVCGFYLJCma1LBX2jC+J3iCDqa1ejriyaPghNPxa2P mnJCAONc40aq3Z5qS4V/0OXUoBAKyXQHYGe5g0jEZSrca6oF3avbGABMVmLtBwUPO37t 0Flcm746uxEGIpEx2lDUi9ifXRq7Tbz+QLs8cCv66mzaHX55FdIAJ8Ig7mtD7U0BLyfH 1kCQ== X-Gm-Message-State: AOJu0YzKNx7N1X/a0Kc04UYJPGHOkP205wjrGj0Sg1GqQqpFV94F3kgR A+uaC9DOVM5tyNTCepsAgTjfWWNEHAXgDbBsm6bxhD9Blw5cD1ftjrkfeXELnw9FK/lmCGkbKrf tu0lYC5bckzfTvrsDWsqyk7/LFvKJGjBUGRIMCkaelEtdTYKMHff0ww+3mo03AdnWwRVkloLgfR pXHYEMKGiwa+MUxhmefyyOUY2PGBbTdcbu2w== X-Received: by 2002:a05:6214:4403:b0:6c1:6e39:b697 with SMTP id 6a1803df08f44-6c57350bdc6mr303518496d6.9.1726684321349; Wed, 18 Sep 2024 11:32:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSvAOiyU95D6ePIobMsNvblxyYYrzW1cd/ZhPg1X5WZtSsh5oHTwQ7sqzJsL5wVzkYLrcqPw== X-Received: by 2002:a05:6214:4403:b0:6c1:6e39:b697 with SMTP id 6a1803df08f44-6c57350bdc6mr303516866d6.9.1726684317717; Wed, 18 Sep 2024 11:31:57 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com, Yichen Wang , Bryan Zhang , Hao Xiang , Yuan Liu Subject: [PULL v2 2/6] migration/multifd: Fix build for qatzip Date: Wed, 18 Sep 2024 14:31:47 -0400 Message-ID: <20240918183151.6413-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684396864116600 Content-Type: text/plain; charset="utf-8" The qatzip series was based on an older commit, it applied cleanly even though it has conflicts. Neither CI nor myself found the build will break as it's skipped by default when qatzip library was missing. Fix the build issues. No need to copy stable as it just landed 9.2. Cc: Yichen Wang Cc: Bryan Zhang Cc: Hao Xiang Cc: Yuan Liu Fixes: 80484f9459 ("migration: Introduce 'qatzip' compression method") Link: https://lore.kernel.org/r/20240910210450.3835123-1-peterx@redhat.com Signed-off-by: Peter Xu --- migration/multifd-qatzip.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/multifd-qatzip.c b/migration/multifd-qatzip.c index 3c787ed879..7b68397625 100644 --- a/migration/multifd-qatzip.c +++ b/migration/multifd-qatzip.c @@ -160,7 +160,8 @@ static void qatzip_send_cleanup(MultiFDSendParams *p, E= rror **errp) */ static int qatzip_send_prepare(MultiFDSendParams *p, Error **errp) { - MultiFDPages_t *pages =3D p->pages; + uint32_t page_size =3D multifd_ram_page_size(); + MultiFDPages_t *pages =3D &p->data->u.ram; QatzipData *q =3D p->compress_data; int ret; unsigned int in_len, out_len; @@ -179,12 +180,12 @@ static int qatzip_send_prepare(MultiFDSendParams *p, = Error **errp) * implementation. */ for (int i =3D 0; i < pages->normal_num; i++) { - memcpy(q->in_buf + (i * p->page_size), + memcpy(q->in_buf + (i * page_size), pages->block->host + pages->offset[i], - p->page_size); + page_size); } =20 - in_len =3D pages->normal_num * p->page_size; + in_len =3D pages->normal_num * page_size; if (in_len > q->in_len) { error_setg(errp, "multifd %u: unexpectedly large input", p->id); return -1; @@ -197,7 +198,7 @@ static int qatzip_send_prepare(MultiFDSendParams *p, Er= ror **errp) p->id, ret); return -1; } - if (in_len !=3D pages->normal_num * p->page_size) { + if (in_len !=3D pages->normal_num * page_size) { error_setg(errp, "multifd %u: QATzip failed to compress all input", p->id); return -1; @@ -329,7 +330,8 @@ static int qatzip_recv(MultiFDRecvParams *p, Error **er= rp) int ret; unsigned int in_len, out_len; uint32_t in_size =3D p->next_packet_size; - uint32_t expected_size =3D p->normal_num * p->page_size; + uint32_t page_size =3D multifd_ram_page_size(); + uint32_t expected_size =3D p->normal_num * page_size; uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; =20 if (in_size > q->in_len) { @@ -370,9 +372,7 @@ static int qatzip_recv(MultiFDRecvParams *p, Error **er= rp) =20 /* Copy each page to its appropriate location. */ for (int i =3D 0; i < p->normal_num; i++) { - memcpy(p->host + p->normal[i], - q->out_buf + p->page_size * i, - p->page_size); + memcpy(p->host + p->normal[i], q->out_buf + page_size * i, page_si= ze); } return 0; } --=20 2.45.0 From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684412; cv=none; d=zohomail.com; s=zohoarc; b=XDHQADz2YGiuM2AZBhB8C6hWusySiq0AIGhPxWCbmNYaDYQ7I0/4ZgV5eBw9CrYnwnC0Z23nEW06N5f/JgTiFZa78jU0SUL1TpY2skvT+L7CV98lZtYtS9qTvsEZv8PhJF8qcsx+sjseWOu5ZZqv/wL7jbkh9iiOrr/xf2j9EoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684412; 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=WN5jXygqxHRuj1VtFy0rqimytcsamIGQeRfTQJKJPW4=; b=Oc2Fa8vmaMR0BUaz/OShBKGlCmsplQUhSQuUyVeUMiE0PQLdxK6GGKkYwbiBgeRsm4gVh0RQrnqrW8ki6t4R/bMrKe/stZz9BNF/WOlyBmCySIpY5zL8iMx4QmBK5ur8XNzcg6ibVLs9t7PYHSxLiUGJhG4PYtkLMae0MQmFi+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17266844120521004.4299069681884; Wed, 18 Sep 2024 11:33:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTD-0001n5-55; Wed, 18 Sep 2024 14:32:07 -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 1sqzTA-0001iL-IX for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:04 -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 1sqzT8-000204-Uv for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:04 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-vtuu4e4kNma1Eo8V8yyXRw-1; Wed, 18 Sep 2024 14:32:00 -0400 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6c357986fc8so107712776d6.1 for ; Wed, 18 Sep 2024 11:32:00 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684321; 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=WN5jXygqxHRuj1VtFy0rqimytcsamIGQeRfTQJKJPW4=; b=VuEFYt5W6Tyj/KziVJHZMsrTa/3qdupKlTsMG0vgU8sUH1me0MgBWuLj9lkB1DoAirOJia 37FBahQRQEjwH7D8FEMus7O3KoUGFodDLw5grya+fWe7t/yuuFSIm6TD6oAowJqWF1YFIk 1rHrLmURGTT7zwA7GiZuOCTRPx+SRzY= X-MC-Unique: vtuu4e4kNma1Eo8V8yyXRw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684320; x=1727289120; 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=WN5jXygqxHRuj1VtFy0rqimytcsamIGQeRfTQJKJPW4=; b=hHBvXxyY9hruGKOcUKWkTaUi/bID7eiq9G70ijdMw8WJ13nXAHj8ITW33k5oNcspo3 AExdkkTt3MqZ87u9a11F3HbieBtHeIO9LTM3mzQr59d/O1QUkB4zI7WqSwThsb2HXHZc 4k4+o2Qqk5YG9Z3izy70FeRjBrHozit8XXIBbhhJkN7GHSB7TDIGFPNjKGDhLLk07qe0 uABqFW51jYdufEQaCIs2IO24535WaHxQW42OyiMQFzBsJQBSDJX7efDi5O397/v1Tceq D9WnxHDqwI6UbsjpSJl4HBII7t9S83gxfcXOZklBPnQW4nHk/svzzH1OctSCca6MrN3A 1hzQ== X-Gm-Message-State: AOJu0YweXgqnHqacLcWekPGw/u/s87rp4LokuyVC1iakI8B85vTNInzm THcXpLNUcj598JZYMskoFEcVKOldxSdMKdiwi20t+z82IpqQRX+Lyb2cGWwYvPmX4McXE5Hw+lR TNHC5hRIjxYdFgk4H+eOQV3dUfQJYqsslHP/Lrv6GLqTRPHQiJL3XpK+fJPodu7o/Ui1Kmd0GS5 jzSNcNkpvrKvTv5m/zrUZ5c5bcbVJlcPp99g== X-Received: by 2002:a05:6214:4686:b0:6c5:1a21:b8b9 with SMTP id 6a1803df08f44-6c57df93104mr395167086d6.13.1726684319691; Wed, 18 Sep 2024 11:31:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/L8OnWNvbR7s0teiUq06ymwPONV2RYnRIFwBZk7aY1X14E31hn27cP6BPVOeeNMqHbJFRkA== X-Received: by 2002:a05:6214:4686:b0:6c5:1a21:b8b9 with SMTP id 6a1803df08f44-6c57df93104mr395166756d6.13.1726684319311; Wed, 18 Sep 2024 11:31:59 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com, Stefan Weil Subject: [PULL v2 3/6] migration/multifd: Fix loop conditions in multifd_zstd_send_prepare and multifd_zstd_recv Date: Wed, 18 Sep 2024 14:31:48 -0400 Message-ID: <20240918183151.6413-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684413136116600 Content-Type: text/plain; charset="utf-8" From: Stefan Weil GitHub's CodeQL reports four critical errors which are fixed by this commit: Unsigned difference expression compared to zero An expression (u - v > 0) with unsigned values u, v is only false if u =3D= =3D v, so all changed expressions did not work as expected. Signed-off-by: Stefan Weil Link: https://lore.kernel.org/r/20240910054138.1458555-1-sw@weilnetz.de [peterx: Fix mangled email for author] Signed-off-by: Peter Xu --- migration/multifd-zstd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 53da33e048..abed140855 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -123,9 +123,9 @@ static int multifd_zstd_send_prepare(MultiFDSendParams = *p, Error **errp) */ do { ret =3D ZSTD_compressStream2(z->zcs, &z->out, &z->in, flush); - } while (ret > 0 && (z->in.size - z->in.pos > 0) - && (z->out.size - z->out.pos > 0)); - if (ret > 0 && (z->in.size - z->in.pos > 0)) { + } while (ret > 0 && (z->in.size > z->in.pos) + && (z->out.size > z->out.pos)); + if (ret > 0 && (z->in.size > z->in.pos)) { error_setg(errp, "multifd %u: compressStream buffer too small", p->id); return -1; @@ -243,7 +243,7 @@ static int multifd_zstd_recv(MultiFDRecvParams *p, Erro= r **errp) */ do { ret =3D ZSTD_decompressStream(z->zds, &z->out, &z->in); - } while (ret > 0 && (z->in.size - z->in.pos > 0) + } while (ret > 0 && (z->in.size > z->in.pos) && (z->out.pos < page_size)); if (ret > 0 && (z->out.pos < page_size)) { error_setg(errp, "multifd %u: decompressStream buffer too smal= l", --=20 2.45.0 From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684422; cv=none; d=zohomail.com; s=zohoarc; b=WQzhusRAHC6vwJOOkDHyLywz5j6WJWC5l+1Ocmqh93maNbDiOktHpzGBxbDGifxciIC/cOXlXwrp4r4zGOmol4UX/lfivj1ruZTn/y0iyn53hPUAf8AA2aCdvr7+bbgG5Zz2H+/oU8sLopqx6mQoa5yCTeOP0ALwicAm4nQh6iE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684422; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uEH7XELrrgRUk7dJEbjSFoDATfJsQ4JEpBQhyHZoeiU=; b=hEKXB5Wcxhu+ZcmedghQabYgNj9c0cW4c123QrspmLRZICISul3s62KG1b0H8TiwVfHnKzLCPxX2g+0pn7Uzna9jB+UjCS3u9cWlS4PT/3ISflsMOe4QRRa3to93Vmoyvc2Czym96aqlLHeeaqrCsCIxKT7yZQsN4fgX0MPA870= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726684422784799.3750573503514; Wed, 18 Sep 2024 11:33:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTK-00028e-3W; Wed, 18 Sep 2024 14:32:14 -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 1sqzTG-0001yQ-2C for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:10 -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 1sqzTB-00020P-6h for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:09 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-435-TFSPAV-bMgCuZgltPCnLTg-1; Wed, 18 Sep 2024 14:32:02 -0400 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6c5a32ec301so48485876d6.0 for ; Wed, 18 Sep 2024 11:32:02 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uEH7XELrrgRUk7dJEbjSFoDATfJsQ4JEpBQhyHZoeiU=; b=KanCymPRGiQdfJgMmiQ4P6YM1ljIzzVth/cD0jAzddI0b299tVEDUkCpFK9DyhNckLiRON rFGdX+vJymfKi0AcMRfDGvw33m+mfRjnRlU7QZpwzmK6+PYNqtA1RFv7FAPB6y49jw46uM tNnEwo3RkBZTZ7EwEGz4bJxw+WzWkhY= X-MC-Unique: TFSPAV-bMgCuZgltPCnLTg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684321; x=1727289121; 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=uEH7XELrrgRUk7dJEbjSFoDATfJsQ4JEpBQhyHZoeiU=; b=BxpoxwXt3DSE+pdnKGxEd2OGuq/knbbnXJRIl5zbbVqUf75o/p8OMRHoWJJpeafjdr wtu0kqZCI3SyZYLF2N3chm8CodwiwEsABETOgIVIVG0eYUGjvpaPSiFWPmJYuXwga+/c tFlBEymBazJ+4bqBZJJFE08IIjgdrI123uiTiqMga322AbszM3+okRAuz5UE+rxhOO32 3/r7smIw+eN/1pzSfyWu49Rqn9t9fXOU6xTzyaZy88sbGlmiRp8dkz73vVRu+GBdC7q8 JPByjP2/syhXz15O/N+vUr5ndJLvwHAWQi3LBgy6dNMskC2DNn//Zg6MLkX9dldzdSuM gQpQ== X-Gm-Message-State: AOJu0YxnPFkeDM7XLp1Zck8T/qSXHXuRy3d70NPcc4MzmSH6VDpSiCPn Ta8DBDQCKLEASvULVfqNAiTG2SlYC2I7M4YAKZ5Re64k93yBrxLDoiPecMt4vN48ri8gyTO61kP K4yQ0KPRPxk5ZoEVvCuS2QEYcPYrqLdJg2Y0ED8npXT/KVP0otmE89Z0yTiuD9Du0kdJIXhW0sd L44G5yzn1BQN2OQUDPZ84+VHVF4tZCbe6pcw== X-Received: by 2002:a05:6214:3287:b0:6c5:537a:ce43 with SMTP id 6a1803df08f44-6c573539d30mr283698416d6.26.1726684321418; Wed, 18 Sep 2024 11:32:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbgzGPMSJ4YTNlbE49Dk6/kMVygvukfp1Fa99RuwdKIMNjIMjCvXr5UOPNMGyMaG4z2EP3vQ== X-Received: by 2002:a05:6214:3287:b0:6c5:537a:ce43 with SMTP id 6a1803df08f44-6c573539d30mr283698096d6.26.1726684320849; Wed, 18 Sep 2024 11:32:00 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com, "Fea.Wang" , qemu-stable@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL v2 4/6] softmmu/physmem.c: Keep transaction attribute in address_space_map() Date: Wed, 18 Sep 2024 14:31:49 -0400 Message-ID: <20240918183151.6413-5-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684424906116600 From: "Fea.Wang" The follow-up transactions may use the data in the attribution, so keep the value of attribution from the function parameter just as flatview_translate() above. Signed-off-by: Fea.Wang Cc: qemu-stable@nongnu.org Fixes: f26404fbee ("Make address_space_map() take a MemTxAttrs argument") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20240912070404.2993976-2-fea.wang@sifive.com Signed-off-by: Peter Xu --- system/physmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/physmem.c b/system/physmem.c index d71a2b1bbd..dc1db3a384 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -3274,7 +3274,7 @@ void *address_space_map(AddressSpace *as, bounce->len =3D l; =20 if (!is_write) { - flatview_read(fv, addr, MEMTXATTRS_UNSPECIFIED, + flatview_read(fv, addr, attrs, bounce->buffer, l); } =20 --=20 2.45.0 From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684433; cv=none; d=zohomail.com; s=zohoarc; b=VBVwTqyCDjsEFM+w6E8Fz3IsKd++ZuB3zI2AgfQRg/8gmYUfClKGF+gmiSVkffznKvxW5ZF7IfH2/5KkO9Eiic2m/vu/1zj182IJSEeOanxvYyIDulY5wskq7U9xy87iarPuj0k4DbS5X6yiyniYAWYvNJyXeTdaDD6kHc+ZRWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684433; 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=w4/INXL/PVn5TMqQnxTEKZfK/Si8TZmajwPGuc+4jWg=; b=KP+HfCGqQ2T67aCIIVZAQsbVS/Yl8nAVwXv/lOVDT0Ve8v8qcgoJg91p3xkX4BkhYu6dTIsblrVClfBu3bKXJ8R2AIpe89bY+OYZVczkuzN0EqzeFZHpas5JO1vHElcFYgxUYtWAevD5O777cQpdILQmS6y9ofYfxYuReMfpTMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726684433106783.5106245006027; Wed, 18 Sep 2024 11:33:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTM-0002Oc-HC; Wed, 18 Sep 2024 14:32:16 -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 1sqzTI-00028H-IO for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:13 -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 1sqzTD-00020l-0g for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:12 -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-593-DGZnF_SaO0KQLDE2M0TILg-1; Wed, 18 Sep 2024 14:32:05 -0400 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4581d371964so559691cf.1 for ; Wed, 18 Sep 2024 11:32:05 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684326; 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=w4/INXL/PVn5TMqQnxTEKZfK/Si8TZmajwPGuc+4jWg=; b=bVMiBzcD4OyKsBt0cI+tA6Ukod3PCgYpIEeZSHldKLmMh3J3WLfGWI7PYFGssSBt6CMe9q nU7O9AQUtx1DQd7vQrJ09TIYzJeAmCExo7oUbNgWmVfPg2TR2C/58gogejuD67Y8FjBu/A TDrfNHjonY7I77n/68Ei00KygASkGi0= X-MC-Unique: DGZnF_SaO0KQLDE2M0TILg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684324; x=1727289124; 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=w4/INXL/PVn5TMqQnxTEKZfK/Si8TZmajwPGuc+4jWg=; b=Eu0l2u5q4pm9xH5SSKVWs6nEGZoWY4VSjZ81+lpBuRScROQwoMqA5+CdH/KuAnQMb4 B6YvBkQQzQ3QCm79aN+srjPF2DNTl4QwJSP1hm9A70aJojtq/RuSkyzJf+VNkZEC1gPp 3xgaxHGBcxJ/ywlaLegycxBIom6jf3u4UaY/o5jXvk0wcp/4P8jvHVPDUj0i+CSxbu9E LSqmVhezRT6RcXedVCkJu2X1x9sSBk4aWw4vWqnSLp7VHH9OtR1LGKHIWPjVI/oBD71C V0eGDBdNqPA0mYK2wO7VkluAS7ceLgXbYAz47hiGFNa79WcHJ2HRGYjluwHm2GtnRc8j ThkQ== X-Gm-Message-State: AOJu0YxN6r5MWPlh8b/ycIlpI+pK5e9BTCmA3vxiaZeeLruCgXxqymAQ JXIih2yG1+FDcIZydKCx9IOj3HWyDo6QVmcIOG/BeT4I2ffVogKjX0UJ2Rf8JR2CKyXwKQvYhHR M7JtxAaXEtWpCbeE0UiHtT1i27jrMoJc7qsr+SrvHEZYxe5AFhRGze7hjU7ybPYl3DzASyG/hy2 8Yp9ydaUR7YdC5uYuFyUOd8yTVqJInUZ0dyw== X-Received: by 2002:a05:6214:448b:b0:6c5:681e:1d4 with SMTP id 6a1803df08f44-6c5736cbbb9mr439299036d6.34.1726684324006; Wed, 18 Sep 2024 11:32:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJi16r2N/lzXN4dbpFGtJgjveCfMxRgrJhniOuy7eKhoXuY2yCxnp6Stvu3hu462F+ia/VSw== X-Received: by 2002:a05:6214:448b:b0:6c5:681e:1d4 with SMTP id 6a1803df08f44-6c5736cbbb9mr439298636d6.34.1726684323504; Wed, 18 Sep 2024 11:32:03 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com Subject: [PULL v2 5/6] migration/savevm: Remove extra load cleanup calls Date: Wed, 18 Sep 2024 14:31:50 -0400 Message-ID: <20240918183151.6413-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684434959116600 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas There are two qemu_loadvm_state_cleanup() calls that were introduced when qemu_loadvm_state_setup() was still called before loading the configuration section, so there was state to be cleaned up if the header checks failed. However, commit 9e14b84908 ("migration/savevm: load_header before load_setup") has moved that configuration section part to qemu_loadvm_state_header() which now happens before qemu_loadvm_state_setup(). Remove the cleanup calls that are now misplaced. Note that we didn't use Fixes because it's benign to cleanup() even if setup() is not invoked. So this patch is not needed for stable, as it falls into cleanup category. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240917185802.15619-2-farosas@suse.de [peterx: added last paragraph of commit message] Signed-off-by: Peter Xu --- migration/savevm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index d500eae979..d0759694fd 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2732,13 +2732,11 @@ static int qemu_loadvm_state_header(QEMUFile *f) if (migrate_get_current()->send_configuration) { if (qemu_get_byte(f) !=3D QEMU_VM_CONFIGURATION) { error_report("Configuration section missing"); - qemu_loadvm_state_cleanup(); return -EINVAL; } ret =3D vmstate_load_state(f, &vmstate_configuration, &savevm_stat= e, 0); =20 if (ret) { - qemu_loadvm_state_cleanup(); return ret; } } --=20 2.45.0 From nobody Sun Nov 24 03:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1726684419; cv=none; d=zohomail.com; s=zohoarc; b=hq3Q5/U5X/jBPli4dwXlgJEkWqXi9IrkRWN7ehQk6qevo1Uoad3rNp6Wr8muziAkBtw0XGOetHZ8q+3BxKztW7ew2aa4wzi0RJdnU+gY5IHkOjyrta2MlfO6PB9DcMX8c2G7ftP94BFTrk/e1H+UyOT2nz44chV0k/VnhvK699s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726684419; 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=wcORaTdOlKE0GN8MprplNyrFUTHIsXM5RvJ3/UsElD0=; b=FVEvjTRa6arB2he0h4GO1aDfUHOZI/wBXQrjlKFKMRLzgHlhiL00WWYWi1uyvD1f7rzIYYFlPsb9KibJanG1Mhm5bwz6ICXqL544NWXIx+oVnbXf/9lrmJ1U23Tunq2ckiHEv3VbczfpfetTni/vUmZNlGcaOABMzKIPrIlLhNU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726684419439228.25043480382294; Wed, 18 Sep 2024 11:33:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqzTL-0002El-2K; Wed, 18 Sep 2024 14:32:15 -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 1sqzTG-000219-O3 for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:10 -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 1sqzTE-000210-OU for qemu-devel@nongnu.org; Wed, 18 Sep 2024 14:32:10 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-647-SbdMavxVNFWNVKZRe1qzUQ-1; Wed, 18 Sep 2024 14:32:06 -0400 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6c3702d3ecfso146035236d6.0 for ; Wed, 18 Sep 2024 11:32:06 -0700 (PDT) Received: from x1n.. (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c75e494a28sm30486d6.68.2024.09.18.11.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 11:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726684328; 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=wcORaTdOlKE0GN8MprplNyrFUTHIsXM5RvJ3/UsElD0=; b=fVC5PCWMc7js8wj6Qhfpf7xCRSuNVotVrdJCd+fCl8/CXgagkLRiydnGU3c9l2G0B0VYQV gBUQb+W4PZkaqfCFY+zKHWH4VR7rRYkjijy7+uHeEudk64fHmRi/d1bN+Vukd4fPj+SBgH sP2ERPkfCDaLVO6buv+hjcFTaM35R2g= X-MC-Unique: SbdMavxVNFWNVKZRe1qzUQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726684326; x=1727289126; 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=wcORaTdOlKE0GN8MprplNyrFUTHIsXM5RvJ3/UsElD0=; b=no2rMXAP7Tmz9M1sSJe0ytiLLbA7HEpe+a0l6EsJ/2m+DahDZAGoymdWCRnRIBL0hT aOX3ju9dZrgRG6rGZoj0gME4goYyxFlKo/vAJPIe5V2M1MBQNyqmW4bJkSQMEo7KeGQn ltr39HonlDF4M/loqAx6xyMKPZfar5Tby0aAA8GsjvN4t64pd5lkkEzV4Mpg9MALUbD2 Jf3q7Tzi8FK18/3oTdefAnjSaUcd1lx93pD2utgfqubv9LlyAaVgIvkZDeuBnRNRCslF TegTnNyvIgHVQNykGn1gTT2IJctRs3GDIk915Gi/+vGC5cEljlp4Vs8R6wv2qqVyGBck PqKQ== X-Gm-Message-State: AOJu0YxSDNJxNpDzK7P+CabtgxpF/VudCUX3INrcjwR8YyyprXWUP6aM 4IxipK3p7zblelCzi8EkvjGJT9joG6ITIhIm9ZzClMXJH2o69PA9iGTJJ+ttijUF6ioMKr5l8U0 BrKbEAZdkHU+ShUIH3g0QKNm1sZWZGrOzN649wFVnfrhrk6zonH4wXWrvqHVj8WDaoRaxE5tX3/ CDPn0Hyy7ecbv1Q1rofRVd61BHTFTPeN2QnA== X-Received: by 2002:a05:6214:45a1:b0:6c3:5d09:cf8a with SMTP id 6a1803df08f44-6c5735685cemr388022686d6.26.1726684325727; Wed, 18 Sep 2024 11:32:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXFYWKFgiIiQNDUCgj/GfFeJlifIaFPAalwWfksM3aEif90jC2SVvLMS0Lz9rbi/QuHgkd1Q== X-Received: by 2002:a05:6214:45a1:b0:6c3:5d09:cf8a with SMTP id 6a1803df08f44-6c5735685cemr388022266d6.26.1726684325316; Wed, 18 Sep 2024 11:32:05 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , David Hildenbrand , Peter Maydell , Fabiano Rosas , peterx@redhat.com, qemu-stable@nongnu.org Subject: [PULL v2 6/6] migration/multifd: Fix rb->receivedmap cleanup race Date: Wed, 18 Sep 2024 14:31:51 -0400 Message-ID: <20240918183151.6413-7-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240918183151.6413-1-peterx@redhat.com> References: <20240918183151.6413-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726684420905116600 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas Fix a segmentation fault in multifd when rb->receivedmap is cleared too early. After commit 5ef7e26bdb ("migration/multifd: solve zero page causing multiple page faults"), multifd started using the rb->receivedmap bitmap, which belongs to ram.c and is initialized and *freed* from the ram SaveVMHandlers. Multifd threads are live until migration_incoming_state_destroy(), which is called after qemu_loadvm_state_cleanup(), leading to a crash when accessing rb->receivedmap. process_incoming_migration_co() ... qemu_loadvm_state() multifd_nocomp_recv() qemu_loadvm_state_cleanup() ramblock_recv_bitmap_set_offset() rb->receivedmap =3D NULL set_bit_atomic(..., rb->receiv= edmap) ... migration_incoming_state_destroy() multifd_recv_cleanup() multifd_recv_terminate_threads(NULL) Move the loadvm cleanup into migration_incoming_state_destroy(), after multifd_recv_cleanup() to ensure multifd threads have already exited when rb->receivedmap is cleared. Adjust the postcopy listen thread comment to indicate that we still want to skip the cpu synchronization. CC: qemu-stable@nongnu.org Fixes: 5ef7e26bdb ("migration/multifd: solve zero page causing multiple pag= e faults") Signed-off-by: Fabiano Rosas Link: https://lore.kernel.org/r/20240917185802.15619-3-farosas@suse.de [peterx: added comment in migration_incoming_state_destroy()] Signed-off-by: Peter Xu --- migration/migration.c | 5 +++++ migration/savevm.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3dea06d577..ae2be31557 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -378,6 +378,11 @@ void migration_incoming_state_destroy(void) struct MigrationIncomingState *mis =3D migration_incoming_get_current(= ); =20 multifd_recv_cleanup(); + /* + * RAM state cleanup needs to happen after multifd cleanup, because + * multifd threads can use some of its states (receivedmap). + */ + qemu_loadvm_state_cleanup(); =20 if (mis->to_src_file) { /* Tell source that we are done */ diff --git a/migration/savevm.c b/migration/savevm.c index d0759694fd..7e1e27182a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2979,7 +2979,10 @@ int qemu_loadvm_state(QEMUFile *f) trace_qemu_loadvm_state_post_main(ret); =20 if (mis->have_listen_thread) { - /* Listen thread still going, can't clean up yet */ + /* + * Postcopy listen thread still going, don't synchronize the + * cpus yet. + */ return ret; } =20 @@ -3022,7 +3025,6 @@ int qemu_loadvm_state(QEMUFile *f) } } =20 - qemu_loadvm_state_cleanup(); cpu_synchronize_all_post_init(); =20 return ret; --=20 2.45.0