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 50D61C04A68 for ; Wed, 27 Jul 2022 11:00:46 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E/CQFVb2e4aLvooSKmamcrvsr6hh7YHHFI8psvrH8PA=; b=xNs5IvMcIP3Tky Dka6T+JawKxC7mbJ013/3iyDdgOKMporVR1/7KAa++axeH7PSI2v5ERfNrqGv9Qj9qeVmmI1PPNy/ /+ptuOWtp7VX6CAzlo2HEh5Y2FjCisdotrT8RMN1HVtmCUhJ1COEo6Jd9FPyKchiIVBpwmT1y41Df L1BCnRz/RGZGpZzEzO0ej+nU4xO6Wn6WBBqQEcQEmTakNfbDpI74unlvt2p75yQ/BMDw6Ztg5a44H 8AEPupZmxioSBnxE8vLbd2IVf0IyIjIq5Xce6pN9fzutvshuygRZRadAo4XTTgM5yQFr2mgNBnH2p cXUWFSjIM9wiw40i/sDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGelU-00CgE4-64; Wed, 27 Jul 2022 10:59:44 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGelM-00Cg7l-MX for linux-arm-kernel@lists.infradead.org; Wed, 27 Jul 2022 10:59:39 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B1757D6E; Wed, 27 Jul 2022 03:59:31 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 21C743F70D; Wed, 27 Jul 2022 03:59:30 -0700 (PDT) Date: Wed, 27 Jul 2022 12:00:10 +0100 From: Alexandru Elisei To: Oliver Upton Cc: Will Deacon , maz@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory Message-ID: References: <20220419141012.GB6143@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220727_035936_803855_8F4ED0AF X-CRM114-Status: GOOD ( 17.96 ) 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 Hi Oliver, On Tue, Jul 26, 2022 at 10:51:21AM -0700, Oliver Upton wrote: > Hi Alex, > > On Mon, Jul 25, 2022 at 11:06:24AM +0100, Alexandru Elisei wrote: > > [...] > > I'm also a bit confused on how we would manage to un-pin memory on the > way out with this. The guest is free to muck with the stage 1 and could > cause the SPU to spew a bunch of stage 2 aborts if it wanted to be > annoying. One way to tackle it would be to only allow a single > root-to-target walk to be pinned by a vCPU at a time. Any time a new > stage 2 abort comes from the SPU, we un-pin the old walk and pin the new > one instead. On the topic of memory unpinning, for a well behaved guest I belive that should be done the next time the buffer is pinned. The buffer can (and should!) be drained when both the buffer and sampling is disabled; unpinning the buffer when profiling becomes disabled would lead to unnecessary stage 2 faults when draining it. That approach also means that KVM wouldn't have to do anything special for SPE stage 2 faults. Thanks, Alex _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel