Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp365421rdb; Mon, 29 Jan 2024 04:57:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtCVhhoLRH2D3NuVOmcPDpq/cuEH2WFMVGZbesgV1/roAFC6r5/tA/pPU3qukuKYMi5Nnf X-Received: by 2002:ac8:5a96:0:b0:42a:73c8:c427 with SMTP id c22-20020ac85a96000000b0042a73c8c427mr5358105qtc.59.1706533034384; Mon, 29 Jan 2024 04:57:14 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d13-20020a05622a15cd00b0042a9a5f09casi3671637qty.179.2024.01.29.04.57.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:57:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42739-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@smile-fr.20230601.gappssmtp.com header.s=20230601 header.b=bWsMN8MK; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-42739-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42739-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=smile.fr 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0EC401C20B44 for ; Mon, 29 Jan 2024 12:57:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B61D9627EE; Mon, 29 Jan 2024 12:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=smile-fr.20230601.gappssmtp.com header.i=@smile-fr.20230601.gappssmtp.com header.b="bWsMN8MK" Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 984626280C for ; Mon, 29 Jan 2024 12:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706533011; cv=none; b=pvz0fSPC4FvZtjodpHNi6BKEsZ7VI5HsLwRFg8mWX304jxk/MtTBjzIccKO4PoTlkzanwDAkWdBxp1VRrhY6CxJlG9tCyxULmVZXhCPt5Ca5C5gPuwffNVLybBJwRPvEw9RXpIgsUD8g4L82CWPCOB45Nn7/l+P5U5HPDhqujO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706533011; c=relaxed/simple; bh=h6Gytjecrgj+QnUGb6LEMt11i7M5rKoL7fKZ/bZIWGE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=u1VLPnhs6cPMshPo/4TCHhGgCRSFxO7enh2iMXhXzUnxAj7a9EZXAC9hCcFp/r8Qy76Ec0aixyHmLaEKRS8ogBe1lFufHt3riOFSMTM3E/2rEL0vfgYN3YjGK6NHo0CpdRNOGwfmf77MDrtoIsnq+BMsrFMUs71rU0gHlGlMPmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smile.fr; spf=pass smtp.mailfrom=smile.fr; dkim=pass (2048-bit key) header.d=smile-fr.20230601.gappssmtp.com header.i=@smile-fr.20230601.gappssmtp.com header.b=bWsMN8MK; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smile.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=smile.fr Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-33ae74e5394so704914f8f.3 for ; Mon, 29 Jan 2024 04:56:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20230601.gappssmtp.com; s=20230601; t=1706533007; x=1707137807; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=QNHXs4gkTIruD9kdTnQ2Vb/LdVmYQFJe6pspYfvSm5Y=; b=bWsMN8MKE8PARjycpKpXl7KJfZvADmB1Md7F55vuA3V8r8nPHAAdQxRCzg/crdGYKW uMfKRtDKJMQk2SeeXovFzXc/WlrZ1fqYq6pbFc9/f/NxM7MiYU0cjZifwlEBm8CdfUSP 5vJLH2Mvo0cLDH1Uv2pPrLcYHEEiqpbGNRAT66Er8+FzGPAJI1EqoMTlYJ0CtFwWYYWI mBUE4jGnMrnPFXGGr6lnUip4RVEvDvjDrd3oiTNtvuC8mtzbRI9mTPOkKwhnbtyX0bdO XF7v72E8nfTWwANmhDNvj7BmTzCKje1qs70bC6nm1elwDM0YKC9LhSZ3xr5mpsqsdpu8 989A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706533007; x=1707137807; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QNHXs4gkTIruD9kdTnQ2Vb/LdVmYQFJe6pspYfvSm5Y=; b=p/uFBMJ/GQ1WLQka6znJM8TsQx6duSHcV4Th+R8xq/lgexDwunDMLQUfICUPf23N/A srKYIa6/UFAKi+XxfjJISVP7oqNgx0BZw2GtOa5s43G9JwJH3rQro8QgAOqhio2HTJy1 7hwOQp5JtNxXGHztrwU+MEjkHG89xQh8ToKI7uxm8Q0gU6xZmlOax7esqsSnBG7Z/h5/ 7kmQ88iNNwiczFf9l+zEQyDT+eszlmmL20cT+WNOP71fhWSoq1Mj0FHn4lVproLO3KKX 2r03klHb7Sfq7RO1pOcEccrGqe2ROLGsSVKtkfgkvC6yzuJGAcxPdZhSwye+TfRg8txc DYOA== X-Gm-Message-State: AOJu0Yw93CGDVQ30OixO40B54j2V3bt5uj0apoayIyz8O5C7eQkbJnnR nn00YF37aSpF96wymZLDdhLG7KpbRNDnf3GXZtfz3jC+UMG71hwhi6qkZu6q7uo= X-Received: by 2002:adf:e88a:0:b0:33a:e7d7:5fbd with SMTP id d10-20020adfe88a000000b0033ae7d75fbdmr3280075wrm.32.1706533006839; Mon, 29 Jan 2024 04:56:46 -0800 (PST) Received: from [192.168.0.20] ([89.159.1.53]) by smtp.gmail.com with ESMTPSA id t18-20020adfe112000000b0033ade19da41sm7316871wrz.76.2024.01.29.04.56.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jan 2024 04:56:46 -0800 (PST) Message-ID: <31306b8b-d534-42ad-8ece-b4b558023efd@smile.fr> Date: Mon, 29 Jan 2024 13:56:44 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] printk: Remove redundant CONFIG_BASE_SMALL Content-Language: en-US To: Jiri Slaby , x86@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Geert Uytterhoeven , "Luis R . Rodriguez" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Greg Kroah-Hartman , Willem de Bruijn , Matthew Wilcox , Peter Zijlstra , Darren Hart , Davidlohr Bueso , =?UTF-8?Q?Andr=C3=A9_Almeida?= , Masahiro Yamada References: <20240127220026.1722399-1-yoann.congal@smile.fr> <60deb891-dab3-4440-82ff-c179486c0a79@kernel.org> From: Yoann Congal Organization: Smile ECS In-Reply-To: <60deb891-dab3-4440-82ff-c179486c0a79@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le 29/01/2024 à 12:28, Jiri Slaby a écrit : > On 27. 01. 24, 23:00, Yoann Congal wrote: >> CONFIG_BASE_SMALL is currently a type int but is only used as a boolean >> equivalent to !CONFIG_BASE_FULL. >> >> So, remove it entirely and move every usage to !CONFIG_BASE_FULL. >> >> In addition, recent kconfig changes (see the discussion in Closes: tag) >> revealed that using: >>    config SOMETHING >>       default "some value" if X >> does not work as expected if X is not of type bool. >> >> CONFIG_BASE_SMALL was used that way in init/Kconfig: >>    config LOG_CPU_MAX_BUF_SHIFT >>        default 12 if !BASE_SMALL >>        default 0 if BASE_SMALL >> >> Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 to >> CONFIG_LOG_CPU_MAX_BUF_SHIFT=0 for some 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 <= __LOG_BUF_LEN / 2) >>            return; >> >> Signed-off-by: Yoann Congal >> Reported-by: Geert Uytterhoeven >> Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/ >> Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable") >> --- >> v1 patch was named "treewide: Change CONFIG_BASE_SMALL to bool type" >> https://lore.kernel.org/all/20240126163032.1613731-1-yoann.congal@smile.fr/ >> >> v1 -> v2: Applied Masahiro Yamada's comments (Thanks!): >> * Changed from "Change CONFIG_BASE_SMALL to type bool" to >>    "Remove it and switch usage to !CONFIG_BASE_FULL" >> * Fixed "Fixes:" tag and reference to the mailing list thread. >> * Added a note about CONFIG_LOG_CPU_MAX_BUF_SHIFT changing. > ... >> --- a/drivers/tty/vt/vc_screen.c >> +++ b/drivers/tty/vt/vc_screen.c >> @@ -51,7 +51,7 @@ >>   #include >>     #define HEADER_SIZE    4u >> -#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) >> +#define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_FULL) ? PAGE_SIZE : 256) > > Why is the IS_ENABLED() addition needed? You don't say anything about that in the commit log. > > thanks, It is needed because we go from using CONFIG_BASE_*SMALL* which is of type _int_ (so either defined to 0 or some other non-zero value) to CONFIG_BASE_*FULL* which is of type _bool_ (so, it is either enabled or not). If I understood correctly, the proper way to check a config of type bool inside of a C function is with IS_ENABLED(). Another way to say this is : CONFIG_BASE_SMALL != 0 is equivalent to !IS_ENABLED(CONFIG_BASE_FULL) Finally, CONFIG_XXX is not defined if CONFIG_XXX is a type bool and disabled so : CONFIG_XXX? "yes":"no"; .. does not compile. I will try to explain it better in the v3 commit log. Thanks! Regards, -- Yoann Congal Smile ECS - Tech Expert