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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no 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 CEAC9C433E1 for ; Mon, 17 Aug 2020 08:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1DD020758 for ; Mon, 17 Aug 2020 08:41:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727805AbgHQIle (ORCPT ); Mon, 17 Aug 2020 04:41:34 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:45200 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726361AbgHQIl2 (ORCPT ); Mon, 17 Aug 2020 04:41:28 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 724AC236C0FF1FBF5E6D; Mon, 17 Aug 2020 16:41:22 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 17 Aug 2020 16:41:12 +0800 From: Keqian Zhu To: , , , CC: Marc Zyngier , Steven Price , Catalin Marinas , Will Deacon , James Morse , Suzuki K Poulose , , Keqian Zhu Subject: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support Date: Mon, 17 Aug 2020 16:41:05 +0800 Message-ID: <20200817084110.2672-1-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.22] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This patch series picks up the LPT pvtime feature originally developed by Steven Price: https://patchwork.kernel.org/cover/10726499/ Backgroud: There is demand for cross-platform migration, which means we have to solve different CPU features and arch counter frequency between hosts. This patch series can solve the latter problem. About LPT: This implements support for Live Physical Time (LPT) which provides the guest with a method to derive a stable counter of time during which the guest is executing even when the guest is being migrated between hosts with different physical counter frequencies. Changes on Steven Price's work: 1. LPT structure: use symmatical semantics of scale multiplier, and use fraction bits instead of "shift" to make everything clear. 2. Structure allocation: host kernel does not allocates the LPT structure, instead it is allocated by userspace through VM attributes. The save/restore functionality can be removed. 3. Since LPT structure just need update once for each guest run, add a flag to indicate the update status. This has two benifits: 1) avoid multiple update by each vCPUs. 2) If the update flag is not set, then return NOT SUPPORT for coressponding guest HVC call. 4. Add VM device attributes interface for userspace configuration. 5. Add a base LPT read/write layer to reduce code. 6. Support ptimer scaling. 7. Support timer event stream translation. Things need concern: 1. https://developer.arm.com/docs/den0057/a needs update. 2. If a guest fails to initialize and use LPT, when it migrates to a host with different native frequency, it will see the virtual counter jump. However this concern is not a problem. 1) Guest does not support LPT or host does not enable LPT: we won't migrate guest to a host with different frequency. 2) Guest kernel faces problem when initilize LPT: guest can not boot up, so counter jump is not a problem at this situation. Patch 2 and 3 implement host KVM part. Patch 4 and 5 implement guest driver part. Keqian Zhu (5): KVM: arm64: Document pvtime LPT interface KVM: arm64: Support Live Physical Time reporting KVM: arm64: Provide VM device attributes for LPT time clocksource: arm_arch_timer: Add pvtime LPT initialization clocksource: arm_arch_timer: Use pvtime LPT Documentation/virt/kvm/arm/pvtime.rst | 78 +++++++++++-- Documentation/virt/kvm/devices/vm.rst | 30 +++++ arch/arm64/include/asm/arch_timer.h | 179 ++++++++++++++++++++++++++-- arch/arm64/include/asm/kvm_host.h | 14 +++ arch/arm64/include/uapi/asm/kvm.h | 5 + arch/arm64/kvm/arm.c | 71 ++++++++++++ arch/arm64/kvm/hypercalls.c | 5 + arch/arm64/kvm/pvtime.c | 212 +++++++++++++++++++++++++++++++++- drivers/clocksource/arm_arch_timer.c | 120 +++++++++++++++---- 9 files changed, 669 insertions(+), 45 deletions(-) -- 1.8.3.1 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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no 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 19E71C433DF for ; Mon, 17 Aug 2020 08:41:37 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id C77B72072D for ; Mon, 17 Aug 2020 08:41:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C77B72072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7D66B4BF7D; Mon, 17 Aug 2020 04:41:36 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i9ZLCkEvH++S; Mon, 17 Aug 2020 04:41:35 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7360B4BF7A; Mon, 17 Aug 2020 04:41:33 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3C4804BF91 for ; Mon, 17 Aug 2020 04:41:30 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9LItYpOiU9g0 for ; Mon, 17 Aug 2020 04:41:29 -0400 (EDT) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 1A6D44BF6E for ; Mon, 17 Aug 2020 04:41:29 -0400 (EDT) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 724AC236C0FF1FBF5E6D; Mon, 17 Aug 2020 16:41:22 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 17 Aug 2020 16:41:12 +0800 From: Keqian Zhu To: , , , Subject: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support Date: Mon, 17 Aug 2020 16:41:05 +0800 Message-ID: <20200817084110.2672-1-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.187.22] X-CFilter-Loop: Reflected Cc: Marc Zyngier , Steven Price , Catalin Marinas , Will Deacon X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi all, This patch series picks up the LPT pvtime feature originally developed by Steven Price: https://patchwork.kernel.org/cover/10726499/ Backgroud: There is demand for cross-platform migration, which means we have to solve different CPU features and arch counter frequency between hosts. This patch series can solve the latter problem. About LPT: This implements support for Live Physical Time (LPT) which provides the guest with a method to derive a stable counter of time during which the guest is executing even when the guest is being migrated between hosts with different physical counter frequencies. Changes on Steven Price's work: 1. LPT structure: use symmatical semantics of scale multiplier, and use fraction bits instead of "shift" to make everything clear. 2. Structure allocation: host kernel does not allocates the LPT structure, instead it is allocated by userspace through VM attributes. The save/restore functionality can be removed. 3. Since LPT structure just need update once for each guest run, add a flag to indicate the update status. This has two benifits: 1) avoid multiple update by each vCPUs. 2) If the update flag is not set, then return NOT SUPPORT for coressponding guest HVC call. 4. Add VM device attributes interface for userspace configuration. 5. Add a base LPT read/write layer to reduce code. 6. Support ptimer scaling. 7. Support timer event stream translation. Things need concern: 1. https://developer.arm.com/docs/den0057/a needs update. 2. If a guest fails to initialize and use LPT, when it migrates to a host with different native frequency, it will see the virtual counter jump. However this concern is not a problem. 1) Guest does not support LPT or host does not enable LPT: we won't migrate guest to a host with different frequency. 2) Guest kernel faces problem when initilize LPT: guest can not boot up, so counter jump is not a problem at this situation. Patch 2 and 3 implement host KVM part. Patch 4 and 5 implement guest driver part. Keqian Zhu (5): KVM: arm64: Document pvtime LPT interface KVM: arm64: Support Live Physical Time reporting KVM: arm64: Provide VM device attributes for LPT time clocksource: arm_arch_timer: Add pvtime LPT initialization clocksource: arm_arch_timer: Use pvtime LPT Documentation/virt/kvm/arm/pvtime.rst | 78 +++++++++++-- Documentation/virt/kvm/devices/vm.rst | 30 +++++ arch/arm64/include/asm/arch_timer.h | 179 ++++++++++++++++++++++++++-- arch/arm64/include/asm/kvm_host.h | 14 +++ arch/arm64/include/uapi/asm/kvm.h | 5 + arch/arm64/kvm/arm.c | 71 ++++++++++++ arch/arm64/kvm/hypercalls.c | 5 + arch/arm64/kvm/pvtime.c | 212 +++++++++++++++++++++++++++++++++- drivers/clocksource/arm_arch_timer.c | 120 +++++++++++++++---- 9 files changed, 669 insertions(+), 45 deletions(-) -- 1.8.3.1 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no 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 E3B52C433DF for ; Mon, 17 Aug 2020 09:13:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B11862063A for ; Mon, 17 Aug 2020 09:13:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vG9vobyp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B11862063A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=eIJUvOq2+Jsw7FpKFK7R2N3fCBMvc//FyLe0owaIavs=; b=vG9vobyp+1ryExMrAGs0wlIvXJ OQRtpH4n/CBSJplD5lp2FZFMK3wx/qKlRyc6Q/FDJa3vzzcaVBsB4VmwEMCCvszt6aukx1cSdfej4 idPZCUMboNu32fGkNc3qdne1H/c65jyqiitrlv4SeG/aQDbJR588EmezrSdY370zDFOFFpXEQr2q4 pcvFn3HlOxrByp4XzOQ/KBTv9CqkT+y1/JLiM1IsqGwSYmp1fSZ09SwykIDW1A3U3YPL1JxwHMVUO /nff1Jvr0m8Jefpajx1Kh/RHu6j7juujfv9kWaYQqK9MU0AAJ38mriOjPGK/bVjRjx3e6yB9cHgHB KPN6YbdQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7bAf-0000vs-9Q; Mon, 17 Aug 2020 09:11:13 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7aht-0002CL-LW for linux-arm-kernel@lists.infradead.org; Mon, 17 Aug 2020 08:41:35 +0000 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 724AC236C0FF1FBF5E6D; Mon, 17 Aug 2020 16:41:22 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 17 Aug 2020 16:41:12 +0800 From: Keqian Zhu To: , , , Subject: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support Date: Mon, 17 Aug 2020 16:41:05 +0800 Message-ID: <20200817084110.2672-1-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.187.22] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200817_044130_084821_CE6A9461 X-CRM114-Status: GOOD ( 13.21 ) 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: Suzuki K Poulose , Marc Zyngier , Keqian Zhu , Steven Price , James Morse , Catalin Marinas , wanghaibin.wang@huawei.com, Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, This patch series picks up the LPT pvtime feature originally developed by Steven Price: https://patchwork.kernel.org/cover/10726499/ Backgroud: There is demand for cross-platform migration, which means we have to solve different CPU features and arch counter frequency between hosts. This patch series can solve the latter problem. About LPT: This implements support for Live Physical Time (LPT) which provides the guest with a method to derive a stable counter of time during which the guest is executing even when the guest is being migrated between hosts with different physical counter frequencies. Changes on Steven Price's work: 1. LPT structure: use symmatical semantics of scale multiplier, and use fraction bits instead of "shift" to make everything clear. 2. Structure allocation: host kernel does not allocates the LPT structure, instead it is allocated by userspace through VM attributes. The save/restore functionality can be removed. 3. Since LPT structure just need update once for each guest run, add a flag to indicate the update status. This has two benifits: 1) avoid multiple update by each vCPUs. 2) If the update flag is not set, then return NOT SUPPORT for coressponding guest HVC call. 4. Add VM device attributes interface for userspace configuration. 5. Add a base LPT read/write layer to reduce code. 6. Support ptimer scaling. 7. Support timer event stream translation. Things need concern: 1. https://developer.arm.com/docs/den0057/a needs update. 2. If a guest fails to initialize and use LPT, when it migrates to a host with different native frequency, it will see the virtual counter jump. However this concern is not a problem. 1) Guest does not support LPT or host does not enable LPT: we won't migrate guest to a host with different frequency. 2) Guest kernel faces problem when initilize LPT: guest can not boot up, so counter jump is not a problem at this situation. Patch 2 and 3 implement host KVM part. Patch 4 and 5 implement guest driver part. Keqian Zhu (5): KVM: arm64: Document pvtime LPT interface KVM: arm64: Support Live Physical Time reporting KVM: arm64: Provide VM device attributes for LPT time clocksource: arm_arch_timer: Add pvtime LPT initialization clocksource: arm_arch_timer: Use pvtime LPT Documentation/virt/kvm/arm/pvtime.rst | 78 +++++++++++-- Documentation/virt/kvm/devices/vm.rst | 30 +++++ arch/arm64/include/asm/arch_timer.h | 179 ++++++++++++++++++++++++++-- arch/arm64/include/asm/kvm_host.h | 14 +++ arch/arm64/include/uapi/asm/kvm.h | 5 + arch/arm64/kvm/arm.c | 71 ++++++++++++ arch/arm64/kvm/hypercalls.c | 5 + arch/arm64/kvm/pvtime.c | 212 +++++++++++++++++++++++++++++++++- drivers/clocksource/arm_arch_timer.c | 120 +++++++++++++++---- 9 files changed, 669 insertions(+), 45 deletions(-) -- 1.8.3.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel