All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>,
	Palmer Dabbelt <palmer@sifive.com>,
	Sagar Karandikar <sagark@eecs.berkeley.edu>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>,
	Riku Voipio <riku.voipio@iki.fi>,
	qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	Michael Clark <mjc@sifive.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [PATCH 2/6] qapi: handle the riscv CpuInfoArch in query-cpus-fast
Date: Wed, 25 Apr 2018 09:48:49 +0200	[thread overview]
Message-ID: <20180425094849.3dd619d1.cohuck@redhat.com> (raw)
In-Reply-To: <87muxraips.fsf@dusky.pond.sub.org>

On Wed, 25 Apr 2018 08:44:15 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Laszlo Ersek <lersek@redhat.com> writes:
> 
> > Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used
> > in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
> > and @query-cpus-fast commands, respectively), and assigned, in both return
> > structures, the @CpuInfoRISCV sub-structure to the new enum value.
> >
> > However, qmp_query_cpus_fast() would not populate either the @arch field
> > or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
> > qmp_query_cpus() would.
> >
> > In theory, there are two ways to fix this:
> >
> > (a) Fill in both the @arch field and the @CpuInfoRISCV sub-structure in
> >     qmp_query_cpus_fast(), by copying the logic from qmp_query_cpus().
> >
> > (b) Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
> >     populate only the @arch field in qmp_query_cpus_fast().
> >
> > Approach (b) seems more robust, because:
> >
> > - clearly there has never been an attempt to get actual RISV CPU state
> >   from qmp_query_cpus_fast(), so its lack of RISCV support is not actually
> >   a problem,
> >
> > - getting CPU state without interrupting KVM looks like an exceptional
> >   thing to do (only S390X does it currently).
> >
> > Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> > Cc: Eric Blake <eblake@redhat.com>
> > Cc: Laurent Vivier <laurent@vivier.eu>
> > Cc: Markus Armbruster <armbru@redhat.com>
> > Cc: Michael Clark <mjc@sifive.com>
> > Cc: Palmer Dabbelt <palmer@sifive.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> > Cc: Richard Henderson <rth@twiddle.net>
> > Cc: Riku Voipio <riku.voipio@iki.fi>
> > Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> > Cc: qemu-stable@nongnu.org
> > Fixes: 25fa194b7b11901561532e435beb83d046899f7a
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> > ---
> >
> > Notes:
> >     PATCHv1:
> >     
> >     - new patch
> >
> >  qapi/misc.json | 2 +-
> >  cpus.c         | 2 ++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/qapi/misc.json b/qapi/misc.json
> > index 5636f4a14997..104d013adba6 100644
> > --- a/qapi/misc.json
> > +++ b/qapi/misc.json
> > @@ -565,23 +565,23 @@
> >  { 'union': 'CpuInfoFast',
> >    'base': {'cpu-index': 'int', 'qom-path': 'str',
> >             'thread-id': 'int', '*props': 'CpuInstanceProperties',
> >             'arch': 'CpuInfoArch' },
> >    'discriminator': 'arch',
> >    'data': { 'x86': 'CpuInfoOther',
> >              'sparc': 'CpuInfoOther',
> >              'ppc': 'CpuInfoOther',
> >              'mips': 'CpuInfoOther',
> >              'tricore': 'CpuInfoOther',
> >              's390': 'CpuInfoS390',
> > -            'riscv': 'CpuInfoRISCV',
> > +            'riscv': 'CpuInfoOther',
> >              'other': 'CpuInfoOther' } }  
> 
> Why do CpuInfoFast's variants match CpuInfo's for s390, but not the
> others?  Your commit message has an educated guess: "looks like an
> exceptional thing to do (only S390X does it currently)".  But why guess
> when we can ask authors of commit ce74ee3dea6?  Luiz and Victor, please
> advise.

I'm neither Luiz nor Viktor, but Laszlo's educated guess is correct. See
https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html
for some background. So yes, s390x is exceptional in that it has state
in QEMU that is actually interesting for upper layers and can be
retrieved without performance penalty.

Might make sense to refer to the above.

> 
> >  ##
> >  # @query-cpus-fast:
> >  #
> >  # Returns information about all virtual CPUs. This command does not
> >  # incur a performance penalty and should be used in production
> >  # instead of query-cpus.
> >  #
> >  # Returns: list of @CpuInfoFast
> >  #
> > diff --git a/cpus.c b/cpus.c
> > index 1a9a2edee1f2..60563a6d54ec 100644
> > --- a/cpus.c
> > +++ b/cpus.c
> > @@ -2225,22 +2225,24 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
> >  #elif defined(TARGET_SPARC)
> >          info->value->arch = CPU_INFO_ARCH_SPARC;
> >  #elif defined(TARGET_MIPS)
> >          info->value->arch = CPU_INFO_ARCH_MIPS;
> >  #elif defined(TARGET_TRICORE)
> >          info->value->arch = CPU_INFO_ARCH_TRICORE;
> >  #elif defined(TARGET_S390X)
> >          s390_cpu = S390_CPU(cpu);
> >          env = &s390_cpu->env;
> >          info->value->arch = CPU_INFO_ARCH_S390;
> >          info->value->u.s390.cpu_state = env->cpu_state;
> > +#elif defined(TARGET_RISCV)
> > +        info->value->arch = CPU_INFO_ARCH_RISCV;
> >  #else
> >          info->value->arch = CPU_INFO_ARCH_OTHER;
> >  #endif
> >          if (!cur_item) {
> >              head = cur_item = info;
> >          } else {
> >              cur_item->next = info;
> >              cur_item = info;
> >          }
> >      }  
> 

  reply	other threads:[~2018-04-25  7:49 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24 21:45 [Qemu-devel] [PATCH 0/6] qapi: introduce the SysEmuTarget enumeration Laszlo Ersek
2018-04-24 21:45 ` [Qemu-devel] [PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fast Laszlo Ersek
2018-04-24 22:30   ` Eric Blake
2018-04-25 12:30     ` Laszlo Ersek
2018-04-25  6:39   ` Markus Armbruster
2018-04-25 12:30     ` Laszlo Ersek
2018-04-25  7:28   ` Cornelia Huck
2018-04-24 21:45 ` [Qemu-devel] [PATCH 2/6] qapi: handle the riscv CpuInfoArch " Laszlo Ersek
2018-04-24 22:32   ` Eric Blake
2018-04-25 12:32     ` Laszlo Ersek
2018-04-25  6:44   ` Markus Armbruster
2018-04-25  7:48     ` Cornelia Huck [this message]
2018-04-25 12:38       ` Viktor VM Mihajlovski
2018-04-25 12:43       ` Laszlo Ersek
2018-04-24 21:45 ` [Qemu-devel] [PATCH 3/6] qapi: add SysEmuTarget to "common.json" Laszlo Ersek
2018-04-24 23:11   ` Eric Blake
2018-04-25 12:54     ` Daniel P. Berrangé
2018-04-25 19:05       ` Laszlo Ersek
2018-04-25 19:08         ` Eric Blake
2018-04-25 22:57           ` Laszlo Ersek
2018-04-24 21:45 ` [Qemu-devel] [PATCH 4/6] qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget Laszlo Ersek
2018-04-25  6:48   ` Markus Armbruster
2018-04-25 12:58     ` Laszlo Ersek
2018-04-24 21:45 ` [Qemu-devel] [PATCH 5/6] qapi: extract CpuInfoCommon to mitigate schema duplication Laszlo Ersek
2018-04-25  7:06   ` Markus Armbruster
2018-04-25 13:20     ` Laszlo Ersek
2018-04-25 17:12       ` Markus Armbruster
2018-04-25 19:12       ` Eric Blake
2018-04-25 22:56         ` Laszlo Ersek
2018-04-26  6:19           ` Markus Armbruster
2018-04-24 21:45 ` [Qemu-devel] [PATCH 6/6] qapi: discriminate CpuInfo[Fast] on SysEmuTarget, not CpuInfoArch Laszlo Ersek
2018-04-25  7:33   ` Markus Armbruster
2018-04-25 13:47     ` Laszlo Ersek
2018-04-26  6:26       ` Markus Armbruster
2018-04-26  9:18         ` Laszlo Ersek
2018-04-26 11:57           ` Markus Armbruster
2018-04-26 13:33           ` Laszlo Ersek
2018-04-26 14:34             ` Markus Armbruster
2018-04-26 14:48               ` Eric Blake
2018-04-26 15:51                 ` Markus Armbruster
2018-04-26 16:30                   ` Laszlo Ersek
2018-04-27  6:53                     ` Markus Armbruster
2018-04-27 13:46                       ` Eric Blake
2018-04-24 22:03 ` [Qemu-devel] [PATCH 0/6] qapi: introduce the SysEmuTarget enumeration no-reply
2018-04-25 12:26   ` Laszlo Ersek
2018-04-25 14:37     ` Eric Blake

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=20180425094849.3dd619d1.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=laurent@vivier.eu \
    --cc=lcapitulino@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mihajlov@linux.vnet.ibm.com \
    --cc=mjc@sifive.com \
    --cc=palmer@sifive.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=sagark@eecs.berkeley.edu \
    /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 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.