qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Prasad Pandit <ppandit@redhat.com>,
	Julia Suvorova <jusual@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Fabiano Rosas <farosas@suse.de>,
	Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH 7/7] hmp: Add "info migrationthreads"
Date: Mon, 30 Sep 2024 23:43:49 +0000	[thread overview]
Message-ID: <Zvs3tb80cXdlSmZW@gallifrey> (raw)
In-Reply-To: <20240930195837.825728-8-peterx@redhat.com>

* Peter Xu (peterx@redhat.com) wrote:
> The QMP command was added in 671326201d ("migration: Introduce interface
> query-migrationthreads", v8.0).  Add the HMP version of it.
> 
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Dr. David Alan Gilbert <dave@treblig.org>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  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 = NULL;
> +
> +    list = qmp_query_migrationthreads(&err);
> +

I think you need to do the hmp_handle_error here rather than at
the end, and return if there was one.

Other than that it looks OK.

Dave

> +    if (!list) {
> +        monitor_printf(mon, "No migration threads found\n");
> +        return;
> +    }
> +
> +    monitor_printf(mon, "%-16s%s\n", "TID", "Thread Name");
> +    while (list) {
> +        entry = list->value;
> +        monitor_printf(mon, "%-16" PRId64 "%s\n",
> +                       entry->thread_id, entry->name);
> +        list = 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
>  
> +    {
> +        .name       = "migrationthreads",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show migration threads information",
> +        .cmd        = hmp_info_migrationthreads,
> +    },
> +
> +SRST
> +  ``info migrationthreads``
> +    Show migration threads information.
> +ERST
> +
>      {
>          .name       = "balloon",
>          .args_type  = "",
> -- 
> 2.45.0
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


  reply	other threads:[~2024-09-30 23:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 19:58 [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Peter Xu
2024-09-30 19:58 ` [PATCH 1/7] migration: Unify names of migration src main thread Peter Xu
2024-09-30 19:58 ` [PATCH 2/7] migration: Put thread names together with macros Peter Xu
2024-09-30 19:58 ` [PATCH 3/7] migration: Remove thread_id in migration_threads_add() Peter Xu
2024-09-30 19:58 ` [PATCH 4/7] migration: Simplify migration-threads API Peter Xu
2024-09-30 19:58 ` [PATCH 5/7] migration: Add all threads with QMP query-migrationthreads Peter Xu
2024-09-30 19:58 ` [PATCH 6/7] migration: Remove MigrationThread and threadinfo.h Peter Xu
2024-09-30 19:58 ` [PATCH 7/7] hmp: Add "info migrationthreads" Peter Xu
2024-09-30 23:43   ` Dr. David Alan Gilbert [this message]
2024-10-01  5:46 ` [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Markus Armbruster
2024-10-01 14:25   ` Daniel P. Berrangé
2024-10-01 15:06     ` Peter Xu
2024-10-02  5:58       ` Markus Armbruster
2024-10-10 19:46         ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zvs3tb80cXdlSmZW@gallifrey \
    --to=dave@treblig.org \
    --cc=armbru@redhat.com \
    --cc=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=jusual@redhat.com \
    --cc=peterx@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).