Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp765257pxb; Wed, 3 Feb 2021 18:00:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp1mh5XpS/xXGfGkbBihjzYjtNSvMAx07ayYUSlSVawqj1oQ4efxW2jcHHsPua3Jp5AmXW X-Received: by 2002:aa7:d755:: with SMTP id a21mr5904424eds.301.1612404044108; Wed, 03 Feb 2021 18:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612404044; cv=none; d=google.com; s=arc-20160816; b=txbAlhF2Ksy/XE9XAmHQ/XHec+9zrr1Pqx560NrK+7TnuWn8f9MsPEm1oCC2CBY2Q1 Nk2q0p5Yg/xZ+5xtmFDClvhszR26y33X2FA8z2ngy5MEP5fpO5oa3zWU4duB+cK0CMRS XlQNED4cKFOJ8OtMsZR66ojtGhKBfv82/oPRrHTF259i5g0G2C+GntAI8aOT+xNx91R+ LZdKNaxXWwDajpxCU+A3T3KMp+A3l0KKOY1+1KH3LuEYPxXmIbT9vI26jfHqiQGLmGfq Y/RRGXP0+Ne8eFw1ZF0W5CgXlrwurWtLaA2ydLF5U35az/AMwwCJTm6N6VgFreA5fI8/ xBOw== 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:dkim-filter; bh=gxgjcR0VEeZAZf1rRpSkG8b/Bi8s2o6fMLa0IvUA9lw=; b=ItoQMMDfmnkaHUrwAjghKTdiC1A53shIm6m+sndZcl25piB9dPrFREpt9yeqKzQEcj KA2CKFfV06hXsvEpqT19awr6b7akwqT3ohQSj9LwMOEp5TXUnuuGQuf8tbq5iwMrVVem Or+jN4wSwZOLPMvEOnC6j20oBy1cPhsOjfEKqgdCxl2nWkQGb0bNsip2iB3uhiVirRjv ZmtqmiiHZY3gey6g16KbpqehPseIv9J4qGQQ+SlWSrIUXisM0V9Yw+Ivomlx5yHHEKLe inbbeLyb62yC9/zGis70K6BE4+Ay0Iq5TohT3imXp+9ukdOvFB6rsdqP2DPbOaXTrBCT QHRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=m8YX4O0I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la11si2376632ejc.399.2021.02.03.18.00.17; Wed, 03 Feb 2021 18:00:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=m8YX4O0I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231390AbhBCVwx (ORCPT + 99 others); Wed, 3 Feb 2021 16:52:53 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:61983 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbhBCVww (ORCPT ); Wed, 3 Feb 2021 16:52:52 -0500 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 113LpkpU031784; Thu, 4 Feb 2021 06:51:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 113LpkpU031784 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1612389107; bh=gxgjcR0VEeZAZf1rRpSkG8b/Bi8s2o6fMLa0IvUA9lw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=m8YX4O0ILm07ceuK5fotq4uY3K1hAC5ptJnoW/XxUW9j/FOFfRWgmXqWK2pF4kSRY 4L+fB30NvHjrsFwew2rRy7cFbU3phsYIDhTUChcaf6G3eSioxTg0vL6rH4L65ZYLmT lz94outN2VEfVM9wget8Gd7fyhP75NCUuuRRltnOaYTm33ePYZq6JljjVBZK6k3iZl 3ap3wl9kfMRsGrDugDGg9SYkc5ORYZDxbd775RD15YXafXAVy4IK760wiJDiB0jNk6 ehrI5u1as17AjgQbBmj8OtK9khhGP8T+iYvA42Yow+UzzxKzQu5AGheonRWWDzVWiT +HiLyq5jRddPQ== X-Nifty-SrcIP: [209.85.210.170] Received: by mail-pf1-f170.google.com with SMTP id w18so696520pfu.9; Wed, 03 Feb 2021 13:51:47 -0800 (PST) X-Gm-Message-State: AOAM530PWonDFWS5MGUKZt+KXi1VUFydsQJGCJj793D3tYC/41DzcCco rTjByl+14SiV/P5wDHKHE13gf4l8p7/VEOOoiy8= X-Received: by 2002:a63:575e:: with SMTP id h30mr5652383pgm.7.1612389106322; Wed, 03 Feb 2021 13:51:46 -0800 (PST) MIME-Version: 1.0 References: <20210202070218.856847-1-masahiroy@kernel.org> <87eehy27b5.fsf@jogness.linutronix.de> In-Reply-To: From: Masahiro Yamada Date: Thu, 4 Feb 2021 06:51:09 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] printk: use CONFIG_CONSOLE_LOGLEVEL_* directly To: Petr Mladek Cc: John Ogness , Linux Kernel Mailing List , Sergey Senozhatsky , Steven Rostedt , Andy Shevchenko , Ard Biesheuvel , Borislav Petkov , Darren Hart , Dimitri Sivanich , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , Jiri Slaby , Mike Travis , Peter Jones , Russ Anderson , Steve Wahl , Thomas Gleixner , dri-devel , linux-efi , Linux Fbdev development list , platform-driver-x86@vger.kernel.org, X86 ML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 4, 2021 at 12:23 AM Petr Mladek wrote: > > On Tue 2021-02-02 09:44:22, John Ogness wrote: > > On 2021-02-02, Masahiro Yamada wrote: > > > CONSOLE_LOGLEVEL_DEFAULT is nothing more than a shorthand of > > > CONFIG_CONSOLE_LOGLEVEL_DEFAULT. > > > > > > When you change CONFIG_CONSOLE_LOGLEVEL_DEFAULT from Kconfig, almost > > > all objects are rebuilt because CONFIG_CONSOLE_LOGLEVEL_DEFAULT is > > > used in , which is included from most of source files. > > > > > > In fact, there are only 4 users of CONSOLE_LOGLEVEL_DEFAULT: > > > > > > arch/x86/platform/uv/uv_nmi.c > > > drivers/firmware/efi/libstub/efi-stub-helper.c > > > drivers/tty/sysrq.c > > > kernel/printk/printk.c > > > > > > So, when you change CONFIG_CONSOLE_LOGLEVEL_DEFAULT and rebuild the > > > kernel, it is enough to recompile those 4 files. > > > > > > Remove the CONSOLE_LOGLEVEL_DEFAULT definition from , > > > and use CONFIG_CONSOLE_LOGLEVEL_DEFAULT directly. > > > > With commit a8fe19ebfbfd ("kernel/printk: use symbolic defines for > > console loglevels") it can be seen that various drivers used to > > hard-code their own values. The introduction of the macros in an > > intuitive location (include/linux/printk.h) made it easier for authors > > to find/use the various available printk settings and thresholds. > > > > Technically there is no problem using Kconfig macros directly. But will > > authors bother to hunt down available Kconfig settings? Or will they > > only look in printk.h to see what is available? > > > > IMHO if code wants to use settings from a foreign subsystem, it should > > be taking those from headers of that subsystem, rather than using some > > Kconfig settings from that subsystem. Headers exist to make information > > available to external code. Kconfig (particularly for a subsystem) exist > > to configure that subsystem. > > I agree with this this view. I have never seen a policy to restrict the use of CONFIG options in relevant subsystem headers. > What about using default_console_loglevel() in the external code? > It reads the value from an array. This value is initialized to > CONSOLE_LOGLEVEL_DEFAULT and never modified later. I do not think default_console_loglevel() is a perfect constant because it can be modified via /proc/sys/kernel/printk I am not sure if it works either. Some code may not be linked to vmlinux. drivers/firmware/efi/libstub/efi-stub-helper.c > Best Regards, > Petr -- Best Regards Masahiro Yamada