From mboxrd@z Thu Jan 1 00:00:00 1970 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 2CEF8C433EF for ; Tue, 14 Dec 2021 19:03:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E6376B0071; Tue, 14 Dec 2021 14:03:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 495036B0073; Tue, 14 Dec 2021 14:03:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35CFE6B0074; Tue, 14 Dec 2021 14:03:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay025.a.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 24BC36B0071 for ; Tue, 14 Dec 2021 14:03:27 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E311860842 for ; Tue, 14 Dec 2021 19:03:16 +0000 (UTC) X-FDA: 78917322792.03.F9056FE Received: from mail-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.182]) by imf14.hostedemail.com (Postfix) with ESMTP id CF43B100028 for ; Tue, 14 Dec 2021 19:03:11 +0000 (UTC) Received: by mail-vk1-f182.google.com with SMTP id 70so13112952vkx.7 for ; Tue, 14 Dec 2021 11:03:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bQOtmTw19Qz+cRCih9T5sdKR1tGH5OnUCCIrsQi5CfA=; b=kB4MLAC0aL3TmLW1XBplceaRm2hyX2q1UIwD55Ysz1uTqyAymkNKCodjgUtbH6ILfc B6M7wEw+j/LRP7wScQx4rgHl10ubmf34aeba9h0F64guQukiiGSdayiNwvsQFoOCzCHk WClurgiSdjMwFErGUFFk5QKpuSIIr+U1TmRlMjHVZtu4cAZyCDw+w8kBhVvdx2qq9O0v RX/mOXE4A/6F1uJhOAlET+Mo721aSgOT5D981Imbgr9F02J3O0MWZZqm84KltXJcM5dD pE3l8ktQu7sGMbxL8gNuFinLbDpu0yPhu/nffj5h+X5DzbpPaIRaVpp9F/lOck52Qf5I odtA== X-Gm-Message-State: AOAM530GJAxko46HLB9rnqHLdX/r0p6ICYYhdyU7OLANpwYjzapHy+9F RRCenujd+E3AGCJIcI5cCBQK6mH1Z25b2w== X-Google-Smtp-Source: ABdhPJxmE107FhhqWR9ZsRFS3WRqrypjBIkL4zKFasNEA7dxxwhxyCSu3Ztb/6dWn+2vmxGHKiQ04w== X-Received: by 2002:a05:6122:20a8:: with SMTP id i40mr1100571vkd.19.1639508592052; Tue, 14 Dec 2021 11:03:12 -0800 (PST) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com. [209.85.222.44]) by smtp.gmail.com with ESMTPSA id y17sm165920uaa.9.2021.12.14.11.03.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Dec 2021 11:03:11 -0800 (PST) Received: by mail-ua1-f44.google.com with SMTP id t13so36573819uad.9 for ; Tue, 14 Dec 2021 11:03:10 -0800 (PST) X-Received: by 2002:a05:6102:3232:: with SMTP id x18mr859450vsf.38.1639508590267; Tue, 14 Dec 2021 11:03:10 -0800 (PST) MIME-Version: 1.0 References: <20211130172954.129587-1-vladimir.murzin@arm.com> <20211130172954.129587-2-vladimir.murzin@arm.com> <8c2b4666-cf13-3735-be1e-b8a1c71df113@arm.com> In-Reply-To: From: Geert Uytterhoeven Date: Tue, 14 Dec 2021 20:02:58 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] percpu: km: ensure it is used with NOMMU (either UP or SMP) To: Dennis Zhou Cc: Vladimir Murzin , linux-arch-owner@vger.kernel.org, Linux MM , Tejun Heo , Christoph Lameter , Andrew Morton , Nicholas Piggin , Christoph Hellwig , Arnd Bergmann , Linux-sh list , Rich Felker , linux-riscv Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: xrt18br5a7pkg6frw4yba9si7gaxud4h Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf14.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.221.182 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CF43B100028 X-HE-Tag: 1639508591-82891 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: Hi Dennis, On Tue, Dec 14, 2021 at 6:26 PM Dennis Zhou wrote: > On Tue, Dec 14, 2021 at 05:29:22PM +0100, Geert Uytterhoeven wrote: > > On Wed, Dec 1, 2021 at 12:53 PM Vladimir Murzin wrote: > > > On 11/30/21 5:41 PM, Dennis Zhou wrote: > > > > On Tue, Nov 30, 2021 at 05:29:54PM +0000, Vladimir Murzin wrote: > > > >> Currently, NOMMU pull km allocator via !SMP dependency because most of > > > >> them are UP, yet for SMP+NOMMU vm allocator gets pulled which: > > > >> > > > >> * may lead to broken build [1] > > > >> * ...or not working runtime due to [2] > > > >> > > > >> It looks like SMP+NOMMU case was overlooked in bbddff054587 ("percpu: > > > >> use percpu allocator on UP too") so restore that. > > > >> > > > >> [1] > > > >> For ARM SMP+NOMMU (R-class cores) > > > >> > > > >> arm-none-linux-gnueabihf-ld: mm/percpu.o: in function `pcpu_post_unmap_tlb_flush': > > > >> mm/percpu-vm.c:188: undefined reference to `flush_tlb_kernel_range' > > > >> > > > >> [2] > > > >> static inline > > > >> int vmap_pages_range_noflush(unsigned long addr, unsigned long end, > > > >> pgprot_t prot, struct page **pages, unsigned int page_shift) > > > >> { > > > >> return -EINVAL; > > > >> } > > > >> > > > >> Signed-off-by: Vladimir Murzin > > > >> --- > > > >> mm/Kconfig | 3 +-- > > > >> 1 file changed, 1 insertion(+), 2 deletions(-) > > > >> > > > >> diff --git a/mm/Kconfig b/mm/Kconfig > > > >> index d16ba92..66331e0 100644 > > > >> --- a/mm/Kconfig > > > >> +++ b/mm/Kconfig > > > >> @@ -425,9 +425,8 @@ config THP_SWAP > > > >> # UP and nommu archs use km based percpu allocator > > > >> # > > > >> config NEED_PER_CPU_KM > > > >> - depends on !SMP > > > >> bool > > > >> - default y > > > >> + default !SMP || !MMU > > > >> > > > > > > > > Should this be `depends on !SMP || !MMU` with default yes? Because with > > > > SMP && MMU, it shouldn't be an option to run with percpu-km. > > > > > > IIUC these are equivalent, truth table would not change if is under "depends" > > > or "default" > > > > > > SMP MMU NEED_PER_CPU_KM > > > y y !y || !y => n || n => n > > > y n !y || !n => n || y => y > > > n y !n || !y => y || n => y > > > n n !n || !n => y || y => y > > > > > > > > > > >> config CLEANCACHE > > > >> bool "Enable cleancache driver to cache clean pages if tmem is present" > > > >> -- > > > >> 2.7.4 > > > >> > > > > > > > > It's interesting to me that this is all coming up at once. Earlier this > > > > month I had the same conversation with people involved with sh [1]. > > > > > > > > [1] https://lore.kernel.org/linux-sh/YY7tp5attRyK42Zk@fedora/ > > > > > > > > I can pull this shortly once I see whatever happened to linux-sh. > > > > > > Ahh, good to know! Adding SH folks here (start of discussion [0]). I see you came > > > to the same conclusion, right? > > > > > > IIRC, RISC-V also have SMP+NOMMU, so adding them as well. > > > > I had seen the j-Core thread, but completely forgot about > > Canaan K210 (RV64 SMP+NOMMU). > > > > This became commit 3583521aabac76e5 ("percpu: km: ensure it is used > > with NOMMU (either UP or SMP)"). And now booting K210 prints: > > > > percpu: wasting 10 pages per chunk > > > > a) Is this bad? > > It's not great.. Can you share the line on boot with the following > prefix: pcpu-alloc [1]. There are no such lines. "make mm/percpu.i mm/percpu.s" and inspecting the generated files, and vmlinux, proves the code is there. But apparently it's not called. So there may be no issue on my system? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds