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 D7F40C433FE for ; Tue, 14 Dec 2021 20:12:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A1F26B0071; Tue, 14 Dec 2021 15:12:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 029856B0073; Tue, 14 Dec 2021 15:12:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE5D6B0074; Tue, 14 Dec 2021 15:12:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id C71616B0071 for ; Tue, 14 Dec 2021 15:12:30 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 834D782FD1 for ; Tue, 14 Dec 2021 20:12:20 +0000 (UTC) X-FDA: 78917496840.27.B91C6DD Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) by imf03.hostedemail.com (Postfix) with ESMTP id 077742000F for ; Tue, 14 Dec 2021 20:12:19 +0000 (UTC) Received: by mail-vk1-f181.google.com with SMTP id u68so13200275vke.11 for ; Tue, 14 Dec 2021 12:12:19 -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=C+mb+oH7+4rpXpD/Z6lXjKtCNpCU2szRv7YE142Zc5o=; b=X5iGRo0wrBf7KeHOvWo8H2r4srZeqqbwbOhcHqF112Vp4NAgURHD/InZ24U7A/2oZP LK90TjWkMIuKVggSAit2CYHTzF8ysA/0WW/vq1fZW8a6D8V5PDVwyTt34/YUdaxe3e2M dEszrahi5siT15iF1Sc+YGWUtSkcoNUmVH8Rw+ROBDcYWKzH0hsO00hmoOD/AbNKQt1K Yo89aaRzx2wVOVP3WXsz99tjjzPtNE7uaA+IDm/s5YAN9VSORXHnH09LUvf1RIpTMCbZ vZ0QnJhfFYdEq/TWr0tvWwL5EAuv2UiPCXBnyo9MOHv/HXb/Luilp0Q178fm5gox66JC 7oZw== X-Gm-Message-State: AOAM532uS4Y5yxQjutri+5ZhYRmVAbovjGCFgguqZrCTANW13DsU3dhX oLPL+NjNoiv+ZJBb8hUuqHbMBSja6rpUnA== X-Google-Smtp-Source: ABdhPJzFTZlAaS8Ne2z6nU0rJALwfNnRqzsptZV7SPQ4wB0iBQrk0Gj8oHMJLQKJmQk5/AXoCLcIwQ== X-Received: by 2002:a1f:5f94:: with SMTP id t142mr1514800vkb.34.1639512738709; Tue, 14 Dec 2021 12:12:18 -0800 (PST) Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com. [209.85.222.50]) by smtp.gmail.com with ESMTPSA id s25sm183826vsk.20.2021.12.14.12.12.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Dec 2021 12:12:18 -0800 (PST) Received: by mail-ua1-f50.google.com with SMTP id n9so17940240uaq.10 for ; Tue, 14 Dec 2021 12:12:18 -0800 (PST) X-Received: by 2002:a05:6102:e10:: with SMTP id o16mr1300775vst.5.1639512737845; Tue, 14 Dec 2021 12:12:17 -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 21:12:06 +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: z7isnrxntm4qwiadjx4ii7sj5rm9c7a3 Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.221.181 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 077742000F X-HE-Tag: 1639512739-576469 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 8:18 PM Dennis Zhou wrote: > On Tue, Dec 14, 2021 at 08:02:58PM +0100, Geert Uytterhoeven wrote: > > 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 > > > > > 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? > > I might be missing something, but that can't be right. Percpu calls > pcpu_dump_alloc_info() from pcpu_setup_first_chunk() which is called by > both embed/page first chunk code. > > Ummm. That can't be right. Percpu call pcpu_dump_alloc_info() from > pcpu_setup_first_chunk() which everyone should call. On my machine: > > $ dmesg | grep "pcpu-alloc" > [ 0.065118] pcpu-alloc: s184320 r8192 d28672 u262144 alloc=1*2097152 Doh, it wasn't printed to the console, due to KERN_DEBUG. Dmesg does have it: <7>[ 0.000000] pcpu-alloc: s15520 r0 d29536 u45056 alloc=11*4096 <7>[ 0.000000] pcpu-alloc: [0] 0 [0] 1 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