From nobody Sat May 18 16:46:49 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=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1714069059; cv=none; d=zohomail.com; s=zohoarc; b=ktK3owQijqrsD74k+TU7ODrjZBPja0MrAk6ZX4tZxELzpWqCj1n7SJmEh6ukLnI9l58kdZGZ/OfnMMc+iXsHepdwap+AQcdS89W/XK8XSZXjEXtnxMY0stQgkggRh/i7vKbvTxxfboBMxYjAd9ePwvMP9SkSdZvTRwCvxHsfce8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714069059; 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=NtYxGgXv8ySl5Yi9Z3EcDc7bBHPrp22NWsEZmBldiEE=; b=h3atFRQ55GpPKYcd0o0jjqN/KxZ3PhIlMdjr2XXc6Z+wlwPOMYJVoDdFoqaRzEiZLTyshCtRBuJ3GhUm3DAr0ZNww/I1OdEMuKmBpzQJ46GvlYq0mjrF+EQqCKykVjdqzy/nNPZswRPvuDk2ofxTfbigG47b6jvLx2qjkjct2Ao= 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 1714069058714520.7463250232803; Thu, 25 Apr 2024 11:17:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s03eH-0001VE-KP; Thu, 25 Apr 2024 14:16: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 1s03e8-0001Ub-9Z for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:36 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s03e5-0003zC-5M for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:35 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2a2a:0:640:d546:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTPS id 9E43160B74; Thu, 25 Apr 2024 21:16:25 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b58e::1:22]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id qFR9v101Pa60-HWZSmsxk; Thu, 25 Apr 2024 21:16:24 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1714068984; bh=NtYxGgXv8ySl5Yi9Z3EcDc7bBHPrp22NWsEZmBldiEE=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=PoQ5VCx2c1EVE0RGigCfO9tIlWlJu/oNsrDEERXupi8ihgAE/d/A0Y4M7z0vr+egY 2CYXY+HaWshaR00SrJLJvS0OBVxmx5BbLV/Abetdp0/mUtkxxWzBtSgvinM3MgnyBz LATlwyJGg6zvofqT4ebwhis/CMvqND+q1Ns9hDU0= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com, farosas@suse.de Cc: eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru Subject: [PATCH v3 1/4] migration: move trace-point from migrate_fd_error to migrate_set_error Date: Thu, 25 Apr 2024 21:15:48 +0300 Message-Id: <20240425181551.1465739-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425181551.1465739-1-vsementsov@yandex-team.ru> References: <20240425181551.1465739-1-vsementsov@yandex-team.ru> 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=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 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 @yandex-team.ru) X-ZM-MESSAGEID: 1714069061546100001 Content-Type: text/plain; charset="utf-8" Cover more cases by trace-point. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas --- migration/migration.c | 4 +++- migration/trace-events | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b5af6b5105..2dc6a063e9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1421,6 +1421,9 @@ static void migrate_fd_cleanup_bh(void *opaque) void migrate_set_error(MigrationState *s, const Error *error) { QEMU_LOCK_GUARD(&s->error_mutex); + + trace_migrate_error(error_get_pretty(error)); + if (!s->error) { s->error =3D error_copy(error); } @@ -1444,7 +1447,6 @@ static void migrate_error_free(MigrationState *s) =20 static void migrate_fd_error(MigrationState *s, const Error *error) { - trace_migrate_fd_error(error_get_pretty(error)); assert(s->to_dst_file =3D=3D NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); diff --git a/migration/trace-events b/migration/trace-events index f0e1cb80c7..d0c44c3853 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -152,7 +152,7 @@ multifd_set_outgoing_channel(void *ioc, const char *ioc= type, const char *hostnam # migration.c migrate_set_state(const char *new_state) "new state %s" migrate_fd_cleanup(void) "" -migrate_fd_error(const char *error_desc) "error=3D%s" +migrate_error(const char *error_desc) "error=3D%s" migrate_fd_cancel(void) "" migrate_handle_rp_req_pages(const char *rbname, size_t start, size_t len) = "in %s at 0x%zx len 0x%zx" migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t post) "exact p= ending size %" PRIu64 " (pre =3D %" PRIu64 " post=3D%" PRIu64 ")" --=20 2.34.1 From nobody Sat May 18 16:46:49 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=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1714069077; cv=none; d=zohomail.com; s=zohoarc; b=eiKbPD+hCvCeWnChtL94SudAxCCc3qMawp9b3LKC8toKA6k4zdTo60ifnEa+O2Jdxnk1w9lAfSwzVC0xqB1tJ2BbixrRa2JfmyNW/uUL2u8QwHhoctdOPcClQ0jto860Pn26tPkTIZv8i8GqU1RtAaeVWEJKtPJbzsd2WJhK8T8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714069077; 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=SYOtIAmK+iBZId02XQX4M1pf4agbZg7ZjvArtiM6+aM=; b=AcWh3cHxXL5jF0CsDqUQ2zs+dtyu+Zmn2kQcBSsLJ/ENCyZAAr5kpE1MK9ekBwxgg+ssGZFqI4irkfeCTA+BiJZiNvk8nB6vbh1ax9QnVxk63LhI3b1sE7ciUSMp8kbaCh4IfDTniNGM83vCBwDtXgS3nMHN5uT1eyGRnfIemQE= 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 1714069077143468.0411858010367; Thu, 25 Apr 2024 11:17:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s03eK-0001W4-Ht; Thu, 25 Apr 2024 14:16:48 -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 1s03e8-0001Uj-NH for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:37 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s03e5-0003zJ-Dw for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:36 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2a2a:0:640:d546:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 6DBBC60BC2; Thu, 25 Apr 2024 21:16:26 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b58e::1:22]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id qFR9v101Pa60-56vSttVI; Thu, 25 Apr 2024 21:16:25 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1714068985; bh=SYOtIAmK+iBZId02XQX4M1pf4agbZg7ZjvArtiM6+aM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=lcYAtwM5hT2f/AhMp5ER8O0FVTeMdabEtVzCVHahZoC598X6TC+eI3QJC6W+7jL3L Jn4D0p0ZS7PX5GnCB6qjGvLnn4z0JzIpFkzGdMOpZ5+q/RT6/oMgc+Iwox48Ceyy65 ztGOCfGkvRPVyglP/o8gs6NT/RANWoARo+kk1z1I= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com, farosas@suse.de Cc: eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru Subject: [PATCH v3 2/4] migration: process_incoming_migration_co(): complete cleanup on failure Date: Thu, 25 Apr 2024 21:15:49 +0300 Message-Id: <20240425181551.1465739-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425181551.1465739-1-vsementsov@yandex-team.ru> References: <20240425181551.1465739-1-vsementsov@yandex-team.ru> 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=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 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 @yandex-team.ru) X-ZM-MESSAGEID: 1714069078468100001 Content-Type: text/plain; charset="utf-8" Make call to migration_incoming_state_destroy(), instead of doing only partial of it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas --- migration/migration.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2dc6a063e9..0d26db47f7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -799,10 +799,7 @@ process_incoming_migration_co(void *opaque) fail: migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); - qemu_fclose(mis->from_src_file); - - multifd_recv_cleanup(); - compress_threads_load_cleanup(); + migration_incoming_state_destroy(); =20 exit(EXIT_FAILURE); } --=20 2.34.1 From nobody Sat May 18 16:46:49 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=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1714069068; cv=none; d=zohomail.com; s=zohoarc; b=Dhs27fJ9Ftx4tJ1P72cYk7iLb6wnlqtGwu8QlcODvWw2v1SQYBzmlVtyQqHRme3SJ0FsnoKxVoEwGInv0w0IhcyxWdeVKhuatQUFfw9YEv5tDptVxcBhD9OwzaP4ezgr1KQArMgPGZI/EOnvJNzX2k1wY98xy5d457dktN8YrUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714069068; 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=B0FdPWCGfpPQABb71E9kETJra9abg0Yu2BvemQLsKCk=; b=ksIMzjG3qOWeKi/5OfM0CkK/q2C+QREieL3qwRKoM7BMjtiw4kQ+CbVPP+ZOAnBjXdKmzIsFajMFR6gdERbVlmHwwoWUxb0pIx4rB6YwF/VB7y7qjenJe+qHUqoxEJo7pHg2MOwfMJnwGAaCSNRaG4cVVFebP/fIr5WrIU1PiQE= 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 1714069068784117.7473946491906; Thu, 25 Apr 2024 11:17:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s03eM-0001Wh-JB; Thu, 25 Apr 2024 14:16:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s03eA-0001Uu-3k for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:43 -0400 Received: from forwardcorp1c.mail.yandex.net ([2a02:6b8:c03:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s03e6-0003zP-EJ for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:36 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2a2a:0:640:d546:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTPS id 7E3B860AEE; Thu, 25 Apr 2024 21:16:27 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b58e::1:22]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id qFR9v101Pa60-6cUwCaUw; Thu, 25 Apr 2024 21:16:26 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1714068986; bh=B0FdPWCGfpPQABb71E9kETJra9abg0Yu2BvemQLsKCk=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=Qww8qj3FYOIglvPLRho1qfcfQzPyUKDCXTC41lJFiWYlIekdy5evGkag2DAGsSmWO wf0viYzTxtIpL/bZodyL1BNijiIPT4JZIyXKZuwlYK5fjJGrBQBo5qio1ils8pKm3V 9ja8Vg0Rw63TYdbWvIhSeE+ftUsATrV2jXHMOrgE= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com, farosas@suse.de Cc: eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru Subject: [PATCH v3 3/4] migration: process_incoming_migration_co(): rework error reporting Date: Thu, 25 Apr 2024 21:15:50 +0300 Message-Id: <20240425181551.1465739-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425181551.1465739-1-vsementsov@yandex-team.ru> References: <20240425181551.1465739-1-vsementsov@yandex-team.ru> 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=2a02:6b8:c03:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 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 @yandex-team.ru) X-ZM-MESSAGEID: 1714069070085100003 Content-Type: text/plain; charset="utf-8" Unify error reporting in the function. This simplifies the following commit, which will not-exit-on-error behavior variant to the function. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas --- migration/migration.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0d26db47f7..0b15f7ccf4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -735,14 +735,16 @@ static void process_incoming_migration_bh(void *opaqu= e) static void coroutine_fn process_incoming_migration_co(void *opaque) { + MigrationState *s =3D migrate_get_current(); MigrationIncomingState *mis =3D migration_incoming_get_current(); PostcopyState ps; int ret; + Error *local_err =3D NULL; =20 assert(mis->from_src_file); =20 if (compress_threads_load_setup(mis->from_src_file)) { - error_report("Failed to setup decompress threads"); + error_setg(&local_err, "Failed to setup decompress threads"); goto fail; } =20 @@ -779,18 +781,12 @@ process_incoming_migration_co(void *opaque) } =20 if (ret < 0) { - MigrationState *s =3D migrate_get_current(); - - if (migrate_has_error(s)) { - WITH_QEMU_LOCK_GUARD(&s->error_mutex) { - error_report_err(s->error); - } - } - error_report("load of migration failed: %s", strerror(-ret)); + error_setg(&local_err, "load of migration failed: %s", strerror(-r= et)); goto fail; } =20 if (colo_incoming_co() < 0) { + error_setg(&local_err, "colo incoming failed"); goto fail; } =20 @@ -801,6 +797,12 @@ fail: MIGRATION_STATUS_FAILED); migration_incoming_state_destroy(); =20 + if (migrate_has_error(s)) { + WITH_QEMU_LOCK_GUARD(&s->error_mutex) { + error_report_err(s->error); + } + } + error_report_err(local_err); exit(EXIT_FAILURE); } =20 --=20 2.34.1 From nobody Sat May 18 16:46:49 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=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1714069086; cv=none; d=zohomail.com; s=zohoarc; b=joVPFH5IISJULdr2hymaYPKsrPwiydaYVgI/I76ZMY2FUAXQoIZ3lcIqy6vb4/ZaP7335rbx7uOHFobMa/7O4p41zojAL6OeRpqcRrCk3JvPfZfMtyWY7sAwK9VM5bNqjL0WSzKY7MwjHRNnE5p+qixxpnKRROtn1bJ80cSEpr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714069086; 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=18w536ufYZlA9siJHU1J/hXZW3Xj6sPZ9OSuuMTxaWo=; b=KY0vLvqPcvMP2g2dUnBeY5BQpeLm2sjKKdaogc1Vgs8YXSPmAT05H6vbPb7/JSmDmcW3aC9q2Q0AbM1YR+5AbaFHzw8vL63jwufyHVPvOxrS4BP2H32c43nn0iqwwEtyUcDL8n5ZzhymJhwHE8oo97U81I7kXiMgbxgxuH3gzcc= 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 17140690865151005.7729060060647; Thu, 25 Apr 2024 11:18:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s03eP-0001Xh-8d; Thu, 25 Apr 2024 14:16:53 -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 1s03eA-0001Uw-KM for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:43 -0400 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s03e5-0003zX-Ds for qemu-devel@nongnu.org; Thu, 25 Apr 2024 14:16:37 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2a2a:0:640:d546:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 7AB9F60B8A; Thu, 25 Apr 2024 21:16:28 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b58e::1:22]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id qFR9v101Pa60-qpvoOCgA; Thu, 25 Apr 2024 21:16:27 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1714068987; bh=18w536ufYZlA9siJHU1J/hXZW3Xj6sPZ9OSuuMTxaWo=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=AGUr9GBz99S5D9meI5pkcWeRmGqjkbdSmOVDxylDDkjemjquD/t24puGVMH6rXnGt kKgQI0HROCZsF9GYWdAM9hffeJobLMQcqFmhT1I46Fcx0fJsy3ThYjZ/BOBlFiMyJv SUoSffjh3cgRo9UgX3prRA7TjGqefToPOMOcPypg= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com, farosas@suse.de Cc: eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, yc-core@yandex-team.ru Subject: [PATCH v3 4/4] qapi: introduce exit-on-error parameter for migrate-incoming Date: Thu, 25 Apr 2024 21:15:51 +0300 Message-Id: <20240425181551.1465739-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240425181551.1465739-1-vsementsov@yandex-team.ru> References: <20240425181551.1465739-1-vsementsov@yandex-team.ru> 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=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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 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 @yandex-team.ru) X-ZM-MESSAGEID: 1714069088527100007 Content-Type: text/plain; charset="utf-8" Now we do set MIGRATION_FAILED state, but don't give a chance to orchestrator to query migration state and get the error. Let's provide a possibility for QMP-based orchestrators to get an error like with outgoing migration. For hmp_migrate_incoming(), let's enable the new behavior: HMP is not and ABI, it's mostly intended to use by developer and it makes sense not to stop the process. For x-exit-preconfig, let's keep the old behavior: - it's called from init(), so here we want to keep current behavior by default - it does exit on error by itself as well So, if we want to change the behavior of x-exit-preconfig, it should be another patch. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster --- migration/migration-hmp-cmds.c | 2 +- migration/migration.c | 36 ++++++++++++++++++++++++++++------ migration/migration.h | 3 +++ qapi/migration.json | 7 ++++++- system/vl.c | 3 ++- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 7e96ae6ffd..23181bbee1 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -466,7 +466,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qd= ict) } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); =20 - qmp_migrate_incoming(NULL, true, caps, &err); + qmp_migrate_incoming(NULL, true, caps, true, false, &err); qapi_free_MigrationChannelList(caps); =20 end: diff --git a/migration/migration.c b/migration/migration.c index 0b15f7ccf4..5cfe420a76 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -72,6 +72,8 @@ #define NOTIFIER_ELEM_INIT(array, elem) \ [elem] =3D NOTIFIER_WITH_RETURN_LIST_INITIALIZER((array)[elem]) =20 +#define INMIGRATE_DEFAULT_EXIT_ON_ERROR true + static NotifierWithReturnList migration_state_notifiers[] =3D { NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_NORMAL), NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_CPR_REBOOT), @@ -234,6 +236,8 @@ void migration_object_init(void) qemu_cond_init(¤t_incoming->page_request_cond); current_incoming->page_requested =3D g_tree_new(page_request_addr_cmp); =20 + current_incoming->exit_on_error =3D INMIGRATE_DEFAULT_EXIT_ON_ERROR; + migration_object_check(current_migration, &error_fatal); =20 blk_mig_init(); @@ -797,13 +801,18 @@ fail: MIGRATION_STATUS_FAILED); migration_incoming_state_destroy(); =20 - if (migrate_has_error(s)) { - WITH_QEMU_LOCK_GUARD(&s->error_mutex) { - error_report_err(s->error); + if (mis->exit_on_error) { + if (migrate_has_error(s)) { + WITH_QEMU_LOCK_GUARD(&s->error_mutex) { + error_report_err(s->error); + } } + error_report_err(local_err); + exit(EXIT_FAILURE); + } else { + migrate_set_error(s, local_err); + error_free(local_err); } - error_report_err(local_err); - exit(EXIT_FAILURE); } =20 /** @@ -1312,6 +1321,15 @@ static void fill_destination_migration_info(Migratio= nInfo *info) break; } info->status =3D mis->state; + + if (!info->error_desc) { + MigrationState *s =3D migrate_get_current(); + QEMU_LOCK_GUARD(&s->error_mutex); + + if (s->error) { + info->error_desc =3D g_strdup(error_get_pretty(s->error)); + } + } } =20 MigrationInfo *qmp_query_migrate(Error **errp) @@ -1795,10 +1813,13 @@ void migrate_del_blocker(Error **reasonp) } =20 void qmp_migrate_incoming(const char *uri, bool has_channels, - MigrationChannelList *channels, Error **errp) + MigrationChannelList *channels, + bool has_exit_on_error, bool exit_on_error, + Error **errp) { Error *local_err =3D NULL; static bool once =3D true; + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 if (!once) { error_setg(errp, "The incoming migration has already been started"= ); @@ -1813,6 +1834,9 @@ void qmp_migrate_incoming(const char *uri, bool has_c= hannels, return; } =20 + mis->exit_on_error =3D + has_exit_on_error ? exit_on_error : INMIGRATE_DEFAULT_EXIT_ON_ERRO= R; + qemu_start_incoming_migration(uri, has_channels, channels, &local_err); =20 if (local_err) { diff --git a/migration/migration.h b/migration/migration.h index 8045e39c26..95995a818e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -227,6 +227,9 @@ struct MigrationIncomingState { * is needed as this field is updated serially. */ unsigned int switchover_ack_pending_num; + + /* Do exit on incoming migration failure */ + bool exit_on_error; }; =20 MigrationIncomingState *migration_incoming_get_current(void); diff --git a/qapi/migration.json b/qapi/migration.json index 8c65b90328..9de8b98d0b 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1837,6 +1837,10 @@ # @channels: list of migration stream channels with each stream in the # list connected to a destination interface endpoint. # +# @exit-on-error: Do exit on incoming migration failure. Default true. +# When set to false, the error is reported by MIGRATION event and +# error could be retrieved by query-migrate command. (since 9.1) +# # Since: 2.3 # # Notes: @@ -1889,7 +1893,8 @@ ## { 'command': 'migrate-incoming', 'data': {'*uri': 'str', - '*channels': [ 'MigrationChannel' ] } } + '*channels': [ 'MigrationChannel' ], + '*exit-on-error': 'bool' } } =20 ## # @xen-save-devices-state: diff --git a/system/vl.c b/system/vl.c index c644222982..3bad81b0a4 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2720,7 +2720,8 @@ void qmp_x_exit_preconfig(Error **errp) if (incoming) { Error *local_err =3D NULL; if (strcmp(incoming, "defer") !=3D 0) { - qmp_migrate_incoming(incoming, false, NULL, &local_err); + qmp_migrate_incoming(incoming, false, NULL, true, true, + &local_err); if (local_err) { error_reportf_err(local_err, "-incoming %s: ", incoming); exit(1); --=20 2.34.1