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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D6D4C433EF for ; Tue, 15 Feb 2022 12:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c+cOyAJYPbNbr5I1W1E8VgpRsRHYl5e8ypXSN/NbQSs=; b=EJ3uMtLHmHI2Yy EaBcOGDXYChwxCxmpe55PrMncey/xEv4AzZduHf4iYlvqrN7VIgPy0krl3YBkPw8MRVINo24EQLOq RhelEDWqc3LfdmwK5oC1/+chFh59lN3UceI67jd7Cb1hoXsZEX6YMZ+4NKMa4K3kwBoBYegOpqu9z mLX4GDkTdxccyULACsO92zEx8d1vetlgfTTkhATS4xmbfZha7JZDtgYS1nmiWCSSvpq0yW8JfFFT0 k3GTdX1K+dO039yJO+oMdVSRTJFz2bzYUrXiOEXOlMy7fR2+ECTjV0iTYOb7BvEnskBooYqmLK/ys cvSBokoSS5/qud2Z725Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJwXT-002dQb-L1; Tue, 15 Feb 2022 12:02:35 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJwXP-002dPl-F5 for linux-arm-kernel@lists.infradead.org; Tue, 15 Feb 2022 12:02:32 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CF6961615; Tue, 15 Feb 2022 12:02:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1305C340EB; Tue, 15 Feb 2022 12:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644926548; bh=s21r4dvSoHmp4TFK+Gvvi3g9+TCZtq/B77jgoG4D1Oo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hhjH34OTmoQ80EVAmuOnjxPcB1CWtcPJJhkjshBsIWwwZVFkDMzcHwoWmfzOUGMmj jnasDFhjf4r8sdAm7aa7U8psXD1+KOTrAJTF6Qty1vfWXk9T80klEy4EzfTClFhGEe tIUDZ86xWXnWJQtUOPBdAUC5gbPCdqvVfitavRqBlzcMS1pS6ioMW3lVEGCzQwQi1b 9NZbknLNN/uPp8yp/esMSRrKNd99Z15MuCWnyE+nAV9S8OZorQqsNzbButofsRY9bL Ljz7ikYKm1i84KmIspMEIVKr5IPcX5byy2CMVFE2MvdTr8VKnSC7MOEf4Fet9OPTrL /SjV8smIzklhg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nJwXK-0082Zt-L7; Tue, 15 Feb 2022 12:02:26 +0000 Date: Tue, 15 Feb 2022 12:02:26 +0000 Message-ID: <87ee4449t9.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: Reiji Watanabe , James Morse , Suzuki K Poulose , Linux ARM , kvmarm@lists.cs.columbia.edu, Will Deacon , Mark Rutland Subject: Re: [RFC PATCH v5 02/38] KVM: arm64: Add lock/unlock memslot user API In-Reply-To: References: <20211117153842.302159-1-alexandru.elisei@arm.com> <20211117153842.302159-3-alexandru.elisei@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, reijiw@google.com, james.morse@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, will@kernel.org, mark.rutland@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220215_040231_627403_4ED07DCD X-CRM114-Status: GOOD ( 23.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 15 Feb 2022 11:03:59 +0000, Alexandru Elisei wrote: > > > If a memslot with read/write permission is locked with read only, > > and then unlocked, can userspace expect stage 2 mapping for the > > memslot to be updated with read/write ? > > Locking a memslot with the read flag would map the memory described by the > memslot with read permissions at stage 2. When the memslot is unlocked, KVM > won't touch the stage 2 entries. > > When the memslot is unlocked, the pages (as in, struct page) backing the VM > memory as described by the memslot are unpinned. Then the host's MM subsystem > can treat the memory like any other pages (make them old, new, unmap them, do > nothing, etc), and the MMU notifier will take care of updating the stage 2 > entries as necessary. > > I guess I should have been more precise in the description. I'll > change "causes the memory pinned when locking the memslot specified > in args[0] to be unpinned" to something that clearly states that the > memory in the host that backs the memslot is unpinned. > > > Can userspace delete the memslot that is locked (without unlocking) ? > > No, it cannot. > > > If so, userspace can expect the corresponding range to be implicitly > > unlocked, correct ? > > Userspace must explicitely unlock the memslot before deleting it. I want > userspace to be explicit in its intent. Does it get in the way of making this robust wrt userspace being killed (or terminating without unlock first)? M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel