Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-31 Thread Gavin Shan
On 10/31/22 5:08 PM, Marc Zyngier wrote: On 2022-10-28 17:51, Sean Christopherson wrote: On Fri, Oct 28, 2022, Gavin Shan wrote: On 10/28/22 2:30 AM, Marc Zyngier wrote: > On Thu, 27 Oct 2022 18:44:51 +0100, > > On Thu, Oct 27, 2022, Marc Zyngier wrote: > > > On Tue, 25 Oct 2022 18:47:12

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-31 Thread Marc Zyngier
On 2022-10-28 17:51, Sean Christopherson wrote: On Fri, Oct 28, 2022, Gavin Shan wrote: Hi Sean and Marc, On 10/28/22 2:30 AM, Marc Zyngier wrote: > On Thu, 27 Oct 2022 18:44:51 +0100, > Sean Christopherson wrote: > > > > On Thu, Oct 27, 2022, Marc Zyngier wrote: > > > On Tue, 25 Oct 2022

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-30 Thread Gavin Shan
Hi Sean, On 10/29/22 12:51 AM, Sean Christopherson wrote: On Fri, Oct 28, 2022, Gavin Shan wrote: On 10/28/22 2:30 AM, Marc Zyngier wrote: On Thu, 27 Oct 2022 18:44:51 +0100, Sean Christopherson wrote: On Thu, Oct 27, 2022, Marc Zyngier wrote: On Tue, 25 Oct 2022 18:47:12 +0100, Sean

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-28 Thread Sean Christopherson
On Fri, Oct 28, 2022, Gavin Shan wrote: > Hi Sean and Marc, > > On 10/28/22 2:30 AM, Marc Zyngier wrote: > > On Thu, 27 Oct 2022 18:44:51 +0100, > > Sean Christopherson wrote: > > > > > > On Thu, Oct 27, 2022, Marc Zyngier wrote: > > > > On Tue, 25 Oct 2022 18:47:12 +0100, Sean Christopherson

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-28 Thread Gavin Shan
Hi Sean and Marc, On 10/28/22 2:30 AM, Marc Zyngier wrote: On Thu, 27 Oct 2022 18:44:51 +0100, Sean Christopherson wrote: On Thu, Oct 27, 2022, Marc Zyngier wrote: On Tue, 25 Oct 2022 18:47:12 +0100, Sean Christopherson wrote: [...] And ideally such bugs would detected without

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-27 Thread Sean Christopherson
On Thu, Oct 27, 2022, Marc Zyngier wrote: > On Thu, 27 Oct 2022 18:44:51 +0100, > Sean Christopherson wrote: > > > > On Thu, Oct 27, 2022, Marc Zyngier wrote: > > > But in the long run, with dirty bits being collected from the IOMMU > > > page tables or directly from devices, we will need a way

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-27 Thread Marc Zyngier
On Thu, 27 Oct 2022 18:44:51 +0100, Sean Christopherson wrote: > > On Thu, Oct 27, 2022, Marc Zyngier wrote: > > On Tue, 25 Oct 2022 18:47:12 +0100, Sean Christopherson > > wrote: > > > Call us incompetent, but I have zero confidence that KVM will never > > > unintentionally add a path that

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-27 Thread Sean Christopherson
On Thu, Oct 27, 2022, Marc Zyngier wrote: > On Tue, 25 Oct 2022 18:47:12 +0100, Sean Christopherson > wrote: > > Call us incompetent, but I have zero confidence that KVM will never > > unintentionally add a path that invokes mark_page_dirty_in_slot() > > without a running vCPU. > > Well, maybe

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-27 Thread Marc Zyngier
On Tue, 25 Oct 2022 18:47:12 +0100, Sean Christopherson wrote: > > On Tue, Oct 25, 2022, Marc Zyngier wrote: > > On Tue, 25 Oct 2022 01:24:19 +0100, Oliver Upton > > wrote: > > > > That's why I asked if it's possible for KVM to require a dirty_bitmap > > > > when KVM > > > > might end up

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-25 Thread Sean Christopherson
On Tue, Oct 25, 2022, Marc Zyngier wrote: > On Tue, 25 Oct 2022 01:24:19 +0100, Oliver Upton > wrote: > > > That's why I asked if it's possible for KVM to require a dirty_bitmap > > > when KVM > > > might end up collecting dirty information without a vCPU. KVM is still > > > technically

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-25 Thread Marc Zyngier
On Tue, 25 Oct 2022 01:24:19 +0100, Oliver Upton wrote: > > On Mon, Oct 24, 2022 at 11:50:29PM +, Sean Christopherson wrote: > > On Sat, Oct 22, 2022, Marc Zyngier wrote: > > > On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson > > > wrote: > > [...] > > > > > Would it be possible

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-25 Thread Marc Zyngier
On Tue, 25 Oct 2022 00:50:29 +0100, Sean Christopherson wrote: > > On Sat, Oct 22, 2022, Marc Zyngier wrote: > > On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson > > wrote: > > > > > > On Fri, Oct 21, 2022, Marc Zyngier wrote: > > > > Because dirtying memory outside of a vcpu context

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-24 Thread Oliver Upton
On Mon, Oct 24, 2022 at 11:50:29PM +, Sean Christopherson wrote: > On Sat, Oct 22, 2022, Marc Zyngier wrote: > > On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson > > wrote: [...] > > > Would it be possible to require a dirty bitmap when an ITS is > > > created? That would allow

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-24 Thread Sean Christopherson
On Mon, Oct 24, 2022, Sean Christopherson wrote: > On Sat, Oct 22, 2022, Marc Zyngier wrote: > > On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson > > wrote: > > > > > > On Fri, Oct 21, 2022, Marc Zyngier wrote: > > > > Because dirtying memory outside of a vcpu context makes it > > > >

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-24 Thread Sean Christopherson
On Sat, Oct 22, 2022, Marc Zyngier wrote: > On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson > wrote: > > > > On Fri, Oct 21, 2022, Marc Zyngier wrote: > > > Because dirtying memory outside of a vcpu context makes it > > > incredibly awkward to handle a "ring full" condition? > > > >

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-22 Thread Marc Zyngier
On Sat, 22 Oct 2022 09:27:41 +0100, Gavin Shan wrote: > > Hi Sean, > > On 10/22/22 12:05 AM, Sean Christopherson wrote: > > On Fri, Oct 21, 2022, Marc Zyngier wrote: > >> On Fri, 21 Oct 2022 00:44:51 +0100, > >> Sean Christopherson wrote: > >>> > >>> On Tue, Oct 11, 2022, Gavin Shan wrote: >

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-22 Thread Marc Zyngier
On Fri, 21 Oct 2022 17:05:26 +0100, Sean Christopherson wrote: > > On Fri, Oct 21, 2022, Marc Zyngier wrote: > > On Fri, 21 Oct 2022 00:44:51 +0100, > > Sean Christopherson wrote: > > > > > > On Tue, Oct 11, 2022, Gavin Shan wrote: > > > > Some architectures (such as arm64) need to dirty

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-22 Thread Gavin Shan
Hi Sean, On 10/22/22 12:05 AM, Sean Christopherson wrote: On Fri, Oct 21, 2022, Marc Zyngier wrote: On Fri, 21 Oct 2022 00:44:51 +0100, Sean Christopherson wrote: On Tue, Oct 11, 2022, Gavin Shan wrote: Some architectures (such as arm64) need to dirty memory outside of the context of a

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-21 Thread Gavin Shan
Hi Sean, On 10/22/22 7:20 AM, Sean Christopherson wrote: On Fri, Oct 21, 2022, Gavin Shan wrote: What about inverting the naming to better capture that this is about the dirty bitmap, and less so about the dirty ring? It's not obvious what "exclusive" means, e.g. I saw this stub before

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-21 Thread Sean Christopherson
On Fri, Oct 21, 2022, Gavin Shan wrote: > > What about inverting the naming to better capture that this is about the > > dirty > > bitmap, and less so about the dirty ring? It's not obvious what "exclusive" > > means, e.g. I saw this stub before reading the changelog and assumed it was > >

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-21 Thread Sean Christopherson
On Fri, Oct 21, 2022, Marc Zyngier wrote: > On Fri, 21 Oct 2022 00:44:51 +0100, > Sean Christopherson wrote: > > > > On Tue, Oct 11, 2022, Gavin Shan wrote: > > > Some architectures (such as arm64) need to dirty memory outside of the > > > context of a vCPU. Of course, this simply doesn't fit

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-21 Thread Gavin Shan
Hi Sean, On 10/21/22 7:44 AM, Sean Christopherson wrote: On Tue, Oct 11, 2022, Gavin Shan wrote: Some architectures (such as arm64) need to dirty memory outside of the context of a vCPU. Of course, this simply doesn't fit with the UAPI of KVM's per-vCPU dirty ring. What is the point of using

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-21 Thread Marc Zyngier
On Fri, 21 Oct 2022 00:44:51 +0100, Sean Christopherson wrote: > > On Tue, Oct 11, 2022, Gavin Shan wrote: > > Some architectures (such as arm64) need to dirty memory outside of the > > context of a vCPU. Of course, this simply doesn't fit with the UAPI of > > KVM's per-vCPU dirty ring. > >

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-20 Thread Sean Christopherson
On Tue, Oct 11, 2022, Gavin Shan wrote: > Some architectures (such as arm64) need to dirty memory outside of the > context of a vCPU. Of course, this simply doesn't fit with the UAPI of > KVM's per-vCPU dirty ring. What is the point of using the dirty ring in this case? KVM still burns a pile of

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-20 Thread Oliver Upton
On Wed, Oct 19, 2022 at 06:20:32AM +0800, Gavin Shan wrote: > Hi Peter, > > On 10/19/22 12:07 AM, Peter Xu wrote: > > On Tue, Oct 11, 2022 at 02:14:42PM +0800, Gavin Shan wrote: [...] > > IMHO it'll be great to start with something like below to describe the > > userspace's responsibility to

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-18 Thread Gavin Shan
Hi Peter, On 10/19/22 12:07 AM, Peter Xu wrote: On Tue, Oct 11, 2022 at 02:14:42PM +0800, Gavin Shan wrote: Some architectures (such as arm64) need to dirty memory outside of the context of a vCPU. Of course, this simply doesn't fit with the UAPI of KVM's per-vCPU dirty ring. Introduce a new

Re: [PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-18 Thread Peter Xu
On Tue, Oct 11, 2022 at 02:14:42PM +0800, Gavin Shan wrote: > Some architectures (such as arm64) need to dirty memory outside of the > context of a vCPU. Of course, this simply doesn't fit with the UAPI of > KVM's per-vCPU dirty ring. > > Introduce a new flavor of dirty ring that requires the use

[PATCH v6 3/8] KVM: Add support for using dirty ring in conjunction with bitmap

2022-10-11 Thread Gavin Shan
Some architectures (such as arm64) need to dirty memory outside of the context of a vCPU. Of course, this simply doesn't fit with the UAPI of KVM's per-vCPU dirty ring. Introduce a new flavor of dirty ring that requires the use of both vCPU dirty rings and a dirty bitmap. The expectation is that