All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Matlack <dmatlack@google.com>
Cc: Ben Gardon <bgardon@google.com>, kvm <kvm@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>, Jim Mattson <jmattson@google.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Junaid Shahid <junaids@google.com>,
	Andrew Jones <drjones@redhat.com>,
	Matthew Wilcox <willy@infradead.org>, Yu Zhao <yuzhao@google.com>,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 3/6] KVM: x86/mmu: Make walk_shadow_page_lockless_{begin,end} interoperate with the TDP MMU
Date: Mon, 12 Jul 2021 20:20:51 +0000	[thread overview]
Message-ID: <YOykI/ptLoyvxo2a@google.com> (raw)
In-Reply-To: <YOyFutKh8Ora2+V9@google.com>

On Mon, Jul 12, 2021, David Matlack wrote:
> On Mon, Jul 12, 2021 at 10:02:31AM -0700, Ben Gardon wrote:
> > On Wed, Jun 30, 2021 at 2:48 PM David Matlack <dmatlack@google.com> wrote:
> > >
> > > Acquire the RCU read lock in walk_shadow_page_lockless_begin and release
> > > it in walk_shadow_page_lockless_end when the TDP MMU is enabled.  This
> > > should not introduce any functional changes but is used in the following
> > > commit to make fast_page_fault interoperate with the TDP MMU.
> > >
> > > Signed-off-by: David Matlack <dmatlack@google.com>
> > 
> > Reviewed-by: Ben Gardon <bgardon@google.com>
> > 
> > This as I understand this, we're just lifting the rcu_lock/unlock out
> > of kvm_tdp_mmu_get_walk, and then putting all the TDP MMU specific
> > stuff down a level under walk_shadow_page_lockless_begin/end and
> > get_walk.
> > 
> > Instead of moving kvm_tdp_mmu_get_walk_lockless into get_walk, it
> > could also be open-coded as:
> > 
> > walk_shadow_page_lockless_begin
> >  if (is_tdp_mmu(vcpu->arch.mmu))
> >                leaf = kvm_tdp_mmu_get_walk(vcpu, addr, sptes, &root);
> >  else
> >                leaf = get_walk(vcpu, addr, sptes, &root);
> > walk_shadow_page_lockless_end
> > 
> > in get_mmio_spte, since get_walk isn't used anywhere else. Then
> > walk_shadow_page_lockless_begin/end could also be moved up out of
> > get_walk instead of having to add a goto to that function.
> > I don't have a strong preference either way, but the above feels like
> > a slightly simpler refactor.
> 
> I don't have a strong preference either way as well. I'd be happy to
> switch to your suggestion in v3.

I vote for Ben's suggestion.  As is, I think it would be too easy to overlook the
TDP MMU path in get_walk() and focus only on the for-loop.

  reply	other threads:[~2021-07-12 20:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 21:47 [PATCH v2 0/6] KVM: x86/mmu: Fast page fault support for the TDP MMU David Matlack
2021-06-30 21:47 ` [PATCH v2 1/6] KVM: x86/mmu: Rename cr2_or_gpa to gpa in fast_page_fault David Matlack
2021-07-12 20:01   ` Sean Christopherson
2021-06-30 21:47 ` [PATCH v2 2/6] KVM: x86/mmu: Fix use of enums in trace_fast_page_fault David Matlack
2021-07-12 16:14   ` Ben Gardon
2021-07-12 18:11     ` David Matlack
2021-07-12 19:53       ` Sean Christopherson
2021-07-12 20:38         ` David Matlack
2021-06-30 21:47 ` [PATCH v2 3/6] KVM: x86/mmu: Make walk_shadow_page_lockless_{begin,end} interoperate with the TDP MMU David Matlack
2021-07-12 17:02   ` Ben Gardon
2021-07-12 18:11     ` David Matlack
2021-07-12 20:20       ` Sean Christopherson [this message]
2021-07-12 20:23   ` Sean Christopherson
2021-06-30 21:48 ` [PATCH v2 4/6] KVM: x86/mmu: fast_page_fault support for " David Matlack
2021-07-01  2:54   ` kernel test robot
2021-07-01  2:54     ` kernel test robot
2021-07-01  4:27   ` kernel test robot
2021-07-01  4:27     ` kernel test robot
2021-07-01 18:27     ` David Matlack
2021-07-01 18:27       ` David Matlack
2021-07-09 18:45   ` David Matlack
2021-07-12 17:49   ` Ben Gardon
2021-07-12 18:20     ` David Matlack
2021-07-12 21:03     ` Sean Christopherson
2021-07-12 21:24       ` David Matlack
2021-06-30 21:48 ` [PATCH v2 5/6] KVM: selftests: Fix missing break in dirty_log_perf_test arg parsing David Matlack
2021-06-30 21:48 ` [PATCH v2 6/6] KVM: selftests: Introduce access_tracking_perf_test David Matlack
2021-07-01  1:15 ` [PATCH v2 0/6] KVM: x86/mmu: Fast page fault support for the TDP MMU Matthew Wilcox
     [not found]   ` <CABgObfZUFWCAvKoxDzGjmksFnwZgbnpX9GuC+nhiVLa-Fhwj6A@mail.gmail.com>
2021-07-01 12:08     ` Matthew Wilcox
2021-07-01 16:50       ` David Matlack
2021-07-01 17:00 ` David Hildenbrand
2021-07-01 22:11   ` David Matlack
2021-07-02  7:53     ` David Hildenbrand

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=YOykI/ptLoyvxo2a@google.com \
    --to=seanjc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bgardon@google.com \
    --cc=david@redhat.com \
    --cc=dmatlack@google.com \
    --cc=drjones@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=junaids@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.