linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Jonathan Corbet <corbet@lwn.net>,
	kvm@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 21/27] docs: kvm: Convert locking.txt to ReST format
Date: Thu, 6 Feb 2020 23:47:36 +0100	[thread overview]
Message-ID: <20200206234736.196ef417@kernel.org> (raw)
In-Reply-To: <a17d6a27-0d3f-2020-7fc2-87ec20a6225f@redhat.com>

Em Thu, 6 Feb 2020 22:57:39 +0100
Paolo Bonzini <pbonzini@redhat.com> escreveu:

> On 06/02/20 17:11, Cornelia Huck wrote:
> > On Thu,  6 Feb 2020 15:50:18 +0100
> > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:
> >   
> >> - Use document title and chapter markups;
> >> - Add markups for literal blocks;
> >> - use :field: for field descriptions;
> >> - Add blank lines and adjust indentation.
> >>
> >> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> >> ---
> >>  Documentation/virt/kvm/index.rst              |   1 +
> >>  .../virt/kvm/{locking.txt => locking.rst}     | 111 ++++++++++--------
> >>  2 files changed, 63 insertions(+), 49 deletions(-)
> >>  rename Documentation/virt/kvm/{locking.txt => locking.rst} (78%)  
> > 
> > (...)
> >   
> >> @@ -48,19 +52,23 @@ restore the saved R/X bits if VMX_EPT_TRACK_ACCESS mask is set, or both. This
> >>  is safe because whenever changing these bits can be detected by cmpxchg.
> >>  
> >>  But we need carefully check these cases:
> >> -1): The mapping from gfn to pfn
> >> +
> >> +1) The mapping from gfn to pfn
> >> +
> >>  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
> >> +At the beginning::
> >>  
> >> -   VCPU 0                           VCPU0
> >> -on fast page fault path:
> >> +	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:  
> > 
> > I'm wondering if that should rather be converted to a proper table.  

Converting into a table would require to escape the asterisk, e. g.:

	old_spte = \*spte;

or:

	``old_spte = *spte;``

	(and, for consistency, for all other stuff there)
	

So, yeah, the html/pdf output could be nicer, but it would be worse for those
who read the .rst file.

> 
> Would be nicer but this is acceptable too I think.  Especially, the
> monospaced font allows breaking the table and keeping the parts aligned.

FYI, there's a way to setup monospaced font on a table by using a template.

As I pointed a while ago, it would require to add something to the
Sphinx theme:

	diff --git a/Documentation/sphinx-static/theme_overrides.css b/Documentation/sphinx-static/theme_overrides.css
	index e21e36cd6761..0948de6651f8 100644
	--- a/Documentation/sphinx-static/theme_overrides.css
	+++ b/Documentation/sphinx-static/theme_overrides.css
	@@ -125,3 +125,7 @@ div[class^="highlight"] pre {
	         color: inherit;
	     }
	 }
	+
	+table.monospaced {
	+	font-family: monospace, monospace;
	+}

Then use, at locking.rst (or anywhere when a monospaced font is desired):

	+.. cssclass:: monospaced

	+ ==== ====== =====
	+ Some Random Table
	+ ==== ====== =====

For completeness, a similar template class should also be needed at 
latex_prefix setting at Documentation/conf.py, implementing the same
feature for LaTeX and PDF output.

IMHO, this would be too complex for not much gain.

> 
> But the two headers should be "CPU 0" and "CPU 1", and it's worth
> changing that while we're at it.  Same for the table below.

Ok.

Maybe we could append the enclosed patch to this one. I suspect it would
visually be better.

Cheers,
Mauro

---

diff --git a/Documentation/virt/kvm/locking.rst b/Documentation/virt/kvm/locking.rst
index 428cb3412ecc..82322a4c9fde 100644
--- a/Documentation/virt/kvm/locking.rst
+++ b/Documentation/virt/kvm/locking.rst
@@ -57,18 +57,18 @@ But we need carefully check these cases:
 
 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:
+will happen::
 
-At the beginning::
+  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:
 
-on fast page fault path::
+	   CPU 0                           CPU 1
 
    old_spte = *spte;
                                  pfn1 is swapped out:
@@ -80,6 +80,7 @@ on fast page fault path::
                                  gfn2 by the guest:
                                     spte = pfn1;
 
+
    if (cmpxchg(spte, old_spte, old_spte+W)
 	mark_page_dirty(vcpu->kvm, gfn1)
              OOPS!!!
@@ -107,16 +108,16 @@ spte is read-only and the Accessed bit has already been set since the
 Accessed bit and Dirty bit can not be lost.
 
 But it is not true after fast page fault since the spte can be marked
-writable between reading spte and updating spte. Like below case:
+writable between reading spte and updating spte. Like below case::
 
-At the beginning::
+  At the beginning:
 
 	spte.W = 0
 	spte.Accessed = 1
 
-	   VCPU 0                                       VCPU0
+	   CPU 0                                       CPU 1
 
-In mmu_spte_clear_track_bits()::
+  In mmu_spte_clear_track_bits():
 
    old_spte = *spte;
 

  reply	other threads:[~2020-02-06 22:47 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 14:49 [PATCH v2 00/27] docs: virt: manually convert text documents to ReST format Mauro Carvalho Chehab
2020-02-06 14:49 ` [PATCH v2 01/27] docs: kvm: add arm/pvtime.rst to index.rst Mauro Carvalho Chehab
2020-02-06 14:49 ` [PATCH v2 02/27] docs: virt: convert UML documentation to ReST Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 03/27] docs: virt: user_mode_linux.rst: update compiling instructions Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 04/27] docs: virt: user_mode_linux.rst: fix URL references Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 05/27] docs: virt: convert halt-polling.txt to ReST format Mauro Carvalho Chehab
2020-02-06 15:41   ` Cornelia Huck
2020-02-06 14:50 ` [PATCH v2 06/27] docs: virt: Convert msr.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 07/27] docs: kvm: devices/arm-vgic-its.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 08/27] docs: kvm: devices/arm-vgit-v3.txt to ReST Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 09/27] docs: kvm: convert devices/arm-vgit.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 10/27] docs: kvm: convert devices/mpic.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 11/27] docs: kvm: convert devices/s390_flic.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 12/27] docs: kvm: convert devices/vcpu.txt " Mauro Carvalho Chehab
2020-02-06 15:47   ` Cornelia Huck
2020-02-06 14:50 ` [PATCH v2 13/27] " Mauro Carvalho Chehab
2020-02-06 15:54   ` Cornelia Huck
2020-02-06 14:50 ` [PATCH v2 14/27] docs: kvm: convert devices/vm.txt " Mauro Carvalho Chehab
2020-02-06 15:57   ` Cornelia Huck
2020-02-06 14:50 ` [PATCH v2 15/27] docs: kvm: convert devices/xics.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 16/27] docs: kvm: convert devices/xive.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 17/27] docs: kvm: Convert api.txt to ReST format Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 18/27] docs: kvm: convert arm/hyp-abi.txt to ReST Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 19/27] docs: kvm: arm/psci.txt: convert " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 20/27] docs: kvm: Convert hypercalls.txt to ReST format Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 21/27] docs: kvm: Convert locking.txt " Mauro Carvalho Chehab
2020-02-06 16:11   ` Cornelia Huck
2020-02-06 21:57     ` Paolo Bonzini
2020-02-06 22:47       ` Mauro Carvalho Chehab [this message]
2020-02-06 23:13         ` Paolo Bonzini
2020-02-07  6:24         ` Mauro Carvalho Chehab
2020-02-07  8:48           ` Cornelia Huck
2020-02-10  5:58             ` Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 22/27] docs: kvm: Convert mmu.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 23/27] docs: kvm: Convert nested-vmx.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 24/27] docs: kvm: Convert ppc-pv.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 25/27] docs: kvm: Convert s390-diag.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 26/27] docs: kvm: Convert timekeeping.txt " Mauro Carvalho Chehab
2020-02-06 14:50 ` [PATCH v2 27/27] docs: kvm: review-checklist.txt: rename to ReST Mauro Carvalho Chehab
2020-02-06 16:13   ` Cornelia Huck
2020-02-06 15:18 ` [PATCH v2 00/27] docs: virt: manually convert text documents to ReST format Paolo Bonzini
2020-02-06 16:17 ` Cornelia Huck
2020-02-06 16:21   ` Mauro Carvalho Chehab

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=20200206234736.196ef417@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=cohuck@redhat.com \
    --cc=corbet@lwn.net \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).