From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937808AbdJQVzB (ORCPT ); Tue, 17 Oct 2017 17:55:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51166 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933438AbdJQVzA (ORCPT ); Tue, 17 Oct 2017 17:55:00 -0400 Date: Tue, 17 Oct 2017 14:54:58 -0700 From: Andrew Morton To: Andi Kleen Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] Support resetting WARN*_ONCE Message-Id: <20171017145458.8991e3bb4bd989004c499ac7@linux-foundation.org> In-Reply-To: <20171017214017.22708-1-andi@firstfloor.org> References: <20171017214017.22708-1-andi@firstfloor.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Oct 2017 14:40:17 -0700 Andi Kleen wrote: > From: Andi Kleen > > I like _ONCE warnings because it's guaranteed that they don't > flood the log. > > During testing I find it useful to reset the state of the once warnings, > so that I can rerun tests and see if they trigger again, or can > guarantee that a test run always hits the same warnings. > > This patch adds a debugfs interface to reset all the _ONCE > warnings so that they appear again: > > echo 1 > /sys/kernel/debug/clear_warn_once > > This is implemented by putting all the warning booleans into > a special section, and clearing it. Seems useful. Can we document the new interface please? I'm not sure where :( If it was in /proc/sys/kernel then we'd have a Documentation file. But debugfs? > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > > #define PANIC_TIMER_STEP 100 > #define PANIC_BLINK_SPD 18 > @@ -587,6 +588,32 @@ void warn_slowpath_null(const char *file, int line) > EXPORT_SYMBOL(warn_slowpath_null); > #endif > > +#ifdef CONFIG_BUG > + > +/* Support resetting WARN*_ONCE state */ > + > +static int clear_warn_once_set(void *data, u64 val) > +{ > + memset(__start_once, 0, __end_once - __start_once); Suggest we include asm/sections.h explicitly, rather than by luck. > + return 0; > +}