From patchwork Tue Sep 17 21:55:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NHc1jFZz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGb57mGz1y1t for ; Wed, 18 Sep 2024 07:56:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAI-0006OH-MX; Tue, 17 Sep 2024 17:55:19 -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 1sqgAG-0006N9-A4 for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqgAE-0004hO-A8 for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610113; 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=NHc1jFZzMrbKJ+msjpDZEL86/AM6K+DmnxMcqWbnp4LBaltLioNWi9iO6bIRsDLUWwnxSK AC5KU25HATyUCXo23rhcX/qXwcTw3Dq5ht7lghU96X6YHn+35RhPK/MsUHon0BNjn+tLpE PutuafEvQJ+CEJznL0ddQiecBoOAjWc= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-PZZ4RUiPPkGW65cRmg16Eg-1; Tue, 17 Sep 2024 17:55:12 -0400 X-MC-Unique: PZZ4RUiPPkGW65cRmg16Eg-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7a9c0f3638aso1423123185a.2 for ; Tue, 17 Sep 2024 14:55:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610111; x=1727214911; 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=MsEtv5Ann+YgxNCdWvsOoZJUnoUuxOWnhcG867wCLAXs7zct71cx5JPM2BjrfYpXd2 MfuS3us77au08YWdQzeHPilGrlZEFj61RIiT3AXscRJPa8IPd6IpOebmXArRQolcq2uN 6bfu6C2Fw9ckgsv3YYBnCdYLHASoWuvZq9Iuk9MuMT/GXr0Dj1j/qkGM1WhWjdvRKRu6 GPAVKdI6uQmkQiWtpc0H0fA+ExatRXwz6cy8yhV8fdU1r+3l7oMheUsQJ18MU2V0wipW dCKtpxlajVYxKjqYww7QT+yR4OdrJkATGECZTDgE/F56sffLZTpNykzOvLAYGyUHMc6u lprg== X-Gm-Message-State: AOJu0YwcRjqqZUqV5miPBksnaCPXgcfosnPxZaQnL2lsOTZJFi3DVgZi qil4gCB2wqJE9PTXsa7o8Te7tY5rlvPbOfGjZD2Q8t4dIzCw1GfkUskF3jYr7vCzxj1WnEIFruK JRQ6Osq1orkqtnFDFiT5y0YjRqILWR7KE1lRIA32M/kyXyph9EXg/aEFcAf4kfDb0RYT2+iLXfe lIpxUqJsc5B3JUscUOS/4oN6HE9NpFwcHWsg== X-Received: by 2002:a05:620a:1790:b0:7a9:af05:79e2 with SMTP id af79cd13be357-7a9e5f1b17bmr3792680285a.26.1726610111327; Tue, 17 Sep 2024 14:55:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAnBASfE9SnecLi6pMoj39yG26gvDGeA9O3HMsAV4/U6AZWqqWrpefKKy+qXfgu4WqXhlGuw== X-Received: by 2002:a05:620a:1790:b0:7a9:af05:79e2 with SMTP id af79cd13be357-7a9e5f1b17bmr3792676185a.26.1726610110894; Tue, 17 Sep 2024 14:55:10 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:09 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas Subject: [PULL 1/6] tests/qtest/migration: Move a couple of slow tests under g_test_slow Date: Tue, 17 Sep 2024 17:55:01 -0400 Message-ID: <20240917215506.472181-2-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) 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); } From patchwork Tue Sep 17 21:55:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PRpLUnn9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGy4RQwz1y1t for ; Wed, 18 Sep 2024 07:57:14 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAa-00072k-LG; Tue, 17 Sep 2024 17:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqgAG-0006Nc-RA for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqgAF-0004sI-5B for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610114; 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=PRpLUnn9wN8CFl7qVgxI0s3hOX+9fzNkH35pLoXNXb+dy7cHcpOrcaZMgLobdQDSwh53vR a7Q+wR5uB+NS3uQCASKBPbhq/HrcLVhTNYTxJg/oGvATE7RJjYFjsdvor2Ku7pmAlkXoYn t4MBwWL9xNjgfr01fNM0vbl0gU9nUUQ= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-260-TrVbBpfTPYS-faY4JXWMZA-1; Tue, 17 Sep 2024 17:55:13 -0400 X-MC-Unique: TrVbBpfTPYS-faY4JXWMZA-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7ac9dff8072so148657885a.2 for ; Tue, 17 Sep 2024 14:55:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610113; x=1727214913; 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=bbYY0+HT/yV7VywxPt00CUMsBypVwD/FFf3tdX488k9W1FmbGKQCN0mbpLv7q799CX eCK3wyLaXAWRE5DDQd+6GR6H7TgC1yF7QKx5SlGIpXGL3A68eqArhIds3EvC7z4nHAmP DumlH7l8WXX3kH9tSRG9hJ748CFrO60TWQv9CwwzpdXehToAMENPNFIJHteymxUqaRNx P6i2RbsDqcn+MiFLUTHsyEwiI0fAsGzSS+I1HKAZucPdNXT+NpneWfvzwQPKw7NCxM0d egVCKla1aHkiHxiKeUeBWzAAbYcnaXhLwzB7WSf/+see/UwFL5hVRtQbDDZnaUuic5fZ D2Ag== X-Gm-Message-State: AOJu0YzwIGaGFG79dGh6648GCVn6fnc4F1AEcRnWcoBANVBtYCOHk/PR KdLNVxMnQAmND86gVZ3Xb6WX0ZBr59MWVczk24FJ4IIME0b68c81npfkQY+GN1aM3cjcX0uveIO d8X/ozFw5/rSNDrs/7iz1ppEE7q5UfaGJ9S3iL+mVM/jowF1hGqfWsKVRhYekwRGkGJsWpd65N9 wQ4Z4VZNg9XwWSXAiLX+E7pu6+oG/TqebKgA== X-Received: by 2002:a05:620a:394a:b0:7a9:b8dd:eb96 with SMTP id af79cd13be357-7a9e5f1a291mr3266823285a.30.1726610112697; Tue, 17 Sep 2024 14:55:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIG+Nnc9cadN1R8kmSGtINYvLscAIObq1RAgDiFuqi9WkYUR7d/pMubeUZdIbGr01Lbvd1gQ== X-Received: by 2002:a05:620a:394a:b0:7a9:b8dd:eb96 with SMTP id af79cd13be357-7a9e5f1a291mr3266818885a.30.1726610112232; Tue, 17 Sep 2024 14:55:12 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:11 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas , Yichen Wang , Bryan Zhang , Hao Xiang , Yuan Liu Subject: [PULL 2/6] migration/multifd: Fix build for qatzip Date: Tue, 17 Sep 2024 17:55:02 -0400 Message-ID: <20240917215506.472181-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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, Error **errp) */ static int qatzip_send_prepare(MultiFDSendParams *p, Error **errp) { - MultiFDPages_t *pages = p->pages; + uint32_t page_size = multifd_ram_page_size(); + MultiFDPages_t *pages = &p->data->u.ram; QatzipData *q = 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 = 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); } - in_len = pages->normal_num * p->page_size; + in_len = 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, Error **errp) p->id, ret); return -1; } - if (in_len != pages->normal_num * p->page_size) { + if (in_len != 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 **errp) int ret; unsigned int in_len, out_len; uint32_t in_size = p->next_packet_size; - uint32_t expected_size = p->normal_num * p->page_size; + uint32_t page_size = multifd_ram_page_size(); + uint32_t expected_size = p->normal_num * page_size; uint32_t flags = p->flags & MULTIFD_FLAG_COMPRESSION_MASK; if (in_size > q->in_len) { @@ -370,9 +372,7 @@ static int qatzip_recv(MultiFDRecvParams *p, Error **errp) /* Copy each page to its appropriate location. */ for (int i = 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_size); } return 0; } From patchwork Tue Sep 17 21:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iylPHQ5d; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGz4cYvz1y2l for ; Wed, 18 Sep 2024 07:57:15 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAM-0006XK-95; Tue, 17 Sep 2024 17:55: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 1sqgAI-0006OW-EZ for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:18 -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 1sqgAG-0004sX-On for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610116; 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=b1EwRJ2C6TfAu0owbGHqQmsTLpssDSJGcP8SDLMrK6k=; b=iylPHQ5dGNVqoaSDnLuJFAjuf8tgtHvT+pF0ON4Kd0HdEcBUp/fp20pUhlOsREIEDL+dRx 9pGUx30UN+2tyLuEL8gtoyJPRJHpYP9zONWQaUFFmZRe426HGUCoXwBn9pEN6C9BJ1xOIp sItNsBHpiItZWptdRnVnjRHS6gPSyck= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-go3QWBmSO9SGMFoZFmehMA-1; Tue, 17 Sep 2024 17:55:14 -0400 X-MC-Unique: go3QWBmSO9SGMFoZFmehMA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a99ec827f3so665181585a.2 for ; Tue, 17 Sep 2024 14:55:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610114; x=1727214914; 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=b1EwRJ2C6TfAu0owbGHqQmsTLpssDSJGcP8SDLMrK6k=; b=iOik8xnWZIHeaK5c2btrHnVB80VMvnxvR4qQikmxaMOLZbBFvi+TrfpcP8+CgErkHP U9JLQgshTOVwpPWXZdDeT/l7/A/viS6ygUsNyLoVHwhQLlrHVtwW17BwW5zocrjhOlJl oPwY8Crlj8VipseNKwWaFlOPfco4xQFQG12WAlaf4wg4oBOCuHG04J6LwNQjSxjcVcLw qkAVB44SGm+gZ6ogyEUYSRejBEqJrwJIf5AzTEqr4dArk6heF+/6JP1FRiUJkpjwOBCp 9MGKmVQZ8rcbVEGmTognidWkkT3DwvNcSslYxkgzGibRq6DbHrC2ZPUOnF8Jci+8LpHJ CNGg== X-Gm-Message-State: AOJu0YylrtYqeaym0p2XfcqT1kjIAdn6il9KG4IwsRczuBb5B1lTLMVG tQm6yBmDE0Nhotq6qCAb+e6HDlmLeioyJFgaWzcK1wcH3dMHAk1LmMdUuuEmT9uAZdnUJOx4iFW DM0sJ69UFelriLixUnS4N88I7HCSAc3FOfo2fQT4Tp6FT1HH4PFArCSaR6FEgWBfylr/ZZb0mRz zVmp2STNrWg/vgmkBeEcDYAhZt15O4VMUUUA== X-Received: by 2002:a05:620a:2495:b0:7a9:d4ae:5f85 with SMTP id af79cd13be357-7ab30da32c6mr2632591285a.43.1726610114185; Tue, 17 Sep 2024 14:55:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrrgZRn/wKcpriEJBW+Hw3qIZRoAt6KPemuOhriLh+xoF9Fk7NyUmbjh0rVmsDt8eSyRyE1Q== X-Received: by 2002:a05:620a:2495:b0:7a9:d4ae:5f85 with SMTP id af79cd13be357-7ab30da32c6mr2632587785a.43.1726610113781; Tue, 17 Sep 2024 14:55:13 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:12 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas , Stefan Weil Subject: [PULL 3/6] migration/multifd: Fix loop conditions in multifd_zstd_send_prepare and multifd_zstd_recv Date: Tue, 17 Sep 2024 17:55:03 -0400 Message-ID: <20240917215506.472181-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil via 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 == 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 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 = 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, Error **errp) */ do { ret = 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 small", From patchwork Tue Sep 17 21:55:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FafSL/+i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGy4kFxz1y2j for ; Wed, 18 Sep 2024 07:57:14 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAj-0007DC-I9; Tue, 17 Sep 2024 17:55:45 -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 1sqgAM-0006at-ED for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:27 -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 1sqgAK-0004tC-Cy for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610119; 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=FafSL/+ibCRgWqJ+zV1rgjBpli9+JiJpx6x9BuJdAvt+u6yKku/moohUAtNIPVNO0q7jOO UYryzCDWC96xgK0BxbpkrTfiBGogVHwugWw/jZOtCdN9ruBMXkGzXFqmTE2Ey08h6UTe/m VeSQBoZKF2xSDhVBREqNT/xwpj7mNPg= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-28-tWoJL2xQNAyiFutzB4K7PQ-1; Tue, 17 Sep 2024 17:55:16 -0400 X-MC-Unique: tWoJL2xQNAyiFutzB4K7PQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a9cfe4442cso987160085a.3 for ; Tue, 17 Sep 2024 14:55:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610116; x=1727214916; 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=hiYH3kpRI0dwXIbrudDjkwyPEQxW+P7IsrCQCYkoZXaW1SBMViSGsp1H9TMcEQsfeh q8nNdLCyMpgLAqGJXW7I01yp0Gy58NrqbN8pnMR6ZsT8+Kvkeet5N+GcA5RFysODRFwo 2OGQ0aIojBiI3VdgyUnSiD/PC343N1BoISTjDLckXF23YKtyX8ZexlwQKC6QGWotlZZa x8rtXzEUx1OobDj/a+qxJ3WHyP8Bhm9OiM/J92GrEyZGWU0qsTtDRkZNvJfoQR5MAkkd 176FTIrudVvE2IGIPTheWXUR78h26qugcI5wExFjKFYbyG6PS0PlKd5oD48wkgveYeFF EFHQ== X-Gm-Message-State: AOJu0YxyVQ1DUJ4N//hAkorPO8Sfg8zcOJlJtG/IwKuGIZltGYATWa4q ixCynApz/Da61CK/9B8BLpXY2nptBCB5H99OqfZWJQRC8rPun0oXvpZBDpmJiv275s5pWWAmwVh u9rBDQefS4lbucXxNCdccmtjXQFtB13OdaXdfWDp1GI8GwZRWZLcVFu18xfDJKxMfNNlVJzavnb SyMkC3rG5Z0BQ3Mr8X7htt0D4V7Sa7NwRzMw== X-Received: by 2002:a05:620a:3954:b0:79f:197d:fe92 with SMTP id af79cd13be357-7a9e5ee7bc3mr3393235185a.2.1726610115819; Tue, 17 Sep 2024 14:55:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAxOc+2TLVFD4V5QSj73rFIH/CJ80tUcVmOunent265Iq4wxz+IWfQhp9ClAUSp/Z+CADqdw== X-Received: by 2002:a05:620a:3954:b0:79f:197d:fe92 with SMTP id af79cd13be357-7a9e5ee7bc3mr3393230985a.2.1726610115305; Tue, 17 Sep 2024 14:55:15 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:14 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas , "Fea.Wang" , qemu-stable@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PULL 4/6] softmmu/physmem.c: Keep transaction attribute in address_space_map() Date: Tue, 17 Sep 2024 17:55:04 -0400 Message-ID: <20240917215506.472181-5-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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é 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 = l; if (!is_write) { - flatview_read(fv, addr, MEMTXATTRS_UNSPECIFIED, + flatview_read(fv, addr, attrs, bounce->buffer, l); } From patchwork Tue Sep 17 21:55:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b67fgO63; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGc5CLtz1y1t for ; Wed, 18 Sep 2024 07:56:56 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAk-0007GA-9d; Tue, 17 Sep 2024 17:55:46 -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 1sqgAN-0006fb-J3 for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:27 -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 1sqgAL-0004t2-Fe for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610118; 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=b67fgO63h2sce1KVP2b4E0V4sas3bVdpSoEHZgcUuw+X0wI4sH9stgbBJRomgZnvMl1XRU 6gRne43jBht2Io/3he9nKhAAzxEboxzwY+7ljiJ91rOMIspZfBHmf2utzcBr3AJTGr/KvA bNzyGG0WGizW08UNw//Cs6Ae1KPOCKA= 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-463-suaYEBHfPOiWrD1SG2zn0g-1; Tue, 17 Sep 2024 17:55:17 -0400 X-MC-Unique: suaYEBHfPOiWrD1SG2zn0g-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a1d0b29198so1374602785a.2 for ; Tue, 17 Sep 2024 14:55:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610116; x=1727214916; 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=uDPBK6vqXczL+dVKZWDkwl/02pkkjJC+1WGYa8Hd3BY3o91CpoF08FxNdpDSdr3Efh qE4WX+eh09UUzmpvviPPp6eIRVnA6y7MdimB6nG4hywvdUzmjNVJ1zXlBBTRQvFQrGP9 lFxkh9LYkfxT9dGORtCoUs6Z08OtPalpnLXyL7iI4Q4bGjappQ5sVrWb+os329WNX6Af bGpPWVJCMTUl/bZajVbfjYDgbMV+Kq1aHqpoQdjmscPiy2Vz7w2M7SxO5F/wOkpb2CyO ATno7AlArOr4RWxp0l93EGA5e3iT5jDlSU9vqsgFt5o/oDXeEk3QPmEFZvGlOZUQDQNv zkzg== X-Gm-Message-State: AOJu0Yym+vvg1PnbIFP9cfTKS/lyHsNg4PXfShViS/Kc/KWmgzHltyo/ gBZFoTHy1XGdMHbhEz8UsNZ9MoYwALd/ivNPhGr1AvGMs2F/c2mtFeQ4FFnmSKZfWyLxSqhtuzn EXBMPFTHVWnIQohWIvpAWxyDnju9pCB8LBhV/Vy4uaxkx4g+gpkbU5cYN7QKTPiBltLe37wAfRr 4HADnH7eSGfNEHMt4WUfgsvq1N8JUemNTVOA== X-Received: by 2002:a05:620a:4013:b0:7a9:bd68:462e with SMTP id af79cd13be357-7a9e5ef6732mr2798297685a.20.1726610116619; Tue, 17 Sep 2024 14:55:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhtYvqJwDzOTsDK6yi5bgA/PvlgQRsE6/BHv5sXkoub+pWaENuY2uuPMbZ0QGBcc0hpj2Z6Q== X-Received: by 2002:a05:620a:4013:b0:7a9:bd68:462e with SMTP id af79cd13be357-7a9e5ef6732mr2798296085a.20.1726610116249; Tue, 17 Sep 2024 14:55:16 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:15 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas Subject: [PULL 5/6] migration/savevm: Remove extra load cleanup calls Date: Tue, 17 Sep 2024 17:55:05 -0400 Message-ID: <20240917215506.472181-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) != QEMU_VM_CONFIGURATION) { error_report("Configuration section missing"); - qemu_loadvm_state_cleanup(); return -EINVAL; } ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0); if (ret) { - qemu_loadvm_state_cleanup(); return ret; } } From patchwork Tue Sep 17 21:55:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 1986600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RJ1/ngjZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7bGZ4svrz1y1t for ; Wed, 18 Sep 2024 07:56:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqgAk-0007IY-Tj; Tue, 17 Sep 2024 17:55:46 -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 1sqgAN-0006fY-Is for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:27 -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 1sqgAL-0004tM-FR for qemu-devel@nongnu.org; Tue, 17 Sep 2024 17:55:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726610120; 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=RJ1/ngjZXZ1wJVODyMX5Zw7MNGXulcodxURkiYhmSGDF+n2Bk7Nv61p3U9SN8cxbs8ceHx x2dorwbf+rg1SCq7GSuysHOs53nYP2P+GVB0JieaI4qAunO7bL5IWE0fgecnozw8Yb/e0C jaRuSIUUr5dcs5jZ6VBCL4qxMInKvNk= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-pp78o2xXOryk1hE9RQDRgg-1; Tue, 17 Sep 2024 17:55:19 -0400 X-MC-Unique: pp78o2xXOryk1hE9RQDRgg-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7a9b1216a68so1073850985a.2 for ; Tue, 17 Sep 2024 14:55:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726610118; x=1727214918; 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=kBb+3RxyaDmetkz+/M/y66fCcogOYbyDqOSgaDXmMJM02435plFscA4OCuIjC07S85 ghkkE0qGJpfIkX4vBjsY8T5gYCiZ6Vz6iwpBz1hJG680UNmQxew/VFiKabBo0n0o1qoj 9eKZmt26a52tzFyrk8pakd1SqPSuNFPycTCqO2lXqVjCxVNEUILpV5OmUZQFCy9fuOjB bQQDKJbUW9DQuVQRfMESDsfEgZNcB3ltUZpdDlxUV4ktSqlPOeshqGjnKsyTWueDQ9zW gYxubc5wk2dU/nCiaSmDmFzDN8KMwqyyU5UG7veIOK4NYbv9o3N8uJwmmJVrGgr/wnSQ NiVA== X-Gm-Message-State: AOJu0Yz8fP+iHGIrDsKpRJPLWk75jHNXnt6bLgLL6aZVzUJXqwTCyDMb hiv5KlmNg8hLbuPRNJMKEGJfYjBz+bEMMz6Ru2YkBuNASJuhT9upFtLLrS652E/bXSUNtIyEayK WF8FW1ltM43l1pVrhazzJKcRiuUotNmmK/8fPLLUhpZyy5iCqoamyv6M+aZ/FkMRsH8FivF/G7x 0zN/PLbYX1n18HNWPZlyfTQ5kICWNZzWAPWQ== X-Received: by 2002:a05:620a:45a7:b0:7a7:f809:9f3f with SMTP id af79cd13be357-7ab30d23c19mr2789422885a.16.1726610118129; Tue, 17 Sep 2024 14:55:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXT7SfkigeDr7r75fSppWtZICdCAaiIqlf7VVOzgRzBR5mdtYSMY2cM7u3bj9TawRLeCf4bA== X-Received: by 2002:a05:620a:45a7:b0:7a7:f809:9f3f with SMTP id af79cd13be357-7ab30d23c19mr2789419185a.16.1726610117699; Tue, 17 Sep 2024 14:55:17 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7ab3e97c9fasm402869685a.28.2024.09.17.14.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 14:55:16 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: peterx@redhat.com, David Hildenbrand , Paolo Bonzini , Fabiano Rosas , qemu-stable@nongnu.org Subject: [PULL 6/6] migration/multifd: Fix rb->receivedmap cleanup race Date: Tue, 17 Sep 2024 17:55:06 -0400 Message-ID: <20240917215506.472181-7-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240917215506.472181-1-peterx@redhat.com> References: <20240917215506.472181-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: -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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 = NULL set_bit_atomic(..., rb->receivedmap) ... 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 page 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 = migration_incoming_get_current(); 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(); 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); 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; } @@ -3022,7 +3025,6 @@ int qemu_loadvm_state(QEMUFile *f) } } - qemu_loadvm_state_cleanup(); cpu_synchronize_all_post_init(); return ret;