Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4121308imw; Tue, 12 Jul 2022 02:09:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tOck9cmdtp+gXxLlhli9IDXmDTLenVUT88xtVi/Y04bJwWmvwMK8/jp3nCAYIrfSYCzWnh X-Received: by 2002:a17:903:22c5:b0:16b:f00c:3361 with SMTP id y5-20020a17090322c500b0016bf00c3361mr22721051plg.32.1657616982708; Tue, 12 Jul 2022 02:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657616982; cv=none; d=google.com; s=arc-20160816; b=dAiIl6uvI2GGwBGmX4hLRcc890ruJj96KF3ZIuuM6a02FuXPJ+XDVXj4zPMgHHWLDm x9qI5hvXrs1XDXLVdRPGjfbhYZ4aPUbcLf63nSKvw6P4yq/5seHPGZnDgiyLxOBOafm0 hbLrMerreB5udpPSD7tpgUY4yIHV4m0LhRK4q9bc66BIkIyJN92y4uwV6zCGHwbGOxE2 D5Buw8o3g7N28uHr5ddNtB0BxJQvfrczDO+6ROdykWrDdAoICwlozuWQORz3BLkY9i9s xe/0En5H0g1sD2jNIn/Lq07XB627OBWoUkJSRvNyoLHmlBTf60TE3VNlkVp/mL1iF4/Z 8mKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kpinsuut8uy/po5okYJBMsfKic8kB6vMadZAvETnKBk=; b=lFnp5QJ83RHtA7B/XnIQTEqnQOPNQ+2cmzWwakzMIytMva/TtEGr9VjfxJivAx/bAz Ny/owxuqVOXZn6Eh/7/Bb+UhlVA7edDPeX/fuuec8RuFqHcKrmxN7gabIoLeLnjIgCah ccEDY9imyIxfd8dQsMTus1MGrfbhLg/tTTe1id8QPKloE7p5hiSVDny9lfFaFc99VhFl PQRxj3LOuj4To1ACEQpkAkvE1KTINeQWFGXJz4eASdRlf98CsxLIKBnjY8IFyRxnKwSh FDq6fQWwjze4LzQk000GWYtK0MmfseLr111FFdbdB2mIpgq7wAksz4R6z1WAqv4AUpWN HlUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dwJv1Pib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a63db49000000b0040cf2e6f0e7si11780146pgi.497.2022.07.12.02.09.28; Tue, 12 Jul 2022 02:09:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dwJv1Pib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbiGLIx5 (ORCPT + 99 others); Tue, 12 Jul 2022 04:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232599AbiGLIxs (ORCPT ); Tue, 12 Jul 2022 04:53:48 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEED462FE; Tue, 12 Jul 2022 01:53:44 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id d187so7171890vsd.10; Tue, 12 Jul 2022 01:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kpinsuut8uy/po5okYJBMsfKic8kB6vMadZAvETnKBk=; b=dwJv1Pib8Q7+nvpJSurnA2xBBEzBrTNW5L3cdY1SvxMosGk6cx1B0idKPFxZEIioGY AqcX5e4NBdjPBEq7A/CCssiZgQL3MJhWHJvRl6jFVmov/5NnQu8w8hIWhurofLTxLKSF 7hdX1g2K84bWUxhnsweKaXjgI2dYVRWiD0zYcTwM+QfWBgCRp+OAjV0bKtVfpAz5BFIc ubqtALxkDCKIOKalZTp1RfBFi+fF80JGD634VfPEY5Z6Xt/6aUrezn2nuycjL2MOvrQo LvFLPxdQ4RyM9UuJGv9NYBzeB4PszmM/TLyxcL7UBHI1/X9WR94/3HDXConzrUZwztQV R1rQ== 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=kpinsuut8uy/po5okYJBMsfKic8kB6vMadZAvETnKBk=; b=rjYK9yXX81DvID5ZmhNc1ZHvGbyxgcgYNdiVYa7uZlhWkUygRAihiaW74dcFkOVkP4 bEba8JFTangvrbph5gxle2tWNYDt5y5kz4+7eZKGMYjfMkbB2QEdrFpHCH+2SGa3J9Mw bXEzPrgs+8pwQd2eIKcKBjY5sApBjD5uj6Qyqlcr6yE6PhkwKIPtuf/RHTj0O1RO4FzA ms6FOU+aWb8F8bL4O9xkMsyOrAe8m8ELYTnsjELWrV4hyEni7cLB0JacewaynB9ceyF8 qJatuSyP2thXGzQN45NRaeKUcvGUbuK8/LdQtTdluxAVf+zZgqigvpDboNU5HckZdsF1 HpJg== X-Gm-Message-State: AJIora/HLL0bnQB9Ual/QgywyQ4lUppc+TRwJbs0eJdv73SZlRnENQhL xqXCnbweVX7DoHn4PH9N56TwdWt2YRVJbIEe3yg= X-Received: by 2002:a67:ec05:0:b0:357:7a48:cba8 with SMTP id d5-20020a67ec05000000b003577a48cba8mr637429vso.78.1657616024024; Tue, 12 Jul 2022 01:53:44 -0700 (PDT) MIME-Version: 1.0 References: <20220712075255.1345991-1-chenhuacai@loongson.cn> <20220712075255.1345991-3-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Tue, 12 Jul 2022 16:53:32 +0800 Message-ID: Subject: Re: [PATCH 3/6] M68K: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK To: Geert Uytterhoeven Cc: Huacai Chen , Arnd Bergmann , Thomas Bogendoerfer , Michal Simek , Yoshinori Sato , Rich Felker , Jeff Dike , Richard Weinberger , Anton Ivanov , loongarch@lists.linux.dev, Linux-Arch , Linux Kernel Mailing List , Guo Ren , Xuerui Wang , Jiaxun Yang , "open list:BROADCOM NVRAM DRIVER" , linux-m68k , Linux-sh list , linux-um , stable Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Geert, On Tue, Jul 12, 2022 at 4:33 PM Geert Uytterhoeven wrote: > > Hi Huacai, > > Thanks for your patch! > > On Tue, Jul 12, 2022 at 9:53 AM Huacai Chen wrote: > > When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, > > DEBUG_PER_CPU_MAPS depends on SMP, which is not supported on m68k, > and thus cannot be enabled. This patch is derived from MIPS and LoongArch, I search all architectures and change those that look the same as MIPS and LoongArch. And the warning message below is also a copy-paste from LoongArch, sorry. Since M68K doesn't support SMP, then this patch seems to make no difference, but does it make sense to keep consistency across all architectures? Huacai > > > cpu_max_bits_warn() generates a runtime warning similar as below while > > we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) > > instead of NR_CPUS to iterate CPUs. > > > > [ 3.052463] ------------[ cut here ]------------ > > [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 > > [ 3.070072] Modules linked in: efivarfs autofs4 > > efivarfs on m68k? > > EFIVAR_FS depends on EFI depends on !CPU_BIG_ENDIAN > > > [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 > > [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 > > [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 > > [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff > > [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 > > [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa > > [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 > > [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 > > [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 > > [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 > > [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c > > [ 3.195868] ... > > [ 3.199917] Call Trace: > > [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c > > [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 > > [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 > > [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc > > [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 > > [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 > > [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 > > [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 > > [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 > > [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 > > [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 > > [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Huacai Chen > > Does this need a Fixes tag, so we know when the problem was introduced? > > > --- a/arch/m68k/kernel/setup_no.c > > +++ b/arch/m68k/kernel/setup_no.c > > @@ -201,7 +201,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) > > > > static void *c_start(struct seq_file *m, loff_t *pos) > > { > > - return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL; > > + return *pos < nr_cpu_ids ? ((void *) 0x12345678) : NULL; > > } > > include/linux/cpumask.h has: > > #if NR_CPUS == 1 > #define nr_cpu_ids 1U > > so on m68k, both evaluate to the same value? > > 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