qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Yi Wang <wang.yi59@zte.com.cn>
Cc: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	dgilbert@redhat.com, qemu-devel@nongnu.org, liu.yunh@zte.com.cn,
	Liu.Jianjun3@zte.com.cn
Subject: Re: [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic"
Date: Tue, 18 Jul 2017 16:54:17 +0200	[thread overview]
Message-ID: <20170718165417.1b18bcbc@nial.brq.redhat.com> (raw)
In-Reply-To: <1500342577-12486-1-git-send-email-wang.yi59@zte.com.cn>

On Mon, 17 Jul 2017 21:49:37 -0400
Yi Wang <wang.yi59@zte.com.cn> wrote:

> Add [vcpu] index support for hmp command "info lapic", which is
> useful when debugging ipi and so on. Current behavior is not
> changed when the parameter isn't specified.
we shouldn't expose cpu_index to users anymore,

I would suggest using to use real APIC ID here but we don't
have monitor command that returns APIC IDs for present cpus.

"info hotpluggable-cpus" gives you a list of available CPUs
it also gives you qom_path to cpu so potentially you could
read apic-id property of cpu.

But we have only QMP variant of qom-get so monitor needs
addition of qom-get command that will be a wrapper around
QMP command.

It could be solved in 2 ways:
 * use socket-id/core-id/thread-id to specify desired cpu
   /possible values in 'info hotpluggable-cpus'/

 * use apic-id value to specify interrupt controller
   - apic-id could be retrieved with new qom-get
     (qom-get would also be useful to read other properties)
   - extend 'info registers' with apic id value
    for example instead of current:
    
     CPU#1
     EAX=00000c06 EBX=00000000 ECX=000002ff EDX=00000000
     ....

    it would look like:

     CPU#1 (socket-id: a, core-id: b, thread-id: c, apic-id: d)
     ...


> 
> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>
> ---
>  hmp-commands-info.hx  | 6 +++---
>  target/i386/monitor.c | 8 +++++++-
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index d9df238..c534b03 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -115,9 +115,9 @@ ETEXI
>  #if defined(TARGET_I386)
>      {
>          .name       = "lapic",
> -        .args_type  = "",
> -        .params     = "",
> -        .help       = "show local apic state",
> +        .args_type  = "vcpu:i?",
> +        .params     = "[vcpu]",
> +        .help       = "show local apic state (vcpu: vCPU to read, default is 0)",
>          .cmd        = hmp_info_local_apic,
>      },
>  #endif
> diff --git a/target/i386/monitor.c b/target/i386/monitor.c
> index 77ead60..813005e 100644
> --- a/target/i386/monitor.c
> +++ b/target/i386/monitor.c
> @@ -632,8 +632,14 @@ const MonitorDef *target_monitor_defs(void)
>  
>  void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
>  {
> -    CPUState *cs = mon_get_cpu();
> +    CPUState *cs;
>  
> +    if (qdict_haskey(qdict, "vcpu")) {
> +        int index = qdict_get_try_int(qdict, "vcpu", 0);
> +        cs = qemu_get_cpu(index);
> +    } else {
> +        cs = mon_get_cpu();
> +    }
>      if (!cs) {
>          monitor_printf(mon, "No CPU available\n");
>          return;

  reply	other threads:[~2017-07-18 14:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  1:49 [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic" Yi Wang
2017-07-18 14:54 ` Igor Mammedov [this message]
2017-07-18 23:26   ` Eduardo Habkost
2017-07-19  7:39     ` Igor Mammedov
2017-07-18 23:25 ` Eduardo Habkost
  -- strict thread matches above, loose matches on Subject: below --
2017-07-19  4:25 wang.yi59
2017-07-19  7:36 ` Igor Mammedov
2017-07-19  4:47 wang.yi59
2017-07-19  6:16 ` Eduardo Habkost
2017-07-19 12:16   ` Dr. David Alan Gilbert
2017-07-19 12:41     ` Eduardo Habkost
2017-07-19 15:02       ` Eric Blake
2017-07-19 15:07         ` Daniel P. Berrange
2017-07-19 15:17           ` Eric Blake
2017-07-19 18:32             ` Eduardo Habkost
2017-07-19 19:17               ` Dr. David Alan Gilbert
2017-07-19 19:46                 ` Eduardo Habkost
2017-07-19  8:10 ` Dr. David Alan Gilbert
2017-07-19  8:48 wang.yi59
2017-07-19  9:16 ` Igor Mammedov
2017-07-20  4:41 wang.yi59

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=20170718165417.1b18bcbc@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=Liu.Jianjun3@zte.com.cn \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=liu.yunh@zte.com.cn \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=wang.yi59@zte.com.cn \
    /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).