From nobody Sat May 18 14:01:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1674204956; cv=none; d=zohomail.com; s=zohoarc; b=OK/SOG0NSzA8SbZp9/pSLyYzrFkpNej4iRnneu5sHXjkUsONwLxNJLHpoXajWnKv2K2KS6BLosSJbuMO0LSdLHnEpY2E+9LFHMo8kynln8/v2sB+aD0Ew5bCsHjkHU8fBb2df3reblJJAgWtNU6mL1A4XPbJaZCwsMCn0EXLOwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674204956; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9rpm6rEBuQ19jlRedxlxuP/0cKIjsTPHcvLQbq+a9I8=; b=C1Gj1pzklJRpXD7IGAYj+U5YmCWLAH7dlGmVA0RzJyDZHWwP6gsXn3X9/asjoyZ0zlW+t7l9i4NJ1P+BUxsUhzAGcTFwby45yOOAfLSYMoAoH+oBPJf/VfvGjrLUyK6vzJZl+3c2NUNoHEcWfnpnikO6SD8ypi69Nt3EfdRr71g= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1674204956833108.96865261072264; Fri, 20 Jan 2023 00:55:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pInBY-00036k-CX; Fri, 20 Jan 2023 03:55:44 -0500 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 1pInB1-0002GX-8T for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:12 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pInAx-0002g1-FP for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:09 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NytYr0pV2zZfp1; Fri, 20 Jan 2023 16:53:04 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 20 Jan 2023 16:54:50 +0800 To: CC: , , , , , , , Subject: [PATCH 1/3] migration: report migration thread name to libvirt Date: Fri, 20 Jan 2023 16:47:33 +0800 Message-ID: <20230120084735.825054-2-jiangjiacheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230120084735.825054-1-jiangjiacheng@huawei.com> References: <20230120084735.825054-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=jiangjiacheng@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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: , Reply-to: Jiang Jiacheng From: Jiang Jiacheng via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1674204958976100006 Content-Type: text/plain; charset="utf-8" Report migration thread name to libvirt in order to support query migration thread infomation by its name. Signed-off-by: Jiang Jiacheng --- migration/migration.c | 3 +++ migration/multifd.c | 5 ++++- qapi/migration.json | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 52b5d39244..b4ce458bb9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3955,6 +3955,9 @@ static void *migration_thread(void *opaque) MigThrError thr_error; bool urgent =3D false; =20 + /* report migration thread name to libvirt */ + qapi_event_send_migration_name("live_migration"); + rcu_register_thread(); =20 object_ref(OBJECT(s)); diff --git a/migration/multifd.c b/migration/multifd.c index 000ca4d4ec..6e834c7111 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -17,6 +17,7 @@ #include "exec/ramblock.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-events-migration.h" #include "ram.h" #include "migration.h" #include "socket.h" @@ -24,7 +25,6 @@ #include "qemu-file.h" #include "trace.h" #include "multifd.h" - #include "qemu/yank.h" #include "io/channel-socket.h" #include "yank_functions.h" @@ -650,6 +650,9 @@ static void *multifd_send_thread(void *opaque) int ret =3D 0; bool use_zero_copy_send =3D migrate_use_zero_copy_send(); =20 + /* report multifd thread name to libvirt */ + qapi_event_send_migration_name(p->name); + trace_multifd_send_thread_start(p->id); rcu_register_thread(); =20 diff --git a/qapi/migration.json b/qapi/migration.json index 88ecf86ac8..b0cf366ac0 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1286,6 +1286,18 @@ { 'event': 'MIGRATION_PASS', 'data': { 'pass': 'int' } } =20 +## +# @MIGRATION_NAME: +# +# Emitted when migration thread appear +# +# @name: name of migration thread +# +# Since: 7.2 +## +{ 'event': 'MIGRATION_NAME', + 'data': { 'name': 'str' } } + ## # @COLOMessage: # --=20 2.33.0 From nobody Sat May 18 14:01:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1674204959; cv=none; d=zohomail.com; s=zohoarc; b=hsxnQhXrcDCYDkUOVZ4TAUkqIG/AHSjc9CCELwutGtLsKTs70X+d7mfO4LLx0lqxTXF2VJTJ2TOk0op2C2KGKAeud5NADkSpSqtLFq81FU1U9oDCf2afbrE5INYNooQrUEA51yegDJmhTfUq714g4/aFJgebUXVniNuyfmIurLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674204959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=eANQaNBAxDnmnIntOVS4iJWXtcx9o+mA/KRZNGGhD6Q=; b=TED1lfXzc27zJXLcVuRkjkDPV+vRIyw8W7O7THjMPfYO0/gKIzm9Ua+9DGGrM7vg+AV8PXYvOoTnO9nJZ6GU0e0CjIE5SFXiozgcDniXUQ9y9f+LWFA9E0Aq0/SCzrGuYtzvqvwxlkA/2H4D4WevypDYMsU7zzYe3coAUDjjz3w= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1674204959353195.90632920885116; Fri, 20 Jan 2023 00:55:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pInBX-0002tT-6w; Fri, 20 Jan 2023 03:55:43 -0500 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 1pInB1-0002GZ-8L for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:12 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pInAx-0002g2-V0 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:10 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NytYr4R1NzZfp6; Fri, 20 Jan 2023 16:53:04 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 20 Jan 2023 16:54:51 +0800 To: CC: , , , , , , , Subject: [PATCH 2/3] migration: implement query migration threadinfo by name Date: Fri, 20 Jan 2023 16:47:34 +0800 Message-ID: <20230120084735.825054-3-jiangjiacheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230120084735.825054-1-jiangjiacheng@huawei.com> References: <20230120084735.825054-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=jiangjiacheng@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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: , Reply-to: Jiang Jiacheng From: Jiang Jiacheng via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1674204960980100011 Content-Type: text/plain; charset="utf-8" Introduce interface query-migrationthreads. The interface is use with the migration thread name reported by qemu and returns with migration thread name and its pid. Introduce threadinfo.c to manage threads with migration. Signed-off-by: Jiang Jiacheng --- migration/meson.build | 1 + migration/threadinfo.c | 70 ++++++++++++++++++++++++++++++++++++++++++ migration/threadinfo.h | 30 ++++++++++++++++++ qapi/migration.json | 30 ++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 migration/threadinfo.c create mode 100644 migration/threadinfo.h diff --git a/migration/meson.build b/migration/meson.build index 690487cf1a..ed7d27f11a 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -25,6 +25,7 @@ softmmu_ss.add(files( 'savevm.c', 'socket.c', 'tls.c', + 'threadinfo.c', ), gnutls) =20 softmmu_ss.add(when: rdma, if_true: files('rdma.c')) diff --git a/migration/threadinfo.c b/migration/threadinfo.c new file mode 100644 index 0000000000..0df668d427 --- /dev/null +++ b/migration/threadinfo.c @@ -0,0 +1,70 @@ +/* + * Migration Threads info + * + * Copyright (c) 2022 HUAWEI TECHNOLOGIES CO., LTD. + * + * Authors: + * Jiang Jiacheng + * + * This work is licensed under the terms of the GNU GPL, version 2 or lat= er. + * See the COPYING file in the top-level directory. + */ + +#include "threadinfo.h" + +static QLIST_HEAD(, MigrationThread) migration_threads; + +MigrationThread* MigrationThreadAdd(const char *name, int thread_id) +{ + MigrationThread *thread =3D NULL; + + thread =3D g_new0(MigrationThread, 1); + thread->name =3D (char*)name; + thread->thread_id =3D thread_id; + + QLIST_INSERT_HEAD(&migration_threads, thread, node); + + return thread; +} + +void MigrationThreadDel(MigrationThread* thread) +{ + if (thread) { + QLIST_REMOVE(thread, node); + g_free(thread); + } +} + +MigrationThread* MigrationThreadQuery(const char* name) +{ + MigrationThread *thread =3D NULL; + + QLIST_FOREACH(thread, &migration_threads, node) { + if (!strcmp(thread->name, name)) { + return thread; + } + } + + return NULL; +} + +MigrationThreadInfo* qmp_query_migrationthreads(const char* name, Error **= errp) +{ + MigrationThread *thread =3D NULL; + MigrationThreadInfo *info =3D NULL; + + thread =3D MigrationThreadQuery(name); + if (!thread) { + goto err; + } + + info =3D g_new0(MigrationThreadInfo, 1); + info->name =3D g_strdup(thread->name); + info->thread_id =3D thread->thread_id; + + return info; + +err: + error_setg(errp, "thread '%s' doesn't exist", name); + return NULL; +} diff --git a/migration/threadinfo.h b/migration/threadinfo.h new file mode 100644 index 0000000000..f62a6ff261 --- /dev/null +++ b/migration/threadinfo.h @@ -0,0 +1,30 @@ +/* + * Migration Threads info + * + * Copyright (c) 2022 HUAWEI TECHNOLOGIES CO., LTD. + * + * Authors: + * Jiang Jiacheng + * + * This work is licensed under the terms of the GNU GPL, version 2 or lat= er. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/queue.h" +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" + +typedef struct MigrationThread MigrationThread; + +struct MigrationThread { + char *name; /* the name of migration thread */ + int thread_id; /* ID of the underlying host thread */ + QLIST_ENTRY(MigrationThread) node; +}; + +MigrationThread *MigrationThreadAdd(const char *name, int thread_id); + +void MigrationThreadDel(MigrationThread* info); + +MigrationThread* MigrationThreadQuery(const char* name); diff --git a/qapi/migration.json b/qapi/migration.json index b0cf366ac0..e93c3e560a 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1970,6 +1970,36 @@ { 'command': 'query-vcpu-dirty-limit', 'returns': [ 'DirtyLimitInfo' ] } =20 +## +# @MigrationThreadInfo: +# +# Information about migrationthreads +# +# @name: the name of migration thread +# +# @thread-id: ID of the underlying host thread +# +# Since: 7.2 +## +{ 'struct': 'MigrationThreadInfo', + 'data': {'name': 'str', + 'thread-id': 'int'} } + +## +# @query-migrationthreads: +# +# Returns threadInfo about the thread specified by name +# +# data: migration thread name +# +# returns: information about the specified thread +# +# Since: 7.2 +## +{ 'command': 'query-migrationthreads', + 'data': { 'name': 'str' }, + 'returns': 'MigrationThreadInfo' } + ## # @snapshot-save: # --=20 2.33.0 From nobody Sat May 18 14:01:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1674204957; cv=none; d=zohomail.com; s=zohoarc; b=Sq3j8jMdK5UgjKIxkxCzzMjqtnc+5T1eWLeJ7qTBi5g8C7wXi2fLuAQBn0I+13R7en4zfdGOonGf1P0iFNUDQ5/z99daf71wxO9H/nxRXWOZ3MCrVqc32dTLi9T/tdkm38ofi3vT1eFtXvnoxUD0LBpesIrYDN2u/+2DptRHL8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674204957; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=V9+K7WX3x+xhPvBLN1zCG2QtntllKZ57P2CwV3kHmYA=; b=IZrQLe32YmYQ8G5BnaAak7YDkMW5o/JZJ9FZIpWBWayUDq434b4qv6tYa2J7ckRhL19Fv6fNT+REQW162pnuU1G5A4E6rE0QKZ/EpdLzR9CDx72gWEeo8hYqg+MOswS5/vEy/wWFFAnr/Qz7WSAL2AHgyrSQjOMNTxLLitrnADI= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 167420495701792.41257170264691; Fri, 20 Jan 2023 00:55:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pInBL-0002M0-Qx; Fri, 20 Jan 2023 03:55:33 -0500 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 1pInB1-0002GY-83 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:11 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pInAx-0002g3-Ux for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:55:09 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NytYj06ptzRqtl; Fri, 20 Jan 2023 16:52:57 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 20 Jan 2023 16:54:51 +0800 To: CC: , , , , , , , Subject: [PATCH 3/3] migration: save/delete migration thread info Date: Fri, 20 Jan 2023 16:47:35 +0800 Message-ID: <20230120084735.825054-4-jiangjiacheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230120084735.825054-1-jiangjiacheng@huawei.com> References: <20230120084735.825054-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=jiangjiacheng@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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: , Reply-to: Jiang Jiacheng From: Jiang Jiacheng via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1674204958975100005 Content-Type: text/plain; charset="utf-8" To support query migration thread infomation, save and delete thread information at thread creation and end. Signed-off-by: Jiang Jiacheng --- migration/migration.c | 4 ++++ migration/multifd.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index b4ce458bb9..957205e693 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -57,6 +57,7 @@ #include "net/announce.h" #include "qemu/queue.h" #include "multifd.h" +#include "threadinfo.h" #include "qemu/yank.h" #include "sysemu/cpus.h" #include "yank_functions.h" @@ -3951,10 +3952,12 @@ static void qemu_savevm_wait_unplug(MigrationState = *s, int old_state, static void *migration_thread(void *opaque) { MigrationState *s =3D opaque; + MigrationThread *thread =3D NULL; int64_t setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); MigThrError thr_error; bool urgent =3D false; =20 + thread =3D MigrationThreadAdd("live_migration", qemu_get_thread_id()); /* report migration thread name to libvirt */ qapi_event_send_migration_name("live_migration"); =20 @@ -4034,6 +4037,7 @@ static void *migration_thread(void *opaque) migration_iteration_finish(s); object_unref(OBJECT(s)); rcu_unregister_thread(); + MigrationThreadDel(thread); return NULL; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index 6e834c7111..fca06284de 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -25,6 +25,7 @@ #include "qemu-file.h" #include "trace.h" #include "multifd.h" +#include "threadinfo.h" #include "qemu/yank.h" #include "io/channel-socket.h" #include "yank_functions.h" @@ -646,10 +647,12 @@ int multifd_send_sync_main(QEMUFile *f) static void *multifd_send_thread(void *opaque) { MultiFDSendParams *p =3D opaque; + MigrationThread *thread =3D NULL; Error *local_err =3D NULL; int ret =3D 0; bool use_zero_copy_send =3D migrate_use_zero_copy_send(); =20 + thread =3D MigrationThreadAdd(p->name, qemu_get_thread_id()); /* report multifd thread name to libvirt */ qapi_event_send_migration_name(p->name); =20 @@ -762,6 +765,7 @@ out: qemu_mutex_unlock(&p->mutex); =20 rcu_unregister_thread(); + MigrationThreadDel(thread); trace_multifd_send_thread_end(p->id, p->num_packets, p->total_normal_p= ages); =20 return NULL; --=20 2.33.0