From: Paul Mackerras <paulus@ozlabs.org>
To: Greg Kurz <groug@kaod.org>
Cc: "Cédric Le Goater" <clg@kaod.org>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
"David Gibson" <david@gibson.dropbear.id.au>,
kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3S HV: XIVE: introduce a KVM device lock
Date: Tue, 28 May 2019 14:17:11 +1000 [thread overview]
Message-ID: <20190528041711.ewohm2pdrya5ompz@oak.ozlabs.ibm.com> (raw)
In-Reply-To: <20190524201621.23eb7c44@bahia.lan>
Greg,
On Fri, May 24, 2019 at 08:16:21PM +0200, Greg Kurz wrote:
> On Fri, 24 May 2019 15:20:30 +0200
> Cédric Le Goater <clg@kaod.org> wrote:
>
> > The XICS-on-XIVE KVM device needs to allocate XIVE event queues when a
> > priority is used by the OS. This is referred as EQ provisioning and it
> > is done under the hood when :
> >
> > 1. a CPU is hot-plugged in the VM
> > 2. the "set-xive" is called at VM startup
> > 3. sources are restored at VM restore
> >
> > The kvm->lock mutex is used to protect the different XIVE structures
> > being modified but in some contextes, kvm->lock is taken under the
> > vcpu->mutex which is a forbidden sequence by KVM.
> >
> > Introduce a new mutex 'lock' for the KVM devices for them to
> > synchronize accesses to the XIVE device structures.
> >
> > Signed-off-by: Cédric Le Goater <clg@kaod.org>
> > ---
> > arch/powerpc/kvm/book3s_xive.h | 1 +
> > arch/powerpc/kvm/book3s_xive.c | 23 +++++++++++++----------
> > arch/powerpc/kvm/book3s_xive_native.c | 15 ++++++++-------
> > 3 files changed, 22 insertions(+), 17 deletions(-)
> >
> > diff --git a/arch/powerpc/kvm/book3s_xive.h b/arch/powerpc/kvm/book3s_xive.h
> > index 426146332984..862c2c9650ae 100644
> > --- a/arch/powerpc/kvm/book3s_xive.h
> > +++ b/arch/powerpc/kvm/book3s_xive.h
> > @@ -141,6 +141,7 @@ struct kvmppc_xive {
> > struct kvmppc_xive_ops *ops;
> > struct address_space *mapping;
> > struct mutex mapping_lock;
> > + struct mutex lock;
> > };
> >
> > #define KVMPPC_XIVE_Q_COUNT 8
> > diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
> > index f623451ec0a3..12c8a36dd980 100644
> > --- a/arch/powerpc/kvm/book3s_xive.c
> > +++ b/arch/powerpc/kvm/book3s_xive.c
> > @@ -271,14 +271,14 @@ static int xive_provision_queue(struct kvm_vcpu *vcpu, u8 prio)
> > return rc;
> > }
> >
> > -/* Called with kvm_lock held */
> > +/* Called with xive->lock held */
> > static int xive_check_provisioning(struct kvm *kvm, u8 prio)
> > {
> > struct kvmppc_xive *xive = kvm->arch.xive;
>
> Since the kvm_lock isn't protecting kvm->arch anymore, this looks weird.
Are you suggesting that something that was protected before now isn't
with Cédric's patch?
> Passing xive instead of kvm and using xive->kvm would make more sense IMHO.
>
> Maybe fold the following into your patch ?
As far as I can see your delta patch doesn't actually change any
locking but just rationalizes the parameters for an internal
function. That being so, for 5.2 I am intending to put Cédric's
original patch in, unless someone comes up with a good reason not to.
Paul.
next prev parent reply other threads:[~2019-05-28 4:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 13:20 [PATCH] KVM: PPC: Book3S HV: XIVE: introduce a KVM device lock Cédric Le Goater
2019-05-24 18:16 ` Greg Kurz
2019-05-28 4:17 ` Paul Mackerras [this message]
2019-05-29 12:03 ` Greg Kurz
2019-05-31 6:35 ` Paul Mackerras
2019-06-03 5:53 ` Cédric Le Goater
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=20190528041711.ewohm2pdrya5ompz@oak.ozlabs.ibm.com \
--to=paulus@ozlabs.org \
--cc=aik@ozlabs.ru \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
/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