From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw@amazon.co.uk>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
Paul Durrant <pdurrant@amazon.co.uk>
Subject: Re: [PATCH] KVM: pfncache: rework __kvm_gpc_refresh() to fix locking issues
Date: Wed, 17 Jan 2024 08:51:39 -0800 [thread overview]
Message-ID: <ZagFm0tmZ4_nWf9L@google.com> (raw)
In-Reply-To: <ef60725c38faa30132ab45cf14ee0af86e885596.camel@amazon.co.uk>
On Wed, Jan 17, 2024, David Woodhouse wrote:
> On Wed, 2024-01-17 at 08:09 -0800, Sean Christopherson wrote:
> > On Fri, Jan 12, 2024, David Woodhouse wrote:
> > As you note above, some other mutex _should_ be held. I think we should lean
> > into that. E.g.
>
> I don't. I'd like this code to stand alone *without* making the caller
> depend on "some other lock" just for its own internal consistency.
Hmm, I get where you're coming from, but protecting a per-vCPU asset with
vcpu->mutex is completely sane/reasonable. Xen's refresh from a completely
different task is the oddball. And unnecessarily taking multiple mutexes muddies
the water, e.g. it's not clear what role kvm->arch.xen.xen_lock plays when it's
acquired by kvm_xen_set_evtchn().
> > 1. Pass in the guarding mutex to kvm_gpc_init() and assert that said mutex is
> > held for __refresh(), activate(), and deactivate().
> > 2. Fix the cases where that doesn't hold true.
> > 3. Drop refresh_mutex
> >
>
> I'll go for (3) but I disagree about (1) and (2). Just let the rwlock
> work as $DEITY intended, which is what this patch is doing. It's a
> cleanup.
>
> (And I didn't drop refresh_lock so far partly because it wants to be
> done in a separate commit, but also because it does provide an
> optimisation, as noted.
next prev parent reply other threads:[~2024-01-17 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 20:38 [PATCH] KVM: pfncache: rework __kvm_gpc_refresh() to fix locking issues Woodhouse, David
2024-01-17 16:09 ` Sean Christopherson
2024-01-17 16:32 ` Woodhouse, David
2024-01-17 16:51 ` Sean Christopherson [this message]
2024-01-17 16:59 ` David Woodhouse
2024-01-17 18:14 ` Sean Christopherson
2024-01-17 18:33 ` David Woodhouse
2024-01-23 15:06 ` David Woodhouse
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=ZagFm0tmZ4_nWf9L@google.com \
--to=seanjc@google.com \
--cc=dwmw@amazon.co.uk \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.co.uk \
/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.