All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] migration: Report migration related thread pid to libvirt to
@ 2023-01-09 11:16 Jiang Jiacheng via
  2023-01-09 11:16 ` [PATCH 1/2] migration: report migration related thread pid to libvirt Jiang Jiacheng via
  2023-01-09 11:16 ` [PATCH 2/2] migration: report multiFd " Jiang Jiacheng via
  0 siblings, 2 replies; 4+ messages in thread
From: Jiang Jiacheng via @ 2023-01-09 11:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: yubihong, xiexiangyou, zhengchuan, linyilu, jiangjiacheng

By default, the migration thread shares CPU resources with the VM process. 
With migration pin, support pin migration thread to expected CPU list 
to avoid preempting CPU resources of VM process.
To support migration pin, we need report migration related thread pid 
to libvirt.

libvirt patches:
https://listman.redhat.com/archives/libvir-list/2023-January/236561.html

Zheng Chuan (2):
  migration: report migration related thread pid to libvirt
  migration: report multiFd related thread pid to libvirt

 migration/migration.c |  3 +++
 migration/multifd.c   |  4 ++++
 qapi/migration.json   | 24 ++++++++++++++++++++++++
 3 files changed, 31 insertions(+)

-- 
2.33.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] migration: report migration related thread pid to libvirt
  2023-01-09 11:16 [PATCH 0/2] migration: Report migration related thread pid to libvirt to Jiang Jiacheng via
@ 2023-01-09 11:16 ` Jiang Jiacheng via
  2023-01-09 11:16 ` [PATCH 2/2] migration: report multiFd " Jiang Jiacheng via
  1 sibling, 0 replies; 4+ messages in thread
From: Jiang Jiacheng via @ 2023-01-09 11:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: yubihong, xiexiangyou, zhengchuan, linyilu, jiangjiacheng

From: Zheng Chuan <zhengchuan@huawei.com>

Report migration thread pid to libvirt in order to pin
migration thread to different cpu.
---
 migration/migration.c |  3 +++
 qapi/migration.json   | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 52b5d39244..2534e5a1f1 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3955,6 +3955,9 @@ static void *migration_thread(void *opaque)
     MigThrError thr_error;
     bool urgent = false;
 
+    /* report migration thread pid to libvirt */
+    qapi_event_send_migration_pid(qemu_get_thread_id());
+
     rcu_register_thread();
 
     object_ref(OBJECT(s));
diff --git a/qapi/migration.json b/qapi/migration.json
index 88ecf86ac8..aafc940617 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -1286,6 +1286,18 @@
 { 'event': 'MIGRATION_PASS',
   'data': { 'pass': 'int' } }
 
+##
+# @MIGRATION_PID:
+#
+# Emitted when migration thread appear
+#
+# @pid: pid of migration thread
+#
+# Since: 7.2
+##
+{ 'event': 'MIGRATION_PID',
+  'data': { 'pid': 'int' } }
+
 ##
 # @COLOMessage:
 #
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] migration: report multiFd related thread pid to libvirt
  2023-01-09 11:16 [PATCH 0/2] migration: Report migration related thread pid to libvirt to Jiang Jiacheng via
  2023-01-09 11:16 ` [PATCH 1/2] migration: report migration related thread pid to libvirt Jiang Jiacheng via
@ 2023-01-09 11:16 ` Jiang Jiacheng via
  2023-01-09 14:44   ` Daniel P. Berrangé
  1 sibling, 1 reply; 4+ messages in thread
From: Jiang Jiacheng via @ 2023-01-09 11:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: yubihong, xiexiangyou, zhengchuan, linyilu, jiangjiacheng

From: Zheng Chuan <zhengchuan@huawei.com>

Report multiFd related thread pid to libvirt in order to
pin multiFd thread to different cpu.
---
 migration/multifd.c |  4 ++++
 qapi/migration.json | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/migration/multifd.c b/migration/multifd.c
index 000ca4d4ec..f3f7e8ae31 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"
@@ -650,6 +651,9 @@ static void *multifd_send_thread(void *opaque)
     int ret = 0;
     bool use_zero_copy_send = migrate_use_zero_copy_send();
 
+    /* report multifd thread pid to libvirt */
+    qapi_event_send_migration_multifd_pid(qemu_get_thread_id());
+
     trace_multifd_send_thread_start(p->id);
     rcu_register_thread();
 
diff --git a/qapi/migration.json b/qapi/migration.json
index aafc940617..33fc319329 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -1286,6 +1286,18 @@
 { 'event': 'MIGRATION_PASS',
   'data': { 'pass': 'int' } }
 
+##
+# @MIGRATION_MULTIFD_PID:
+#
+# Emitted when multifd thread appear
+#
+# @pid: pid of multifd thread
+#
+# Since: 7.2
+##
+{ 'event': 'MIGRATION_MULTIFD_PID',
+  'data': { 'pid': 'int' } }
+
 ##
 # @MIGRATION_PID:
 #
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] migration: report multiFd related thread pid to libvirt
  2023-01-09 11:16 ` [PATCH 2/2] migration: report multiFd " Jiang Jiacheng via
@ 2023-01-09 14:44   ` Daniel P. Berrangé
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2023-01-09 14:44 UTC (permalink / raw)
  To: Jiang Jiacheng; +Cc: qemu-devel, yubihong, xiexiangyou, zhengchuan, linyilu

On Mon, Jan 09, 2023 at 07:16:31PM +0800, Jiang Jiacheng via wrote:
> From: Zheng Chuan <zhengchuan@huawei.com>
> 
> Report multiFd related thread pid to libvirt in order to
> pin multiFd thread to different cpu.
> ---
>  migration/multifd.c |  4 ++++
>  qapi/migration.json | 12 ++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/migration/multifd.c b/migration/multifd.c
> index 000ca4d4ec..f3f7e8ae31 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"
> @@ -650,6 +651,9 @@ static void *multifd_send_thread(void *opaque)
>      int ret = 0;
>      bool use_zero_copy_send = migrate_use_zero_copy_send();
>  
> +    /* report multifd thread pid to libvirt */
> +    qapi_event_send_migration_multifd_pid(qemu_get_thread_id());
> +
>      trace_multifd_send_thread_start(p->id);
>      rcu_register_thread();
>  
> diff --git a/qapi/migration.json b/qapi/migration.json
> index aafc940617..33fc319329 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -1286,6 +1286,18 @@
>  { 'event': 'MIGRATION_PASS',
>    'data': { 'pass': 'int' } }
>  
> +##
> +# @MIGRATION_MULTIFD_PID:
> +#
> +# Emitted when multifd thread appear
> +#
> +# @pid: pid of multifd thread
> +#
> +# Since: 7.2
> +##
> +{ 'event': 'MIGRATION_MULTIFD_PID',
> +  'data': { 'pid': 'int' } }

Why do we need to have separate events instead of emitting MIGRATION_PID
multiple times, possibly with a 'type' field if clients genuinely need
to distinguish multifd threads.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-09 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 11:16 [PATCH 0/2] migration: Report migration related thread pid to libvirt to Jiang Jiacheng via
2023-01-09 11:16 ` [PATCH 1/2] migration: report migration related thread pid to libvirt Jiang Jiacheng via
2023-01-09 11:16 ` [PATCH 2/2] migration: report multiFd " Jiang Jiacheng via
2023-01-09 14:44   ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.