Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1369510imm; Wed, 20 Jun 2018 17:03:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK5X7VmXz2P016KMpGPNeHDc+druRmixx4kWk5QcfpJgAC5uv+nCQfS4C4ccCWQzL+f7reZ X-Received: by 2002:a62:8b0a:: with SMTP id j10-v6mr24815606pfe.28.1529539383051; Wed, 20 Jun 2018 17:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529539383; cv=none; d=google.com; s=arc-20160816; b=Y7N8FjbGdfAHOByIj0hTE7J7257jrXKBAkC3tbkj0P6hUFu9nw6B4aOs+b33JYp4LB 1CNe5UeiiTRHMaWRquv5U+TNZTza9Otlrwg/W1OP3PgPNhHGbIju8wYD3IpxWfZ2GLzm jfUiBh20b+CbtMfViyts3fh7hMWetqeI8zI2lbV97G4xKgLp4TD6JJQwR/EKEjrOZMCT nLnvGkgZ3tb2+jjlQi0ZurA/Qle1xHMLJBXRrildGD4Jho1yrS5juAfJ8GR5ieVTCNYE YzgT6Jxclcg/gnOrCocPRoOVHCb9PSYaKnat4c1Mu4Hc5GWcRlQNYJCx6rIoU9em2mw7 Vdzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=giVPxdV0PhucvUuOiMvusgCD/gLkZQ3dggNQy7gat1k=; b=JZA9uDPx8vizvYmkh8x5pxIkmTUDoqDOQSNQpEIOAUAZjpVeqjT98S6AxGB8StLdNI 2ss+tMWYsPTHyadZEnhecS/IBNIU0Le44rxlSUBBie/RtH0yHvGEYjSj2cPmUVKrzXob 3tyWgw1TlxiY5wgPiCGrTLAxOg3AXCURjJ1w9FPtz2ZXyEbaMeAWJpUH826sKY14/nWE 1dBUn0kX3sLUUkh30UCEKcOyOLL7zoEcAp4qtEoA1KYkbguMNPVRvwhdIud8+lA1rCti hEahFhj8PUcwHBdpb8MM+JS4KbblHsCpl9xS8q2D2MTrQgFBY+nIL9rOPVrzWZb45JZL 8quQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w78-v6si3496646pfa.359.2018.06.20.17.02.49; Wed, 20 Jun 2018 17:03:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932718AbeFUACK (ORCPT + 99 others); Wed, 20 Jun 2018 20:02:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40598 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932307AbeFUACJ (ORCPT ); Wed, 20 Jun 2018 20:02:09 -0400 Received: from localhost (113x41x139x141.ap113.ftth.ucom.ne.jp [113.41.139.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 15EFDD5E; Thu, 21 Jun 2018 00:02:08 +0000 (UTC) Date: Thu, 21 Jun 2018 09:02:07 +0900 From: Greg KH To: Dmitry Vyukov Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, Dmitry Vyukov Subject: Re: [PATCH] include/asm-generic/bug.h: clarify valid uses of WARN() Message-ID: <20180621000207.GB21936@kroah.com> References: <20180620103716.61636-1-dvyukov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180620103716.61636-1-dvyukov@gmail.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 20, 2018 at 12:37:16PM +0200, Dmitry Vyukov wrote: > From: Dmitry Vyukov > > Explicitly state that WARN*() should be used only for recoverable > kernel issues/bugs and that it should not be used for any kind of > invalid external inputs or transient conditions. > > Motivation: it's a very useful capability to be able to understand > if a particular kernel splat means a kernel bug or simply an invalid > user-space program. For the former one wants to notify kernel developers, > while notifying kernel developers for the latter is annoying. > Even a kernel developer may not know what to do with a WARNING > in an unfamiliar subsystem. This is especially critical for any automated > testing systems that may use panic_on_warn and mail kernel developers. > > The clear separation also serves as an additional documentation: > is it a condition that must never occur because of additional > checks/logic elsewhere? or is it simply a check for invalid inputs > or unfortunate conditions? > > Use of pr_err() for user messages also leads to better error messages. > "Something is wrong in file foo on line X" is not particularly useful > message for end user. pr_err() forces developers to write more meaningful > error messages for user. > > As of now we are almost there. We are doing systematic kernel testing > with panic_on_warn and are not seeing massive amounts of false positives. > But every now and then another WARN on ENOMEM or invalid inputs pops up > and leads to a lengthy argument each time. The goal of this change > is to officially document the rules. > > Signed-off-by: Dmitry Vyukov > --- > include/asm-generic/bug.h | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) Nice! Acked-by: Greg Kroah-Hartman