From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Sean Christopherson <seanjc@google.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
David Woodhouse <dwmw@amazon.co.uk>,
Mingwei Zhang <mizhang@google.com>
Subject: [PATCH v3 0/8] KVM: Fix mmu_notifier vs. pfncache vs. pfncache races
Date: Fri, 29 Apr 2022 21:00:17 +0000 [thread overview]
Message-ID: <20220429210025.3293691-1-seanjc@google.com> (raw)
Fix races between mmu_notifier invalidation and pfncache refresh, and
within the pfncache itself.
The first two patches are reverts of the patches sitting in kvm/queue,
trying to separate and fix the races independently is nigh impossible.
I assume/hope they can be ignored and the original patches dropped.
I've proven all the races, though I was never able to trigger an actual
error in the race with the mmu_notifier, just a WARN I added on the
hva=>pfn translation being invalid/not-present when accessing memory
via the khva. Hitting the race also required a series of handoffs in the
kernel between the two tasks, i.e. I can't provide any upstream-worthy
test :-(
v3:
- Split the refresh serialization to a separate patch.
- Use a mutex to serialize refrehses. [Lai Jiangshan]
- Add back Cc to stable@ (omitted in v2 because I was less confident
that backporting the mess would be a good idea].
v2:
- https://lore.kernel.org/all/20220427014004.1992589-1-seanjc@google.com
- Map the pfn=>khva outside of gpc->lock. [Maxim]
- Fix a page leak.
- Fix more races.
v1:
https://lore.kernel.org/all/20220420004859.3298837-1-seanjc@google.com
Sean Christopherson (8):
Revert "KVM: Do not speculatively mark pfn cache valid to "fix" race"
Revert "KVM: Fix race between mmu_notifier invalidation and pfncache
refresh"
KVM: Drop unused @gpa param from gfn=>pfn cache's __release_gpc()
helper
KVM: Put the extra pfn reference when reusing a pfn in the gpc cache
KVM: Do not incorporate page offset into gfn=>pfn cache user address
KVM: Fully serialize gfn=>pfn cache refresh via mutex
KVM: Fix multiple races in gfn=>pfn cache refresh
KVM: Do not pin pages tracked by gfn=>pfn caches
include/linux/kvm_types.h | 2 +
virt/kvm/pfncache.c | 180 +++++++++++++++++++++++---------------
2 files changed, 113 insertions(+), 69 deletions(-)
base-commit: 2a39d8b39bffdaf1a4223d0d22f07baee154c8f3
--
2.36.0.464.gb9c8b46e94-goog
next reply other threads:[~2022-04-29 21:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 21:00 Sean Christopherson [this message]
2022-04-29 21:00 ` [PATCH v3 1/8] Revert "KVM: Do not speculatively mark pfn cache valid to "fix" race" Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 2/8] Revert "KVM: Fix race between mmu_notifier invalidation and pfncache refresh" Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 3/8] KVM: Drop unused @gpa param from gfn=>pfn cache's __release_gpc() helper Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 4/8] KVM: Put the extra pfn reference when reusing a pfn in the gpc cache Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 5/8] KVM: Do not incorporate page offset into gfn=>pfn cache user address Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 6/8] KVM: Fully serialize gfn=>pfn cache refresh via mutex Sean Christopherson
2022-05-20 15:24 ` Paolo Bonzini
2022-05-20 15:53 ` Sean Christopherson
2022-05-20 16:01 ` Paolo Bonzini
2022-04-29 21:00 ` [PATCH v3 7/8] KVM: Fix multiple races in gfn=>pfn cache refresh Sean Christopherson
2022-04-29 21:00 ` [PATCH v3 8/8] KVM: Do not pin pages tracked by gfn=>pfn caches Sean Christopherson
2022-05-20 16:04 ` [PATCH v3 0/8] KVM: Fix mmu_notifier vs. pfncache vs. pfncache races Paolo Bonzini
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=20220429210025.3293691-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=dwmw@amazon.co.uk \
--cc=jiangshanlai@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--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
all inboxes | Powered by JetHome®