Re: [PATCH v8 10/14] KVM: selftests: aarch64: Add aarch64/page_fault_test

2022-09-27 Thread Ricardo Koller
On Tue, Sep 27, 2022 at 10:06:23PM +, Sean Christopherson wrote: > On Mon, Sep 26, 2022, Ricardo Koller wrote: > > On Thu, Sep 22, 2022 at 07:32:42PM +, Sean Christopherson wrote: > > > On Thu, Sep 22, 2022, Ricardo Koller wrote: > > > > + void *hva = (void

Re: [PATCH v4 3/6] KVM: arm64: Enable ring-based dirty memory tracking

2022-09-27 Thread Gavin Shan
Hi Peter and Marc, On 9/28/22 4:21 AM, Peter Xu wrote: On Tue, Sep 27, 2022 at 01:32:07PM -0400, Marc Zyngier wrote: On Tue, 27 Sep 2022 12:02:52 -0400, Peter Xu wrote: [...] Any decision made on how to tackle with the GIC status dirty bits? Which dirty bits? Are you talking of the

Re: [PATCH v8 10/14] KVM: selftests: aarch64: Add aarch64/page_fault_test

2022-09-27 Thread Sean Christopherson
On Mon, Sep 26, 2022, Ricardo Koller wrote: > On Thu, Sep 22, 2022 at 07:32:42PM +, Sean Christopherson wrote: > > On Thu, Sep 22, 2022, Ricardo Koller wrote: > > > + void *hva = (void *)region->region.userspace_addr; > > > + uint64_t paging_size = region->region.memory_size; > > > + int ret,

Re: [PATCH v2] KVM: arm64: Limit stage2_apply_range() batch size to 1GB

2022-09-27 Thread Oliver Upton
Hi Marc, On Tue, Sep 27, 2022 at 07:34:22AM -0400, Marc Zyngier wrote: [...] > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > index c9a13e487187..5d05bb92e129 100644 > > --- a/arch/arm64/kvm/mmu.c > > +++ b/arch/arm64/kvm/mmu.c > > @@ -31,6 +31,12 @@ static phys_addr_t

Re: [PATCH v4 3/6] KVM: arm64: Enable ring-based dirty memory tracking

2022-09-27 Thread Peter Xu
On Tue, Sep 27, 2022 at 01:32:07PM -0400, Marc Zyngier wrote: > On Tue, 27 Sep 2022 12:02:52 -0400, > Peter Xu wrote: > > > > On Tue, Sep 27, 2022 at 08:54:36AM +0800, Gavin Shan wrote: > > > Enable ring-based dirty memory tracking on arm64 by selecting > > > CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL

Re: [PATCH] KVM: arm64: Cleanup the __get_fault_info() to take out the code that validates HPFAR

2022-09-27 Thread Mingwei Zhang
> > Honestly, I'd refrain from such changes *unless* they enable something > else. The current code is well understood by people hacking on it, and > although I don't mind revamping it, it has to be for a good reason. > > I'd be much more receptive to such a change if it was a prefix to >

Re: [PATCH] KVM: arm64: Cleanup the __get_fault_info() to take out the code that validates HPFAR

2022-09-27 Thread Mingwei Zhang
> > +static inline bool __hpfar_is_valid(u64 esr) > > Unlike what the name implies, this function returns true for some > cases that HPFAR is not valid (i.e. SEA). I think the function > returns true when KVM doesn't need HPFAR, or when HPFAR is valid. > IMHO the name might be a bit misleading,

Re: [PATCH v4 3/6] KVM: arm64: Enable ring-based dirty memory tracking

2022-09-27 Thread Marc Zyngier
On Tue, 27 Sep 2022 12:02:52 -0400, Peter Xu wrote: > > On Tue, Sep 27, 2022 at 08:54:36AM +0800, Gavin Shan wrote: > > Enable ring-based dirty memory tracking on arm64 by selecting > > CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL and providing the ring buffer's > > physical page offset

Re: [PATCH v4 3/6] KVM: arm64: Enable ring-based dirty memory tracking

2022-09-27 Thread Peter Xu
On Tue, Sep 27, 2022 at 08:54:36AM +0800, Gavin Shan wrote: > Enable ring-based dirty memory tracking on arm64 by selecting > CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL and providing the ring buffer's > physical page offset (KVM_DIRTY_LOG_PAGE_OFFSET). > > Signed-off-by: Gavin Shan Gavin, Any decision

Re: [PATCH v4 2/6] KVM: x86: Move declaration of kvm_cpu_dirty_log_size() to kvm_dirty_ring.h

2022-09-27 Thread Peter Xu
On Tue, Sep 27, 2022 at 08:54:35AM +0800, Gavin Shan wrote: > Not all architectures like ARM64 need to override the function. Move > its declaration to kvm_dirty_ring.h to avoid the following compiling > warning on ARM64 when the feature is enabled. > >

Re: [PATCH v4 1/6] KVM: x86: Introduce KVM_REQ_RING_SOFT_FULL

2022-09-27 Thread Peter Xu
On Tue, Sep 27, 2022 at 06:26:41AM -0400, Marc Zyngier wrote: > > +static inline bool kvm_dirty_ring_check_request(struct kvm_vcpu *vcpu) > > +{ > > + return false; > > +} > > + > > nit: I don't think this is needed at all. The dirty ring feature is > not user-selectable, and this is always

Re: [PATCH v2 0/6] KVM: Fix dirty-ring ordering on weakly ordered architectures

2022-09-27 Thread Peter Xu
On Mon, Sep 26, 2022 at 03:51:14PM +0100, Marc Zyngier wrote: > [Same distribution list as Gavin's dirty-ring on arm64 series] > > This is an update on the initial series posted as [0]. > > As Gavin started posting patches enabling the dirty-ring infrastructure > on arm64 [1], it quickly became

Re: [PATCH v2] KVM: arm64: Limit stage2_apply_range() batch size to 1GB

2022-09-27 Thread Marc Zyngier
On Mon, 26 Sep 2022 18:21:45 -0400, Oliver Upton wrote: > > Presently stage2_apply_range() works on a batch of memory addressed by a > stage 2 root table entry for the VM. Depending on the IPA limit of the > VM and PAGE_SIZE of the host, this could address a massive range of > memory. Some

Re: [PATCH v4 1/6] KVM: x86: Introduce KVM_REQ_RING_SOFT_FULL

2022-09-27 Thread Gavin Shan
Hi Marc, On 9/27/22 8:26 PM, Marc Zyngier wrote: On Mon, 26 Sep 2022 20:54:34 -0400, Gavin Shan wrote: This adds KVM_REQ_RING_SOFT_FULL, which is raised when the dirty ring of the specific VCPU becomes softly full in kvm_dirty_ring_push(). The VCPU is enforced to exit when the request is

Re: [PATCH v4 0/6] KVM: arm64: Enable ring-based dirty memory tracking

2022-09-27 Thread Marc Zyngier
+ Sean On Mon, 26 Sep 2022 20:54:33 -0400, Gavin Shan wrote: > > This series enables the ring-based dirty memory tracking for ARM64. > The feature has been available and enabled on x86 for a while. It > is beneficial when the number of dirty pages is small in a checkpointing > system or live

Re: [PATCH v4 1/6] KVM: x86: Introduce KVM_REQ_RING_SOFT_FULL

2022-09-27 Thread Marc Zyngier
On Mon, 26 Sep 2022 20:54:34 -0400, Gavin Shan wrote: > > This adds KVM_REQ_RING_SOFT_FULL, which is raised when the dirty > ring of the specific VCPU becomes softly full in kvm_dirty_ring_push(). > The VCPU is enforced to exit when the request is raised and its > dirty ring is softly full on

Re: [PATCH] KVM: arm64: Cleanup the __get_fault_info() to take out the code that validates HPFAR

2022-09-27 Thread Marc Zyngier
On Tue, 27 Sep 2022 01:14:16 -0400, Oliver Upton wrote: > > Hi Mingwei, > > On Tue, Sep 27, 2022 at 12:27:15AM +, Mingwei Zhang wrote: > > Cleanup __get_fault_info() to take out the code that checks HPFAR. The > > conditions in __get_fault_info() that checks if HPFAR contains a valid IPA >

Re: [PATCH] KVM: arm64: Cleanup the __get_fault_info() to take out the code that validates HPFAR

2022-09-27 Thread Reiji Watanabe
Hi Mingwei, On Mon, Sep 26, 2022 at 5:27 PM Mingwei Zhang wrote: > > Cleanup __get_fault_info() to take out the code that checks HPFAR. The > conditions in __get_fault_info() that checks if HPFAR contains a valid IPA > is slightly messy in that several conditions are written within one IF >