public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Subject: Re: [PATCH] KVM: s390: add proper locking for CMMA migration bitmap
Date: Fri, 22 Dec 2017 14:38:02 +0100	[thread overview]
Message-ID: <8a3e9dae-42da-5750-0575-b4b04d3c90a2@de.ibm.com> (raw)
In-Reply-To: <20171222143536.0aee4d5b.cohuck@redhat.com>



On 12/22/2017 02:35 PM, Cornelia Huck wrote:
> On Fri, 22 Dec 2017 12:21:45 +0100
> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> 
>> Some parts of the cmma migration bitmap is already protected
>> with the kvm->lock (e.g. the migration start). On the other
>> hand the read of the cmma bits is not protected against a
>> concurrent free, neither is the emulation of the ESSA instruction.
>> Let's extend the locking to all related ioctls by using
>> the slots lock and wait for the freeing until all unlocked
>> users have finished (those hold kvm->srcu for read).
>>
>> Reported-by: David Hildenbrand <david@redhat.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> Cc: stable@vger.kernel.org # 4.13+
>> Fixes: 190df4a212a7 (KVM: s390: CMMA tracking, ESSA emulation, migration mode)
>> ---
>>  arch/s390/kvm/kvm-s390.c | 14 +++++++++-----
>>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> I'm way too confused by the locking rules to give this a good review
> before Christmas... do we have a general writeup somewhere?

The hiararchy is documented (Documentation/virtual/locking) but not the purpose
and what is locked by what. the slots_lock basically protects the memory slots
as it is used for memslot changes (normally you would use rcu but the mutex is
the big hammer to prevent concurrent memslot changes).


Lets defer this to after christmas. I will do a pull request for the other
2 patches.

  reply	other threads:[~2017-12-22 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 11:21 [PATCH] KVM: s390: add proper locking for CMMA migration bitmap Christian Borntraeger
2017-12-22 13:35 ` Cornelia Huck
2017-12-22 13:38   ` Christian Borntraeger [this message]
2018-01-08 13:56 ` Cornelia Huck
2018-01-23 16:43 ` Claudio Imbrenda

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=8a3e9dae-42da-5750-0575-b4b04d3c90a2@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@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