From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16DE2C433E0 for ; Wed, 3 Jun 2020 13:27:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C499B20679 for ; Wed, 3 Jun 2020 13:27:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C499B20679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=us.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49cV8H2G1lzDqc3 for ; Wed, 3 Jun 2020 23:27:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=us.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=linuxram@us.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49cV5q59k3zDq5k for ; Wed, 3 Jun 2020 23:25:35 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 053D4GO3046338; Wed, 3 Jun 2020 09:25:28 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 31e3kqgp56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Jun 2020 09:25:27 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 053DKGN8007367; Wed, 3 Jun 2020 13:25:25 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 31bf4804ba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Jun 2020 13:25:25 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 053DPM2P13042014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 3 Jun 2020 13:25:22 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A31142041; Wed, 3 Jun 2020 13:25:22 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 589CB42042; Wed, 3 Jun 2020 13:25:19 +0000 (GMT) Received: from oc0525413822.ibm.com (unknown [9.211.130.237]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 3 Jun 2020 13:25:19 +0000 (GMT) Date: Wed, 3 Jun 2020 06:25:16 -0700 From: Ram Pai To: Laurent Dufour Subject: Re: [PATCH v1 4/4] KVM: PPC: Book3S HV: migrate hot plugged memory Message-ID: <20200603132516.GA5423@oc0525413822.ibm.com> References: <1590892071-25549-1-git-send-email-linuxram@us.ibm.com> <1590892071-25549-5-git-send-email-linuxram@us.ibm.com> <1df25542-1977-fad4-c56d-b6b2c40a6852@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1df25542-1977-fad4-c56d-b6b2c40a6852@linux.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-03_12:2020-06-02, 2020-06-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 cotscore=-2147483648 bulkscore=0 clxscore=1015 suspectscore=2 mlxscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006030103 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ram Pai Cc: cclaudio@linux.ibm.com, kvm-ppc@vger.kernel.org, bharata@linux.ibm.com, aneesh.kumar@linux.ibm.com, sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, bauerman@linux.ibm.com, david@gibson.dropbear.id.au Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Jun 02, 2020 at 10:31:32AM +0200, Laurent Dufour wrote: > Le 31/05/2020 à 04:27, Ram Pai a écrit : > >From: Laurent Dufour > > > >When a memory slot is hot plugged to a SVM, GFNs associated with that > >memory slot automatically default to secure GFN. Hence migrate the > >PFNs associated with these GFNs to device-PFNs. > > > >uv_migrate_mem_slot() is called to achieve that. It will not call > >UV_PAGE_IN since this request is ignored by the Ultravisor. > >NOTE: Ultravisor does not trust any page content provided by > >the Hypervisor, ones the VM turns secure. > > > >Cc: Paul Mackerras > >Cc: Benjamin Herrenschmidt > >Cc: Michael Ellerman > >Cc: Bharata B Rao > >Cc: Aneesh Kumar K.V > >Cc: Sukadev Bhattiprolu > >Cc: Laurent Dufour > >Cc: Thiago Jung Bauermann > >Cc: David Gibson > >Cc: Claudio Carvalho > >Cc: kvm-ppc@vger.kernel.org > >Cc: linuxppc-dev@lists.ozlabs.org > >Signed-off-by: Ram Pai > > (fixed merge conflicts. Modified the commit message) > >Signed-off-by: Laurent Dufour > >--- > > arch/powerpc/include/asm/kvm_book3s_uvmem.h | 4 ++++ > > arch/powerpc/kvm/book3s_hv.c | 11 +++++++---- > > arch/powerpc/kvm/book3s_hv_uvmem.c | 3 +-- > > 3 files changed, 12 insertions(+), 6 deletions(-) > > > >diff --git a/arch/powerpc/include/asm/kvm_book3s_uvmem.h b/arch/powerpc/include/asm/kvm_book3s_uvmem.h > >index f0c5708..2ec2e5afb 100644 > >--- a/arch/powerpc/include/asm/kvm_book3s_uvmem.h > >+++ b/arch/powerpc/include/asm/kvm_book3s_uvmem.h > >@@ -23,6 +23,7 @@ unsigned long kvmppc_h_svm_page_out(struct kvm *kvm, > > void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free, > > struct kvm *kvm, bool skip_page_out, > > bool purge_gfn); > >+int uv_migrate_mem_slot(struct kvm *kvm, const struct kvm_memory_slot *memslot); > > #else > > static inline int kvmppc_uvmem_init(void) > > { > >@@ -78,5 +79,8 @@ static inline int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn) > > kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free, > > struct kvm *kvm, bool skip_page_out, > > bool purge_gfn) { } > >+ > >+static int uv_migrate_mem_slot(struct kvm *kvm, > >+ const struct kvm_memory_slot *memslot); > > That line was not part of the patch I sent to you! Your patch is rebased on top of my patches. This prototype declaration is for the ifndef CONFIG_PPC_UV case. > > > > #endif /* CONFIG_PPC_UV */ > > #endif /* __ASM_KVM_BOOK3S_UVMEM_H__ */ > >diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > >index 4c62bfe..604d062 100644 > >--- a/arch/powerpc/kvm/book3s_hv.c > >+++ b/arch/powerpc/kvm/book3s_hv.c > >@@ -4516,13 +4516,16 @@ static void kvmppc_core_commit_memory_region_hv(struct kvm *kvm, > > case KVM_MR_CREATE: > > if (kvmppc_uvmem_slot_init(kvm, new)) > > return; > >- uv_register_mem_slot(kvm->arch.lpid, > >- new->base_gfn << PAGE_SHIFT, > >- new->npages * PAGE_SIZE, > >- 0, new->id); > >+ if (uv_register_mem_slot(kvm->arch.lpid, > >+ new->base_gfn << PAGE_SHIFT, > >+ new->npages * PAGE_SIZE, > >+ 0, new->id)) > >+ return; > >+ uv_migrate_mem_slot(kvm, new); > > break; > > case KVM_MR_DELETE: > > uv_unregister_mem_slot(kvm->arch.lpid, old->id); > >+ kvmppc_uvmem_drop_pages(old, kvm, true, true); > > Again that line has been changed from the patch I sent to you. The > last 'true' argument has nothing to do here. yes. i did add another parameter to kvmppc_uvmem_drop_pages() in my patch series. So had to adapt your patch to operate on top my mine. > > Is that series really building? yes. it built for me. RP