kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Steven Price <steven.price@arm.com>
Cc: "Marc Zyngier" <maz@kernel.org>, "Will Deacon" <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"James Morse" <james.morse@arm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Pouloze" <suzuki.poulose@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 10/10] arm64: Retrieve stolen time as paravirtualized guest
Date: Tue, 3 Sep 2019 10:47:03 +0200	[thread overview]
Message-ID: <20190903084703.hwpelmr7fikb32nj@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20190830084255.55113-11-steven.price@arm.com>

On Fri, Aug 30, 2019 at 09:42:55AM +0100, Steven Price wrote:
> Enable paravirtualization features when running under a hypervisor
> supporting the PV_TIME_ST hypercall.
> 
> For each (v)CPU, we ask the hypervisor for the location of a shared
> page which the hypervisor will use to report stolen time to us. We set
> pv_time_ops to the stolen time function which simply reads the stolen
> value from the shared page for a VCPU. We guarantee single-copy
> atomicity using READ_ONCE which means we can also read the stolen
> time for another VCPU than the currently running one while it is
> potentially being updated by the hypervisor.
> 
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
>  arch/arm64/include/asm/paravirt.h |   9 +-
>  arch/arm64/kernel/paravirt.c      | 148 ++++++++++++++++++++++++++++++
>  arch/arm64/kernel/time.c          |   3 +
>  include/linux/cpuhotplug.h        |   1 +
>  4 files changed, 160 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/paravirt.h b/arch/arm64/include/asm/paravirt.h
> index 799d9dd6f7cc..125c26c42902 100644
> --- a/arch/arm64/include/asm/paravirt.h
> +++ b/arch/arm64/include/asm/paravirt.h
> @@ -21,6 +21,13 @@ static inline u64 paravirt_steal_clock(int cpu)
>  {
>  	return pv_ops.time.steal_clock(cpu);
>  }
> -#endif
> +
> +int __init kvm_guest_init(void);
> +
> +#else
> +
> +#define kvm_guest_init()
> +
> +#endif // CONFIG_PARAVIRT
>  
>  #endif
> diff --git a/arch/arm64/kernel/paravirt.c b/arch/arm64/kernel/paravirt.c
> index 4cfed91fe256..5bf3be7ccf7e 100644
> --- a/arch/arm64/kernel/paravirt.c
> +++ b/arch/arm64/kernel/paravirt.c
> @@ -6,13 +6,161 @@
>   * Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>   */
>  
> +#define pr_fmt(fmt) "kvmarm-pv: " fmt
> +
> +#include <linux/arm-smccc.h>
> +#include <linux/cpuhotplug.h>
>  #include <linux/export.h>
> +#include <linux/io.h>
>  #include <linux/jump_label.h>
> +#include <linux/printk.h>
> +#include <linux/psci.h>
> +#include <linux/reboot.h>
> +#include <linux/slab.h>
>  #include <linux/types.h>
> +
>  #include <asm/paravirt.h>
> +#include <asm/pvclock-abi.h>
> +#include <asm/smp_plat.h>
>  
>  struct static_key paravirt_steal_enabled;
>  struct static_key paravirt_steal_rq_enabled;
>  
>  struct paravirt_patch_template pv_ops;
>  EXPORT_SYMBOL_GPL(pv_ops);
> +
> +struct kvmarm_stolen_time_region {
> +	struct pvclock_vcpu_stolen_time *kaddr;
> +};
> +
> +static DEFINE_PER_CPU(struct kvmarm_stolen_time_region, stolen_time_region);
> +
> +static bool steal_acc = true;
> +static int __init parse_no_stealacc(char *arg)
> +{
> +	steal_acc = false;
> +	return 0;
> +}
> +
> +early_param("no-steal-acc", parse_no_stealacc);

Need to also add an 'ARM64' to the
Documentation/admin-guide/kernel-parameters.txt entry for this.

Thanks,
drew

  reply	other threads:[~2019-09-03  8:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  8:42 [PATCH v4 00/10] arm64: Stolen time support Steven Price
2019-08-30  8:42 ` [PATCH v4 01/10] KVM: arm64: Document PV-time interface Steven Price
2019-08-30 14:47   ` Andrew Jones
2019-08-30 15:25     ` Steven Price
2019-09-02 12:52       ` Andrew Jones
2019-09-04 13:55         ` Steven Price
2019-09-04 14:22           ` Andrew Jones
2019-09-04 15:07             ` Steven Price
2019-08-30  8:42 ` [PATCH v4 02/10] KVM: arm/arm64: Factor out hypercall handling from PSCI code Steven Price
2019-09-02  7:06   ` kbuild test robot
2019-09-04 15:05     ` Steven Price
2019-09-02 13:07   ` kbuild test robot
2019-08-30  8:42 ` [PATCH v4 03/10] KVM: arm64: Implement PV_FEATURES call Steven Price
2019-08-30  8:42 ` [PATCH v4 04/10] KVM: Implement kvm_put_guest() Steven Price
2019-08-30  8:42 ` [PATCH v4 05/10] KVM: arm64: Support stolen time reporting via shared structure Steven Price
2019-08-30  9:42   ` Christoffer Dall
2019-08-30  9:52     ` Steven Price
2019-09-03  9:14   ` Zenghui Yu
2019-09-04 15:53     ` Steven Price
2019-08-30  8:42 ` [PATCH v4 06/10] KVM: Allow kvm_device_ops to be const Steven Price
2019-08-30  8:42 ` [PATCH v4 07/10] KVM: arm64: Provide VCPU attributes for stolen time Steven Price
2019-08-30 10:02   ` Marc Zyngier
2019-08-30 15:04     ` Steven Price
2019-08-30  8:42 ` [PATCH v4 08/10] arm/arm64: Provide a wrapper for SMCCC 1.1 calls Steven Price
2019-08-30  8:42 ` [PATCH v4 09/10] arm/arm64: Make use of the SMCCC 1.1 wrapper Steven Price
2019-08-30  8:42 ` [PATCH v4 10/10] arm64: Retrieve stolen time as paravirtualized guest Steven Price
2019-09-03  8:47   ` Andrew Jones [this message]
2019-09-04 16:01     ` Steven Price
2019-09-03  8:03 ` [PATCH v4 00/10] arm64: Stolen time support Andrew Jones
2019-09-03  8:49   ` Andrew Jones
2019-09-04 16:02     ` Steven Price

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=20190903084703.hwpelmr7fikb32nj@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --subject='Re: [PATCH v4 10/10] arm64: Retrieve stolen time as paravirtualized guest' \
    /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

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).