From mboxrd@z Thu Jan 1 00:00:00 1970 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 6322AC433FE for ; Tue, 4 Oct 2022 12:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D78E66B0072; Tue, 4 Oct 2022 08:32:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D282C6B0073; Tue, 4 Oct 2022 08:32:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC7B76B0074; Tue, 4 Oct 2022 08:32:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A960D6B0072 for ; Tue, 4 Oct 2022 08:32:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 73EBD1C6515 for ; Tue, 4 Oct 2022 12:32:50 +0000 (UTC) X-FDA: 79983206100.10.8967CE8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 1BCDF14001C for ; Tue, 4 Oct 2022 12:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664886769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ARqzLCUGK9oxipjgV/TP0dhqnyFoncnYQ36iiV2KnPc=; b=Bj3j42Z1UFJxAf6YnYiq7NJ3NO9F4UlDsMIq/7WYaWkpoVrynneqQ4mr6cmd8P35wooo+5 YZikVsJClDnsIlB4/Pq/SufLkKeAPtSRu2ZnjjVHRF5aQOrXEaeBt1id4GngKaVoV67Uyk y+uh0YZd8vEipXD3A8r7trk4I9m0sI4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-386-K9JCuiWKOCetMTFCGinQVQ-1; Tue, 04 Oct 2022 08:32:48 -0400 X-MC-Unique: K9JCuiWKOCetMTFCGinQVQ-1 Received: by mail-wr1-f69.google.com with SMTP id p7-20020adfba87000000b0022cc6f805b1so4053295wrg.21 for ; Tue, 04 Oct 2022 05:32:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=ARqzLCUGK9oxipjgV/TP0dhqnyFoncnYQ36iiV2KnPc=; b=36QegAf2txMezd3KbgsfHEMeFHmr3kV08bOwP4fdosRwUTjfBVo3ePBTri6YX9cp5Z J1CHu9VRxM17ZC7Y4SgtrPwJlspQkTivs7jVpJRNKezWMF9dY/Gf67JdqbyKlUWinX2C cx5cy+exZBSuM0IV8HIr4mELg4kTjoZNP9xhGY65tYbfy6thWxlzWtmLJjkYsaWRokUt Rue7oqvk9p2k4zxtRkD+Y/t8PW5nsf2PNiJ77j1PcMQ6wVWmqj8LlxREl6MCcGYr1NFu 8rFQ7AKYLXt3eq5Y7VQsfAUkNPejk6zY6VUfM2LJiWfVt4Of81zWg4VcIPkKMLEJjK8B cklw== X-Gm-Message-State: ACrzQf3rnbLWf2J5I2JLRTs1tLjmmHp19JVXn24Aw+V898oFI7RbFvBw zLRdGahbpR4yOB6ZbaWBwPX9fZvwn61icU7PEC+5wiKJxVl2XTNWWPEqj/3MvHyfCw3YBStyZkW Og/DGcrWFiFw= X-Received: by 2002:adf:fb84:0:b0:21a:10f2:1661 with SMTP id a4-20020adffb84000000b0021a10f21661mr15777352wrr.2.1664886767406; Tue, 04 Oct 2022 05:32:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xqePutEPB3BXlHEVeHUD3E+8ExIhv/azDcUvIYjAckd2CXwfmrDfdmGjPdpAJS/YBJHMgGg== X-Received: by 2002:adf:fb84:0:b0:21a:10f2:1661 with SMTP id a4-20020adffb84000000b0021a10f21661mr15777319wrr.2.1664886767130; Tue, 04 Oct 2022 05:32:47 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:5000:4fff:1dd6:7868:a36? (p200300cbc70650004fff1dd678680a36.dip0.t-ipconnect.de. [2003:cb:c706:5000:4fff:1dd6:7868:a36]) by smtp.gmail.com with ESMTPSA id k5-20020adff5c5000000b0022afbd02c69sm10360655wrp.56.2022.10.04.05.32.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Oct 2022 05:32:46 -0700 (PDT) Message-ID: <31f20ddf-cd41-69b5-2875-2d738b166ae2@redhat.com> Date: Tue, 4 Oct 2022 14:32:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v1 1/3] coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel") To: Kalle Valo Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, 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 References: <20220920122302.99195-1-david@redhat.com> <20220920122302.99195-2-david@redhat.com> <87pmfp8hnj.fsf@kernel.org> <87leq64m20.fsf@kernel.org> From: David Hildenbrand Organization: Red Hat In-Reply-To: <87leq64m20.fsf@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664886770; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ARqzLCUGK9oxipjgV/TP0dhqnyFoncnYQ36iiV2KnPc=; b=BZUGbdhl2nAzjmqHE4gqgSgyU0O4k6us/E67ncdOPeRg75rBRz+p5GLpzvHRQOtD3AjaQO QIUjlHPQJCVez1ib6kVGUCxcKEHLrYr0le2q5flgfgn6AjOEIJ0ZMXKmQuQZcH07xwijP3 xwo0+Uk8H+k/9qVTHpY4133sv4wB4ks= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Bj3j42Z1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664886770; a=rsa-sha256; cv=none; b=PWhIn29E/uhfx6Hs2slm4NttwmiNiEYdsR9U0Al9SeW2ozleNxeam98WxlaEJJD087o8nN O/CnaXEdk0n2RyPIWbjo/h8pH0Kmgq0+ydvhkrPZzGQx0JaKPPBwcx3xd+S8j/SVklnm4L S9fptsemu8EESqnDprzYUzScyP9YqoM= X-Stat-Signature: zy7tp3tb6h4jpopayjanu5x73r3eq7x8 X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1BCDF14001C Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Bj3j42Z1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com X-HE-Tag: 1664886769-898524 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: On 26.09.22 09:44, Kalle Valo wrote: > David Hildenbrand writes: > >>>> +Use WARN_ON_ONCE() rather than WARN() or WARN_ON() >>>> +************************************************** >>>> + >>>> +WARN_ON_ONCE() is generally preferred over WARN() or WARN_ON(), because it >>>> +is common for a given warning condition, if it occurs at all, to occur >>>> +multiple times. This can fill up and wrap the kernel log, and can even slow >>>> +the system enough that the excessive logging turns into its own, additional >>>> +problem. >>> >>> FWIW I have had cases where WARN() messages caused a reboot, maybe >>> mention that here? In my case the logging was so excessive that the >>> watchdog wasn't updated and in the end the device was forcefully >>> rebooted. >>> >> >> That should be covered by the last part, no? What would be your suggestion? > > I was just thinking that maybe make it more obvious that even WARN_ON() > can crash the system, something along these lines: > > "..., additional problem like stalling the system so much that it causes > a reboot." Hi Kalle, sorry for the late reply. Jonathan already queued v2 and sent it upstream. I think that's it is already covered by the statement and that the additional example isn't required -- most of us learned the hard way that "excessive logging turns into its own problem" includes all weird kinds of kernel crashes. A panic/reboot due to a watchdog not firing is one such possible outcome. Thanks! -- Thanks, David / dhildenb