From: Eduardo Habkost <ehabkost@redhat.com>
To: Yi Wang <wang.yi59@zte.com.cn>
Cc: dgilbert@redhat.com, armbru@redhat.com, pbonzini@redhat.com,
rth@twiddle.net, imammedo@redhat.com, qemu-devel@nongnu.org,
Liu.Jianjun3@zte.com.cn, liu.yunh@zte.com.cn
Subject: Re: [Qemu-devel] [PATCH v2 1/2] hmp: dump ids including socket-id, core-id and so on for 'info registers'
Date: Wed, 26 Jul 2017 11:01:14 -0300 [thread overview]
Message-ID: <20170726140114.GF20793@localhost.localdomain> (raw)
In-Reply-To: <1501049917-4701-2-git-send-email-wang.yi59@zte.com.cn>
On Wed, Jul 26, 2017 at 02:18:36AM -0400, Yi Wang wrote:
> This patch add output of CPUs' socket-id, core-id, thread-id and
> apic-id for 'info registers', which can be used for querying other
> hmp commands.
>
> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>
> ---
> target/i386/helper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index f63eb3d..a52f300 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -416,6 +416,14 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
> int eflags, i, nb;
> char cc_op_name[32];
> static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
> + APICCommonState *s = APIC_COMMON(cpu->apic_state);
> +
> + if (!s) {
> + cpu_fprintf(f, "local apic state not available\n");
> + return;
> + }
This breaks "info registers" on 486:
$ ./x86_64-softmmu/qemu-system-x86_64 -cpu 486 -display none -monitor stdio
QEMU 2.9.90 monitor - type 'help' for more information
(qemu) info registers
local apic state not available
(qemu)
You can simply use X86CPU::apic_id. The field is set to a consistent value
even if there's no guest-visible APIC, because we use it as a VCPU identifier
internally.
However, I'm not sure "info registers" is the right place to print this info.
I think "info cpus" would be a more obvious place, but it would probably make
its output too long.
We could implement something like "info cpus -v", but: the "apic-id" info would
be redundant as soon as we replace "CPU #<cpu_index>" with "CPU #<arch_id>",
and other details like socket/core/thread could just appear on "info qtree".
> + cpu_fprintf(f, "(socket-id:%d core-id:%d thread-id:%d apic-id:%d)\n",
> + cpu->socket_id, cpu->core_id, cpu->thread_id, s->id);
>
> eflags = cpu_compute_eflags(env);
> #ifdef TARGET_X86_64
> --
> 1.8.3.1
>
>
--
Eduardo
next prev parent reply other threads:[~2017-07-26 14:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 6:18 [Qemu-devel] [PATCH v2 0/2] hmp: support querying lapic through apic-id for 'info lapic' Yi Wang
2017-07-26 6:18 ` no-reply
2017-07-26 6:18 ` [Qemu-devel] [PATCH v2 1/2] hmp: dump ids including socket-id, core-id and so on for 'info registers' Yi Wang
2017-07-26 14:01 ` Eduardo Habkost [this message]
2017-07-26 14:27 ` Igor Mammedov
2017-07-26 17:50 ` Eduardo Habkost
2017-07-27 15:12 ` Igor Mammedov
2017-07-27 16:46 ` Eduardo Habkost
2017-07-26 14:29 ` Igor Mammedov
2017-07-26 6:18 ` [Qemu-devel] [PATCH v2 2/2] hmp: allow apic-id for "info lapic" Yi Wang
2017-07-26 17:36 ` Eduardo Habkost
2017-07-26 18:53 ` [Qemu-devel] [PATCH] cpu: cpu_by_arch_id() helper Eduardo Habkost
2017-07-26 18:53 ` [Qemu-devel] [PATCH v2 2/2] hmp: allow apic-id for "info lapic" Eduardo Habkost
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=20170726140114.GF20793@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=Liu.Jianjun3@zte.com.cn \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=imammedo@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).