Re: [PATCH RFC 00/15] KVM: Dirty ring interface

Peter Xu
2019-12-02T20:43:51Z

On Mon, Dec 02, 2019 at 12:21:19PM -0800, Sean Christopherson wrote:
> On Sat, Nov 30, 2019 at 09:29:42AM +0100, Paolo Bonzini wrote:
> > Hi Peter,
> >
> > thanks for the RFC! Just a couple comments before I look at the series
> > (for which I don't expect many surprises).
> >
> > On 29/11/19 22:34, Peter Xu wrote:
> > > I marked this series as RFC because I'm at least uncertain on this
> > > change of vcpu_enter_guest():
> > >
> > > if (kvm_check_request(KVM_REQ_DIRTY_RING_FULL, vcpu)) {
> > > vcpu->run->exit_reason = KVM_EXIT_DIRTY_RING_FULL;
> > > /*
> > > * If this is requested, it means that we've
> > > * marked the dirty bit in the dirty ring BUT
> > > * we've not written the date. Do it now.
> > > */
> > > r = kvm_emulate_instruction(vcpu, 0);
> > > r = r >= 0 ? 0 : r;
> > > goto out;
> > > }
> >
> > This is not needed, it will just be a false negative (dirty page that
> > actually isn't dirty). The dirty bit will be cleared when userspace
> > resets the ring buffer; then the instruction will be executed again and
> > mark the page dirty again. Since ring full is not a common condition,
> > it's not a big deal.
>
> Side topic, KVM_REQ_DIRTY_RING_FULL is misnamed, it's set when a ring goes
> above its soft limit, not when the ring is actually full. It took quite a
> bit of digging to figure out whether or not PML was broken...

Yeah it's indeed a bit confusing.

Do you like KVM_REQ_DIRTY_RING_COLLECT? Pair with
KVM_EXIT_DIRTY_RING_COLLECT. Or, suggestions?

--
Peter Xu