Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4126189ybz; Tue, 28 Apr 2020 06:16:29 -0700 (PDT) X-Google-Smtp-Source: APiQypJ32QodoAEJGXw3rvvuOBhbpK2ZzdqhAmL4CmLW+A/4u3x4Ddwq8j1gJ3bP278xFZnTKci7 X-Received: by 2002:a17:906:4553:: with SMTP id s19mr24069586ejq.295.1588079789514; Tue, 28 Apr 2020 06:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588079789; cv=none; d=google.com; s=arc-20160816; b=eFPe2UY7FcxlAIbmcym3xOF8D8yyMvYPwvL5IC80y9Vki1SJJOkCmetW1BV88iEHLi +3OVYQGHpNz0qF+HNuz7rw5pEcn2Tm/MFMoBpwAO3bP8duiWMzgsxRgcb8rbJZvxK3k9 BuLEaoqmDU2ksYpkv2qTO9yVCb6I+q/r4JZQomdTJwoQcAIc0d+fE8ls1HpWRGKgclYx Wf5nBj488VZslnCh3rFIeDZw6pkJqau6wOrmdctWfLKnyabLAVVj1QyG2ixtNUWv1+EY nBkrnNHIMg4wYedF+axWVw2k2iKXwduJA6BYvgq48d4ZE2ugVFMS/YmHlo1+MeWWvHy4 4RXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=N/CJJXaWdziJyFhJk9DxP4ffJyJiFki2kzwfrTN0gjM=; b=XhjOT5pe/Fv4QwlXwwdxbs0C3rRaKkjumJefektyWiGPpd3EtoIT2MZWQw2YbpHV97 Lwl14ElbaQD8SrodnNMZ8+XYqeVUnMxJDovFVKy5p5zW6WqPOhFKdgM118x8ei3wXBA8 gRmpBjNIziNEDdGRP9ydxRG0MyyA0qdN7lMfiD0Z0is78k55obwuyLN6rBzZ9qF6Lo8e abxFJ92RyVlFdNPVrF3p7OE0F+9rOHNU2kaDImFfUHcpBX+vZ9qHZUd6g3XH/aFsKH5D CGkzAs85nO8qvIC06NXxudxFuvBkdg+fjTvXCkQiRT8XyaDZkziST1EBiHZPhuDUAMx2 18mA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qq22si1726692ejb.523.2020.04.28.06.16.05; Tue, 28 Apr 2020 06:16:29 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbgD1NMP (ORCPT + 99 others); Tue, 28 Apr 2020 09:12:15 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:52173 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbgD1NMP (ORCPT ); Tue, 28 Apr 2020 09:12:15 -0400 Received: from fsav103.sakura.ne.jp (fsav103.sakura.ne.jp [27.133.134.230]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 03SDBVLO084794; Tue, 28 Apr 2020 22:11:31 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav103.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav103.sakura.ne.jp); Tue, 28 Apr 2020 22:11:31 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav103.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 03SDBRAQ084782 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 Apr 2020 22:11:31 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] printk: Add loglevel for "do not print to consoles". To: Michal Hocko Cc: Sergey Senozhatsky , Petr Mladek , Steven Rostedt , linux-kernel@vger.kernel.org, Dmitry Safonov , Yafang Shao 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> From: Tetsuo Handa Message-ID: Date: Tue, 28 Apr 2020 22:11:19 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428121828.GP28637@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/04/28 21:18, Michal Hocko wrote: > On Tue 28-04-20 20:33:21, Tetsuo Handa wrote: >> On 2020/04/27 15:21, Sergey Senozhatsky wrote: >>>> KERN_NO_CONSOLES is for type of messages where "saved for later analysis" is >>>> important but "printed for immediate notification" is not important. >>>> In other words, KERN_NO_CONSOLES is NOT for dying messages where "printed for >>>> immediate notification" is important. >>> >>> per-console loglevel is a user configurable parameter. >>> KERN_NO_CONSOLES is a hard-coded policy. >> >> But given that whether to use KERN_NO_CONSOLES is configurable via e.g. sysctl, >> KERN_NO_CONSOLES will become a user configurable parameter. What's still wrong? > > How do I as a kernel developer know that KERN_NO_CONSOLES should be > used? In other words, how can I assume what a user will consider > important on the console? > 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). Consoles which are limited by "rows" * "columns" size should receive (ideally) up to a few lines of messages. Printing more lines on such consoles disturbs users using such consoles. Let alone printing one thousand lines of messages (e.g. dump_tasks()) on such consoles. Printing one thousand lines of messages on read-only consoles (e.g. netconsole) might be fine, but non-urgent messages can afford waiting for userspace to do more sophisticated handling (e.g. evaluate and filter). Even without per-console loglevel feature, we can reduce spam messages for consoles by using KERN_NO_CONSOLES. For example, send only the summary part of OOM-killer and allocation failure messages to both consoles and log files (by not using KERN_NO_CONSOLES), and send the non-summary part to only log files (by using KERN_NO_CONSOLES with KERN_$LEVEL used for summary part in order to make sure that userspace daemon will save both the summary and non-summary parts).