From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Subject: Re: [PATCH kernel v2 6/6] KVM: PPC: Add support for multiple-TCE hcalls Date: Fri, 12 Feb 2016 16:52:58 +1100 Message-ID: <20160212055258.GA6219@fergus.ozlabs.ibm.com> References: <1453361977-19589-1-git-send-email-aik@ozlabs.ru> <1453361977-19589-7-git-send-email-aik@ozlabs.ru> <20160211053206.GD9757@oak.ozlabs.ibm.com> <56BD657A.1020203@ozlabs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linuxppc-dev@lists.ozlabs.org, David Gibson , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Alexey Kardashevskiy Return-path: Received: from ozlabs.org ([103.22.144.67]:46904 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbcBLFxD (ORCPT ); Fri, 12 Feb 2016 00:53:03 -0500 Content-Disposition: inline In-Reply-To: <56BD657A.1020203@ozlabs.ru> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Feb 12, 2016 at 03:54:18PM +1100, Alexey Kardashevskiy wrote: > On 02/11/2016 04:32 PM, Paul Mackerras wrote: > >On Thu, Jan 21, 2016 at 06:39:37PM +1100, Alexey Kardashevskiy wrote: > >>+ rmap = (void *) vmalloc_to_phys(rmap); > >>+ > >>+ lock_rmap(rmap); > > > >A comment here explaining why we lock the rmap and what that achieves > >would be useful for future generations. > > > /* This protects the guest page with the TCE list from going away while we > are reading TCE list */ > > ? > > By "going away" I mean H_ENTER/H_REMOVE executed on parallel CPUs, is this > roughly correct? as I did grep for "lock_rmap()" and did not find a single > comment next to it... Actually, taking the rmap lock stops the guest real -> host real mapping from changing. For the comment, I suggest this: /* * Synchronize with the MMU notifier callbacks in * book3s_64_mmu_hv.c (kvm_unmap_hva_hv etc.). * While we have the rmap lock, code running on other CPUs * cannot finish unmapping the host real page that backs * this guest real page, so we are OK to access the host * real page. */ Paul.