Message ID | 20231028231339.3116618-1-samuel.holland@sifive.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1436387vqb; Sat, 28 Oct 2023 16:15:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD8F6SVfE28mF23ouXb/0HRS05T1VaAvPbOx1c21Y5/9vmCfPSwPvqHsdnZ1r62JVkgY3J X-Received: by 2002:a17:902:dac4:b0:1cc:2be7:c0f2 with SMTP id q4-20020a170902dac400b001cc2be7c0f2mr4320869plx.13.1698534906730; Sat, 28 Oct 2023 16:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698534906; cv=none; d=google.com; s=arc-20160816; b=tPRlJLpF+pdbcbGMFHS1kpD7S9eQhZW+fMu2Tg6K5TIvxkF+D7rIhkdO1kuHASLQ7l X+kvUcDxNytnrEpGSaTHNdrBGAZ74dWS6Cq8+R3g90QO1ecpfisVDAzE7Fqdf0FKWw38 OyjMWwgbfjUpLgFI5FOw1xiXpZIkipwC3ZgKm4IVyBFFFid0L0lZ9nqtmLvAfTEECwT2 14n0Y0ejkIBu0EEKTK0VQt4D9JrGBkMMvQUjpnTiyG+3K262V9t1HJJLcUcYXYPLJSf/ 0ls+zZ9Trh9HjdTGdFRPdEYCWAxZ5k31GyaDuBeKrCoDSoDlNvypiVrw+/XM6KEu+o+n 1Vlg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=+YSC/hhoRjtMopBh7FLE1bSq2O3YdveY+o3Gj9D1j+k=; fh=9K4IlIICZaNW+K3e6o3g6KPBoLBMkIMAK+rlB58927I=; b=OfcuEmM9kaEc1lT86V4iMMh3O/5jMWt7YYrJGJKcC/Mh6qUfKDpqjuy7qxefpWKmDX HffQMO5Qa4XsT6GkHbn0T/MKZFNZMGRpsW4HGCXEEditNpanIIr7xBpsL7LPvv84OhJt Udo1rzcYCVNUKTlcBD6vl3DZYmPXD4vF4lu4nj2GVOQI6ICaFMA6VjlvUHuSPxe3PO9b 5qJSc9q8ppqTasIeVUMaw+Jxk1EMcOju6zXZ9fN9Z9d73yjXwrR2NTpPW6fYwInFAvKP E0+uYqvme2OS6Obrrozw6nRTdibbZpGOoqIkfLMxPIdxzKbXxKC6zfJ+jTgYm3o3XNi8 9+2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UxmzIfft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id d17-20020a170903209100b001cc330e48e5si1242894plc.103.2023.10.28.16.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 16:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UxmzIfft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F298180597BB; Sat, 28 Oct 2023 16:14:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229605AbjJ1XNp (ORCPT <rfc822;peter110.wang@gmail.com> + 29 others); Sat, 28 Oct 2023 19:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjJ1XNo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 28 Oct 2023 19:13:44 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFEFD6 for <linux-kernel@vger.kernel.org>; Sat, 28 Oct 2023 16:13:42 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cc131e52f1so18759055ad.0 for <linux-kernel@vger.kernel.org>; Sat, 28 Oct 2023 16:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1698534822; x=1699139622; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+YSC/hhoRjtMopBh7FLE1bSq2O3YdveY+o3Gj9D1j+k=; b=UxmzIfftYYnNOz9waJLgkfrA1vz8CLxl09VIpvPuR/CmnJ38g9XlHwXRtdhVANiYY/ PHYmCJogcqyWhTaCjjc8OGVJfnrQJKNaFzAmdSbx22YgrAvZwNGelfjbw1JmtZV9OJRd mNFOQW3yC6T4tpPLfA+TR5VHa7AIja0a02uHHHHFfGkJsw3I8P7sO91BP3yyZzVkJBAv 0ua7vIHr6Nj0FW0EYUYlPfKmkscaEwmwVBT4uiI/FKQxajFThAcX/08liDZZmPnIEH4D 2NukUhfR3KAHWcNlvhmXwPE/L8xSvTPetgqNz5WqkTwhx3EViXvha8+cem2/JEAAlxjC GrVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698534822; x=1699139622; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+YSC/hhoRjtMopBh7FLE1bSq2O3YdveY+o3Gj9D1j+k=; b=VW9aMAg+ExwdcTJjAOTOwnbmvrCgdctSBp6b25qVzFeovrQsbHlcZ3EzoycUjrkWYk ML5sJpD6l32QYMOcyGAOzLmUcK1ePDynOxFQSQhYrYKk5i80ywS/7qX/9axMIM8YecsU GENC34CbhFL2M16iLrgzjnJGe/lLVR7TvkbuSfWnejHDQ76yenAW0102FvB7EtFl7YDv 8uAEG6hOarkFOkIoP4YYQ2mbhPeyjlNMWXZ1aAJNjEf3cLrYKAAuXsSzpmqRvasOmwiI AFlLhehe7BS2DHbDtP313SHgttnVdoRvFEQpVKDcVtkwgJ9Vqpl8WpyP67zsAdO6XXA5 J4mg== X-Gm-Message-State: AOJu0YwxlzBHBa+XUMSW5mjS3+D3dZMy0YXHBGKBglSV0cVx7pI/fr+D SjI1XXAUQHrae8ARBkIOcRVckw== X-Received: by 2002:a17:903:11d1:b0:1cc:f41:8f82 with SMTP id q17-20020a17090311d100b001cc0f418f82mr8777732plh.16.1698534821805; Sat, 28 Oct 2023 16:13:41 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id u17-20020a17090341d100b001b8622c1ad2sm3679345ple.130.2023.10.28.16.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 16:13:41 -0700 (PDT) From: Samuel Holland <samuel.holland@sifive.com> To: Palmer Dabbelt <palmer@dabbelt.com>, Alexandre Ghiti <alexghiti@rivosinc.com>, linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Samuel Holland <samuel.holland@sifive.com> Subject: [PATCH v2 00/11] riscv: ASID-related and UP-related TLB flush enhancements Date: Sat, 28 Oct 2023 16:11:58 -0700 Message-ID: <20231028231339.3116618-1-samuel.holland@sifive.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 28 Oct 2023 16:14:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781042938147283167 X-GMAIL-MSGID: 1781042938147283167 |
Series |
riscv: ASID-related and UP-related TLB flush enhancements
|
|
Message
Samuel Holland
Oct. 28, 2023, 11:11 p.m. UTC
While reviewing Alexandre Ghiti's "riscv: tlb flush improvements" series[1], I noticed that most TLB flush functions end up as a call to local_flush_tlb_all() when SMP is disabled. This series resolves that. Along the way, I realized that we should be using single-ASID flushes wherever possible, so I implemented that as well. [1]: https://lore.kernel.org/linux-riscv/20231019140151.21629-1-alexghiti@rivosinc.com/ --- This series is based on v5 of Alexandre's changes, which I have included here so the series can be built by the CI bots. I will rebase once his series is merged. Changes in v2: - Rebase on Alexandre's "riscv: tlb flush improvements" series v5 - Move the SMP/UP merge earlier in the series to avoid build issues - Make a copy of __flush_tlb_range() instead of adding ifdefs inside - local_flush_tlb_all() is the only function used on !MMU (smpboot.c) Alexandre Ghiti (4): riscv: Improve tlb_flush() riscv: Improve flush_tlb_range() for hugetlb pages riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb riscv: Improve flush_tlb_kernel_range() Samuel Holland (7): riscv: mm: Combine the SMP and UP TLB flush code riscv: Apply SiFive CIP-1200 workaround to single-ASID sfence.vma riscv: mm: Introduce cntx2asid/cntx2version helper macros riscv: mm: Use a fixed layout for the MM context ID riscv: mm: Make asid_bits a local variable riscv: mm: Preserve global TLB entries when switching contexts riscv: mm: Always use ASID to flush MM contexts arch/riscv/include/asm/errata_list.h | 12 +- arch/riscv/include/asm/mmu.h | 3 + arch/riscv/include/asm/mmu_context.h | 2 - arch/riscv/include/asm/sbi.h | 3 - arch/riscv/include/asm/tlb.h | 8 +- arch/riscv/include/asm/tlbflush.h | 59 +++++---- arch/riscv/kernel/sbi.c | 32 ++--- arch/riscv/mm/Makefile | 5 +- arch/riscv/mm/context.c | 26 ++-- arch/riscv/mm/tlbflush.c | 184 ++++++++++++++++----------- 10 files changed, 186 insertions(+), 148 deletions(-)
Comments
Hello: This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <palmer@rivosinc.com>: On Sat, 28 Oct 2023 16:11:58 -0700 you wrote: > While reviewing Alexandre Ghiti's "riscv: tlb flush improvements" > series[1], I noticed that most TLB flush functions end up as a call to > local_flush_tlb_all() when SMP is disabled. This series resolves that. > Along the way, I realized that we should be using single-ASID flushes > wherever possible, so I implemented that as well. > > [1]: https://lore.kernel.org/linux-riscv/20231019140151.21629-1-alexghiti@rivosinc.com/ > > [...] Here is the summary with links: - [v2,01/11] riscv: Improve tlb_flush() https://git.kernel.org/riscv/c/c5e9b2c2ae82 - [v2,02/11] riscv: Improve flush_tlb_range() for hugetlb pages https://git.kernel.org/riscv/c/c962a6e74639 - [v2,03/11] riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb https://git.kernel.org/riscv/c/9d4e8d5fa7db - [v2,04/11] riscv: Improve flush_tlb_kernel_range() https://git.kernel.org/riscv/c/5e22bfd520ea - [v2,05/11] riscv: mm: Combine the SMP and UP TLB flush code (no matching commit) - [v2,06/11] riscv: Apply SiFive CIP-1200 workaround to single-ASID sfence.vma (no matching commit) - [v2,07/11] riscv: mm: Introduce cntx2asid/cntx2version helper macros (no matching commit) - [v2,08/11] riscv: mm: Use a fixed layout for the MM context ID (no matching commit) - [v2,09/11] riscv: mm: Make asid_bits a local variable (no matching commit) - [v2,10/11] riscv: mm: Preserve global TLB entries when switching contexts (no matching commit) - [v2,11/11] riscv: mm: Always use ASID to flush MM contexts (no matching commit) You are awesome, thank you!