From patchwork Tue Dec 12 21:34:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13490008 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1432C4167B for ; Tue, 12 Dec 2023 21:35:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F32B6B03B6; Tue, 12 Dec 2023 16:35:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A3A56B03B7; Tue, 12 Dec 2023 16:35:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31C5C6B03B8; Tue, 12 Dec 2023 16:35:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 180116B03B6 for ; Tue, 12 Dec 2023 16:35:03 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C7C4BA1D9F for ; Tue, 12 Dec 2023 21:35:02 +0000 (UTC) X-FDA: 81559471644.04.DCBA27C Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf22.hostedemail.com (Postfix) with ESMTP id F2213C001C for ; Tue, 12 Dec 2023 21:35:00 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Cd6vzWnV; dmarc=none; spf=pass (imf22.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702416901; a=rsa-sha256; cv=none; b=HJtuabjwHxtTDl/Rv7/TVUf7qv91tIhH9u8HVFGMeasIYD1eNvwfCWIunrlxKzRWEV0B3h JsuojWtqmJF7FefP8g8YG8lBP/Y524G71DD7af54Pw1SuxBoSff4WcfK4Hu/y2hFhnP27U HZup6Dbqi60CibIe2EydAbfd14JpbIY= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Cd6vzWnV; dmarc=none; spf=pass (imf22.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702416901; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=692HNWJOlFtonZp1MhpojM8sdqlm3KHIVwJ0Hg03uAs=; b=1jMpsuG+tI1Ie+2FEnBmHAjQSvhSzUyXprj5QAZb/w0yyzEavR4/yYyP7dESYTZuc151qw cnK4aIx2ECtrao1Newh21eeQjZCf7+8334VFSw9kg1YIMr2j4JuP3lVchViW4n5TkGDv4U lvHIy44qdfUyK6pXUiWuI+T5WpW7xpQ= Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3333074512bso3883035f8f.1 for ; Tue, 12 Dec 2023 13:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702416899; x=1703021699; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=692HNWJOlFtonZp1MhpojM8sdqlm3KHIVwJ0Hg03uAs=; b=Cd6vzWnVqlf3RQ/fjUuySkTtZ3TGLTlA7ojMG7phO9XHlaz8HHlErs9umY5oNg/xr0 Xem7xyYOqaYygPIthXY/cIoXsigBhHA6DNi2INaPrcUabseJ4kSdkgvSrT/WhiC0Cs+y bMLtKqO+verYVjeT/W6SAHpfWfV0vBxmFs3S4GP0uQZt3znoiJh0oCxS2dfJyMfo/Bw7 4kGuP0IaRNT7aK4Clod1H5pvrtnS0+WKRNxOsKnJkHGgmVDuRPjVVuG4vSwAZcJgXfe5 LY3pQrufFbALE2Pxe+teTzopJ9M4WEAItWfHLopNq44Jw/5SPVawuhRLO8LPujU1JMVl Ee2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702416899; x=1703021699; 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=692HNWJOlFtonZp1MhpojM8sdqlm3KHIVwJ0Hg03uAs=; b=LKwBK3IzZ+4FQHIr0kGnUbX4g7RzjsxmYOj0YBdET5EbFNI2ldL/JmEqe69Hq7j5QC xnJwOGhwaMibboPIJOws2jKPj1REhAliqtRE6YNgBMjyoZWKnmqq00PTYgYGwxvVN3X8 LrNUG+X7vcFV0apx5oMaKgOrNAn44GaXRNIeFIfd8WBMTTc+m4vRzdwBdTigCuoc8GVD bfMIA+J8IqgqwF5X3VCa9RpUTk8aVsKjiCF915w7Zn0+qCYxTWDYACyoeC1mZKcKr3wm 7rCr4U0yLqXnHqX4UbtkP1XnG0VE3+2Tu/96e0IJkz/79o2OEIzyZrHw3SXn/Fz/P9CX wp0Q== X-Gm-Message-State: AOJu0YzXIB7eaXDlriubL3iHFQIPrSYmUYXASFjnZKE6ryDuA9G4jk0+ EITJfyUC+WlKng+Z2NBK+5RkMA== X-Google-Smtp-Source: AGHT+IFkzrnkDCYHfteg2uRMUBp/558DJ+5TYEbB94HHSPp6l/nbeDaimGFYdGQPy4EXupq5BMw1bw== X-Received: by 2002:a05:600c:600b:b0:40b:5e4a:2374 with SMTP id az11-20020a05600c600b00b0040b5e4a2374mr3902004wmb.118.1702416899421; Tue, 12 Dec 2023 13:34:59 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id bg38-20020a05600c3ca600b0040b540ff0a5sm17655337wmb.19.2023.12.12.13.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 13:34:58 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Arnd Bergmann , Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH v2 0/2] riscv: Enable percpu page first chunk allocator Date: Tue, 12 Dec 2023 22:34:55 +0100 Message-Id: <20231212213457.132605-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: F2213C001C X-Stat-Signature: z9cirhr3dcxp5pmzbuhjiyxhdbx8a9jg X-HE-Tag: 1702416900-759135 X-HE-Meta: U2FsdGVkX1/zU/ecvxHEq/SgwR17BKRNQNWdX0O5cXwj/PU/5MAvJLNvfgMnD3zdtggCgPMEyy6WZMycrXFmIIRI9gmtBKLL580QzUFhgqm2jxB5IPuDV3IBcQy5BwPOvguPxEhsqBwh03qnFdBUvGbjXHnzF4OEXW6sBzUeqsFi0RIHNq5asuafJU+UbF6+Xvocts/s7K4U2JV8dJLoqFXoqNBkRL3V0moKhFHvWKN1JpNJamLN+qZZEGAnVH6hAqYhSnE7hmbsid+3zmpNbChGEcW0frtP1YmOB4oQFilz6axoSycnu63lDGaXAE1C5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pjkkG4Sj9yUcmIjDvdby7J4VxSxEHPkNTotSlHfwEy2inT0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: While working with pcpu variables, I noticed that riscv did not support first chunk allocation in the vmalloc area which may be needed as a fallback in case of a sparse NUMA configuration. patch 1 starts by introducing a new function flush_cache_vmap_early() which is needed since a new vmalloc mapping is established and directly accessed: on riscv, this would likely fail in case of a reordered access or if the uarch caches invalid entries in TLB. Note that most architectures do not include asm-generic/cacheflush.h so to avoid build failures, this patch implements the new function on each of those architectures. For all architectures except riscv, this new function is implemented as a no-op to keep the existing behaviour but it likely needs another implementation. patch 2 simply enables the page percpu first chunk allocator in riscv. Changes in v2: - Rebase on top of 6.7 - Define flush_cache_vmap_early() for all architectures that do not include to avoid build failures Alexandre Ghiti (2): mm: Introduce flush_cache_vmap_early() riscv: Enable pcpu page first chunk allocator arch/arc/include/asm/cacheflush.h | 1 + arch/arm/include/asm/cacheflush.h | 2 ++ arch/csky/abiv1/inc/abi/cacheflush.h | 1 + arch/csky/abiv2/inc/abi/cacheflush.h | 1 + arch/m68k/include/asm/cacheflush_mm.h | 1 + arch/mips/include/asm/cacheflush.h | 2 ++ arch/nios2/include/asm/cacheflush.h | 1 + arch/parisc/include/asm/cacheflush.h | 1 + arch/riscv/Kconfig | 2 ++ arch/riscv/include/asm/cacheflush.h | 3 ++- arch/riscv/include/asm/tlbflush.h | 1 + arch/riscv/mm/kasan_init.c | 8 ++++++++ arch/riscv/mm/tlbflush.c | 5 +++++ arch/sh/include/asm/cacheflush.h | 1 + arch/sparc/include/asm/cacheflush_32.h | 1 + arch/sparc/include/asm/cacheflush_64.h | 1 + arch/xtensa/include/asm/cacheflush.h | 6 ++++-- include/asm-generic/cacheflush.h | 6 ++++++ mm/percpu.c | 8 +------- 19 files changed, 42 insertions(+), 10 deletions(-)