From: Steven Price <steven.price@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
linux-doc@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Will Deacon <will@kernel.org>,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 05/10] KVM: arm64: Support stolen time reporting via shared structure
Date: Mon, 21 Oct 2019 12:24:19 +0100 [thread overview]
Message-ID: <89a8002f-a9b0-1864-a568-36285eb2c485@arm.com> (raw)
In-Reply-To: <cc639f743d621198ef02f880089bb54d@www.loen.fr>
On 21/10/2019 11:40, Marc Zyngier wrote:
> On 2019-10-21 11:21, Steven Price wrote:
>> On 19/10/2019 12:12, Marc Zyngier wrote:
>>> On Fri, 11 Oct 2019 13:59:25 +0100,
>>> Steven Price <steven.price@arm.com> wrote:
>>>>
>>>> Implement the service call for configuring a shared structure between a
>>>> VCPU and the hypervisor in which the hypervisor can write the time
>>>> stolen from the VCPU's execution time by other tasks on the host.
>>>>
>>>> User space allocates memory which is placed at an IPA also chosen by
>>>> user
>>>> space. The hypervisor then updates the shared structure using
>>>> kvm_put_guest() to ensure single copy atomicity of the 64-bit value
>>>> reporting the stolen time in nanoseconds.
>>>>
>>>> Whenever stolen time is enabled by the guest, the stolen time
>>>> counter is
>>>> reset.
>>>>
>>>> The stolen time itself is retrieved from the sched_info structure
>>>> maintained by the Linux scheduler code. We enable SCHEDSTATS when
>>>> selecting KVM Kconfig to ensure this value is meaningful.
>>>>
>>>> Signed-off-by: Steven Price <steven.price@arm.com>
>>>> ---
>>>> arch/arm/include/asm/kvm_host.h | 20 +++++++++++
>>>> arch/arm64/include/asm/kvm_host.h | 21 +++++++++++-
>>>> arch/arm64/kvm/Kconfig | 1 +
>>>> include/linux/kvm_types.h | 2 ++
>>>> virt/kvm/arm/arm.c | 11 ++++++
>>>> virt/kvm/arm/hypercalls.c | 3 ++
>>>> virt/kvm/arm/pvtime.c | 56 +++++++++++++++++++++++++++++++
>>>> 7 files changed, 113 insertions(+), 1 deletion(-)
>
> [...]
>
>>>> +long kvm_hypercall_stolen_time(struct kvm_vcpu *vcpu)
>>>
>>> Why long? If that's a base address, then it is either a phys_addr_t or
>>> a gpa_t. I'd suggest you move the error check to the caller.
>>
>> This is a bit more tricky. It's a long because that's the declared type
>> of the SMCCC return in kvm_hvc_call_handler(). I can't (easily) move the
>> code into kvm_hvc_call_handler() because that is compiled for arm (as
>> well as arm64) and we don't have the definitions for stolen time there.
>> The best option I could come up with is to have a dummy stub for arm and
>> use generic types for this function.
>>
>> This means we need a type which can contain both a gpa_t and the
>> SMCCC_RET_NOT_SUPPORTED error code.
>>
>> I'm open to alternative suggestions on how to make this work.
>
> My suggestion would be to always return a gpa_t from this function, and
> change the 32bit stub for kvm_hypercall_stolen_time() to always return
> GPA_INVALID.
Ok, fair enough. Although it ends up with this strange looking fragment
in kvm_hvc_call_handler():
case ARM_SMCCC_HV_PV_TIME_ST:
gpa = kvm_init_stolen_time(vcpu);
if (gpa != GPA_INVALID)
val = gpa;
break;
But I agree the gpa_t return type is clearer.
Thanks,
Steve
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next prev parent reply other threads:[~2019-10-21 11:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 12:59 [PATCH v6 00/10] arm64: Stolen time support Steven Price
2019-10-11 12:59 ` [PATCH v6 01/10] KVM: arm64: Document PV-time interface Steven Price
2019-10-11 12:59 ` [PATCH v6 02/10] KVM: arm/arm64: Factor out hypercall handling from PSCI code Steven Price
2019-10-11 12:59 ` [PATCH v6 03/10] KVM: arm64: Implement PV_TIME_FEATURES call Steven Price
2019-10-11 12:59 ` [PATCH v6 04/10] KVM: Implement kvm_put_guest() Steven Price
2019-10-11 12:59 ` [PATCH v6 05/10] KVM: arm64: Support stolen time reporting via shared structure Steven Price
2019-10-19 11:12 ` Marc Zyngier
2019-10-21 10:21 ` Steven Price
2019-10-21 10:40 ` Marc Zyngier
2019-10-21 11:24 ` Steven Price [this message]
2019-10-11 12:59 ` [PATCH v6 06/10] KVM: Allow kvm_device_ops to be const Steven Price
2019-10-11 12:59 ` [PATCH v6 07/10] KVM: arm64: Provide VCPU attributes for stolen time Steven Price
2019-10-19 11:28 ` Marc Zyngier
2019-10-21 11:00 ` Steven Price
2019-10-11 12:59 ` [PATCH v6 08/10] arm/arm64: Provide a wrapper for SMCCC 1.1 calls Steven Price
2019-10-21 11:42 ` Marc Zyngier
2019-10-21 13:43 ` Steven Price
2019-10-21 14:05 ` Marc Zyngier
2019-10-11 12:59 ` [PATCH v6 09/10] arm/arm64: Make use of the SMCCC 1.1 wrapper Steven Price
2019-10-11 12:59 ` [PATCH v6 10/10] arm64: Retrieve stolen time as paravirtualized guest Steven Price
2019-10-19 20:28 ` Marc Zyngier
2019-10-21 5:01 ` Jürgen Groß
2019-10-21 7:55 ` Marc Zyngier
2019-10-21 12:14 ` 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=89a8002f-a9b0-1864-a568-36285eb2c485@arm.com \
--to=steven.price@arm.com \
--cc=catalin.marinas@arm.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=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=will@kernel.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).