Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1487817pxu; Fri, 27 Nov 2020 08:18:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk7iqnlljHuwTS96TpRQyRGXDphyKzi6OAhXUKCHs/crOjp2MSmbBD2ce8UEpNO0VFHPww X-Received: by 2002:a05:6402:17f0:: with SMTP id t16mr8311442edy.107.1606493926584; Fri, 27 Nov 2020 08:18:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606493926; cv=none; d=google.com; s=arc-20160816; b=o2eExqZPuQr4NWAGM1UXBruHzp4OpEG3GeN5fkT+XFJnOe1mzMM8NrvjCpSfm3f+Ao YkpY9OrpESxtlhaHdTOjQfLXwvzVIP/pCLNOEgdYrgtKXVooiQ77a+V9zH4J8x3nLh07 gxpNrN3egDWPWuSn9I/GTJf7tV/N73d5UfbXXp2ZEvdjnQm6+V605ZRgR6Y6KqgCXLCL Bs0Zjzr2zucOmYP5tNOf9v/IanSuX9sx6n2yzSSZTdbtySzLfoTxZXxwy4FMJkq6kiBX Mpd7mYm5uv2brJdcq9aFksT8rsSlW4xarmug4Vgbnoz1x+SWYvEFTSVpP+Zf28XngCKA MYKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zNyePPr8eaM8q6N1hI8z6fuqCl9mrbj+/oSQS+LcGdc=; b=Hw9eJisj0GAo4xZBUZvpobqqbdZlSLBlxPZWkusDUrB6daFiuIu5sUmgx9DBdhPjmR JHJaYiEiHc9SMgpi3YFIwCLbPGqqONynB4aP0dvcAtALlKIjXinKGQl4F49Vzs4uBKfy XlyYaMU2fUKNCsvn1cfHpHjwCe5bAsfwnFtBAu+8UKYsZ6N8mZWI0nLyo1PTqDSpH2on XNcBbCf9mzgbz0rtwLSO0ySu4cVRB4vQDMeK6+dnBOIHd5GnpsCk4MNAUPmJAiCzuQ5x Sk1eCkFY9sEcHCZBIwcrY8BAUpC0OTDWynKkiOITtWvv9RK2Fd3bF0syqkPuMRU70XYg Ndwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qxot8es6; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yj16si4016326ejb.693.2020.11.27.08.18.22; Fri, 27 Nov 2020 08:18:46 -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=@suse.com header.s=susede1 header.b=qxot8es6; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731374AbgK0QN4 (ORCPT + 99 others); Fri, 27 Nov 2020 11:13:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:39666 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbgK0QNz (ORCPT ); Fri, 27 Nov 2020 11:13:55 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606493633; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zNyePPr8eaM8q6N1hI8z6fuqCl9mrbj+/oSQS+LcGdc=; b=qxot8es63erorEWepO3xkbh/OnZQsbV5DAmD478L74PIdOK5TOvWXbwgE27UHuuu1YTiFt H+YZqvkVTWnZQTFR4dH1OdqCFzhgH3adySpeBkklnUAr+AzBm2QnUq19Mc5rsZmd2556ld kaMBZRwNX8C9Zjls+1LinOQxg7Tsa84= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B387FAC2D; Fri, 27 Nov 2020 16:13:53 +0000 (UTC) Date: Fri, 27 Nov 2020 17:13:52 +0100 From: Petr Mladek To: Paul Gortmaker Cc: linux-kernel@vger.kernel.org, Andi Kleen , Sergey Senozhatsky , Steven Rostedt , John Ogness Subject: Re: [PATCH 0/3] clear_warn_once: add timed interval resetting Message-ID: References: <20201126063029.2030-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126063029.2030-1-paul.gortmaker@windriver.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-11-26 01:30:26, Paul Gortmaker wrote: > The existing clear_warn_once functionality is currently a manually > issued state reset via the file /sys/kernel/debug/clear_warn_once when > debugfs is mounted. The idea being that a developer would be running > some tests, like LTP or similar, and want to check reproducibility > without having to reboot. > > But you currently can't make use of clear_warn_once unless you've got > debugfs enabled and mounted - which may not be desired by some people > in some deployment situations. > > The functionality added here allows for periodic resets in addition to > the one-shot reset it already had. Then we allow for a boot-time setting > of the periodic resets so it can be used even when debugfs isn't mounted. > > By having a periodic reset, we also open the door for having the various > "once" functions act as long period ratelimited messages, where a sysadmin > can pick an hour or a day reset if they are facing an issue and are > wondering "did this just happen once, or am I only being informed once?" What is the primary problem that you wanted to solve, please? Do you have an example what particular printk_once() you were interested into? I guess that the main problem is that /sys/kernel/debug/clear_warn_once is available only when debugfs is mounted. And the periodic reset is just one possible solution that looks like a nice to have. Do I get it correctly, please? I am not completely against the idea. But I have some concerns. 1. It allows to convert printk_once() into printk_ratelimited() with some special semantic and interface. It opens possibilities for creativity. It might be good and it also might create problems that are hard to foresight now. printk_ratelimited() is problematic, definitely, see below. 2. printk_ratelimited() is typically used when a message might get printed too often. It prevents overloading consoles, log daemons. Also it helps to see other messages that might get lost otherwise. I have seen many discussions about what is the right ratelimit for a particular message. I have to admit that it was mainly related to console speed. The messages were lost with slow consoles. People want to see more on fast consoles. The periodic warn once should not have this problem because the period would typically be long. And it would produce only one message on each location. The problem is that it is a global setting. It would reset all printk_once() callers. And I see two problems here: + Periodic reset might cause printing related problems in the wrong order. Messages from victims first. Messages about the root of the problem later (from next cycle). It might create confusion. + People have problems to set the right ratelimit for a particular message. It would be even bigger problem to set the right ratelimit for the entire system. I do not know. Maybe I am just too paranoid today. Anyway, there are other possibilities: + Move clear_warn_once from debugfs to a location that is always available. For example, into /proc + Allow to change printk_once() to printk_n_times() globally. I mean that it would print the same message only N-times instead on once. It will print only first few occurrences, so it will not have the problem with ordering. Any other opinion? Best Regards, Petr