From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF1A5C3A5A8 for ; Wed, 4 Sep 2019 16:01:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A50B52339D for ; Wed, 4 Sep 2019 16:01:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="khbwTXO5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A50B52339D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LfeX0B1TamLPr/ND1klEj3VJ5Tp6Y/d4xa/aIpwKvUE=; b=khbwTXO5wd6E2P VEI6eLE5iYPb0vBK0Wg/AhSUzbI4jfNCBrnktH18ndb3Ivkux3xMx1AWi+7MNDhW1/egOVwJ3bPfs b/+PgDPqPj5Nfy4+bXtsTT+fLpPEOYOCBwK4qddhTz2qYbyJ/LLAIfbLkKzZ/edp7IPl6y7nfWTkm nlaMniww2GuAWNNphrqEePk3cZcM0XR8tUv3naoRKyWe8PCXVto4KHwA+DGUMJxl3ZgRNpK5h+i8W APLTwA4aEgwcDFBqi5f5bpWe1fF63qotstQzLj9Phb5oeNjgEGtEk6BFBYihXLQ8SPPO3BawLJQR4 H7PDx4akr7OmVLEvYG2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5Xig-0003J4-Kh; Wed, 04 Sep 2019 16:01:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i5Xid-0003IT-9P for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2019 16:01:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8F5CB28; Wed, 4 Sep 2019 09:01:14 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9042B3F246; Wed, 4 Sep 2019 09:01:12 -0700 (PDT) Subject: Re: [PATCH v4 10/10] arm64: Retrieve stolen time as paravirtualized guest To: Andrew Jones References: <20190830084255.55113-1-steven.price@arm.com> <20190830084255.55113-11-steven.price@arm.com> <20190903084703.hwpelmr7fikb32nj@kamzik.brq.redhat.com> From: Steven Price Message-ID: <329fa72e-5c92-602e-a010-2083366221d1@arm.com> Date: Wed, 4 Sep 2019 17:01:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190903084703.hwpelmr7fikb32nj@kamzik.brq.redhat.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190904_090115_419373_2D862F8D X-CRM114-Status: GOOD ( 18.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Marc Zyngier , Suzuki K Pouloze , linux-doc@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, James Morse , Julien Thierry , Catalin Marinas , Paolo Bonzini , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/09/2019 09:47, Andrew Jones wrote: > 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 >> --- >> 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 >> */ >> >> +#define pr_fmt(fmt) "kvmarm-pv: " fmt >> + >> +#include >> +#include >> #include >> +#include >> #include >> +#include >> +#include >> +#include >> +#include >> #include >> + >> #include >> +#include >> +#include >> >> 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. Good point, thanks for the pointer. Steve _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel