Em Fri, 7 Feb 2020 09:48:03 +0100 Cornelia Huck <cohuck@xxxxxxxxxx> escreveu: > On Fri, 7 Feb 2020 07:24:09 +0100 > Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx> wrote: > > > > > > > > > > > > Would be nicer but this is acceptable too I think. Especially, the > > > > monospaced font allows breaking the table and keeping the parts aligned. > > > > I couldn't resist trying to use a table ;-) > > > > The following patch does that. IMO, it looks nice on both text and html > > outputs. > > Now that I see this, I think this version is actually more readable > than the existing text. Yes, that was my feeling too: even for one reading the text version, it looked clearer on my eyes. > > > > > Cheers, > > Mauro > > > > diff --git a/Documentation/virt/kvm/locking.rst b/Documentation/virt/kvm/locking.rst > > index 428cb3412ecc..c02291beac3f 100644 > > --- a/Documentation/virt/kvm/locking.rst > > +++ b/Documentation/virt/kvm/locking.rst > > @@ -59,30 +59,39 @@ The mapping from gfn to pfn may be changed since we can only ensure the pfn > > is not changed during cmpxchg. This is a ABA problem, for example, below case > > will happen: > > > > -At the beginning:: > > - > > - gpte = gfn1 > > - gfn1 is mapped to pfn1 on host > > - spte is the shadow page table entry corresponding with gpte and > > - spte = pfn1 > > - > > - VCPU 0 VCPU0 > > - > > -on fast page fault path:: > > - > > - old_spte = *spte; > > - pfn1 is swapped out: > > - spte = 0; > > - > > - pfn1 is re-alloced for gfn2. > > - > > - gpte is changed to point to > > - gfn2 by the guest: > > - spte = pfn1; > > - > > - if (cmpxchg(spte, old_spte, old_spte+W) > > - mark_page_dirty(vcpu->kvm, gfn1) > > - OOPS!!! > > ++------------------------------------------------------------------------+ > > +| At the beginning:: | > > +| | > > +| gpte = gfn1 | > > +| gfn1 is mapped to pfn1 on host | > > +| spte is the shadow page table entry corresponding with gpte and | > > +| spte = pfn1 | > > ++------------------------------------------------------------------------+ > > +| On fast page fault path: | > > ++------------------------------------+-----------------------------------+ > > +| CPU 0: | CPU 1: | > > ++------------------------------------+-----------------------------------+ > > +| :: | | > > The '::' directives look a bit like leftover christmas decorations, > but it's not really distracting, and on the plus side, we'll get nice > html formatting. Yes the only downside are those extra "::". The alternatives to it that would produce a similar look and feel would be a lot worse. > > > +| | | > > +| old_spte = *spte; | | > > ++------------------------------------+-----------------------------------+ > > +| | pfn1 is swapped out:: | > > +| | | > > +| | spte = 0; | > > +| | | > > +| | pfn1 is re-alloced for gfn2. | > > +| | | > > +| | gpte is changed to point to | > > +| | gfn2 by the guest:: | > > +| | | > > +| | spte = pfn1; | > > ++------------------------------------+-----------------------------------+ > > +| :: | > > +| | > > +| if (cmpxchg(spte, old_spte, old_spte+W) | > > +| mark_page_dirty(vcpu->kvm, gfn1) | > > +| OOPS!!! | > > ++------------------------------------------------------------------------+ > > > > We dirty-log for gfn1, that means gfn2 is lost in dirty-bitmap. > > > > So I'd like to cast my vote for this version :) > Ok. I'm submitting version 3 with this version. Regards, Mauro Cheers, Mauro