Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp671396ybz; Wed, 29 Apr 2020 07:23:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKhU1UmsLhj1lFsgHRHAc2GBj42TvHKdQTCFQ5pdp+dgwPQw9DErJc01L1wg+9JJiE33wJa X-Received: by 2002:a17:906:f90d:: with SMTP id lc13mr2637751ejb.367.1588170216469; Wed, 29 Apr 2020 07:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588170216; cv=none; d=google.com; s=arc-20160816; b=Iu85YxVXP0X50bzAk0aJNUAFpCKYT7WK3A0P1hs1Tdn7PVf9dxaBITPGb9Mx8wh8z2 L1oHl68TjZTp2mm6yJ/WFpeKm9nphM96pEPvQCDONbsfeBjRs1GlOQ2odxXtDpotyXjQ HxsuaM2EdQSVr2WwydahlGtX5ty1HkEoH6sct/52Sn7AsfLCaR3F3gmWGyHt72vaIU4b p7Ja2DggXeS46S1RClupYsImqpgXez/FPgj2Y0iLGj0Eml16X2k4q0elwPU+221u3knc YU0Zumbc+R/0my390nsjdDhXwmZvO8PiTBouLr5DW98DvSkJ1z9HiK5rTQW+2yI7mfSA te5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ojboWOZgZoqIyeUJJnXwlgbMdttS6Y5MRL/4YmrAAyE=; b=TW/9uNXG/GzgD2fmMs+g3/Eh7GL4l4pHYTJD0tsjm9w2VNplWl78Gn6HOwiYu4Ptp3 DDoN2hsMazIVZNibi/TOP/92RcgS3Pmvo2nB/Ua05blMDVm5Xd1UyX/w84iqXCCDUo4Z eQr+d3MY61bLX6eilqdAZW4EEMrVfp7qZqMEpgKUaImjQ4E8t82odSB/FloJOrMZN7SY zsY25a19bKtPqr8xQQbC736mNsmG3d9xEHR6Da1ubAAMQYHF0MsJgFXNggB6fIkyQqlY nbz53dLtm5t7A7ppebbtaz3jfDaJq61r+6J8erS8EUS/YzMaAs9Dppe5oU9gCq64+Vy2 udJw== ARC-Authentication-Results: i=1; mx.google.com; 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 f16si3702954eds.152.2020.04.29.07.23.11; Wed, 29 Apr 2020 07:23:36 -0700 (PDT) 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; 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 S1727047AbgD2OVN (ORCPT + 99 others); Wed, 29 Apr 2020 10:21:13 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36590 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbgD2OVM (ORCPT ); Wed, 29 Apr 2020 10:21:12 -0400 Received: by mail-wm1-f66.google.com with SMTP id u127so2242277wmg.1 for ; Wed, 29 Apr 2020 07:21:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ojboWOZgZoqIyeUJJnXwlgbMdttS6Y5MRL/4YmrAAyE=; b=FAXP1rFryOM4haayFqYW/qE6c81HBken5bHAX7Rl1hPJ2+rPVjYGY0TUhYoo8HlTrO pAiQmvFT+z5u/YuQYEv3rJRqiTf/V5kiJDbs+GerD8NMJFgvpZBgcz5EW6tdL7k18LTc szPHFK2fUCJ3mvWGzZmaeUczL7FIIjTqddcxvHayC+/TwTysROVL1k/4BTmdnxa9cXzx 93V+eFCYULgnmkmxxWuXwWIDcxQUoLDMBeO0k1iR9E6bIiRY6rp/jogk11rk8E2Hp/pL 2rd4npQhHkXESqNe01Z+7mzq2pqDAcNmO8uUy4w3dXbtQFzJXVCe+TNcgOtcR9VVY4GI M5Qg== X-Gm-Message-State: AGi0PubxdvBaTwQ4lSKsOhXQt2UhaH/8bCvVXo0Mdkq4fUMAucNdfnEj VMeN+cen18ZECPQorXwrVSA= X-Received: by 2002:a05:600c:210:: with SMTP id 16mr3389215wmi.57.1588170069159; Wed, 29 Apr 2020 07:21:09 -0700 (PDT) Received: from localhost (ip-37-188-130-62.eurotel.cz. [37.188.130.62]) by smtp.gmail.com with ESMTPSA id s6sm8007704wmh.17.2020.04.29.07.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 07:21:08 -0700 (PDT) Date: Wed, 29 Apr 2020 16:21:06 +0200 From: Michal Hocko To: Tetsuo Handa Cc: Sergey Senozhatsky , Petr Mladek , Steven Rostedt , linux-kernel@vger.kernel.org, Dmitry Safonov , Yafang Shao Subject: Re: [PATCH] printk: Add loglevel for "do not print to consoles". Message-ID: <20200429142106.GG28637@dhcp22.suse.cz> References: <20200424024239.63607-1-penguin-kernel@I-love.SAKURA.ne.jp> <20200425004609.GE8982@jagdpanzerIV.localdomain> <842ff40b-a232-6098-4333-996a3033b30a@i-love.sakura.ne.jp> <20200427062117.GC486@jagdpanzerIV.localdomain> <4dae86af-1d9a-f5a8-cff6-aa91ec038a79@i-love.sakura.ne.jp> <20200428121828.GP28637@dhcp22.suse.cz> <20200428154532.GU28637@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 29-04-20 01:23:15, Tetsuo Handa wrote: > On 2020/04/29 0:45, Michal Hocko wrote: > > On Tue 28-04-20 22:11:19, Tetsuo Handa wrote: > >> Existing KERN_$LEVEL allows a user to determine whether he/she wants that message > >> to be printed on consoles (even if it spams his/her operation doing on consoles), and > >> at the same time constrains that user whether that message is saved to log files. > >> KERN_NO_CONSOLES allows a user to control whether he/she wants that message to be > >> saved to log files (without spamming his/her operation doing on consoles). > > > > I understand that. But how do I know whether the user considers the > > particular information important enough to be dumped on the console. > > This sounds like a policy in the kernel to me. > > I'm still unable to understand your question. I am trying to say that KERN_NO_CONSOLES resembles more a policy than a priority. Because I as a developer have no idea whether the message is good enough for console or not. > > I simply cannot forsee > > any console configuration to tell whether my information is going to > > swamp the console to no use or not. > > Neither can I. > > > Compare that to KERN_$LEVEL instead. > > I know that an information is of low/high importance. It is the user > > policy to decide and base some filtering on top of that priority. > > Whether to use KERN_NO_CONSOLES is not per-importance basis but per-content basis. > > Since both pr_info("[%7d] %5d %5d %8lu %8lu %8ld %8lu %5hd %s\n", ...) from dump_tasks() and > pr_info("oom-kill:constraint=%s,nodemask=%*pbl", ...) from dump_oom_summary() use KERN_INFO importance, > existing KERN_$LEVEL-based approach cannot handle these messages differently. Since changing the former to > e.g. KERN_DEBUG will cause userspace to discard the messages, we effectively can't change KERN_$LEVEL. I believe we are free to change kernel log levels as we find a fit. I was not aware that KERN_DEBUG messages are automatically filtered out. Even if this is the case then this doesn't really disallow admins to allow KERN_DEBUG into log files. Dump of the oom eligible tasks is arguably a debugging output anyway. So I disagree with your statement. > If the kernel allows the former to use KERN_NO_CONSOLES in addition to KERN_INFO, the administrator can > select from two choices: printing "both the former and the latter" or "only the latter" to consoles. I am not really familiar with all the possibilities admins have when setting filtering for different consoles but KERN_NO_CONSOLES sounds rather alien to the existing priority based approach. You can fine tune priorities and that is all right because they should be reflecting importance. But global no-consoles doesn't really fit in here because each console might require a different policy but the marking is unconditional and largely unaware of existing consoles. -- Michal Hocko SUSE Labs