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 289DAC433F5 for ; Tue, 19 Apr 2022 15:02:10 +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=+NlT5TZi9VL564AX1BV2CcnXQuXLE/ivTJXLSf71Ywo=; b=hC7ID17qhN0jcm bUh9t5jHgEAM1x3tvjzh52FKU/JQyfK2O17OIrZbOZuO9f9gCeEFuimwBP/JVGmtSeCz12pX5RmGZ R2HU7uTYs0XuhpRnSZ4r1iWWlqEiinKxXE0Baydp4QCgIjzwiXdtN6Sl0LvqFh5VF43RMQYB/ihYg 2BKrPVkgQiAJvbSdgb/CXOWmw+mXsRgSxnU7ofmRtJcGd3d9lEvK6djAk1Y4D88v3TbwchU7D/0I6 z7g1YfeDNsFEj67fnu+daP35WUI4FCZv3b9PVhWcT/Uic/W4TlfuLhyyJlUDhcSui/XC2EH90ZuMv ruBOROgs2+x+uFa00nsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngpKZ-004TOA-3w; Tue, 19 Apr 2022 14:59:52 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngoYi-0049Jk-PG for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 14:10:26 +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 sin.source.kernel.org (Postfix) with ESMTPS id 30C07CE18A1; Tue, 19 Apr 2022 14:10:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01113C385A7; Tue, 19 Apr 2022 14:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650377418; bh=0nhux9KiEQromYdtSaEzV3I8DtuQ8Z93gboBBQUEsII=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kIjXlrleNlWbfTMc/WrsLg7Aq6KO+8LJgLS/1qHc1KjSoAyrC9jZe8G0OcllHklab lsb5vvk8qGI2ZH0/3ZkF2IEwQLx2C3JS8cf2Fx+tCLpLyyvKvqCoum2SDmrQVy05Dl RaOLB2LhCGaYQEVs4r7xNpa6yZ5RHVYHs08B/WJJHS3RDyHxL4LwFpAi5uVfw6sHM1 CWWEQ+DBkv9o2rml8LVrWprZytzQVnRRRVVSNt4pS1gs6jSSAilHJzRE7UQKIaKGMz 8agkIsbe8w5lWwI8AsSz1kdu0lLFSR+z4CfFAmbvvdvZpU/8NowOJywAX646wU1iLt +B2llkGoneNlw== Date: Tue, 19 Apr 2022 15:10:13 +0100 From: Will Deacon To: Alexandru Elisei Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu Subject: Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory Message-ID: <20220419141012.GB6143@willie-the-truck> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220419_071025_061193_08DCCCD3 X-CRM114-Status: GOOD ( 19.60 ) 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, Apr 19, 2022 at 02:51:05PM +0100, Alexandru Elisei wrote: > The approach I've taken so far in adding support for SPE in KVM [1] relies > on pinning the entire VM memory to avoid SPE triggering stage 2 faults > altogether. I've taken this approach because: > > 1. SPE reports the guest VA on an stage 2 fault, similar to stage 1 faults, > and at the moment KVM has no way to resolve the VA to IPA translation. The > AT instruction is not useful here, because PAR_EL1 doesn't report the IPA > in the case of a stage 2 fault on a stage 1 translation table walk. > > 2. The stage 2 fault is reported asynchronously via an interrupt, which > means there will be a window where profiling is stopped from the moment SPE > triggers the fault and when the PE taks the interrupt. This blackout window > is obviously not present when running on bare metal, as there is no second > stage of address translation being performed. Are these faults actually recoverable? My memory is a bit hazy here, but I thought SPE buffer data could be written out in whacky ways such that even a bog-standard page fault could result in uncoverable data loss (i.e. DL=1), and so pinning is the only game in town. A funkier approach might be to defer pinning of the buffer until the SPE is enabled and avoid pinning all of VM memory that way, although I can't immediately tell how flexible the architecture is in allowing you to cache the base/limit values. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel