From patchwork Fri Dec 2 18:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 29080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1023318wrr; Fri, 2 Dec 2022 11:03:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zLqoxDek0twCfIoYuAqC9hENo+k1swfkN6lc1Fqi4IFKljykYwyqI5Eod2fEKbgl7OxJj X-Received: by 2002:a05:6402:4c2:b0:461:3ae6:8bf2 with SMTP id n2-20020a05640204c200b004613ae68bf2mr11590913edw.396.1670007793660; Fri, 02 Dec 2022 11:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670007793; cv=none; d=google.com; s=arc-20160816; b=GqAo+Hh06XmAIyzR8N++flFrjKnLAtQW4+3xrEXmAzNYFrcnq2xGfP2wF+uIxtWqiD J5rch7/76KlF0htTHuN/JA4k44vTZBoSqTMemeNsUhtJRTnkJhy0285m6ADdoZ5M7krG E0Kc8yiI9UuhH80obcfKjnCr42mKvtY2y025CbBGAEmhVg372nfDxREWP7A0Xt+gBN/W TCuldvC2n4wXLj82Rd6pDQyWTv4zCFhyVeTneQCbDXhvUuqDNBw2C+4Duuj77ZtG6plF dQvpP2EqonyjOkDvMavsjq3Mb4yu3CyAmM+d3VNM3IAdwgbe+6qIkhyXi8EzTMKE4nrI pi4g== 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=p0G2k7kswoLiP2SpEr1E5NK57Rotg3EVnFBgR0I4F3I=; b=E4zTk21RD/PKpE01+Jn25osjnEVFc5/NNoRUCZAqil7eSqPzRCeU1tw2MTPQv2sRmt xHsihG93Osi5jv7ibIWPkkbT1EsI2tbn28dvMcg202SNUDj/DhdmtiifN/1lFNN+8hBz zEp1WC2fltE49Kv4r+MKQZormSD3Gt3/Er1PS4HP2k9++v3xtS1FUSzz7uxErq+CFcll WvogoXIoRfbmmsaqxXUfMixHolyCPm34y6cTRWiNozqqGmDnLJ0vnJl12rNBjZGLEBaX 3VjHEwXwNOjKxTV1b2oV/T9/HtzF33a4bBE6ecr26PexTi1drFG6gO2vlPGev0jBYSWM OLSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="eCd/6YTI"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020aa7d992000000b0046ab57f617bsi5766487eds.633.2022.12.02.11.02.44; Fri, 02 Dec 2022 11:03:13 -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="eCd/6YTI"; 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 S234680AbiLBSw2 (ORCPT + 99 others); Fri, 2 Dec 2022 13:52:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234424AbiLBSwW (ORCPT ); Fri, 2 Dec 2022 13:52:22 -0500 Received: from out-32.mta0.migadu.com (out-32.mta0.migadu.com [91.218.175.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58148E2FD6 for ; Fri, 2 Dec 2022 10:52:22 -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=1670007140; 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=p0G2k7kswoLiP2SpEr1E5NK57Rotg3EVnFBgR0I4F3I=; b=eCd/6YTIdgNLrnwSwiWJGcww3hgEmBKfKAvGafrp8UOmQ8M7RWmBMHLU7/9MoNFNay6G8S yVt6FFkHbzpvEXwXFLXVaUFyS2MFoJgmVsptp5ChP1IWoXkjs0rfzAUfwQcr+ReyjY+0v2 sdb951ZVTYiLT9uRYhjOv9fbV9xgyvo= 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 3/6] KVM: arm64: Return EAGAIN for invalid PTE in attr walker Date: Fri, 2 Dec 2022 18:51:53 +0000 Message-Id: <20221202185156.696189-4-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 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=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751130092096377756?= X-GMAIL-MSGID: =?utf-8?q?1751130092096377756?= Return EAGAIN for invalid PTEs in the attr walker, signaling to the caller that any serialization and/or invalidation can be elided. Signed-off-by: Oliver Upton --- arch/arm64/kvm/hyp/pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 98818214a479..204e59e05674 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -1048,7 +1048,7 @@ static int stage2_attr_walker(const struct kvm_pgtable_visit_ctx *ctx, struct kvm_pgtable_mm_ops *mm_ops = ctx->mm_ops; if (!kvm_pte_valid(ctx->old)) - return 0; + return -EAGAIN; data->level = ctx->level; data->pte = pte;