Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2534911rwb; Fri, 2 Dec 2022 11:05:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4zLCwmSRRsCl7qOJiSWv6jhLh3pkIM/lOVL8UwQJbRAgCr797n94jIynhQaCLhz/dQ4XXF X-Received: by 2002:a17:906:c0c:b0:78d:77b1:a433 with SMTP id s12-20020a1709060c0c00b0078d77b1a433mr60928346ejf.486.1670007920513; Fri, 02 Dec 2022 11:05:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670007920; cv=none; d=google.com; s=arc-20160816; b=jojiBWne2ImLTBiam0BgW+kgyOSDlt4+GAUZDTliozhm3tsPtl4ZDicqwo2QRSoN1r op1mM3Ij+mAhUy6ifIkyVQOnyWz/BRVffKOekG0lApxTAVWKhLpNtqi2J+BWstCqx8dz 2WvKXUhbfMNRgUpreMmaxLRm5WDdyadsHwXxz+8p+q9CMf6MKZSvNMei7Mm7gQvC7Ynm bXq2wiqdYgJ3Sw9GuzEyIDd8JD+e6IU8HEeNHOMS/XmyeGRO4y2BlFuUbjAnI5EmclRI TDX5+TLHrfZiT+27NR+cVJ6kV73s/7GjF0okSAYxM7nuRh0jPlGl4k4EnP40F8Lb9K5M Zm3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9ZCh4EK+ILrdNiTkDxgoQos8GcG756fNB3ErlzEuT8I=; b=AdhB7MB2c7/gNhE22TK/QOGgXuUCbwR/bAy3hW7Sf4ztXR7kawHbtgGx/PTUG3q7Ns yWrIlEEADq6WF1I3FIKbR8GUiaaVWzUqSVy7YzzeGC57H2cdWi/RgKWP2DfxypwtiVAb pYaceUsAfA1LZiv50JvzPKtQUELTl1eY34DghfL8KYOL7OvXeDDcW4GB2R0/Nt3RFKp4 qqHBIrLnhF84mOJJQ+LHnbkWaCZOGa9oNmNjsh2VaWF0gXhZrT3L7z75lgPT7ETef/h6 suWammCY/65BA+eIeQ+uCbhhQK3agJ6jR8F10A0mHtUvHVIiHSXSqhP+bWBwRdf1JaZi aJTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="oIRtW/qt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a056402190600b00468cd2ab847si6943231edz.172.2022.12.02.11.05.00; Fri, 02 Dec 2022 11:05:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="oIRtW/qt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234705AbiLBSwm (ORCPT + 82 others); Fri, 2 Dec 2022 13:52:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234655AbiLBSw0 (ORCPT ); Fri, 2 Dec 2022 13:52:26 -0500 Received: from out-137.mta0.migadu.com (out-137.mta0.migadu.com [IPv6:2001:41d0:1004:224b::89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6901EE344D for ; Fri, 2 Dec 2022 10:52:25 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1670007143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ZCh4EK+ILrdNiTkDxgoQos8GcG756fNB3ErlzEuT8I=; b=oIRtW/qtFE+f4BRGQbkhz9LDxzzx4jHeyI9Kr0i7Q8X237Bcpai7BotPaX/3hUG5tesQIk cEyEUI31AfdEY2A3AHbp0YGJ75fHka73HJXRL0JgsS4pFl9SRkWSiwXdZxTV0TuRmHmuEf YhFScCjKQgwpM8fNDDxvtEDM8wq+Q8E= From: Oliver Upton To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, Ricardo Koller , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] KVM: arm64: Don't serialize if the access flag isn't set Date: Fri, 2 Dec 2022 18:51:54 +0000 Message-Id: <20221202185156.696189-5-oliver.upton@linux.dev> In-Reply-To: <20221202185156.696189-1-oliver.upton@linux.dev> References: <20221202185156.696189-1-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Of course, if the PTE wasn't changed then there are absolutely no serialization requirements. Skip the DSB for an unsuccessful update to the access flag. Signed-off-by: Oliver Upton --- arch/arm64/kvm/hyp/pgtable.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 204e59e05674..aa36d896bd8c 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -1116,10 +1116,14 @@ int kvm_pgtable_stage2_wrprotect(struct kvm_pgtable *pgt, u64 addr, u64 size) kvm_pte_t kvm_pgtable_stage2_mkyoung(struct kvm_pgtable *pgt, u64 addr) { kvm_pte_t pte = 0; - stage2_update_leaf_attrs(pgt, addr, 1, KVM_PTE_LEAF_ATTR_LO_S2_AF, 0, - &pte, NULL, - KVM_PGTABLE_WALK_HANDLE_FAULT); - dsb(ishst); + int ret; + + ret = stage2_update_leaf_attrs(pgt, addr, 1, KVM_PTE_LEAF_ATTR_LO_S2_AF, 0, + &pte, NULL, + KVM_PGTABLE_WALK_HANDLE_FAULT); + if (!ret) + dsb(ishst); + return pte; } -- 2.39.0.rc0.267.gcb52ba06e7-goog