Message ID | 20230608220558.39094-2-ctshao@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 EFB67C7EE25 for <linux-arm-kernel@archiver.kernel.org>; Thu, 8 Jun 2023 22:06:51 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZuS7zuXAHDYgdKg7H/4Zq15GSOfyex5coAMJUdk1dUg=; b=V2TXPsr9Oq8z/0ob/oIEgsqfj8 7PROdEcs1yyucBENif3UUCqgDEmG0hxnrBXcI4AYi3Pq2OC1mjAudD3P+JZIF2C36/OcBfmyXNq33 xOQOI6BmKgnk2q2Hh39rF1+xYuCDr9ivJksn5fmj+TjmVznwODmzyHj2jvcn4i/sDxoWcrGvihXJg qjPWs9KNmNvbf0qWMMK6GmPjZyYuveDRg4JodJ8Nt7ytIsBXP6Or3mq6eM/o4xHQk956JOrsMgOBx GIiLMLmJW5M7OJlJTO3QaVGcvdQQ0JbeTNA/KvoUfFbyouyivp2EbKlezs9VMlsuNkFJXfzmXs0ga fY74FpGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7Nm1-00Aktk-0w; Thu, 08 Jun 2023 22:06:29 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7Nlz-00AksJ-0X for linux-arm-kernel@lists.infradead.org; Thu, 08 Jun 2023 22:06:28 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-ba87bd29e9dso1572060276.3 for <linux-arm-kernel@lists.infradead.org>; Thu, 08 Jun 2023 15:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686261982; x=1688853982; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=tdKizssFsMQJzj8/wSt0vRuPFuTT8IrX+6c5/ZqQtUU=; b=pYi5twzK16pe/u6UpDUsq5/gZ7VstFYaQpSoVInd6hIj+oSGhYPXPylVFxcNSuyTfw wCt/PuskPgVKlLP4RTlX1/zs0+7HkXHCX4XS7if1kU6ECFkPaPA6XhFNVqu9JjsX2WO/ 6WqFpH3dBOcrzKhywdtBIapeXoWXFx6aay6wJ/Qn7Ov7MwhcjCvIcth7YseBLy8rA6Ov 3DWI59xmNFppvf7woPF6SLT4FB7lfdwPzuUsRo9pwvg0hPnS8pOlnHx7+zVUdbb0FVld p5m22USbLg8gn8rqzTBnF1FE/reHbyRKFfM6g+eovhC7zK7inCcLfL8yF7dcAeB22C5F IZfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686261982; x=1688853982; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tdKizssFsMQJzj8/wSt0vRuPFuTT8IrX+6c5/ZqQtUU=; b=ZIdkcCMGezj1umJ1PQCp4YwBwBgPmpvqX7RAZywVjbRDCP+7qD+vVKxEcs4htLQehw 0HjLrfxDKJDR5gejdE6ik+Oh+X3qMU73Lu51mjGYW9lMbAG9M8DWkgRD3qkqMjxzKh+s fQRy4jf5XxkGDHMBPqEVIklERYfEaAsodLKapNW+9pTB7THq8P6XFRILIJkIw1wvBtR2 rScoAEFVs0kaDryRxDF0ddNpR9h4zpNl+91mzK7N7+BWcK6yxckhFkstnxUDZYnD5NZw lPJAETalwyncIvjoaTac7jZzNC89LHsDUIBWULnPWK22RjQzptu3Tp+mQPzTeZX61FWz usSA== X-Gm-Message-State: AC+VfDyjuqfYuDfM809KEi922Rj1dGEyBPMFcm+beFm+HQOkFLKwpWfD JJ+UKMkZGnb2URLT161eKWejfcxCF4k= X-Google-Smtp-Source: ACHHUZ4KfiB8l1+dUoVGrkHr93Y38MLg1AxejqBfztTpsuysMtbSy6a+JxAixUHY2sVHAQ46IvK3wvSRaY8= X-Received: from colette.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:5cff]) (user=ctshao job=sendgmr) by 2002:a05:6902:691:b0:ba8:1f20:ff4f with SMTP id i17-20020a056902069100b00ba81f20ff4fmr517992ybt.12.1686261982675; Thu, 08 Jun 2023 15:06:22 -0700 (PDT) Date: Thu, 8 Jun 2023 15:05:39 -0700 In-Reply-To: <20230608220558.39094-1-ctshao@google.com> Mime-Version: 1.0 References: <20230608220558.39094-1-ctshao@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230608220558.39094-2-ctshao@google.com> Subject: [PATCH v1 2/3] KVM: arm64: Only initiate walk if page_count() > 1 in free_removed_table() From: Chun-Tse Shao <ctshao@google.com> To: linux-kernel@vger.kernel.org, yuzhao@google.com, oliver.upton@linux.dev Cc: Chun-Tse Shao <ctshao@google.com>, Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Zenghui Yu <yuzenghui@huawei.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Ben Gardon <bgardon@google.com>, Gavin Shan <gshan@redhat.com>, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230608_150627_207789_E516E10B X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v1,1/3] KVM: arm64: Consistently use free_removed_table() for stage-2
|
expand
|
diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index cc1af0286755..d8e570263388 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -1319,5 +1319,6 @@ void kvm_pgtable_stage2_free_removed(struct kvm_pgtable_mm_ops *mm_ops, void *pg .end = kvm_granule_size(level), }; - WARN_ON(__kvm_pgtable_walk(&data, mm_ops, ptep, level + 1)); + if (mm_ops->page_count(pgtable) > 1) + WARN_ON(__kvm_pgtable_walk(&data, mm_ops, ptep, level + 1)); }
Page table walk is unnecessary in free_removed_table() being called from the stage-2 unmap path while PTEs on the table is empty. It can be fast-pathed by only initiating a walk if page_count() > 1 Original disussion can be found in: https://lore.kernel.org/kvmarm/ZHfWzX04GlcNngdU@linux.dev/ Suggested-by: Yu Zhao <yuzhao@google.com> Suggested-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Chun-Tse Shao <ctshao@google.com> --- arch/arm64/kvm/hyp/pgtable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)