All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhukeqian <zhukeqian1@huawei.com>
To: Steven Price <steven.price@arm.com>, Marc Zyngier <maz@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<kvmarm@lists.cs.columbia.edu>, <kvm@vger.kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	<wanghaibin.wang@huawei.com>, <xiexiangyou@huawei.com>,
	<yebiaoxiang@huawei.com>
Subject: Re: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support
Date: Fri, 21 Aug 2020 11:54:22 +0800	[thread overview]
Message-ID: <177a273d-3312-ec33-de0c-fd38b49f153b@huawei.com> (raw)
In-Reply-To: <f14cfd5b-c103-5d56-82fb-59d0371c6f21@arm.com>



On 2020/8/19 16:54, Steven Price wrote:
> On 18/08/2020 15:41, Marc Zyngier wrote:
>> On 2020-08-17 09:41, Keqian Zhu wrote:
>>> 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.
>>
>> LPT was explicitly removed from the spec because it doesn't really
>> solve the problem, specially for the firmware: EFI knows
>> nothing about this, for example. How is it going to work?
>> Also, nobody was ever able to explain how this would work for
>> nested virt.
>>
>> ARMv8.4 and ARMv8.6 have the feature set that is required to solve
>> this problem without adding more PV to the kernel.
> 
> Hi Marc,
> 
> These are good points, however we do still have the situation that CPUs that don't have ARMv8.4/8.6 clearly cannot implement this. I presume the use-case Keqian is looking at predates the necessary support in the CPU - Keqian if you can provide more details on the architecture(s) involved that would be helpful.
> 
> Nested virt is indeed more of an issue - we did have some ideas around using SDEI that never made it to the spec. However I would argue that the most pragmatic approach would be to not support the combination of nested virt and LPT. Hopefully that can wait until the counter scaling support is available and not require PV.
> 
> We are discussing (re-)releasing the spec with the LPT parts added. If you have fundamental objections then please me know.
> 
> Thanks,
> 
> Steve
> .
> 
Hi Marc and Steven,

In fact, I have realize a demo which utilize v8.6-ECV to present a constant timer freq to guest. It seems
work well, but this approach has some shortcoming:

1. Guest access to cntvct cntv_ctl cntv_tval cntv_cval must trap to EL2. Every trap will take about
   hundreds of nano-seconds. For every timer interrupt, there is about 5~6 traps, so it will spend
   several us (this seems not a serious problem :-) ). But trap will cause big deviation for nano-sleep.
2. We have to make cntfrq be a context of guest. However, only the highest exception level has right to
   modify cntfrq. It means we have to add a new SMC call.
3. cntkctl controls event stream freq, so KVM should also translate the guest access of cntkctl. However
   we cannot trap guest access of that. Any solution for this problem?

I think LPT as a software solution can solve these problems. However, as Marc said, UEFI knows nothing about
LPT, and it will access vtimer/counter directly. The key point is how serious the impact is on UEFI.

I can see that some UEFI runtime services and drivers/applications will access timer/counter.
For runtime services, it is OK. Because we can translate the result which return from UEFI for Linux.
For drivers/applications, they will feel time goes faster or slower after migration. This is a problem indeed :-)

Thanks,
Keqian

WARNING: multiple messages have this Message-ID (diff)
From: zhukeqian <zhukeqian1@huawei.com>
To: Steven Price <steven.price@arm.com>, Marc Zyngier <maz@kernel.org>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org, yebiaoxiang@huawei.com,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support
Date: Fri, 21 Aug 2020 11:54:22 +0800	[thread overview]
Message-ID: <177a273d-3312-ec33-de0c-fd38b49f153b@huawei.com> (raw)
In-Reply-To: <f14cfd5b-c103-5d56-82fb-59d0371c6f21@arm.com>



On 2020/8/19 16:54, Steven Price wrote:
> On 18/08/2020 15:41, Marc Zyngier wrote:
>> On 2020-08-17 09:41, Keqian Zhu wrote:
>>> 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.
>>
>> LPT was explicitly removed from the spec because it doesn't really
>> solve the problem, specially for the firmware: EFI knows
>> nothing about this, for example. How is it going to work?
>> Also, nobody was ever able to explain how this would work for
>> nested virt.
>>
>> ARMv8.4 and ARMv8.6 have the feature set that is required to solve
>> this problem without adding more PV to the kernel.
> 
> Hi Marc,
> 
> These are good points, however we do still have the situation that CPUs that don't have ARMv8.4/8.6 clearly cannot implement this. I presume the use-case Keqian is looking at predates the necessary support in the CPU - Keqian if you can provide more details on the architecture(s) involved that would be helpful.
> 
> Nested virt is indeed more of an issue - we did have some ideas around using SDEI that never made it to the spec. However I would argue that the most pragmatic approach would be to not support the combination of nested virt and LPT. Hopefully that can wait until the counter scaling support is available and not require PV.
> 
> We are discussing (re-)releasing the spec with the LPT parts added. If you have fundamental objections then please me know.
> 
> Thanks,
> 
> Steve
> .
> 
Hi Marc and Steven,

In fact, I have realize a demo which utilize v8.6-ECV to present a constant timer freq to guest. It seems
work well, but this approach has some shortcoming:

1. Guest access to cntvct cntv_ctl cntv_tval cntv_cval must trap to EL2. Every trap will take about
   hundreds of nano-seconds. For every timer interrupt, there is about 5~6 traps, so it will spend
   several us (this seems not a serious problem :-) ). But trap will cause big deviation for nano-sleep.
2. We have to make cntfrq be a context of guest. However, only the highest exception level has right to
   modify cntfrq. It means we have to add a new SMC call.
3. cntkctl controls event stream freq, so KVM should also translate the guest access of cntkctl. However
   we cannot trap guest access of that. Any solution for this problem?

I think LPT as a software solution can solve these problems. However, as Marc said, UEFI knows nothing about
LPT, and it will access vtimer/counter directly. The key point is how serious the impact is on UEFI.

I can see that some UEFI runtime services and drivers/applications will access timer/counter.
For runtime services, it is OK. Because we can translate the result which return from UEFI for Linux.
For drivers/applications, they will feel time goes faster or slower after migration. This is a problem indeed :-)

Thanks,
Keqian
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: zhukeqian <zhukeqian1@huawei.com>
To: Steven Price <steven.price@arm.com>, Marc Zyngier <maz@kernel.org>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org, xiexiangyou@huawei.com,
	yebiaoxiang@huawei.com, James Morse <james.morse@arm.com>,
	wanghaibin.wang@huawei.com, Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support
Date: Fri, 21 Aug 2020 11:54:22 +0800	[thread overview]
Message-ID: <177a273d-3312-ec33-de0c-fd38b49f153b@huawei.com> (raw)
In-Reply-To: <f14cfd5b-c103-5d56-82fb-59d0371c6f21@arm.com>



On 2020/8/19 16:54, Steven Price wrote:
> On 18/08/2020 15:41, Marc Zyngier wrote:
>> On 2020-08-17 09:41, Keqian Zhu wrote:
>>> 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.
>>
>> LPT was explicitly removed from the spec because it doesn't really
>> solve the problem, specially for the firmware: EFI knows
>> nothing about this, for example. How is it going to work?
>> Also, nobody was ever able to explain how this would work for
>> nested virt.
>>
>> ARMv8.4 and ARMv8.6 have the feature set that is required to solve
>> this problem without adding more PV to the kernel.
> 
> Hi Marc,
> 
> These are good points, however we do still have the situation that CPUs that don't have ARMv8.4/8.6 clearly cannot implement this. I presume the use-case Keqian is looking at predates the necessary support in the CPU - Keqian if you can provide more details on the architecture(s) involved that would be helpful.
> 
> Nested virt is indeed more of an issue - we did have some ideas around using SDEI that never made it to the spec. However I would argue that the most pragmatic approach would be to not support the combination of nested virt and LPT. Hopefully that can wait until the counter scaling support is available and not require PV.
> 
> We are discussing (re-)releasing the spec with the LPT parts added. If you have fundamental objections then please me know.
> 
> Thanks,
> 
> Steve
> .
> 
Hi Marc and Steven,

In fact, I have realize a demo which utilize v8.6-ECV to present a constant timer freq to guest. It seems
work well, but this approach has some shortcoming:

1. Guest access to cntvct cntv_ctl cntv_tval cntv_cval must trap to EL2. Every trap will take about
   hundreds of nano-seconds. For every timer interrupt, there is about 5~6 traps, so it will spend
   several us (this seems not a serious problem :-) ). But trap will cause big deviation for nano-sleep.
2. We have to make cntfrq be a context of guest. However, only the highest exception level has right to
   modify cntfrq. It means we have to add a new SMC call.
3. cntkctl controls event stream freq, so KVM should also translate the guest access of cntkctl. However
   we cannot trap guest access of that. Any solution for this problem?

I think LPT as a software solution can solve these problems. However, as Marc said, UEFI knows nothing about
LPT, and it will access vtimer/counter directly. The key point is how serious the impact is on UEFI.

I can see that some UEFI runtime services and drivers/applications will access timer/counter.
For runtime services, it is OK. Because we can translate the result which return from UEFI for Linux.
For drivers/applications, they will feel time goes faster or slower after migration. This is a problem indeed :-)

Thanks,
Keqian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-08-21  3:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17  8:41 [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support Keqian Zhu
2020-08-17  8:41 ` Keqian Zhu
2020-08-17  8:41 ` Keqian Zhu
2020-08-17  8:41 ` [RFC PATCH 1/5] KVM: arm64: Document pvtime LPT interface Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41 ` [RFC PATCH 2/5] KVM: arm64: Support Live Physical Time reporting Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41 ` [RFC PATCH 3/5] KVM: arm64: Provide VM device attributes for LPT time Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41 ` [RFC PATCH 4/5] clocksource: arm_arch_timer: Add pvtime LPT initialization Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41 ` [RFC PATCH 5/5] clocksource: arm_arch_timer: Use pvtime LPT Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17  8:41   ` Keqian Zhu
2020-08-17 10:43   ` kernel test robot
2020-08-18 14:41 ` [RFC PATCH 0/5] KVM: arm64: Add pvtime LPT support Marc Zyngier
2020-08-18 14:41   ` Marc Zyngier
2020-08-18 14:41   ` Marc Zyngier
2020-08-19  8:54   ` Steven Price
2020-08-19  8:54     ` Steven Price
2020-08-19  8:54     ` Steven Price
2020-08-21  3:54     ` zhukeqian [this message]
2020-08-21  3:54       ` zhukeqian
2020-08-21  3:54       ` zhukeqian
2020-08-22 10:31     ` Marc Zyngier
2020-08-22 10:31       ` Marc Zyngier
2020-08-22 10:31       ` Marc Zyngier
2020-09-02 10:09       ` Steven Price
2020-09-02 10:09         ` Steven Price
2020-09-02 10:09         ` Steven Price
2020-09-07  2:48         ` zhukeqian
2020-09-07  2:48           ` zhukeqian
2020-09-07  2:48           ` zhukeqian
2020-08-25 12:52     ` Mark Rutland
2020-08-25 12:52       ` Mark Rutland
2020-08-25 12:52       ` Mark Rutland

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=177a273d-3312-ec33-de0c-fd38b49f153b@huawei.com \
    --to=zhukeqian1@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=xiexiangyou@huawei.com \
    --cc=yebiaoxiang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.