qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: bijan.mottahedeh@oracle.com, Marc Zyngier <maz@kernel.org>,
	Richard Henderson <richard.henderson@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>, Heyi Guo <guoheyi@huawei.com>,
	msys.mizuma@gmail.com
Subject: Re: [RFC PATCH v2 5/5] target/arm/cpu: Add the kvm-no-adjvtime CPU property
Date: Mon, 16 Dec 2019 17:52:49 +0100	[thread overview]
Message-ID: <20191216165249.lygksiptf2yowqh7@kamzik.brq.redhat.com> (raw)
In-Reply-To: <CAFEAcA8=FcrT8dRMDzxu14J-gv5LEDuNBNpD5yo9j3waV7u8iw@mail.gmail.com>

On Mon, Dec 16, 2019 at 03:06:57PM +0000, Peter Maydell wrote:
> On Thu, 12 Dec 2019 at 17:33, Andrew Jones <drjones@redhat.com> wrote:
> >
> > kvm-no-adjvtime is a KVM specific CPU property and a first of its kind.
> > To accommodate it we also add kvm_arm_add_vcpu_properties() and a
> > KVM specific CPU properties description to the CPU features document.
> >
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  docs/arm-cpu-features.rst | 31 ++++++++++++++++++++++++++++++-
> >  hw/arm/virt.c             |  8 ++++++++
> >  include/hw/arm/virt.h     |  1 +
> >  target/arm/cpu.c          |  2 ++
> >  target/arm/cpu64.c        |  1 +
> >  target/arm/kvm.c          | 28 ++++++++++++++++++++++++++++
> >  target/arm/kvm_arm.h      | 11 +++++++++++
> >  target/arm/monitor.c      |  1 +
> >  tests/arm-cpu-features.c  |  4 ++++
> >  9 files changed, 86 insertions(+), 1 deletion(-)
> >
> > diff --git a/docs/arm-cpu-features.rst b/docs/arm-cpu-features.rst
> > index 1b367e22e16e..641ec9cb8f4a 100644
> > --- a/docs/arm-cpu-features.rst
> > +++ b/docs/arm-cpu-features.rst
> > @@ -31,7 +31,9 @@ supporting the feature or only supporting the feature under certain
> >  configurations.  For example, the `aarch64` CPU feature, which, when
> >  disabled, enables the optional AArch32 CPU feature, is only supported
> >  when using the KVM accelerator and when running on a host CPU type that
> > -supports the feature.
> > +supports the feature.  While `aarch64` currently only works with KVM,
> > +it could work with TCG.  CPU features that are specific to KVM are
> > +prefixed with "kvm-" and are described in "KVM VCPU Features".
> >
> >  CPU Feature Probing
> >  ===================
> > @@ -171,6 +173,33 @@ disabling many SVE vector lengths would be quite verbose, the `sve<N>` CPU
> >  properties have special semantics (see "SVE CPU Property Parsing
> >  Semantics").
> >
> > +KVM VCPU Features
> > +=================
> > +
> > +KVM VCPU features are CPU features that are specific to KVM, such as
> > +paravirt features or features that enable CPU virtualization extensions.
> > +The features' CPU properties are only available when KVM is enabled and
> > +are named with the prefix "kvm-".  KVM VCPU features may be probed,
> > +enabled, and disabled in the same way as other CPU features.  Below is the
> > +list of KVM VCPU features and their descriptions.
> > +
> > +  kvm-no-adjvtime          When disabled, each time the VM transitions
> > +                           back to running state from the paused state the
> > +                           VCPU's vitual counter is updated to ensure the
> 
> "virtual"
> 
> > +                           stopped time is not counted.  This avoids time
> > +                           jumps surprising guest OSes and applications,
> > +                           as long as they use the virtual counter for
> > +                           timekeeping, but has the side effect of the
> > +                           virtual and physical counters diverging.  All
> > +                           timekeeping based on the virtual counter will
> > +                           appear to lag behind any timekeeping that does
> > +                           not subtract VM stopped time.  The guest may
> > +                           resynchronize its virtual counter with other
> > +                           time sources as needed.  Enabling this KVM VCPU
> > +                           feature provides the legacy behavior, which is
> > +                           to also count stopped time with the virtual
> > +                           counter.
> 
> This phrasing reads a bit confusingly to me. What I would usually expect
> is that you get
>   name-of-option              Description of what the option does.
> 
> But here we have
>   name-of-option              Long description of the default behaviour,
>                               taking many lines and several sentences.
>                               Brief note at the end that enabling this
>                               feature gives the opposite effect.
> 
> Especially since the default-behaviour description isn't prefaced
> with "By default" or similar, it's quite easy to start reading the
> text assuming it's defining what the option is going to do, only
> to get to the end and realise that it's defining what the option
> is *not* going to do...

I'll take another stab at this, but my feeling is that a '-no-' option
should be one that just turns off the default behavior, which is why I
wrote a long description of the default behavior. If you'd prefer the
description to be more terse, then I can certainly delete a bunch of
the text, but then I fear what this option disables wouldn't be clear
enough.

> 
> Incidentally, if I understand things correctly, for TCG the
> behaviour is (and has always been) that VM-stopped time is
> not counted, because we run the emulated versions of these counters
> off QEMU_CLOCK_VIRTUAL. So having the KVM default be the same as
> the TCG default is nicely consistent.

Thanks,
drew



  reply	other threads:[~2019-12-16 17:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 17:33 [RFC PATCH v2 0/5] target/arm/kvm: Adjust virtual time Andrew Jones
2019-12-12 17:33 ` [RFC PATCH v2 1/5] hw: add compat machines for 5.0 Andrew Jones
2019-12-12 18:27   ` David Hildenbrand
2019-12-12 19:24   ` Eduardo Habkost
2019-12-13  7:10     ` Andrew Jones
2019-12-13  5:00   ` David Gibson
2019-12-12 17:33 ` [RFC PATCH v2 2/5] target/arm/kvm64: kvm64 cpus have timer registers Andrew Jones
2019-12-12 17:33 ` [RFC PATCH v2 3/5] target/arm/kvm: Implement virtual time adjustment Andrew Jones
2019-12-16 15:14   ` Peter Maydell
2019-12-16 15:40     ` Peter Maydell
2019-12-16 16:43       ` Andrew Jones
2019-12-16 18:06         ` Peter Maydell
2019-12-19 14:30           ` Andrew Jones
2020-01-20  9:40             ` Andrew Jones
2019-12-16 16:36     ` Andrew Jones
2019-12-12 17:33 ` [RFC PATCH v2 4/5] tests/arm-cpu-features: Check feature default values Andrew Jones
2019-12-12 17:33 ` [RFC PATCH v2 5/5] target/arm/cpu: Add the kvm-no-adjvtime CPU property Andrew Jones
2019-12-16 15:06   ` Peter Maydell
2019-12-16 16:52     ` Andrew Jones [this message]
2019-12-16 16:57       ` Peter Maydell
2020-01-20 10:31     ` Andrew Jones
2020-02-06 12:08   ` Philippe Mathieu-Daudé
2020-02-06 12:40     ` Andrew Jones
2020-02-06 22:46       ` Philippe Mathieu-Daudé
2020-02-07  7:37         ` Andrew Jones
2019-12-16 15:33 ` [RFC PATCH v2 0/5] target/arm/kvm: Adjust virtual time Peter Maydell
2019-12-16 15:44   ` Peter Maydell
2020-01-20 13:45     ` Andrew Jones
2019-12-16 16:18   ` Marc Zyngier
2019-12-16 16:59     ` Andrew Jones
2019-12-16 17:05       ` Marc Zyngier

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=20191216165249.lygksiptf2yowqh7@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=bijan.mottahedeh@oracle.com \
    --cc=guoheyi@huawei.com \
    --cc=maz@kernel.org \
    --cc=msys.mizuma@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).