On Wed, 26 Jul 2017 11:01:14 -0300
Eduardo Habkost <ehabk...@redhat.com> wrote:

> 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.y...@zte.com.cn>
> > Signed-off-by: Yun Liu <liu.y...@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>",
lets do it in 'info registers' for now, it looks like obvious place to display
yet another cpu register.


> and other details like socket/core/thread could just appear on "info qtree".
cpus are not displayed in '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
> > 
> >   
> 


Reply via email to