Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp265446lqt; Mon, 18 Mar 2024 07:22:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWoO7dxfxB1bg8p88a5lxXtEqANQ5vQblRhsfQ+wdJybTwRokX5unTlX2Vc0JM4JhQP/52DrakfFvm8ts2lhFdcwYXTEnDPmgUddLjJtA== X-Google-Smtp-Source: AGHT+IHqHOhhCRilfpy6BGLHoFsoJOYuYdZbuNz5RPwfo9rHCf1/hCCsqeF+yoLYPyEJAJmxHzj7 X-Received: by 2002:a17:902:d511:b0:1de:f59a:4e6 with SMTP id b17-20020a170902d51100b001def59a04e6mr12174930plg.24.1710771723380; Mon, 18 Mar 2024 07:22:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710771723; cv=pass; d=google.com; s=arc-20160816; b=T8m6fG8LkvrfJKm7oU1RId3cEjVEgU8W3z4tuBlCu72VxyO4w2sKsGNMT+vC8rIv8B +Xil9Z+EbicHiAVFlh5E+ZAY/ph77CDjaqc6A5nYeDls0uhK/2Ki2/3NF/H5sYqm8eFt umek4+nmN9N40OpfEPaZQY0acI7NWPtKj0ode+hQdZ3eZfDHAsikvtruGZ3IwYyVCRAf 7yDif8yxtC4d1mdLsJycpD803mANPcXSBITe8hyQ30homa+OhxQdypUkoCLf4tpbSSmd nsTKVzxOjgq2Sh/6ISGh2LHimuXguLw2jiti1PShsP+QEy0qcmV5WJKNhOLR9Lrs0z2Z mAFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Y8pVWVzYyCf08T0G0EdrgewZbyCpSJ/9af1OTexXimM=; fh=6IcDOET6c+sjpwlHMMghPAGX7NN1MXMsKT9g5ZB8NBA=; b=KbZobzqP4HRh8vkWlB8n+Zzp5IzLa+jFaAHYGQ0neVFefB/dNiEH0TYgvrvrlP+pAl 9xiMj96l5ZUm5oXf1ZFaSBNlVlj216ZBnfy4VbjjHK+bh5JiPgGIFyxGctK+TKp5SqXd 4S6UsC7htgV5DJmO94QXiKystWTbfuA5ZVBOLOp2DQRsyEz+b86Jm5mN5jEduVSMQcpY u2rbc3dl0CS3NKhDLqAnzUm/j0+HGV6PQs2RJb0xfNU1+Z8493xQpa6gw9O/LU2INs9d fQJ1qRb80xy10ADyuF5uMIu4EfNvTm7N1zYiVSNriE6Ew249/pdIbOLq46xoMgF/8Ntb FYbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FmJeA8AE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-106208-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106208-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id r2-20020a170902be0200b001e01f268762si2414061pls.593.2024.03.18.07.22.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 07:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106208-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FmJeA8AE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-106208-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106208-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F7782814FD for ; Mon, 18 Mar 2024 14:22:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54B1F4CE0F; Mon, 18 Mar 2024 14:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FmJeA8AE" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14AB82C877; Mon, 18 Mar 2024 14:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710771712; cv=none; b=CX5wRyeM5SoNNPH9g477YFfvx+9RvIgjvMFsQAfNIS55gDd3lqhtShadBdpjo6f+wMRetEjUFx+VMCYRDT0ysTZZnPH6ibqEhthCYAsEfgY+4KAXvJeUy5MwlS1cCCgNwf9pvhnXaTh53iVQESGeFuLU7LUmBLEOM9nqn1kwpS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710771712; c=relaxed/simple; bh=QUbSeiRZVfNGfqAcNd6KenE2viIRmcdDxVpkHP2kLGA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NvgnXniiWe86XXOQl4isaDhMSBAqce5UE28lrFlNdqIbGiRPB8pDsInVfv68Q02yP5JOxtaqZERtxE5sh3qRW421/eWeEq8b45lfM2J3L8voR/Xh5ncASsLuhcuIc+bHtxko37y+pBpR2oG75MRfDMvFu5sMAbzvr/USpQL5G60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FmJeA8AE; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a46cc947929so92155066b.1; Mon, 18 Mar 2024 07:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710771708; x=1711376508; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Y8pVWVzYyCf08T0G0EdrgewZbyCpSJ/9af1OTexXimM=; b=FmJeA8AEw4DRLt/3d+cxC5L+5LYFO5JoZD17Ald8pUlYrr5imYG7fhb66OKnXSKcHa RpctgCeLRuVqtkOdo6o0Q4BDcONpWg24otOgttK/aAB/AiD9+Iup0JF8I6R2kfUC5tGz vfhEM7h9Xf8vQNcMO9h29WEXSjVmIV0b/1EJPyWDEYjTKV9Ag2TiRba5M8A4cZpFr3DU +FXgnygx3lwqZydmKqJKRS+0mlyvQtjzKKm9KJPx+w0dM1YuymQj0fsQIQ299pcXJjd8 F9AfFjYsIFDFrxCu6WWxGDddPHOiqbSEKW/+1d5dW+BR9a5omEno9ETQ7wCjMlJN5IMY E/fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710771708; x=1711376508; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y8pVWVzYyCf08T0G0EdrgewZbyCpSJ/9af1OTexXimM=; b=LwejlTN9ZfSpm86rZL0stmbooUk7YeP5aFNDNHaX77UJ8vYO+PIsP9h6C+DeuGpE3D e9rbhjhWywy02YyuVr8hPNGeA5wgq7z/6xU9W8D5j0PSfzlSknuhmOXFLqGyb6Z/4gg1 51OUx1PCEj94FDFCJmdbCyIqZK2H36ukacmDx4/CE89HR28Z9QkcLvaCSNso9HrhE2gZ tQt4cyjUMJkkLSpYix3tR6F+LRWMK6WGNrN6M4i61ZZmRBz7OdaBV3RGAINyF9SRyVT4 PPH6azPYAzGMl2KGMn+fG1H/KxGt20oPxZegErev04HXNzV0gqKS1VEA1+h4gCyw1ZCg UF1A== X-Forwarded-Encrypted: i=1; AJvYcCVWhG+knlUA8asxmDCIZOEnjrGAzrS4BW+Pz8p5MUKF///pw4pQu5x25VjtwVXL+qr0grB7lX4kpxoOtdh4osw63kqNNuMX64OhLMmgsJ6rO3hBYapg0fIR2AFr2Er8bC4B2fW7pCpPHzWchyoaAimyY/b76QuWf/TVbN32lUvDetW/CZOiR0G4Ip0/smcofjV+A/K4aZAa3BkyS0m59VUhk5gbrrz9sYEnqd9eeiKRCE1O7ixc3g== X-Gm-Message-State: AOJu0YzP3HlmYqR3iJZgD/VwH47j7vF32XaGFk2OZ/1ZGiEDzbDFIPXm g9ykkyCFPymIRyJ4qjKL8FyQdBEPnd3XApoUK2sQEbAnxjnmfZruUDW/sDYNjGCNIJALv+lO4Eo vCAJWdlKNzGrTWsVIuM34N5vpjx4= X-Received: by 2002:a17:906:c14e:b0:a46:a786:8c8c with SMTP id dp14-20020a170906c14e00b00a46a7868c8cmr3870315ejc.77.1710771708145; Mon, 18 Mar 2024 07:21:48 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220714084136.570176-1-chenhuacai@loongson.cn> <20220714084136.570176-3-chenhuacai@loongson.cn> <3a5a4bee5c0739a3b988a328376a6eed3c385fda.camel@physik.fu-berlin.de> In-Reply-To: <3a5a4bee5c0739a3b988a328376a6eed3c385fda.camel@physik.fu-berlin.de> From: Huacai Chen Date: Mon, 18 Mar 2024 22:21:36 +0800 Message-ID: Subject: Re: [PATCH V2 3/3] SH: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK To: John Paul Adrian Glaubitz Cc: Huacai Chen , Arnd Bergmann , Thomas Bogendoerfer , Yoshinori Sato , Rich Felker , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Guo Ren , Xuerui Wang , Jiaxun Yang , linux-mips@vger.kernel.org, linux-sh@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, SuperH maintainers, On Wed, Feb 8, 2023 at 8:59=E2=80=AFPM John Paul Adrian Glaubitz wrote: > > On Thu, 2022-07-14 at 16:41 +0800, Huacai Chen wrote: > > When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, > > 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 sh= ow_cpuinfo+0x5e8/0x5f0 > > [ 3.070072] Modules linked in: efivarfs autofs4 > > [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 > > [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf84= 6c 9000000100154000 > > [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a= 58 9000000000ef7430 > > [ 3.118774] 90000001001578e8 0000000000000040 00000000000000= 20 ffffffffffffffff > > [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de= 80 900000000101c890 > > [ 3.138056] 0000000000000000 0000000000000000 00000000000000= 00 0000000000aaaaaa > > [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab40= 00 0000000000000000 > > [ 3.157364] 900000000101c998 0000000000000004 9000000000ef74= 30 0000000000000000 > > [ 3.167012] 0000000000000009 000000000000006c 00000000000000= 00 0000000000000000 > > [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086= d8 00007ffff0080286 > > [ 3.186260] 00000000000000b0 0000000000000004 00000000000000= 00 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 > > --- > > arch/sh/kernel/cpu/proc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/sh/kernel/cpu/proc.c b/arch/sh/kernel/cpu/proc.c > > index a306bcd6b341..5f6d0e827bae 100644 > > --- a/arch/sh/kernel/cpu/proc.c > > +++ b/arch/sh/kernel/cpu/proc.c > > @@ -132,7 +132,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 ? cpu_data + *pos : NULL; > > + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; > > } > > static void *c_next(struct seq_file *m, void *v, loff_t *pos) > > { > > I build-tested the patch and also booted the patched kernel successfully > on my SH-7785LCR board. > > Showing the contents of /proc/cpuinfo works fine, too: > > root@tirpitz:~> cat /proc/cpuinfo > machine : SH7785LCR > processor : 0 > cpu family : sh4a > cpu type : SH7785 > cut : 7.x > cpu flags : fpu perfctr llsc > cache type : split (harvard) > icache size : 32KiB (4-way) > dcache size : 32KiB (4-way) > address sizes : 32 bits physical > bogomips : 599.99 > root@tirpitz:~> > > Tested-by: John Paul Adrian Glaubitz > > I am not sure yet whether the change is also correct as I don't know whet= her > it's possible to change the number of CPUs at runtime on SuperH. Can this patch be merged? This is the only one still unmerged in the whole series. Huacai > > Adrian > > -- > .''`. John Paul Adrian Glaubitz > : :' : Debian Developer > `. `' Physicist > `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913