From patchwork Fri Sep 23 11:34:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 12986474 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B389ECAAD8 for ; Fri, 23 Sep 2022 11:34:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 529E780008; Fri, 23 Sep 2022 07:34:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B2C080007; Fri, 23 Sep 2022 07:34:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32DFD80008; Fri, 23 Sep 2022 07:34:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 212A480007 for ; Fri, 23 Sep 2022 07:34:40 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E340F81610 for ; Fri, 23 Sep 2022 11:34:39 +0000 (UTC) X-FDA: 79943142678.02.2E96D85 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 892DC10000C for ; Fri, 23 Sep 2022 11:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663932878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4X3wisODltpxscZtCSRmTQy5pbD/XdZXOSG0hYXXj4k=; b=CAzUaYR2RwalxSSWcpvH1xZvAtxhkah7kiJ+jdToj9z7ntnGkHU0GdLQLiXEQWzeBU1KDn GFaXt/GSIeKi65DThXanf4/pbCAxOZfkEihUZ5oYLDZ8SqFJpSFcy59s8h+FDqSZvIIOtm Au1REmRgCB2eBTUVtAGLlp3Il7f7ZRQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-381-WxR3GrKZOCqkUD7z_oVV3g-1; Fri, 23 Sep 2022 07:34:33 -0400 X-MC-Unique: WxR3GrKZOCqkUD7z_oVV3g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B7D83806721; Fri, 23 Sep 2022 11:34:32 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78889492B06; Fri, 23 Sep 2022 11:34:27 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, David Hildenbrand , Linus Torvalds , Andrew Morton , Ingo Molnar , David Laight , Jonathan Corbet , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Baoquan He , Vivek Goyal , Dave Young , Jani Nikula , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Akira Yokosawa , Kalle Valo , "Daniel K ." Subject: [PATCH v2 0/2] coding-style.rst: document BUG() and WARN() rules Date: Fri, 23 Sep 2022 13:34:23 +0200 Message-Id: <20220923113426.52871-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663932878; a=rsa-sha256; cv=none; b=qk9RlspYuP9nTvnhAWi+zE5bruAt/oeOdkGojp15gCJd1/agWS66VVhr1iBXsx/aN0fEDS C/TKHkrtX9Yrb7a2kUdhniYdNLJh3nMv2ldghV0PpzXKfzoDx0WVDQXM98qb6WRR1LedOk eKK5eeHicvCNT6UVnUaRh4ShLmpPOCw= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CAzUaYR2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663932878; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=4X3wisODltpxscZtCSRmTQy5pbD/XdZXOSG0hYXXj4k=; b=Oq6saiWVjnmKU3KCwbFUQI7sOdQ12aDqsxLrdWrjO/d6CIpkDsN50XSqUuzR6+DkTXbnBJ 2WzjyVgXN98Kv0EQp59D68I9s32y62ByAQchIq6lfgZf4GqalGrC1Y1EW/2yiI9Dox4JL9 WMAyhAPwyYF+RX5AInNHlEPzKQ8r2rw= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 892DC10000C X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CAzUaYR2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com X-Stat-Signature: 8fixp9s1j5y1rn7a9ggbxtmsecsfmqyy X-HE-Tag: 1663932878-952791 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As it seems to be rather unclear if/when to use BUG(), BUG_ON(), VM_BUG_ON(), WARN_ON_ONCE(), ... let's try to document the result of a recent discussion. Details can be found in patch #1. v1 -> v2: * "coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel")" -> Minor rephrasing / reference fix [John] -> Compile fix [Akira] * "powerpc/prom_init: drop PROM_BUG()" -> Dropped because it will go upstream via a different tree * "checkpatch: warn on usage of VM_BUG_ON() and other BUG variants" -> Rephrase warning message and remove trailing period [John+Joe] RFC -> v1: * "coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel")" -> Rephrase/extend according to John -> Add some details regarding the use of panic() * powerpc/prom_init: drop PROM_BUG() -> Added * "checkpatch: warn on usage of VM_BUG_ON() and other BUG variants" -> Warn on more variants Cc: Linus Torvalds Cc: Andrew Morton Cc: Ingo Molnar Cc: David Laight Cc: Jonathan Corbet Cc: Andy Whitcroft Cc: Joe Perches Cc: Dwaipayan Ray Cc: Lukas Bulwahn Cc: Baoquan He Cc: Vivek Goyal Cc: Dave Young Cc: Jani Nikula Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Akira Yokosawa Cc: Kalle Valo Cc: Daniel K. David Hildenbrand (2): coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel") checkpatch: warn on usage of VM_BUG_ON() and other BUG variants Documentation/process/coding-style.rst | 62 ++++++++++++++++++++++++++ scripts/checkpatch.pl | 6 +-- 2 files changed, 65 insertions(+), 3 deletions(-)