From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Maxim Levitsky <mlevitsk@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: kvm_gfn_to_pfn_cache_refresh started getting a warning recently
Date: Tue, 26 Apr 2022 18:15:00 +0000 [thread overview]
Message-ID: <Ymg2pN9V4uwkmLZ/@google.com> (raw)
In-Reply-To: <YmgtPGur0Uwk5Yg6@google.com>
On Tue, Apr 26, 2022, Sean Christopherson wrote:
> On Tue, Apr 26, 2022, Paolo Bonzini wrote:
> > On 4/26/22 18:45, Sean Christopherson wrote:
> > > On Tue, Apr 26, 2022, Maxim Levitsky wrote:
> > > > [ 390.511995] BUG: sleeping function called from invalid context at include/linux/highmem-internal.h:161
> > > > [ 390.513681] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 4439, name: CPU 0/KVM
> > >
> > > This is my fault. memremap() can sleep as well. I'll work on a fix.
> >
> > Indeed, "KVM: Fix race between mmu_notifier invalidation and pfncache
> > refresh" hadn't gone through a full test cycle yet.
>
> And I didn't run with PROVE_LOCKING :-(
>
> I'm pretty sure there's an existing memory leak too. If a refresh occurs, but
> the pfn ends up being the same, KVM will keep references to both the "old" and the
> "new", but only release one when the cache is destroyed.
>
> The refcounting bug begs the question of why KVM even keeps a reference. This code
> really should look exactly like the page fault path, i.e. should drop the reference
> to the pfn once the pfn has been installed into the cache and obtained protection
> via the mmu_notifier.
This is getting a bit gnarly. It probably makes sense to drop the existing patches
from kvm/queue, and then I can send a full v2 instead of just the delta?
next prev parent reply other threads:[~2022-04-26 18:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-26 15:33 kvm_gfn_to_pfn_cache_refresh started getting a warning recently Maxim Levitsky
2022-04-26 16:45 ` Sean Christopherson
2022-04-26 16:56 ` Maxim Levitsky
2022-04-26 17:11 ` Paolo Bonzini
2022-04-26 17:34 ` Sean Christopherson
2022-04-26 18:15 ` Sean Christopherson [this message]
2022-04-27 12:22 ` 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=Ymg2pN9V4uwkmLZ/@google.com \
--to=seanjc@google.com \
--cc=dwmw2@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=mlevitsk@redhat.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