Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1737984rdb; Sat, 10 Feb 2024 15:42:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+De7iwq8R2UuYJeVwrXVnfl0FJ0ZAV+xoxABHX1Z0PG9VYZjeYoLv/Lt+o6AVrJH1axGn X-Received: by 2002:a19:8c56:0:b0:511:7549:1942 with SMTP id i22-20020a198c56000000b0051175491942mr2053187lfj.48.1707608542795; Sat, 10 Feb 2024 15:42:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707608542; cv=pass; d=google.com; s=arc-20160816; b=DCnLknQ0ONOfCFqLv7ARK7L1q3W8dtiKyrLTxBS5R3fOKLbQFdrqU67jn8FmCmYZXo D867GeB5DCWRmUxKt+XtH63/a+oaXBbb161jFkz1oONbGYq4FuF5dccatoskjhYeZ3uC xrEPoXs55kSJygtJDSGd65nnbnt64olmrwOrrtFed9rEDxN1Hp0uWuuy0FkwyYORagdk TdX/uho8HscG6xwtWbqR5ply15PR9zkhTsNeQEjrmnntPbx3dKEe0Dj+/qz76rqTEDt8 p8e7LuIC3+I/pDuXkCrpo1SQiw7MY+rpqJA8fvtFep77WCCfR87GZlcHIWkFi2BS/zoK yQ+A== 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=wguiwnaO3SrnAglt4P8PiplfA65enn+RkSbCJJ7LOzg=; fh=czLoRFmcDIClimGINKTn1tTkm0nwyoFwEhCqi9tAmIg=; b=k0gzBTdWiEGwUtNM7LMRz1iN75KbAkL5rubOTW56to4X2D/YJM+pCbkvPXbxDYLwEe 7oOEigfUbNLHDYdD9jEhUiM702s12yW2IUNtEC+IefHkDxEnU2hUEzMt0d0xJ/iWu4dM u0fw0fHO9eP8TE7Yf4jXubE5wQHEbxcfahrLKLtHRRYjXWv/RKxK+U+5tT06wF4Dsu/K XmiN5K3rDTZZqZg77m2hHiSa1l/FAJiXkoiHjBuqlhHkbejMEBQx/kDtbU+q1X7X8mhd CehV4Tm/9iCrc7d9J99dGyJF0VhzxWkUV2sAjq7PrKtKrFIIEw1C7FIgMIo3/PQEvEln NBhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N8sfitrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60580-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60580-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWX86N8uz0QChPiUWkUygnTIRWPZtUdbDbzfWbm6DUppxJlwj8DDEdvyB3lEhTBe7ZcMJQLy8SXpBz6d+dO+1YRssMEw8IyRGTLL5Mtng== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qb19-20020a1709077e9300b00a3b9394354asi2478896ejc.865.2024.02.10.15.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 15:42:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60580-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N8sfitrJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60580-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60580-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 87FC01F22A85 for ; Sat, 10 Feb 2024 23:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F21155FF10; Sat, 10 Feb 2024 23:42:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N8sfitrJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E03B5F552; Sat, 10 Feb 2024 23:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707608529; cv=none; b=LKgqHKVOeeBswNlBJWNt6Yk211ROqcw6WK0mKol2QBsbW63jjnwf1IB7qxsB2MLD876L0JMXO9I3TQSzL/zYPPRi4BPgYVN+6TRwuuZO+g4Lr2cS7RlK1tsDPRtdtkZ98d6sSfpNx1iDZ7knQ9QVMGahQuBlbXxdFmVbYjpKlCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707608529; c=relaxed/simple; bh=tFeQveoRiLrfsqwNncZbXzJt0Qth44vsHgw3n1Z0lF8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=tS3pLqGNtEqjVUqsz/VbtjrTO2qWiTJL/yespRiyxE6zV57wmEgpHuNsskjaHJj/p42UTi6t8MaOCpwbMCuxT4UwFLCyLU/0jOge72HCO/K0+nJGhncsCSzm/wF6LUFbEenXUStLawe2iJ3YCzMMqAWr3I0ty1OPWpvz7bEe/8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N8sfitrJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 780E0C43390; Sat, 10 Feb 2024 23:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707608528; bh=tFeQveoRiLrfsqwNncZbXzJt0Qth44vsHgw3n1Z0lF8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=N8sfitrJHun5EHWTiV+Zk9uE6MBFV43sOsK1wsuiYVMMUJdcz6Vp/bZLhwlvmFUOT QH3iKkHx4nFkY00vyvrnSbVCDPMQFv01B+hB09STZPrZnqj7dob8TNVJ5+TbbPDfPa Rmemwde9W3hEqiyDGQrpH3vcmOJcBqtkjctTFIaNpYBvejdYHtqg9DgMVMoWB+SIke ofj/yToMLimy1zhMVkuAHAb9GLia3VgsGTvmbpKUZpWI2T7rx2ztcLmtp8JH9uvys+ 8QUhZV4hb51er5SbRXPnGtbtJa7V7Kq3Vd2w3nPd2/C5Sj+wnsHYFWA01kJ0z4FcQ/ 9c0cFjdvQSrGw== Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d0cdbd67f0so28139971fa.3; Sat, 10 Feb 2024 15:42:08 -0800 (PST) X-Gm-Message-State: AOJu0YwThSOfbZbrtLiYyxjB8B9PdXpK1vtvbSV7waAW7+LInYCG90IJ p4P5yljlOELOMNu0+gk3Q3oMvQ7T/cHmgNxQs8LhPs/z/jq9xSXzgm/9ClLbLCjohMvrBKD5r3l 4XFhkIfpqahPBqllZJIve2khiy/c= X-Received: by 2002:a05:6512:ba0:b0:511:6f79:46e2 with SMTP id b32-20020a0565120ba000b005116f7946e2mr2646301lfv.64.1707608527006; Sat, 10 Feb 2024 15:42:07 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240207171020.41036-1-yoann.congal@smile.fr> <20240207171020.41036-2-yoann.congal@smile.fr> In-Reply-To: <20240207171020.41036-2-yoann.congal@smile.fr> From: Masahiro Yamada Date: Sun, 11 Feb 2024 08:41:30 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 1/3] printk: Fix LOG_CPU_MAX_BUF_SHIFT when BASE_SMALL is enabled To: Yoann Congal Cc: linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, x86@kernel.org, =?UTF-8?Q?Andr=C3=A9_Almeida?= , Borislav Petkov , Darren Hart , Dave Hansen , Davidlohr Bueso , Geert Uytterhoeven , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Jiri Slaby , John Ogness , Josh Triplett , Matthew Wilcox , Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , Willem de Bruijn , Vegard Nossum Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 8, 2024 at 2:10=E2=80=AFAM Yoann Congal = wrote: > > LOG_CPU_MAX_BUF_SHIFT default value depends on BASE_SMALL: > config LOG_CPU_MAX_BUF_SHIFT > default 12 if !BASE_SMALL > default 0 if BASE_SMALL > But, BASE_SMALL is a config of type int and "!BASE_SMALL" is always > evaluated to true whatever is the value of BASE_SMALL. > > This patch fixes this by using the correct conditional operator for int > type : BASE_SMALL !=3D 0. > > Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=3D12 to > CONFIG_LOG_CPU_MAX_BUF_SHIFT=3D0 for BASE_SMALL defconfigs, but that will > not be a big impact due to this code in kernel/printk/printk.c: > /* by default this will only continue through for large > 64 CPUs */ > if (cpu_extra <=3D __LOG_BUF_LEN / 2) > return; > Systems using CONFIG_BASE_SMALL and having 64+ CPUs should be quite > rare. > > John Ogness (printk reviewer) wrote: > > For printk this will mean that BASE_SMALL systems were probably > > previously allocating/using the dynamic ringbuffer and now they will > > just continue to use the static ringbuffer. Which is fine and saves > > memory (as it should). > > Petr Mladek (printk maintainer) wrote: > > More precisely, it allocated the buffer dynamically when the sum > > of per-CPU-extra space exceeded half of the default static ring > > buffer. This happened for systems with more than 64 CPUs with > > the default config values. > > Signed-off-by: Yoann Congal > Reported-by: Geert Uytterhoeven > Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=3D2XUAHascps76YQ= ac6rdnQGhc8nop_Q@mail.gmail.com/ > Reported-by: Vegard Nossum > Closes: https://lore.kernel.org/all/f6856be8-54b7-0fa0-1d17-39632bf29ada@= oracle.com/ > Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable") > All the Reviewed-by tags are dropped every time, annoyingly. This is equivalent to v4, which had these tags: Reviewed-by: Petr Mladek Reviewed-by: Masahiro Yamada > --- > v3->v4: > * Fix BASE_SMALL usage instead of switching to BASE_FULL because > BASE_FULL will be removed in the next patches of this series. > --- > init/Kconfig | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/init/Kconfig b/init/Kconfig > index deda3d14135bb..d50ebd2a2ce42 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -734,8 +734,8 @@ config LOG_CPU_MAX_BUF_SHIFT > int "CPU kernel log buffer size contribution (13 =3D> 8 KB, 17 = =3D> 128KB)" > depends on SMP > range 0 21 > - default 12 if !BASE_SMALL > - default 0 if BASE_SMALL > + default 0 if BASE_SMALL !=3D 0 > + default 12 > depends on PRINTK > help > This option allows to increase the default ring buffer size > -- > 2.39.2 > > -- Best Regards Masahiro Yamada