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 AE80DC433FE for ; Wed, 30 Nov 2022 08:22:35 +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=BjFYxIGHycnCqq/M7FfLBI+hWffAzI4Nn7NH9d1tft0=; b=EyvVajqfjqb6G1 wpF0h/7CNNNOnyAvL6ZGmHtwrWLaYNwOTxzg3QaYMTvNx4H0bGZ8C+ygGzaIXabcM3jCueWi4jI45 p1U46pbDSWIqmKgTIeysO99MmqB71wne8csdg8D+Jxc5ETwD286PEYleZFxtfzhnFzkoSgjfD6gQj 9bbQvyCEdhsk8hU8g20pGFDaUbFEaOLlsQXcx7MPU/llrDKXOJvwuRB1og6TOCZ8Htqa5h1YY7/FJ HDEPcNhf/pUVZzf75euCBJLxUzQBmOW2czd3cM73gf3QiE8WB3x51CsK1jCSCnOuXM+v7aR06BYt4 V5bNktAxLSlVdQXVorYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0ILc-00ETTg-9n; Wed, 30 Nov 2022 08:21:40 +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 1p0ILX-00ETRI-VU for linux-arm-kernel@lists.infradead.org; Wed, 30 Nov 2022 08:21:37 +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 217FACE1626; Wed, 30 Nov 2022 08:21:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D5D6C433D6; Wed, 30 Nov 2022 08:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669796492; bh=YVwFW8ukFc+IWgIXWj/9MV56uKwQlCK2O51RttnjsSU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XYccEQE2rG2H1YWBiPcP0nHSASIeJGHz3yVc3OT1lb/hZxxmiK7Z0783XIRtx+rLK uqJ8E7Cu8+fNMFdCHqiFJfLLywmxTSC9sdTLxA1y9tFrrSHu7IIgWOSBxL3A/QFEXs 3VBkhbGnWuxNeyyLsJ4aga7pANlntiFNWyx/JhSs1YKTYWt0EozKM4h4ClP7Pz9udz 7lffzkqLx2NjLkqB7TQkJ3bXVvk7iYqEzKnKgqV+nja7GQZOrGjqXP0f8OwJU4L+Hv EKIwgmYu8ngvdlKj1HvhnEWBgU6GY/B2w5SsgOc8fL2CdmgDpOfPnsx/9oIcSMSd72 S0EhDDZ31eF2A== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p0ILR-009X1T-Rc; Wed, 30 Nov 2022 08:21:30 +0000 Date: Wed, 30 Nov 2022 08:21:17 +0000 Message-ID: <87pmd4ua2q.wl-maz@kernel.org> From: Marc Zyngier To: Ricardo Koller Cc: Oliver Upton , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] KVM: arm64: Don't serialize if the access flag isn't set In-Reply-To: References: <20221129191946.1735662-1-oliver.upton@linux.dev> <20221129191946.1735662-3-oliver.upton@linux.dev> 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.104.136.29 X-SA-Exim-Rcpt-To: ricarkol@google.com, oliver.upton@linux.dev, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org 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-20221130_002136_392638_96762B99 X-CRM114-Status: GOOD ( 27.28 ) 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 Wed, 30 Nov 2022 01:23:20 +0000, Ricardo Koller wrote: > > On Tue, Nov 29, 2022 at 09:15:21PM +0000, Oliver Upton wrote: > > Hi Ricardo, > > > > Thanks for having a look. > > > > On Tue, Nov 29, 2022 at 12:52:12PM -0800, Ricardo Koller wrote: > > > On Tue, Nov 29, 2022 at 07:19:44PM +0000, Oliver Upton wrote: > > > > [...] > > > > > > + ret = stage2_update_leaf_attrs(pgt, addr, 1, KVM_PTE_LEAF_ATTR_LO_S2_AF, 0, > > > > + &pte, NULL, 0); > > > > + if (!ret) > > > > + dsb(ishst); > > > > > > At the moment, the only reason for stage2_update_leaf_attrs() to not > > > update the PTE is if it's not valid: > > > > > > if (!kvm_pte_valid(pte)) > > > return 0; > > > > > > I guess you could check that as well: > > > > > > + if (!ret || kvm_pte_valid(pte)) > > > + dsb(ishst); > > > > Thanks for catching this. > > > > Instead of pivoting on the returned PTE value, how about we return > > -EAGAIN from the early return in stage2_attr_walker()? It would better > > match the pattern used elsewhere in the pgtable code. > > That works, although I would use another return code (e.g., EINVAL)? as > that's not exactly a "try again" type of error. EINVAL usually is an indication of something that went horribly wrong. But is that really a failure mode? Here, failing to update the PTE should not be considered a failure, but just a benign race: access fault being taken on a CPU and the page being evicted on another (not unlikely, as the page was marked old before). And if I'm correct above, this is definitely a "try again" situation: you probably won't take the same type of fault the second time though. Thanks, 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