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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 6B7FFC43331 for ; Mon, 11 Nov 2019 06:55:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F044B21855 for ; Mon, 11 Nov 2019 06:55:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F044B21855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4C6296B0005; Mon, 11 Nov 2019 01:55:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 44EE96B0006; Mon, 11 Nov 2019 01:55:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 316B16B0007; Mon, 11 Nov 2019 01:55:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 1987B6B0005 for ; Mon, 11 Nov 2019 01:55:39 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id BEEF0180AD81D for ; Mon, 11 Nov 2019 06:55:38 +0000 (UTC) X-FDA: 76143085956.30.cork05_31342bd861b12 X-HE-Tag: cork05_31342bd861b12 X-Filterd-Recvd-Size: 5193 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 Nov 2019 06:55:37 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAB6pu4I023654 for ; Mon, 11 Nov 2019 01:55:36 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w71um9yrs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Nov 2019 01:55:36 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Nov 2019 06:55:33 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Nov 2019 06:55:30 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAB6tSXt62521470 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2019 06:55:28 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98A44A406B; Mon, 11 Nov 2019 06:55:28 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C994AA4065; Mon, 11 Nov 2019 06:55:25 +0000 (GMT) Received: from in.ibm.com (unknown [9.109.247.23]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 11 Nov 2019 06:55:25 +0000 (GMT) Date: Mon, 11 Nov 2019 12:25:22 +0530 From: Bharata B Rao To: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org, paulus@au1.ibm.com, aneesh.kumar@linux.vnet.ibm.com, jglisse@redhat.com, cclaudio@linux.ibm.com, linuxram@us.ibm.com, sukadev@linux.vnet.ibm.com, hch@lst.de Subject: Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest Reply-To: bharata@linux.ibm.com References: <20191104041800.24527-1-bharata@linux.ibm.com> <20191104041800.24527-7-bharata@linux.ibm.com> <20191111052806.GC4017@oak.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191111052806.GC4017@oak.ozlabs.ibm.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-TM-AS-GCONF: 00 x-cbid: 19111106-0028-0000-0000-000003B4CE29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111106-0029-0000-0000-00002477D4AF Message-Id: <20191111065522.GH21634@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-11-11_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911110066 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 11, 2019 at 04:28:06PM +1100, Paul Mackerras wrote: > On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: > > Add support for reset of secure guest via a new ioctl KVM_PPC_SVM_OFF. > > This ioctl will be issued by QEMU during reset and includes the > > the following steps: > > > > - Ask UV to terminate the guest via UV_SVM_TERMINATE ucall > > - Unpin the VPA pages so that they can be migrated back to secure > > side when guest becomes secure again. This is required because > > pinned pages can't be migrated. > > Unpinning the VPA pages is normally handled during VM reset by QEMU > doing set_one_reg operations to set the values for the > KVM_REG_PPC_VPA_ADDR, KVM_REG_PPC_VPA_SLB and KVM_REG_PPC_VPA_DTL > pseudo-registers to zero. Is there some reason why this isn't > happening for a secure VM, and if so, what is that reason? > If it is happening, then why do we need to unpin the pages explicitly > here? We were observing these VPA pages still remaining pinned during reset and hence subsequent paging-in of these pages were failing. Unpinning them fixed the problem. I will investigate and get back on why exactly these pages weren't gettting unpinned normally as part of reset. > > > - Reinitialize guest's partitioned scoped page tables. These are > > freed when guest becomes secure (H_SVM_INIT_DONE) > > It doesn't seem particularly useful to me to free the partition-scoped > page tables when the guest becomes secure, and it feels like it makes > things more fragile. If you don't free them then, then you don't need > to reallocate them now. Sure, I will not free them in the next version. Regards, Bharata.