From patchwork Fri Oct 27 11:56:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13438564 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 661D8C25B67 for ; Fri, 27 Oct 2023 11:57:16 +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:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ib96W8PmR5d/4t6SWan9gODA3UdwUoVhYvZCMKRrCC4=; b=YaKA2HDTA1GjaK UmFI8f2YUXUakZdeqHG4urvUH4Q+0MY1PWL3fYNvVCS/S7H+QvHvZGAYbC3Xu3Wx8zZaSRcap2V8B D9Rpq6jhU2AgeWz01gkCruhrBCVNBUkaBApvbn+mkTA7UZH9Y6D1yJx8Piqzn6g0aRp0P9x/d6Qu7 vCHOxjoOEwdBTCfgCOKCXhn2z9jjpslFgSdyBBpgLyR6VKFWPUfjlEguK3wy9YYH/fK82U4jdiCB9 FuLCFD1E11iUJ1SEu2Udcjs+HjYRZa0OdtNVf6yT5/50qdR9rZFDWXA+V1f9TANv5L3ZgvrbXaPhA Q0VffgBqJB7T513BTz1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwLSP-00GLDs-2l; Fri, 27 Oct 2023 11:56:53 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwLSM-00GLBs-0k for linux-arm-kernel@lists.infradead.org; Fri, 27 Oct 2023 11:56:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6BB811424; Fri, 27 Oct 2023 04:57:25 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D65D03F738; Fri, 27 Oct 2023 04:56:41 -0700 (PDT) From: Ryan Roberts To: Ard Biesheuvel , Ard Biesheuvel , Will Deacon , Catalin Marinas , Marc Zyngier , Oliver Upton , Mark Rutland , Anshuman Khandual , Kees Cook , Joey Gouly , Suzuki K Poulose , James Morse , Zenghui Yu Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: [RFC PATCH v1 0/3] Update tlb invalidation routines for FEAT_LPA2 Date: Fri, 27 Oct 2023 12:56:31 +0100 Message-Id: <20231027115634.1432154-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231027_045650_318154_7CFFD3AB X-CRM114-Status: GOOD ( 15.61 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi All, As raised yesterday against Ard's LPA2 series [1], we need to address the TLBI changes to properly support LPA2 before Ard's changes get merged. So far those changes have been part of my KVM LPA2 series [2]. So this is an attempt to split the TLBI changes to make them independent. The idea is that this series would go in first, then Ard's and the rest of my series can race eachother and it doesn't really matter who wins. I've attempted to address all of Marc's feedback against the versions of these patches posted at [2], including adding benchmark data (see patch 1). Although if people are still nervous that this could regress non-lpa2 performance in some cases, I could rework so that there are lpa2 and non-lpa2 variants of __flush_tlb_range_op(), and the correct version is chosen at the higher level (based on lpa2_is_enabled() / kvm_lpa2_is_enabled()). It turns out that we won't be able to key LPA2 usage off the same static key for both the kernel and kvm usage because the kernel usage additionally depends on CONFIG_ARM64_LPA2 being enabled. So I've introduced 2 stub functions (lpa2_is_enabled() and kvm_lpa2_is_enabled()) to advertise it. Ard already defines and implements lpa2_is_enabled() in his series, so there will be a minor conflict to resolve there. I plan to define kvm_lpa2_is_enabled() to be the static key for kvm in my series. Marc, would you be happy with this approach? Anyway, I wanted to put this out there as an RFC. If we are happy with it, then I'll re-post on 6.7-rc1. [1] https://lore.kernel.org/linux-arm-kernel/5651bb31-9ef6-4dfc-b146-64606279bbf7@arm.com/ [2] https://lore.kernel.org/kvmarm/20231009185008.3803879-1-ryan.roberts@arm.com/ Thanks, Ryan Ryan Roberts (3): arm64/mm: Modify range-based tlbi to decrement scale arm64/mm: Add lpa2_is_enabled() kvm_lpa2_is_enabled() stubs arm64/mm: Update tlb invalidation routines for FEAT_LPA2 arch/arm64/include/asm/kvm_mmu.h | 3 + arch/arm64/include/asm/pgtable-prot.h | 2 + arch/arm64/include/asm/tlb.h | 15 ++-- arch/arm64/include/asm/tlbflush.h | 100 ++++++++++++++++---------- 4 files changed, 78 insertions(+), 42 deletions(-) --- 2.25.1