From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726452; cv=none; d=zohomail.com; s=zohoarc; b=eAZ21U2Bs1MgVfPG6Z89qjzc1eDegchmsTo47mAFstbsGY/dg/YJ0lBqmiW7aQUJ7YUXAXGb/W2hPC49+YaS3IGKIb1c516N0TsUAPUKVXLrFZGmTVFHdHDfI94oMDjxwPM/V1D+UN+3EvVmfqEKMrjbsHB87kF+qZbWxoyxHsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726452; 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=AsdoBAm4/H/7Jy2H83poWUQ7xQPm3c8gUhD4CXkcCgo=; b=LA/wzfJjDnz/AeeSU+dSMVLXV8AsTqb/HV2eLF9G6M/e40gaQNgMCFqh19qf54yKMkcD8xJ0inC7GqtFGtzqLbRxttXb1zYhzKXPcEnh0GLi2j0B0sfyDdXMsgt6/u4cDnrJXDvCKnVONrvdB6KRfT+GgqtPZN3R9hBKpO7TG6o= 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 1727726452417106.4374654029732; Mon, 30 Sep 2024 13:00:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYW-0004gc-8v; Mon, 30 Sep 2024 15:59:40 -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 1svMXw-000436-2t for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svMXm-0003xU-QZ for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:03 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-NO7T5VowO7KvxgBRt3ktfQ-1; Mon, 30 Sep 2024 15:58:49 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-458260b3dccso96613651cf.2 for ; Mon, 30 Sep 2024 12:58:49 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726332; 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=AsdoBAm4/H/7Jy2H83poWUQ7xQPm3c8gUhD4CXkcCgo=; b=ancHlzBpOK4eCIoVymHJQpizwEoFMWUVxMQIae5pnLCoH2d+R++cyloHMerph69YiOKgIC IFcpbNknZfclasbQ+rMbn4ms0mG0wfRfZC8KkzakMgH52LmukAFZiGy4Mo6JvUuM7fY9VS vr0F9WMfA2DbBHZ7WkKkOI5xBaHevY8= X-MC-Unique: NO7T5VowO7KvxgBRt3ktfQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726324; x=1728331124; 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=AsdoBAm4/H/7Jy2H83poWUQ7xQPm3c8gUhD4CXkcCgo=; b=nXwYT//p1Pde4zs8R0S+qNydMlPkvbug605CfDMtrmnwhD6mfdKSSLWI41tV7Irh2J 5jc/Bt3wHSFpMsU4nm91pGbWZSr5ZHWBWPMncMfiqn0naxqcx2kJAP4dEqfxSSNp5lll K9YstgsLqa/lwzyS+vUxBTQ8XFgPZwGzUasI64ah/4ymmNVbi2tAIdahNChSOwRXRGXE 9eKaIWjX1QRGDu3lahayOeBmYO+aWF/k8rOBxU3qGCSjeAn+xTZrfUWDZyutt+M9UPaF SfJgyO/4rZXzP2qBAETjedb2URvA2rZHWlBJFu9vRnKMOZmgNmmTkj0yI4kODQIVfKs8 F3EA== X-Gm-Message-State: AOJu0YyTzLMIkg51ml5v2nFUaDgiiWKaui6C0ua11HurVmx//TuykoVG J/0a/5CIoazVr9PCDrM3QQhZY5ZEG/JYdn83XJ6WTAnoUYc0JzyesGBA4r88QMbEncs5TGxH0PR fifwln9EXLV+rEum15B8NZf52MuBJ9gXT9JWqAl+ArGWKQZ9JUsMxMYB7llT74FCoVfXbM9nwy4 r4YcrDZbMDOZBvroI0q/Al5axMvcqxE5IRQA== X-Received: by 2002:a05:622a:d1:b0:458:34df:1e6a with SMTP id d75a77b69052e-45c9f292b5bmr212843431cf.48.1727726324003; Mon, 30 Sep 2024 12:58:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGTck3+ESskPrGJHCUxQNvDlQUXbp+UL5AXiNPooCEFu2ayCsK4lii6fSwoOVPAExbiEAsxg== X-Received: by 2002:a05:622a:d1:b0:458:34df:1e6a with SMTP id d75a77b69052e-45c9f292b5bmr212843141cf.48.1727726323572; Mon, 30 Sep 2024 12:58:43 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 1/7] migration: Unify names of migration src main thread Date: Mon, 30 Sep 2024 15:58:31 -0400 Message-ID: <20240930195837.825728-2-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726452744116600 Content-Type: text/plain; charset="utf-8" Make pthread name match with what we report in query-migrationthreads. We used to report the same, but not anymore after 60ce47675d ("migration: Rename thread debug names"). Not a huge deal but it was still good to follow. Multifd threads are still matched because at least on the src the QMP facility reused p->name. The QMP command missed dest multifd threads though, but that's another thing to address later. Not copy stable, as we'd better keep the names not changed for stable branches in QMP responses (even though we shouldn't guarantee ABI stability on the names anyway). Cc: Juraj Marcin Reported-by: Prasad Pandit Signed-off-by: Peter Xu --- migration/migration.h | 2 ++ migration/migration.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 38aa1402d5..519455796d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,6 +28,8 @@ #include "sysemu/runstate.h" #include "migration/misc.h" =20 +#define MIGRATION_THREAD_SRC_MAIN "mig/src/main" + struct PostcopyBlocktimeContext; =20 #define MIGRATION_RESUME_ACK_VALUE (1) diff --git a/migration/migration.c b/migration/migration.c index ae2be31557..505b62c8f3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3467,7 +3467,8 @@ static void *migration_thread(void *opaque) Error *local_err =3D NULL; int ret; =20 - thread =3D migration_threads_add("live_migration", qemu_get_thread_id(= )); + thread =3D migration_threads_add(MIGRATION_THREAD_SRC_MAIN, + qemu_get_thread_id()); =20 rcu_register_thread(); =20 @@ -3820,7 +3821,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) qemu_thread_create(&s->thread, "mig/snapshot", bg_migration_thread, s, QEMU_THREAD_JOINABLE); } else { - qemu_thread_create(&s->thread, "mig/src/main", + qemu_thread_create(&s->thread, MIGRATION_THREAD_SRC_MAIN, migration_thread, s, QEMU_THREAD_JOINABLE); } s->migration_thread_running =3D true; --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726406; cv=none; d=zohomail.com; s=zohoarc; b=JNMcFTUIgiBsEbS8w0rqwg1nfxGkMR6H67eQBEwDsGqqOBMkQk+nJBdMFQdB5gxk7LNyOXKJ9yPWYE1CsElxgHfJZ83yQVhoCxHqSoJ7beaWz3QQ1znoveIAMoPqlGjlI7WR5ygkbLO/97yvwoHQ1DvSBRu/JXt8MRP1kMFCUnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726406; 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=fBD3pQ9OiqYUxqrsoMFJzeYINwaBKJNjacu1woAbQd0=; b=LMRa7mBqUz/hoeEUR8rWnYEjhZwO+MvyO49J0/h88ZWfJrR19sgM5/tmlegG7bT9extNVXww8S2krCssQj6KOJvnLUrCkJ3jwVZKBQid+75mR7X8BX6aAdyRnOLDoj0ZF2UcHcpJCPddYBKpZORUvSZDbyyG9tj2IZondDzMv2o= 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 1727726406610760.2729847167218; Mon, 30 Sep 2024 13:00:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYE-0004Fj-KY; Mon, 30 Sep 2024 15:59:22 -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 1svMXw-00043g-CL for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svMXn-0003xk-U4 for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:04 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-110-aLZHqKtOMLy4eJQ1k2adGw-1; Mon, 30 Sep 2024 15:58:51 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4581d15ced1so77859281cf.3 for ; Mon, 30 Sep 2024 12:58:51 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726334; 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=fBD3pQ9OiqYUxqrsoMFJzeYINwaBKJNjacu1woAbQd0=; b=Be5wUFpdkZQxoqbpkvcu4jqon6HP4pBuWaqLlBuPn1DPeEmuFmz3m6LAhp5Hr++G9XttX/ pIBVSPaakz+QV54MbBJUfpYDgKpGxi63+4LpqYffp5C926PhHjVK89wrTTepa8gWNBVCCl 82JdutpJcaZ3spY2JmMHvAIEE3hvP8c= X-MC-Unique: aLZHqKtOMLy4eJQ1k2adGw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726330; x=1728331130; 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=fBD3pQ9OiqYUxqrsoMFJzeYINwaBKJNjacu1woAbQd0=; b=GGVgltQOKV0TtbRXYBWAIAPnb9soj3VlOwFXxrVq00Isn8s3s4VsmnTi27BPanULvL ChnVh2CE32YV9R2Y94vaDo4MdSiitJe+UMVHvqjT/M+z/f4o3CVk6za0Xsxguw99AYvE f9P43OqZkiXz8eCgA6LJ9d70DZSGaLtiPFD0qNKeoc4U3ZIVORNhtzD+8ZX8DRz33fiZ hkoywm8iM4uHkPKvRuVN5l7liPgOcUYgDQULNfVts6TGSK7vTGG8powngV9O5Lz3reJ7 Tj7i8Oa3lKQXYH3s5JyjMNDiNmPuNl4SPy5202fZz7yKP55dAX6GF29yMqWAFRJzALUZ 9hEQ== X-Gm-Message-State: AOJu0YwvkrVk5FSiAtHefsEAsgoVWQr2f+di71iGrKjmDNku92vjriuY kNKFg6GG2nZ/jBCJnQ248TBhWNY01WPrxD5L6+6Rc2p3wUPVSAK7g8SyR2ZgrnfwZavTXwQbYuJ vLdWUFsJU+4XgpnUZj3yohdj6scGaQqwWmunKtmr8zAmQfujj7TUEdvkb03XuwjFNKF5uiPtPiq 1H6emBIB+e6EwFBhCVWnP7COs7+5flHyW6xA== X-Received: by 2002:ac8:5709:0:b0:458:35f7:3952 with SMTP id d75a77b69052e-45c9f2877e6mr254328421cf.40.1727726329914; Mon, 30 Sep 2024 12:58:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDCGKpRszIYZqqocL0QnCe7EYHJTqxIVWBzQMzUlfbALLGQ25mW31KBiyjc7eoOWxSygKg4w== X-Received: by 2002:ac8:5709:0:b0:458:35f7:3952 with SMTP id d75a77b69052e-45c9f2877e6mr254328061cf.40.1727726329482; Mon, 30 Sep 2024 12:58:49 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 2/7] migration: Put thread names together with macros Date: Mon, 30 Sep 2024 15:58:32 -0400 Message-ID: <20240930195837.825728-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726408875116600 Content-Type: text/plain; charset="utf-8" Since we have places where there can be more than one reference to the thread names, time to clean up the thread names with macros so that they're even cleaner when put together. Still two functional changes below: - There's one dirty rate thread that we overlooked before, now we add that too and name it as "mig/dirtyrate" following the old rules. - The old name "mig/src/rp-thr" has "-thr" but it may not be useful if it's a thread name anyway, while "rp" can be slightly hard to read. Taking this chance to rename it to "mig/src/return", hopefully a better name. Signed-off-by: Peter Xu --- migration/migration.h | 14 +++++++++++++- migration/colo.c | 3 ++- migration/dirtyrate.c | 6 ++++-- migration/migration.c | 4 ++-- migration/multifd.c | 6 +++--- migration/postcopy-ram.c | 6 ++++-- migration/savevm.c | 3 ++- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 519455796d..b9ce5aa4ff 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -28,7 +28,19 @@ #include "sysemu/runstate.h" #include "migration/misc.h" =20 -#define MIGRATION_THREAD_SRC_MAIN "mig/src/main" +#define MIGRATION_THREAD_SNAPSHOT "mig/snapshot" +#define MIGRATION_THREAD_DIRTY_RATE "mig/dirtyrate" + +#define MIGRATION_THREAD_SRC_MAIN "mig/src/main" +#define MIGRATION_THREAD_SRC_MULTIFD "mig/src/send_%d" +#define MIGRATION_THREAD_SRC_RETURN "mig/src/return" +#define MIGRATION_THREAD_SRC_TLS "mig/src/tls" + +#define MIGRATION_THREAD_DST_COLO "mig/dst/colo" +#define MIGRATION_THREAD_DST_MULTIFD "mig/src/recv_%d" +#define MIGRATION_THREAD_DST_FAULT "mig/dst/fault" +#define MIGRATION_THREAD_DST_LISTEN "mig/dst/listen" +#define MIGRATION_THREAD_DST_PREEMPT "mig/dst/preempt" =20 struct PostcopyBlocktimeContext; =20 diff --git a/migration/colo.c b/migration/colo.c index 6449490221..9590f281d0 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -935,7 +935,8 @@ void coroutine_fn colo_incoming_co(void) assert(bql_locked()); assert(migration_incoming_colo_enabled()); =20 - qemu_thread_create(&th, "mig/dst/colo", colo_process_incoming_thread, + qemu_thread_create(&th, MIGRATION_THREAD_DST_COLO, + colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); =20 mis->colo_incoming_co =3D qemu_coroutine_self(); diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 5478d58de3..2339ba400d 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -29,6 +29,7 @@ #include "sysemu/runstate.h" #include "exec/memory.h" #include "qemu/xxhash.h" +#include "migration.h" =20 /* * total_dirty_pages is procted by BQL and is used @@ -839,8 +840,9 @@ void qmp_calc_dirty_rate(int64_t calc_time, =20 init_dirtyrate_stat(config); =20 - qemu_thread_create(&thread, "get_dirtyrate", get_dirtyrate_thread, - (void *)&config, QEMU_THREAD_DETACHED); + qemu_thread_create(&thread, MIGRATION_THREAD_DIRTY_RATE, + get_dirtyrate_thread, (void *)&config, + QEMU_THREAD_DETACHED); } =20 =20 diff --git a/migration/migration.c b/migration/migration.c index 505b62c8f3..813c45ad04 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2478,7 +2478,7 @@ static int open_return_path_on_source(MigrationState = *ms) =20 trace_open_return_path_on_source(); =20 - qemu_thread_create(&ms->rp_state.rp_thread, "mig/src/rp-thr", + qemu_thread_create(&ms->rp_state.rp_thread, MIGRATION_THREAD_SRC_RETUR= N, source_return_path_thread, ms, QEMU_THREAD_JOINABLE= ); ms->rp_state.rp_thread_created =3D true; =20 @@ -3818,7 +3818,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) } =20 if (migrate_background_snapshot()) { - qemu_thread_create(&s->thread, "mig/snapshot", + qemu_thread_create(&s->thread, MIGRATION_THREAD_SNAPSHOT, bg_migration_thread, s, QEMU_THREAD_JOINABLE); } else { qemu_thread_create(&s->thread, MIGRATION_THREAD_SRC_MAIN, diff --git a/migration/multifd.c b/migration/multifd.c index 9b200f4ad9..697fe86fdf 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -723,7 +723,7 @@ static bool multifd_tls_channel_connect(MultiFDSendPara= ms *p, args->p =3D p; =20 p->tls_thread_created =3D true; - qemu_thread_create(&p->tls_thread, "mig/src/tls", + qemu_thread_create(&p->tls_thread, MIGRATION_THREAD_SRC_TLS, multifd_tls_handshake_thread, args, QEMU_THREAD_JOINABLE); return true; @@ -841,7 +841,7 @@ bool multifd_send_setup(void) + sizeof(uint64_t) * page_count; p->packet =3D g_malloc0(p->packet_len); } - p->name =3D g_strdup_printf("mig/src/send_%d", i); + p->name =3D g_strdup_printf(MIGRATION_THREAD_SRC_MULTIFD, i); p->write_flags =3D 0; =20 if (!multifd_new_send_channel_create(p, &local_err)) { @@ -1259,7 +1259,7 @@ int multifd_recv_setup(Error **errp) + sizeof(uint64_t) * page_count; p->packet =3D g_malloc0(p->packet_len); } - p->name =3D g_strdup_printf("mig/dst/recv_%d", i); + p->name =3D g_strdup_printf(MIGRATION_THREAD_DST_MULTIFD, i); p->normal =3D g_new0(ram_addr_t, page_count); p->zero =3D g_new0(ram_addr_t, page_count); } diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 83f6160a36..a535fd2e30 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1230,7 +1230,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingStat= e *mis) return -1; } =20 - postcopy_thread_create(mis, &mis->fault_thread, "mig/dst/fault", + postcopy_thread_create(mis, &mis->fault_thread, + MIGRATION_THREAD_DST_FAULT, postcopy_ram_fault_thread, QEMU_THREAD_JOINABLE= ); mis->have_fault_thread =3D true; =20 @@ -1250,7 +1251,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingStat= e *mis) * This thread needs to be created after the temp pages because * it'll fetch RAM_CHANNEL_POSTCOPY PostcopyTmpPage immediately. */ - postcopy_thread_create(mis, &mis->postcopy_prio_thread, "mig/dst/p= reempt", + postcopy_thread_create(mis, &mis->postcopy_prio_thread, + MIGRATION_THREAD_DST_PREEMPT, postcopy_preempt_thread, QEMU_THREAD_JOINAB= LE); mis->preempt_thread_status =3D PREEMPT_THREAD_CREATED; } diff --git a/migration/savevm.c b/migration/savevm.c index 7e1e27182a..e796436979 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2131,7 +2131,8 @@ static int loadvm_postcopy_handle_listen(MigrationInc= omingState *mis) } =20 mis->have_listen_thread =3D true; - postcopy_thread_create(mis, &mis->listen_thread, "mig/dst/listen", + postcopy_thread_create(mis, &mis->listen_thread, + MIGRATION_THREAD_DST_LISTEN, postcopy_ram_listen_thread, QEMU_THREAD_DETACHE= D); trace_loadvm_postcopy_handle_listen("return"); =20 --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726406; cv=none; d=zohomail.com; s=zohoarc; b=e69FJ/Q8LEU3142mrZNunJ6O0VY+8KI1xQGxHKsXdJrXeEh+xJQWyb3qfchylI+afHgbzwOYaLyUVZ5Wn7z4Qh+7AlhilCIsOQDMJ/N8/+w3Ig6JdZQgYkBjajEUIpaqlHncXnvWMqe3LQQSXKtWhu/jGDF5IQwB8dkC1GN9HMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726406; 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=K0KTK9vQGWewvOY3cSlTOqfE9A0WK5IwRE3a47FyV7w=; b=WwNQ6dZFYE8gFwx/YngyFYWmu2oFm8iLFRoC+DikZUJSaT4l3VJoscGl5Dvebu6VkOYs2arTkjiy13Ci94NHtfuKPmtHAwClqeAR76w1y19Ay9J2hhx9MNvhs9DFFdBYV8uO3vyVtlacB5QUuSIQX6mTnFtJQIVygJ6oOZuUQAo= 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 1727726406887131.9831377349849; Mon, 30 Sep 2024 13:00:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYZ-0004so-7F; Mon, 30 Sep 2024 15:59:43 -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 1svMXw-00044c-UM for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svMXp-00040A-VN for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:04 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-EU_C1ZyGMQqdCaoV_loPCw-1; Mon, 30 Sep 2024 15:58:55 -0400 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-458657ce53aso81887981cf.0 for ; Mon, 30 Sep 2024 12:58:54 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726337; 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=K0KTK9vQGWewvOY3cSlTOqfE9A0WK5IwRE3a47FyV7w=; b=UJw+dllhEVFGBo33uqVpGh4DeSDSccHAthwoYUeQFTQNMx11RazfTwqRpr90GiyCx3s6Hd CZrglxZ2fTlMzKcACdoaxUaqUfCuWp4uF2QOzkFwftqPVZFotJT+ELi5NBxbdUJpmeafG2 II6nNXT0u/0lqwLILgD+b5kvFYbVQvQ= X-MC-Unique: EU_C1ZyGMQqdCaoV_loPCw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726332; x=1728331132; 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=K0KTK9vQGWewvOY3cSlTOqfE9A0WK5IwRE3a47FyV7w=; b=YtBJ9jH/6gRaoTbcpZAAha7epivDf6QiTPVH2JyJW1lbn2L+GIxvy7gNYIk1azbjut 2yyWRzPLcb3dq0eT+cTK7agZLMEnLNmSNM1oeUuVRFKajjyy35fo2/qFNtJ1MAG/TP5L talgmKFcDM9DfWtsHTv1nY5qxA3gl207Y0ewb2RaWaQpOalB2j95GAgceZI0KqwTd9gT B9pyncfdoKsR3e6+ENzWKqJ36uaoTSlaD0IIVhug4Tr8QThkTgMvmb05Cg6dgDC3l07D MfZsNcvOGseErCbJoYHU34OxQP+umocbSmtM80DBoQV7ucltgRcCV8IiuVngqquTky0F EVZA== X-Gm-Message-State: AOJu0YyYiXDNipCBAeiNmMNDGR8hfMfqbT75TKcSxCV5E+35wfQyG0wZ um6QWMeyGQ6hAoV75VQinPoFy1YsIl5NBsB6i5vejB/QwgayZjH+GBM5jLNBfulP8yPymGDO5ea Eodg4GRUVqfDW2HiIuDj/jx7B2NQtsXhj7VHCf4iXkbeLq87bD87+DIFfKxnzVH98NlavUzheig +thfzGE8CiHhu9TsR+Pw++/XNeyh9fWEvOuA== X-Received: by 2002:a05:622a:144c:b0:458:5fd0:964c with SMTP id d75a77b69052e-45c9f31955amr203760581cf.50.1727726332489; Mon, 30 Sep 2024 12:58:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1ietuHwWWS0bbq2F/1PbII+kQ9eUVBriZz3SMMbWS/0Qod2lXONQ3ih789dvVEXAmsYO86Q== X-Received: by 2002:a05:622a:144c:b0:458:5fd0:964c with SMTP id d75a77b69052e-45c9f31955amr203760291cf.50.1727726332105; Mon, 30 Sep 2024 12:58:52 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 3/7] migration: Remove thread_id in migration_threads_add() Date: Mon, 30 Sep 2024 15:58:33 -0400 Message-ID: <20240930195837.825728-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726408802116600 Content-Type: text/plain; charset="utf-8" It always fetches the ID of the curren thread, so there's no point passing it over. Signed-off-by: Peter Xu --- migration/threadinfo.h | 2 +- migration/migration.c | 3 +-- migration/multifd.c | 2 +- migration/threadinfo.c | 5 +++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/migration/threadinfo.h b/migration/threadinfo.h index 2f356ff312..d0e4ab0aa3 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -21,5 +21,5 @@ struct MigrationThread { QLIST_ENTRY(MigrationThread) node; }; =20 -MigrationThread *migration_threads_add(const char *name, int thread_id); +MigrationThread *migration_threads_add(const char *name); void migration_threads_remove(MigrationThread *info); diff --git a/migration/migration.c b/migration/migration.c index 813c45ad04..1ddcf54a70 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3467,8 +3467,7 @@ static void *migration_thread(void *opaque) Error *local_err =3D NULL; int ret; =20 - thread =3D migration_threads_add(MIGRATION_THREAD_SRC_MAIN, - qemu_get_thread_id()); + thread =3D migration_threads_add(MIGRATION_THREAD_SRC_MAIN); =20 rcu_register_thread(); =20 diff --git a/migration/multifd.c b/migration/multifd.c index 697fe86fdf..04db886c7e 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -575,7 +575,7 @@ static void *multifd_send_thread(void *opaque) int ret =3D 0; bool use_packets =3D multifd_use_packets(); =20 - thread =3D migration_threads_add(p->name, qemu_get_thread_id()); + thread =3D migration_threads_add(p->name); =20 trace_multifd_send_thread_start(p->id); rcu_register_thread(); diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 262990dd75..8069413091 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -23,11 +23,12 @@ static void __attribute__((constructor)) migration_thre= ads_init(void) qemu_mutex_init(&migration_threads_lock); } =20 -MigrationThread *migration_threads_add(const char *name, int thread_id) +MigrationThread *migration_threads_add(const char *name) { MigrationThread *thread =3D g_new0(MigrationThread, 1); + thread->name =3D name; - thread->thread_id =3D thread_id; + thread->thread_id =3D qemu_get_thread_id(); =20 WITH_QEMU_LOCK_GUARD(&migration_threads_lock) { QLIST_INSERT_HEAD(&migration_threads, thread, node); --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726517; cv=none; d=zohomail.com; s=zohoarc; b=SbyfOwVcglCVEnoJTxJyWtkpeDRHdIa1sZUnImIMGWFTAAuxthtaTqHBDZhQyZGB5K7cfG06qpmTTL54XL/K/goCWcLNBce5Hyju3wf+sgWEknCMEhP2T+m3J0MMHI8SFRfqPMOCKwwPjjjVGX/PVDeX6IGQP0vUifA4gXZI82Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726517; 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=64NuNC1LXyWR9BlyqFsA8AEgcMwuGH1wwkajjFosllk=; b=ctOUhWhY8cxhOtEIXV4y/mZ94lCqzZtds+X4KJgXaH0f8VmZ0dSJavX50vCanJhpunMknTZxPTHbKTRuKH6izKdAfdz8BZnqVpms1KMjl0Wfq/BA5CSj+1RRzcAle91dmCylUIuWEGtZfQqqvOeYXMwcx+SlCNs+2WqfU5u0px8= 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 1727726517337394.080676874447; Mon, 30 Sep 2024 13:01:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYc-00057A-N0; Mon, 30 Sep 2024 15:59: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 1svMXx-00045N-G2 for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:05 -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 1svMXt-00041x-SC for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:05 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-w37P3WYJP4ihE5VuugavLA-1; Mon, 30 Sep 2024 15:58:59 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-45b172569a2so57190211cf.0 for ; Mon, 30 Sep 2024 12:58:59 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726340; 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=64NuNC1LXyWR9BlyqFsA8AEgcMwuGH1wwkajjFosllk=; b=P+weIxhKjRs0gWY1vpHk4f12pj+LURxyNYL8l5tu39fCh7ivrIJp0ZGIWX57D582WW39Ku TlYjLbLLMu0biKy7JoV3VlAABzv72VBtKN4GsswoQLaz7AEvMDSNsc0GtHSBgUxMebB+1D DR6hxBzomFiip4DkhIz1RhObFgEjzwc= X-MC-Unique: w37P3WYJP4ihE5VuugavLA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726337; x=1728331137; 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=64NuNC1LXyWR9BlyqFsA8AEgcMwuGH1wwkajjFosllk=; b=o3kKthrGP22o4tACQJyjDNo00P4bnMUxAhQD/INphVJVEoAcgVQBZY9kqTJyAKH1d5 33Lt+a764kYMa23uWcyASKHTp1k43wYjIJDATDyRVo07gnaVxhS0/CK/wSjNhnW7chwn 4knoODfD5FzI1kB4I8KUkZRwuKCrFQwJ89NxH386xP4tiaskegRVX+fYcrSGxPeVlPYW sHWBGbiWc4MO59jYabqdq41hjmi1pCFKQXwr8vAVF00sfYF8C/0XfV4G4rZjrtkBwjRz Wr3M2vq2zG11DAiOrUtJmMj8PIkSMC9Z9uodcPRQjKG60IIG71BlvkzkRkT1qdBMlKiN Iykg== X-Gm-Message-State: AOJu0Yydmbmkho5Dd9M7SXcJV4paGTcJ8E98hKZISxuXG+SqAoNJ1iHo yZmSs7afUoRvoz3NfJ5Ii6gG6h7p0SLgZ1cqltsvCU8wkGjXLAHdFAyhG1xPOZlyklsXJ5CP2IV W1vHtRYo1qcknZojw44z3ZBWfhKzbNOebYb9AwjZbbuZ1jIDMXzXpt714mHB1/S3wIVc4miXbmA tWp6j80kXPYt6c1Vec51aImkQdPb3nJO8ZGw== X-Received: by 2002:ac8:5756:0:b0:458:1749:e195 with SMTP id d75a77b69052e-45c9f1b1fe4mr164506131cf.10.1727726336702; Mon, 30 Sep 2024 12:58:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqiB7b3fIawvfRZqUY0ehIHYZkiFiRJyfeO1PLeLl54hB4ha+h6XAsGKJ/AVLigYDn5juGaA== X-Received: by 2002:ac8:5756:0:b0:458:1749:e195 with SMTP id d75a77b69052e-45c9f1b1fe4mr164505841cf.10.1727726336208; Mon, 30 Sep 2024 12:58:56 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 4/7] migration: Simplify migration-threads API Date: Mon, 30 Sep 2024 15:58:34 -0400 Message-ID: <20240930195837.825728-5-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726519172116600 Content-Type: text/plain; charset="utf-8" There's no need to return a thread struct, because both the add/remove APIs must be used in the working threads so tid would work. Similar to the fact we don't need to pass in tid in each call sites, we don't need the thread struct for removal too because tid is always in the context. Remove it in both add & remove APIs. Instead making sure when remove a thread the tid is always there. Signed-off-by: Peter Xu --- migration/threadinfo.h | 4 ++-- migration/migration.c | 5 ++--- migration/multifd.c | 5 ++--- migration/threadinfo.c | 19 ++++++++++++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/migration/threadinfo.h b/migration/threadinfo.h index d0e4ab0aa3..7c86ae8763 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -21,5 +21,5 @@ struct MigrationThread { QLIST_ENTRY(MigrationThread) node; }; =20 -MigrationThread *migration_threads_add(const char *name); -void migration_threads_remove(MigrationThread *info); +void migration_threads_add(const char *name); +void migration_threads_remove(void); diff --git a/migration/migration.c b/migration/migration.c index 1ddcf54a70..74b2c1c627 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3460,14 +3460,13 @@ 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; Error *local_err =3D NULL; int ret; =20 - thread =3D migration_threads_add(MIGRATION_THREAD_SRC_MAIN); + migration_threads_add(MIGRATION_THREAD_SRC_MAIN); =20 rcu_register_thread(); =20 @@ -3566,7 +3565,7 @@ out: migration_iteration_finish(s); object_unref(OBJECT(s)); rcu_unregister_thread(); - migration_threads_remove(thread); + migration_threads_remove(); return NULL; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index 04db886c7e..2738d78407 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -570,12 +570,11 @@ int multifd_send_sync_main(void) 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_packets =3D multifd_use_packets(); =20 - thread =3D migration_threads_add(p->name); + migration_threads_add(p->name); =20 trace_multifd_send_thread_start(p->id); rcu_register_thread(); @@ -669,7 +668,7 @@ out: } =20 rcu_unregister_thread(); - migration_threads_remove(thread); + migration_threads_remove(); trace_multifd_send_thread_end(p->id, p->packets_sent); =20 return NULL; diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 8069413091..25e77404e2 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -23,7 +23,7 @@ static void __attribute__((constructor)) migration_thread= s_init(void) qemu_mutex_init(&migration_threads_lock); } =20 -MigrationThread *migration_threads_add(const char *name) +void migration_threads_add(const char *name) { MigrationThread *thread =3D g_new0(MigrationThread, 1); =20 @@ -33,17 +33,26 @@ MigrationThread *migration_threads_add(const char *name) WITH_QEMU_LOCK_GUARD(&migration_threads_lock) { QLIST_INSERT_HEAD(&migration_threads, thread, node); } - - return thread; } =20 -void migration_threads_remove(MigrationThread *thread) +void migration_threads_remove(void) { + int tid =3D qemu_get_thread_id(); + MigrationThread *thread; + QEMU_LOCK_GUARD(&migration_threads_lock); - if (thread) { + + QLIST_FOREACH(thread, &migration_threads, node) { + if (tid !=3D thread->thread_id) { + continue; + } + QLIST_REMOVE(thread, node); g_free(thread); + return; } + + g_assert_not_reached(); } =20 MigrationThreadInfoList *qmp_query_migrationthreads(Error **errp) --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726483; cv=none; d=zohomail.com; s=zohoarc; b=Vy8lNACTzF13TUsircNcSx5L/0FvuuoSIKTeown8xz/15bG3G5AlMriWvHOBZjuEFlaBqxMMxRaIGsR2bvjCSjQaOAgsN8uWtsnplgyHWQIGLFzQO4I/RfcGxAPn+hffUhHDXtdfc0/Z26dZKHiYAuwTj7ASuMyVC8Em8M023l4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726483; 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=AZVd4Pug3ifuQz90VwbIAIsYrOTo120GMYeAvFDr5kM=; b=ZedtnpT/Dbzl/sYrU0eU+K7wevCRt9LdCh7qP/PTQD0LgJF3iqZCm1Y2dluk3lINHrD+px6mheekjaWywXuwp1UDQ73IcMCQuoWhMjhUaBPAbfst5ceL3afPCfAwiDLz74/dT5ewSXhkhFroDpoArHMlKsPVeqNGUbSsdg2lH08= 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 1727726483560583.307134064451; Mon, 30 Sep 2024 13:01:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYc-00057j-Rn; Mon, 30 Sep 2024 15:59: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 1svMXz-00047P-Hc for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:08 -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 1svMXx-000466-Ki for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:07 -0400 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-eN7qVG16OPSKELawoOx-XA-1; Mon, 30 Sep 2024 15:59:02 -0400 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-45832b277d9so79429461cf.1 for ; Mon, 30 Sep 2024 12:59:02 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726345; 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=AZVd4Pug3ifuQz90VwbIAIsYrOTo120GMYeAvFDr5kM=; b=NFUAXDLV9h9hsWKVcty6O9fzpzpinC6CkqCn7RRl/6owAGKbdfHkGW6XCpwe6X1Gy7+17H XCMhMhCHeTFFvLYTw9OAmxlwZ1X6jklfAhlaWEe9+jBCiq14wZlFAz5jdJnwzvBMjeBvzq 2louDRTAUa3MFIjEmQpjmpGDWg6kVqQ= X-MC-Unique: eN7qVG16OPSKELawoOx-XA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726342; x=1728331142; 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=AZVd4Pug3ifuQz90VwbIAIsYrOTo120GMYeAvFDr5kM=; b=oNUoIAVqpAGsmL+Mv4aJKObzIBd/pzzBn7cV7NSyrbqGXOlfGM8rkL/4aLR42i1hsF nn3mvhlAQZmp9SVsEwoCSHeCV3himeRsBPkylBmfEFKKLHcoWtu3Y+lzXcBZU3ruHivO zsGgbHh61ec5VaQ3w43CWQQLcxSTSs1Nz1UhSsYUfqBUH+BfPiQzzwTCnInyWP6J0dLQ /oE0qXxnscnYFEkJmfaCjjJbh2pBlRktf9uFJA2RQRzMG+FItPlUrDtCkIDfrGjP91kI OZfO4In6X/xTCZD4V4PiZMfvrXurAct4F4EdUB8LyGZRlFhjDC7/+8Rj05phIFudGykF wL8g== X-Gm-Message-State: AOJu0YyUsFm8wgYs9yBum1hyGA6t5KkbPO/HgiBNhNBR05yxjF8rLjQN dduDVtUJr+rl9eSzMT/dBOEAIrRJLIhtkLQQK/XdJT3vjsZXRAQTy6VWmd/r9uOq1rlUJehIOM7 kIBEC/w35Dbsb7X2sWDKM6YJzfrKNEq/XGIT4jHEaL/b8u8VuNSZ3jzTawm/v+yjJ0qlyoPwAxn 2/nNVLh9M3fY5Nq1bYlhWK4Czq3H8nc/XF5Q== X-Received: by 2002:a05:622a:54d:b0:45b:5cdf:54b8 with SMTP id d75a77b69052e-45c9f1fba6amr208457121cf.19.1727726341518; Mon, 30 Sep 2024 12:59:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqPysoEctDd1HPNkOdQUXjHclJJZtuerEr6FAqLthVfUIXv32H0mWurxxO8/0bKDzYGmDekw== X-Received: by 2002:a05:622a:54d:b0:45b:5cdf:54b8 with SMTP id d75a77b69052e-45c9f1fba6amr208456741cf.19.1727726340978; Mon, 30 Sep 2024 12:59:00 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 5/7] migration: Add all threads with QMP query-migrationthreads Date: Mon, 30 Sep 2024 15:58:35 -0400 Message-ID: <20240930195837.825728-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726485016116600 Content-Type: text/plain; charset="utf-8" The QMP interface query-migrationthreads lacks a lot of migration threads but only reports multifd sender threads. That's incomplete. Since I'm at this, make all threads available to the QMP responses. NOTE: there're a few changes that should fix some bugs on e.g. not unregister rcu threads on failure paths, but I didn't make them separate because they do not exist in live migration main logics but only either COLO or dirty rate thread on rare failures. I'd not bother, but if anyone things we should split it out feel free to shoot. Signed-off-by: Peter Xu --- migration/migration.h | 3 +++ migration/threadinfo.h | 3 --- migration/colo.c | 7 +++++-- migration/dirtyrate.c | 7 ++++++- migration/migration.c | 7 ++++++- migration/multifd.c | 6 ++++++ migration/postcopy-ram.c | 10 +++++++--- migration/savevm.c | 10 ++++++---- migration/threadinfo.c | 1 + 9 files changed, 40 insertions(+), 14 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index b9ce5aa4ff..85ec203a01 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -551,4 +551,7 @@ int migration_rp_wait(MigrationState *s); */ void migration_rp_kick(MigrationState *s); =20 +void migration_threads_add(const char *name); +void migration_threads_remove(void); + #endif diff --git a/migration/threadinfo.h b/migration/threadinfo.h index 7c86ae8763..59f334af21 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -20,6 +20,3 @@ struct MigrationThread { int thread_id; /* ID of the underlying host thread */ QLIST_ENTRY(MigrationThread) node; }; - -void migration_threads_add(const char *name); -void migration_threads_remove(void); diff --git a/migration/colo.c b/migration/colo.c index 9590f281d0..2f5cb96a90 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -823,6 +823,7 @@ static void *colo_process_incoming_thread(void *opaque) QIOChannelBuffer *bioc =3D NULL; /* Cache incoming device state */ Error *local_err =3D NULL; =20 + migration_threads_add(MIGRATION_THREAD_DST_COLO); rcu_register_thread(); qemu_sem_init(&mis->colo_incoming_sem, 0); =20 @@ -831,7 +832,7 @@ static void *colo_process_incoming_thread(void *opaque) =20 if (get_colo_mode() !=3D COLO_MODE_SECONDARY) { error_report("COLO mode must be COLO_MODE_SECONDARY"); - return NULL; + goto out_last; } =20 /* Make sure all file formats throw away their mutable metadata */ @@ -840,7 +841,7 @@ static void *colo_process_incoming_thread(void *opaque) bql_unlock(); if (local_err) { error_report_err(local_err); - return NULL; + goto out_last; } =20 failover_init_state(); @@ -923,7 +924,9 @@ out: qemu_sem_wait(&mis->colo_incoming_sem); qemu_sem_destroy(&mis->colo_incoming_sem); =20 +out_last: rcu_unregister_thread(); + migration_threads_remove(); return NULL; } =20 diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 2339ba400d..555c599c17 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -729,13 +729,15 @@ void *get_dirtyrate_thread(void *arg) { struct DirtyRateConfig config =3D *(struct DirtyRateConfig *)arg; int ret; + + migration_threads_add(MIGRATION_THREAD_DIRTY_RATE); rcu_register_thread(); =20 ret =3D dirtyrate_set_state(&CalculatingState, DIRTY_RATE_STATUS_UNSTA= RTED, DIRTY_RATE_STATUS_MEASURING); if (ret =3D=3D -1) { error_report("change dirtyrate state failed."); - return NULL; + goto out; } =20 calculate_dirtyrate(config); @@ -746,7 +748,10 @@ void *get_dirtyrate_thread(void *arg) error_report("change dirtyrate state failed."); } =20 +out: rcu_unregister_thread(); + migration_threads_remove(); + return NULL; } =20 diff --git a/migration/migration.c b/migration/migration.c index 74b2c1c627..04c4272e46 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2321,6 +2321,7 @@ static void *source_return_path_thread(void *opaque) int res; =20 trace_source_return_path_thread_entry(); + migration_threads_add(MIGRATION_THREAD_SRC_RETURN); rcu_register_thread(); =20 while (migration_is_setup_or_active()) { @@ -2463,8 +2464,9 @@ out: migration_rp_kick(ms); } =20 - trace_source_return_path_thread_end(); rcu_unregister_thread(); + migration_threads_remove(); + trace_source_return_path_thread_end(); =20 return NULL; } @@ -3602,6 +3604,8 @@ static void *bg_migration_thread(void *opaque) Error *local_err =3D NULL; int ret; =20 + migration_threads_add(MIGRATION_THREAD_SNAPSHOT); + rcu_register_thread(); object_ref(OBJECT(s)); =20 @@ -3726,6 +3730,7 @@ fail_setup: qemu_fclose(fb); object_unref(OBJECT(s)); rcu_unregister_thread(); + migration_threads_remove(); =20 return NULL; } diff --git a/migration/multifd.c b/migration/multifd.c index 2738d78407..b96aaffebb 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -685,6 +685,8 @@ static void *multifd_tls_handshake_thread(void *opaque) { MultiFDTLSThreadArgs *args =3D opaque; =20 + migration_threads_add(MIGRATION_THREAD_SRC_TLS); + qio_channel_tls_handshake(args->tioc, multifd_new_send_channel_async, args->p, @@ -692,6 +694,8 @@ static void *multifd_tls_handshake_thread(void *opaque) NULL); g_free(args); =20 + migration_threads_remove(); + return NULL; } =20 @@ -1122,6 +1126,7 @@ static void *multifd_recv_thread(void *opaque) int ret; =20 trace_multifd_recv_thread_start(p->id); + migration_threads_add(MIGRATION_THREAD_DST_MULTIFD); rcu_register_thread(); =20 while (true) { @@ -1209,6 +1214,7 @@ static void *multifd_recv_thread(void *opaque) } =20 rcu_unregister_thread(); + migration_threads_remove(); trace_multifd_recv_thread_end(p->id, p->packets_recved); =20 return NULL; diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index a535fd2e30..ee8f2eac77 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -962,6 +962,7 @@ static void *postcopy_ram_fault_thread(void *opaque) RAMBlock *rb =3D NULL; =20 trace_postcopy_ram_fault_thread_entry(); + migration_threads_add(MIGRATION_THREAD_DST_FAULT); rcu_register_thread(); mis->last_rb =3D NULL; /* last RAMBlock we sent part of */ qemu_sem_post(&mis->thread_sync_sem); @@ -1142,9 +1143,12 @@ retry: } } } + + g_free(pfd); rcu_unregister_thread(); + migration_threads_remove(); trace_postcopy_ram_fault_thread_exit(); - g_free(pfd); + return NULL; } =20 @@ -1713,7 +1717,7 @@ void *postcopy_preempt_thread(void *opaque) int ret; =20 trace_postcopy_preempt_thread_entry(); - + migration_threads_add(MIGRATION_THREAD_DST_PREEMPT); rcu_register_thread(); =20 qemu_sem_post(&mis->thread_sync_sem); @@ -1740,7 +1744,7 @@ void *postcopy_preempt_thread(void *opaque) qemu_mutex_unlock(&mis->postcopy_prio_thread_mutex); =20 rcu_unregister_thread(); - + migration_threads_remove(); trace_postcopy_preempt_thread_exit(); =20 return NULL; diff --git a/migration/savevm.c b/migration/savevm.c index e796436979..90f87a90c9 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2002,14 +2002,15 @@ static void *postcopy_ram_listen_thread(void *opaqu= e) int load_res; MigrationState *migr =3D migrate_get_current(); =20 - object_ref(OBJECT(migr)); + trace_postcopy_ram_listen_thread_start(); + migration_threads_add(MIGRATION_THREAD_DST_LISTEN); + rcu_register_thread(); =20 + object_ref(OBJECT(migr)); migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_POSTCOPY_ACTIVE); qemu_sem_post(&mis->thread_sync_sem); - trace_postcopy_ram_listen_thread_start(); =20 - rcu_register_thread(); /* * Because we're a thread and not a coroutine we can't yield * in qemu_file, and thus we must be blocking now. @@ -2078,11 +2079,12 @@ static void *postcopy_ram_listen_thread(void *opaqu= e) migration_incoming_state_destroy(); qemu_loadvm_state_cleanup(); =20 - rcu_unregister_thread(); mis->have_listen_thread =3D false; postcopy_state_set(POSTCOPY_INCOMING_END); =20 object_unref(OBJECT(migr)); + rcu_unregister_thread(); + migration_threads_remove(); =20 return NULL; } diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 25e77404e2..73db26dc82 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -14,6 +14,7 @@ #include "qemu/queue.h" #include "qemu/lockable.h" #include "threadinfo.h" +#include "migration.h" =20 QemuMutex migration_threads_lock; static QLIST_HEAD(, MigrationThread) migration_threads; --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726460; cv=none; d=zohomail.com; s=zohoarc; b=JvZxIRt94xSjnI4CQ3vvqqwetmktskgZcHUkGMkApbD/nhrGB2kpmvbdyqos7Rl+mzbcJv5o/gLrbO0ZrGA9BsfpLzGGZeqJ1KZzi07wzYk68Ue9+39kg+Ee1GpM8QV/PnT26a/JHLJ3qxhzH1Az1gscoTVyzVYytpkatL+75Wo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726460; 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=yDBWKslzG5nwdIt7YxzIRAMdilvoFhU+JDma5UP115Q=; b=N2y2fu8GFQBoctbDidZ47VnDcAzo8pYuPC0GbllxLk6Od89tUetFGm9hhSNVqjrcM1c6OUr0YevFLoz7c3N9upBxJH41B1PaqRJ216aQenCy2m2RczyLedgxcdjeWyZz2mstM46hQtO4nM4GrP/nZ1FEjUvvcVvA2BKXK68xhHA= 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 1727726460232716.3720249799782; Mon, 30 Sep 2024 13:01:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYK-0004Qw-Gj; Mon, 30 Sep 2024 15:59:29 -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 1svMY2-00049Q-MG for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:12 -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 1svMY0-00047c-Tj for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:10 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-NstkanWxMuSETVVL5Fm1sw-1; Mon, 30 Sep 2024 15:59:06 -0400 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-45856a29545so99100651cf.3 for ; Mon, 30 Sep 2024 12:59:06 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726347; 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=yDBWKslzG5nwdIt7YxzIRAMdilvoFhU+JDma5UP115Q=; b=cl+EtGGnys4iz0IciZh2L47g0TxlojJlbYWnzpqOGP0YYf2nuBSsZU07E9hgykTUx69Liz KVTr7X/gigJIeyWliLeFqeEk/t0iA0F8InOAn6ycIASWkCNGlq4U/L+7w+ofIB36AVIcTj VyawdcAz1NdnXArPWKdtkMy+Aa8XptQ= X-MC-Unique: NstkanWxMuSETVVL5Fm1sw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726345; x=1728331145; 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=yDBWKslzG5nwdIt7YxzIRAMdilvoFhU+JDma5UP115Q=; b=VOfuzNAqvQpLJP3ppZ4feFchwm4XcETngCcCZdQTkz1lgda7G1Q1d9WsShvij6/OSN oUkjYd26uYR6EtjzYOzVLTTK+NphMR2rSioH+59ymkm5UOYEtN0XKQ2BH1ctRc+TOtAk 9X2Wfa8G4NlJR8mgMD4GwKaGgyCjDreC0xrgq+o8sJYbpqmCa4xqZr/B9J/oMHadbLnE iNpZF1Fiy+k2o9AGvvKanPrmxZCdgDv3RaNjp7aLeeHwnMshwVDxH9PgLkWRXF0MXnTE NUSR4LdYudOyyaPzgjs+UmJnrljhr9irCAtPx++DaJubIRhhExoC68187fW4BdGvfKvK c+QQ== X-Gm-Message-State: AOJu0Yz21JXGVP6AMRu4pzy8YwlO+bt6ImM6dJFZqS3ciaTGmykabR3p tQa5JGH2PIoVotJIKEw14wFHCag5LcLdQ6JTz2vV5E3sLTQjj2l7++CpQnDRe1wJALg1fiFe6xo eNpO6ktfe6OefQgD/gUUPO7tU7TGyzQkpvV398ANETtzLy7vN70Bs8KSgl5wTKpLrXhb2AzAJKB D72sjF8PFUe5KUPUC8M1q17EPsrsmpTqwEJw== X-Received: by 2002:ac8:7f09:0:b0:45b:5596:f785 with SMTP id d75a77b69052e-45c9f2a3ccamr217341481cf.44.1727726344594; Mon, 30 Sep 2024 12:59:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF00fm5R2Yl9uT792JudZsOBV9gQxJc9d2Ztjd5aqJ+8ReyVARVuAaZm4316X4jDrwIXTThdA== X-Received: by 2002:ac8:7f09:0:b0:45b:5596:f785 with SMTP id d75a77b69052e-45c9f2a3ccamr217341161cf.44.1727726344203; Mon, 30 Sep 2024 12:59:04 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 6/7] migration: Remove MigrationThread and threadinfo.h Date: Mon, 30 Sep 2024 15:58:36 -0400 Message-ID: <20240930195837.825728-7-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726461047116600 Content-Type: text/plain; charset="utf-8" The MigrationThread struct is mostly the same as MigrationThreadInfoList, except that it's a double-linked list so removal doesn't need to remember prev pointer. That might not be necessary, especially considering that the defintion of that struct is the only thing in threadinfo.h now. Reuse MigrationThreadInfoList, then let's drop the header. Need to manage a single list entry removal, but after I saw the diff, it's not so bad. With that, query-migrationthreads is much easier, as we can simply do QAPI_CLONE() now. Signed-off-by: Peter Xu --- migration/threadinfo.h | 22 ------------------- migration/migration.c | 1 - migration/multifd.c | 1 - migration/threadinfo.c | 50 +++++++++++++++++++++--------------------- 4 files changed, 25 insertions(+), 49 deletions(-) delete mode 100644 migration/threadinfo.h diff --git a/migration/threadinfo.h b/migration/threadinfo.h deleted file mode 100644 index 59f334af21..0000000000 --- a/migration/threadinfo.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 "qapi/error.h" -#include "qapi/qapi-commands-migration.h" - -typedef struct MigrationThread MigrationThread; - -struct MigrationThread { - const char *name; /* the name of migration thread */ - int thread_id; /* ID of the underlying host thread */ - QLIST_ENTRY(MigrationThread) node; -}; diff --git a/migration/migration.c b/migration/migration.c index 04c4272e46..1034668a90 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -57,7 +57,6 @@ #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" diff --git a/migration/multifd.c b/migration/multifd.c index b96aaffebb..0baa760ccf 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -26,7 +26,6 @@ #include "qemu-file.h" #include "trace.h" #include "multifd.h" -#include "threadinfo.h" #include "options.h" #include "qemu/yank.h" #include "io/channel-file.h" diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 73db26dc82..6c1278b4ea 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -13,11 +13,13 @@ #include "qemu/osdep.h" #include "qemu/queue.h" #include "qemu/lockable.h" -#include "threadinfo.h" #include "migration.h" +#include "qapi/qapi-commands-migration.h" +#include "qapi/qapi-visit-migration.h" +#include "qapi/clone-visitor.h" =20 QemuMutex migration_threads_lock; -static QLIST_HEAD(, MigrationThread) migration_threads; +static MigrationThreadInfoList *migration_threads; =20 static void __attribute__((constructor)) migration_threads_init(void) { @@ -26,31 +28,40 @@ static void __attribute__((constructor)) migration_thre= ads_init(void) =20 void migration_threads_add(const char *name) { - MigrationThread *thread =3D g_new0(MigrationThread, 1); + MigrationThreadInfo *thread =3D g_new0(MigrationThreadInfo, 1); =20 - thread->name =3D name; + thread->name =3D g_strdup(name); thread->thread_id =3D qemu_get_thread_id(); =20 WITH_QEMU_LOCK_GUARD(&migration_threads_lock) { - QLIST_INSERT_HEAD(&migration_threads, thread, node); + QAPI_LIST_PREPEND(migration_threads, thread); } } =20 void migration_threads_remove(void) { int tid =3D qemu_get_thread_id(); - MigrationThread *thread; + MigrationThreadInfoList *thread, *prev; =20 QEMU_LOCK_GUARD(&migration_threads_lock); =20 - QLIST_FOREACH(thread, &migration_threads, node) { - if (tid !=3D thread->thread_id) { - continue; - } + prev =3D NULL; + thread =3D migration_threads; =20 - QLIST_REMOVE(thread, node); - g_free(thread); - return; + while (thread) { + if (tid =3D=3D thread->value->thread_id) { + if (!prev) { + migration_threads =3D thread->next; + } else { + prev->next =3D thread->next; + } + /* Terminate this single object to not free the rest */ + thread->next =3D NULL; + qapi_free_MigrationThreadInfoList(thread); + return; + } + prev =3D thread; + thread =3D thread->next; } =20 g_assert_not_reached(); @@ -58,18 +69,7 @@ void migration_threads_remove(void) =20 MigrationThreadInfoList *qmp_query_migrationthreads(Error **errp) { - MigrationThreadInfoList *head =3D NULL; - MigrationThreadInfoList **tail =3D &head; - MigrationThread *thread =3D NULL; - QEMU_LOCK_GUARD(&migration_threads_lock); - QLIST_FOREACH(thread, &migration_threads, node) { - MigrationThreadInfo *info =3D g_new0(MigrationThreadInfo, 1); - info->name =3D g_strdup(thread->name); - info->thread_id =3D thread->thread_id; - - QAPI_LIST_APPEND(tail, info); - } =20 - return head; + return QAPI_CLONE(MigrationThreadInfoList, migration_threads); } --=20 2.45.0 From nobody Sun Nov 24 01:02:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1727726484; cv=none; d=zohomail.com; s=zohoarc; b=OxW/WJ81rq2l5xq+w/kFH+ORuoEQnJuaDLVK+845eJX5kZYqMh9nbvlSx/owyRBoBOS7ebdcISGV8A67Wljfr1LDwrfule/qPzY850pD3opE909I66Vp/WebraidK1SckDIa9seVCZtks0ELYzxATET30+Odr+QGLNTG7Uqsi5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727726484; 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=0IVNh8rkuBzemuMWp2WPFFN8HowcfvDmFRDqv1ADWW0=; b=my1aKZVR0cEpAdtW3HdEzA5CQQscM7+ZLTVrvfi8BIFNIywUxu2I38B+XK735DjyO8CA9q0ffISlJWKc5diDriFpsMDDEj8aCEk1mtO3lVAsqa2gyNzw6zUHqlIaQsRrgw03OvnLhI20dgIrdm3VHYpD2wMmAqyXkqh2q9YiNy4= 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 1727726484280271.59064336243557; Mon, 30 Sep 2024 13:01:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svMYW-0004hR-Dm; Mon, 30 Sep 2024 15:59:40 -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 1svMY5-0004AN-MK for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:15 -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 1svMY3-00048s-Ql for qemu-devel@nongnu.org; Mon, 30 Sep 2024 15:59:13 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-557-gC2mVLvGO8qfST2PGrVE-Q-1; Mon, 30 Sep 2024 15:59:09 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6cb3d5736a4so70540996d6.2 for ; Mon, 30 Sep 2024 12:59:09 -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 d75a77b69052e-45c9f28e481sm38879371cf.16.2024.09.30.12.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 12:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727726351; 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=0IVNh8rkuBzemuMWp2WPFFN8HowcfvDmFRDqv1ADWW0=; b=gSqmtYi0SQ4mYMazWZhULR6Jl95z5t2VT3LBWu7nwkVeWMo3cgypwEGDcvi0owJoka+c7m xz4ySB6Mlmdl3sFo9TdMr6seSQxqX1w5aYZJt0SFjWWqPeg45o4GfT7TbW1RHtDOVgc9XQ IGMDC4lKjqmjr5mHc8iJEA3UogjzHc8= X-MC-Unique: gC2mVLvGO8qfST2PGrVE-Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726349; x=1728331149; 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=0IVNh8rkuBzemuMWp2WPFFN8HowcfvDmFRDqv1ADWW0=; b=VG1EmUdsIZto3oqFsB6AwO1Ev+RR5CkkMorjQHQ3FzIRQFhTBwJn8Cq4VwXYIHRYBC v+E6DTTtiUbklrNwQ0hD+jUrTQfYvq+pHYtYMqMqkGZOihkhhCd6DgkaOyOx3YKFzzOZ R3mQorJ4vAzGWdz6JXDd0H4Pzpan0LpTm+czwQZgLEpqoHYiwBYb9321iD7onSjSVlrj oHLkGzi9mtZZySdPeNZSUS+lpH3wQhuzjxTK80dcoaPiS4SQiOnqxSXihURj/Fc/OzQQ njALQFGBwpHjGsJ9Ytd2CxU2V+FRDFqxmH+DUPJ5+3POJK9ExluEISmt4lP5EkKqV+h1 Ts7Q== X-Gm-Message-State: AOJu0Yz0ueHEnx1BFapz7rSH3fM+nWEuVajgR9auicpcI04viQ87AjRs 8Jc1Bqg6b0DvHxsYV/5WUPOIiJkPlDbSHj3YsuXMiMpbFOjCowKYHKaUoWPjwstSQ7tmC4idTI9 BQr98KYV9yCV5FDdV0TPyGcA3HTbS6rflWOzmOPW6doXDR8XM/6Nkr7GnCUYgNuryTpLsQwbDS7 uco+ZrRwj8SGsSpck/vMTGSbH+PGWej3DrFw== X-Received: by 2002:a05:6214:328e:b0:6cb:2ad6:78ef with SMTP id 6a1803df08f44-6cb3b5c6732mr186119366d6.4.1727726348852; Mon, 30 Sep 2024 12:59:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVzVpt6MhFCkdOiTIb7rTrFVkeUwAuegBYrxZJiBIgstHCiSjypMXUonr8bOYSr/TzXdewRw== X-Received: by 2002:a05:6214:328e:b0:6cb:2ad6:78ef with SMTP id 6a1803df08f44-6cb3b5c6732mr186119176d6.4.1727726348511; Mon, 30 Sep 2024 12:59:08 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Prasad Pandit , Julia Suvorova , Markus Armbruster , peterx@redhat.com, Fabiano Rosas , Juraj Marcin , "Dr . David Alan Gilbert" Subject: [PATCH 7/7] hmp: Add "info migrationthreads" Date: Mon, 30 Sep 2024 15:58:37 -0400 Message-ID: <20240930195837.825728-8-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240930195837.825728-1-peterx@redhat.com> References: <20240930195837.825728-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1727726484955116600 Content-Type: text/plain; charset="utf-8" The QMP command was added in 671326201d ("migration: Introduce interface query-migrationthreads", v8.0). Add the HMP version of it. Cc: Markus Armbruster Cc: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- include/monitor/hmp.h | 1 + migration/migration-hmp-cmds.c | 25 +++++++++++++++++++++++++ hmp-commands-info.hx | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index ae116d9804..e44a399e4a 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -31,6 +31,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict); void hmp_info_migrate(Monitor *mon, const QDict *qdict); void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); +void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict); void hmp_info_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vnc(Monitor *mon, const QDict *qdict); void hmp_info_spice(Monitor *mon, const QDict *qdict); diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 20d1a6e219..63a6ea61f2 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -814,3 +814,28 @@ void loadvm_completion(ReadLineState *rs, int nb_args,= const char *str) vm_completion(rs, str); } } + +void hmp_info_migrationthreads(Monitor *mon, const QDict *qdict) +{ + MigrationThreadInfoList *list; + MigrationThreadInfo *entry; + Error *err =3D NULL; + + list =3D qmp_query_migrationthreads(&err); + + if (!list) { + monitor_printf(mon, "No migration threads found\n"); + return; + } + + monitor_printf(mon, "%-16s%s\n", "TID", "Thread Name"); + while (list) { + entry =3D list->value; + monitor_printf(mon, "%-16" PRId64 "%s\n", + entry->thread_id, entry->name); + list =3D list->next; + } + + qapi_free_MigrationThreadInfoList(list); + hmp_handle_error(mon, err); +} diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index c59cd6637b..a8dc55dbd2 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -512,6 +512,19 @@ SRST Show current migration parameters. ERST =20 + { + .name =3D "migrationthreads", + .args_type =3D "", + .params =3D "", + .help =3D "show migration threads information", + .cmd =3D hmp_info_migrationthreads, + }, + +SRST + ``info migrationthreads`` + Show migration threads information. +ERST + { .name =3D "balloon", .args_type =3D "", --=20 2.45.0