From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Ben Gardon <bgardon@google.com>,
Makarand Sonare <makarandsonare@google.com>
Subject: Re: [PATCH 00/14] KVM: x86/mmu: Dirty logging fixes and improvements
Date: Thu, 18 Feb 2021 13:57:43 +0100 [thread overview]
Message-ID: <b5ab72f2-970f-64bd-891c-48f1c303548d@redhat.com> (raw)
In-Reply-To: <20210213005015.1651772-1-seanjc@google.com>
On 13/02/21 01:50, Sean Christopherson wrote:
> Paolo, this is more or less ready, but on final read-through before
> sending I realized it would be a good idea to WARN during VM destruction
> if cpu_dirty_logging_count is non-zero. I wanted to get you this before
> the 5.12 window opens in case you want the TDP MMU fixes for 5.12. I'll
> do the above change and retest next week (note, Monday is a US holiday).
>
> On to the code...
>
> This started out as a small tweak to collapsible SPTE zapping in the TDP
> MMU, and ended up as a rather large overhaul of CPU dirty logging, a.k.a.
> PML.
>
> Four main highlights:
>
> - Do a more precise check on whether or not a SPTE should be zapped to
> rebuild it as a large page.
> - Disable PML when running L2. PML is fully emulated for L1 VMMs, thus
> enabling PML in L2 can only hurt and never help.
> - Drop the existing PML kvm_x86_ops. They're basically trampolines into
> the MMU, and IMO do far more harm than good.
> - Turn on PML only when it's needed instead of setting all dirty bits to
> soft disable PML.
>
> What led me down the rabbit's hole of ripping out the existing PML
> kvm_x86_ops isn't really shown here. Prior to incorporating Makarand's
> patch, which allowed for the wholesale remove of setting dirty bits,
> I spent a bunch of time poking around the "set dirty bits" code. My
> original changes optimized that path to skip setting dirty bits in the
> nested MMU, since the nested MMU relies on write-protection and not PML.
> That in turn allowed the TDP MMU zapping to completely skip walking the
> rmaps, but doing so based on a bunch of callbacks was a twisted mess.
>
> Happily, those patches got dropped in favor of nuking the code entirely.
>
> Ran selftest and unit tests, and migrated actual VMs on AMD and Intel,
> with and without TDP MMU, and with and without EPT. The AMD system I'm
> testing on infinite loops on the reset vector due to a #PF when NPT is
> disabled, so that didn't get tested. That reproduces with kvm/next,
> I'll dig into it next week (no idea if it's a KVM or hardware issue).
>
> For actual migration, I ran kvm-unit-tests in L1 along with stress to
> hammer memory, and verified migration was effectively blocked until the
> stress threads were killed (I didn't feel like figuring out how to
> throttle the VM).
>
> Makarand Sonare (1):
> KVM: VMX: Dynamically enable/disable PML based on memslot dirty
> logging
>
> Sean Christopherson (13):
> KVM: x86/mmu: Expand collapsible SPTE zap for TDP MMU to ZONE_DEVICE
> pages
> KVM: x86/mmu: Don't unnecessarily write-protect small pages in TDP MMU
> KVM: x86/mmu: Split out max mapping level calculation to helper
> KVM: x86/mmu: Pass the memslot to the rmap callbacks
> KVM: x86/mmu: Consult max mapping level when zapping collapsible SPTEs
> KVM: nVMX: Disable PML in hardware when running L2
> KVM: x86/mmu: Expand on the comment in
> kvm_vcpu_ad_need_write_protect()
> KVM: x86/mmu: Make dirty log size hook (PML) a value, not a function
> KVM: x86: Move MMU's PML logic to common code
> KVM: x86: Further clarify the logic and comments for toggling log
> dirty
> KVM: x86/mmu: Don't set dirty bits when disabling dirty logging w/ PML
> KVM: x86: Fold "write-protect large" use case into generic
> write-protect
> KVM: x86/mmu: Remove a variety of unnecessary exports
>
> arch/x86/include/asm/kvm-x86-ops.h | 6 +-
> arch/x86/include/asm/kvm_host.h | 36 +----
> arch/x86/kvm/mmu/mmu.c | 203 +++++++++--------------------
> arch/x86/kvm/mmu/mmu_internal.h | 7 +-
> arch/x86/kvm/mmu/tdp_mmu.c | 66 +---------
> arch/x86/kvm/mmu/tdp_mmu.h | 3 +-
> arch/x86/kvm/vmx/nested.c | 34 +++--
> arch/x86/kvm/vmx/vmx.c | 94 +++++--------
> arch/x86/kvm/vmx/vmx.h | 2 +
> arch/x86/kvm/x86.c | 145 +++++++++++++--------
> 10 files changed, 230 insertions(+), 366 deletions(-)
>
Queued 1-9 and 14 until you clarify my doubt about patch 10, thanks.
Paolo
prev parent reply other threads:[~2021-02-18 15:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-13 0:50 Sean Christopherson
2021-02-13 0:50 ` [PATCH 01/14] KVM: x86/mmu: Expand collapsible SPTE zap for TDP MMU to ZONE_DEVICE pages Sean Christopherson
2021-02-18 12:36 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 02/14] KVM: x86/mmu: Don't unnecessarily write-protect small pages in TDP MMU Sean Christopherson
2021-02-13 0:50 ` [PATCH 03/14] KVM: x86/mmu: Split out max mapping level calculation to helper Sean Christopherson
2021-02-13 0:50 ` [PATCH 04/14] KVM: x86/mmu: Pass the memslot to the rmap callbacks Sean Christopherson
2021-02-13 0:50 ` [PATCH 05/14] KVM: x86/mmu: Consult max mapping level when zapping collapsible SPTEs Sean Christopherson
2021-02-18 12:43 ` Paolo Bonzini
2021-02-18 16:23 ` Sean Christopherson
2021-02-18 22:30 ` Mike Kravetz
2021-02-19 1:31 ` Sean Christopherson
2021-02-13 0:50 ` [PATCH 06/14] KVM: nVMX: Disable PML in hardware when running L2 Sean Christopherson
2021-02-13 0:50 ` [PATCH 07/14] KVM: x86/mmu: Expand on the comment in kvm_vcpu_ad_need_write_protect() Sean Christopherson
2021-02-13 0:50 ` [PATCH 08/14] KVM: x86/mmu: Make dirty log size hook (PML) a value, not a function Sean Christopherson
2021-02-18 12:45 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 09/14] KVM: x86: Move MMU's PML logic to common code Sean Christopherson
2021-02-13 0:50 ` [PATCH 10/14] KVM: x86: Further clarify the logic and comments for toggling log dirty Sean Christopherson
2021-02-18 12:50 ` Paolo Bonzini
2021-02-18 16:15 ` Sean Christopherson
2021-02-18 16:56 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 11/14] KVM: VMX: Dynamically enable/disable PML based on memslot dirty logging Sean Christopherson
2021-02-13 0:50 ` [PATCH 12/14] KVM: x86/mmu: Don't set dirty bits when disabling dirty logging w/ PML Sean Christopherson
2021-02-18 17:08 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 13/14] KVM: x86: Fold "write-protect large" use case into generic write-protect Sean Christopherson
2021-02-13 0:50 ` [PATCH 14/14] KVM: x86/mmu: Remove a variety of unnecessary exports Sean Christopherson
2021-02-17 22:50 ` [PATCH 00/14] KVM: x86/mmu: Dirty logging fixes and improvements Sean Christopherson
2021-02-18 12:57 ` Paolo Bonzini [this message]
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=b5ab72f2-970f-64bd-891c-48f1c303548d@redhat.com \
--to=pbonzini@redhat.com \
--cc=bgardon@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=makarandsonare@google.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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
all inboxes | Powered by JetHome®