mbox series

[v3,0/5] hw/arm/virt: Introduce kvm-steal-time

Message ID 20200916092620.19161-1-drjones@redhat.com
Headers show
Series hw/arm/virt: Introduce kvm-steal-time | expand

Message

Andrew Jones Sept. 16, 2020, 9:26 a.m. UTC
Previous posting:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg727588.html

v3:
  - Rebased: 5.2 machine type and kvm32 drop now included
  - Switched to using new KVM cap that has been merged upstream
  - Picked up some r-b's and some of Eric's comments from v2

KVM supports the ability to publish the amount of time that VCPUs
were runnable, but not running due to other host threads running
instead, to the guest. The guest scheduler may use that information
when making decisions and the guest may expose it to its userspace
(Linux publishes this information in /proc/stat). This feature is
called "steal time" as it represents the amount of time stolen from
a guest by scheduling out its VCPUs. To enable this feature KVM
userspace must provide a memory region that will be used to publish
the information to the guest. The memory region is typical migratable
region. The GPA of the region is given to KVM through a VCPU device
ioctl interface. This feature is only available for 64-bit guests
per the Arm PVTIME specification (DEN0057A).

This series provides the QEMU support of this feature. It will
be enabled by default for 5.2 machine types and later, but may
be disabled with a new CPU property "kvm-steal-time".

Thanks,
drew


Andrew Jones (5):
  target/arm/kvm: Make uncalled stubs explicitly unreachable
  hw/arm/virt: Move post cpu realize check into its own function
  hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init
  DO NOT MERGE: HACK: Add steal time KVM cap to kvm.h
  hw/arm/virt: Implement kvm-steal-time

 docs/system/arm/cpu-features.rst |  11 ++++
 hw/arm/virt.c                    | 110 ++++++++++++++++++++++---------
 include/hw/arm/virt.h            |   5 ++
 linux-headers/linux/kvm.h        |   1 +
 target/arm/cpu.c                 |   8 +++
 target/arm/cpu.h                 |   4 ++
 target/arm/kvm.c                 |  16 +++++
 target/arm/kvm64.c               |  64 ++++++++++++++++--
 target/arm/kvm_arm.h             |  94 ++++++++++++++++++++------
 target/arm/monitor.c             |   2 +-
 tests/qtest/arm-cpu-features.c   |  25 +++++--
 11 files changed, 281 insertions(+), 59 deletions(-)

Comments

Andrew Jones Sept. 29, 2020, 2:47 p.m. UTC | #1
Hi Peter, Eric, and other interested parties,

Here's a gentle ping for reviewers.

Thanks,
drew

On Wed, Sep 16, 2020 at 11:26:15AM +0200, Andrew Jones wrote:
> Previous posting:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg727588.html
> 
> v3:
>   - Rebased: 5.2 machine type and kvm32 drop now included
>   - Switched to using new KVM cap that has been merged upstream
>   - Picked up some r-b's and some of Eric's comments from v2
> 
> KVM supports the ability to publish the amount of time that VCPUs
> were runnable, but not running due to other host threads running
> instead, to the guest. The guest scheduler may use that information
> when making decisions and the guest may expose it to its userspace
> (Linux publishes this information in /proc/stat). This feature is
> called "steal time" as it represents the amount of time stolen from
> a guest by scheduling out its VCPUs. To enable this feature KVM
> userspace must provide a memory region that will be used to publish
> the information to the guest. The memory region is typical migratable
> region. The GPA of the region is given to KVM through a VCPU device
> ioctl interface. This feature is only available for 64-bit guests
> per the Arm PVTIME specification (DEN0057A).
> 
> This series provides the QEMU support of this feature. It will
> be enabled by default for 5.2 machine types and later, but may
> be disabled with a new CPU property "kvm-steal-time".
> 
> Thanks,
> drew
> 
> 
> Andrew Jones (5):
>   target/arm/kvm: Make uncalled stubs explicitly unreachable
>   hw/arm/virt: Move post cpu realize check into its own function
>   hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init
>   DO NOT MERGE: HACK: Add steal time KVM cap to kvm.h
>   hw/arm/virt: Implement kvm-steal-time
> 
>  docs/system/arm/cpu-features.rst |  11 ++++
>  hw/arm/virt.c                    | 110 ++++++++++++++++++++++---------
>  include/hw/arm/virt.h            |   5 ++
>  linux-headers/linux/kvm.h        |   1 +
>  target/arm/cpu.c                 |   8 +++
>  target/arm/cpu.h                 |   4 ++
>  target/arm/kvm.c                 |  16 +++++
>  target/arm/kvm64.c               |  64 ++++++++++++++++--
>  target/arm/kvm_arm.h             |  94 ++++++++++++++++++++------
>  target/arm/monitor.c             |   2 +-
>  tests/qtest/arm-cpu-features.c   |  25 +++++--
>  11 files changed, 281 insertions(+), 59 deletions(-)
> 
> -- 
> 2.26.2
>
Andrew Jones Sept. 30, 2020, 11:26 a.m. UTC | #2
On Tue, Sep 29, 2020 at 04:47:33PM +0200, Andrew Jones wrote:
> 
> Hi Peter, Eric, and other interested parties,
> 
> Here's a gentle ping for reviewers.

Thanks for the review Eric! I'll send a Linux header update patch and a
rebase of this series with R-b's.

drew

> 
> Thanks,
> drew
> 
> On Wed, Sep 16, 2020 at 11:26:15AM +0200, Andrew Jones wrote:
> > Previous posting:
> > https://www.mail-archive.com/qemu-devel@nongnu.org/msg727588.html
> > 
> > v3:
> >   - Rebased: 5.2 machine type and kvm32 drop now included
> >   - Switched to using new KVM cap that has been merged upstream
> >   - Picked up some r-b's and some of Eric's comments from v2
> > 
> > KVM supports the ability to publish the amount of time that VCPUs
> > were runnable, but not running due to other host threads running
> > instead, to the guest. The guest scheduler may use that information
> > when making decisions and the guest may expose it to its userspace
> > (Linux publishes this information in /proc/stat). This feature is
> > called "steal time" as it represents the amount of time stolen from
> > a guest by scheduling out its VCPUs. To enable this feature KVM
> > userspace must provide a memory region that will be used to publish
> > the information to the guest. The memory region is typical migratable
> > region. The GPA of the region is given to KVM through a VCPU device
> > ioctl interface. This feature is only available for 64-bit guests
> > per the Arm PVTIME specification (DEN0057A).
> > 
> > This series provides the QEMU support of this feature. It will
> > be enabled by default for 5.2 machine types and later, but may
> > be disabled with a new CPU property "kvm-steal-time".
> > 
> > Thanks,
> > drew
> > 
> > 
> > Andrew Jones (5):
> >   target/arm/kvm: Make uncalled stubs explicitly unreachable
> >   hw/arm/virt: Move post cpu realize check into its own function
> >   hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init
> >   DO NOT MERGE: HACK: Add steal time KVM cap to kvm.h
> >   hw/arm/virt: Implement kvm-steal-time
> > 
> >  docs/system/arm/cpu-features.rst |  11 ++++
> >  hw/arm/virt.c                    | 110 ++++++++++++++++++++++---------
> >  include/hw/arm/virt.h            |   5 ++
> >  linux-headers/linux/kvm.h        |   1 +
> >  target/arm/cpu.c                 |   8 +++
> >  target/arm/cpu.h                 |   4 ++
> >  target/arm/kvm.c                 |  16 +++++
> >  target/arm/kvm64.c               |  64 ++++++++++++++++--
> >  target/arm/kvm_arm.h             |  94 ++++++++++++++++++++------
> >  target/arm/monitor.c             |   2 +-
> >  tests/qtest/arm-cpu-features.c   |  25 +++++--
> >  11 files changed, 281 insertions(+), 59 deletions(-)
> > 
> > -- 
> > 2.26.2
> > 
> 
>