Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp581230rwe; Fri, 26 Aug 2022 10:11:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Fs2w3VOPjcWm/BAXv6QhFdeCzCKGPDybxSMAuMb3qI2J5XwD0HkFJESy6HbGIKpxas0wp X-Received: by 2002:a63:4625:0:b0:42a:d055:22df with SMTP id t37-20020a634625000000b0042ad05522dfmr4021008pga.312.1661533912572; Fri, 26 Aug 2022 10:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661533912; cv=none; d=google.com; s=arc-20160816; b=NwUenKkHU3DJpmhyuLreX5Om0SgKvvYf9PJUrEQ+mpybbUtASw7rhw8xcl+L8OUuG/ wDKTH6Jglf+6hHQwDaUfg+XDG/H73b4wn/o6sNZzCti+MqCHgKV3jzBBnCiWeKr2MkWh 2ozwK33TrQ6Ehuv6OrAMBMnGpyY115lGdWPNVdb0+WNDxH53H5DAvTU6kW0+7xK8aJfw YF0TLTsNylsSqFZ+zP5lEeoSs7AVsGSZ65SCE/s2FCsW8C3AZgG6Xzw7yTibtUuIx4tO JimPlMJJRanEz9xp6wF59qV6uzCicRkYznvLiQgSRU2cKkW7rYdymvW9DlZ6dd9FwKVd LWmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=jD7hXmOLkBQH1CWMlWymLxkZmC0QqnhEG6nyPcsh0A4=; b=ouY7MAZywXzh6/92vUPIA8Ryu77ErSx2XslIoXjBn6U1dykvx/UCRObekfaetLc9Dm Ltx58v5kex4tpy94odAEbrD0zXik3h0Ltk+9S64yAOeoRm5/WPii+MzrIHwd+pax34UE dBO9NJffS76TB00NeOgy+9k6CbEd8FfO1zV/gtMsmAt7QjzyQGYx+n5Vo2L5Pv0mA8w4 ijyupZCdk9xi+N0GnsixYFH8iJkRp1a5Acdty84+uYbzkJyQKh1lyDuwd8ze3PJy/TeK q+1HJQd9UpYpxiUMXzMMqb1Y+qW6J71ePOExI0K5NLIO9ll9QgqowJFNwmO9yylQVGku YvFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GN6vhlrn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a37-20020a634d25000000b0042b72b95457si2115971pgb.416.2022.08.26.10.11.40; Fri, 26 Aug 2022 10:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GN6vhlrn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242728AbiHZRCd (ORCPT + 99 others); Fri, 26 Aug 2022 13:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344884AbiHZRCR (ORCPT ); Fri, 26 Aug 2022 13:02:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A61E6C6CEF for ; Fri, 26 Aug 2022 10:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661533331; 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=jD7hXmOLkBQH1CWMlWymLxkZmC0QqnhEG6nyPcsh0A4=; b=GN6vhlrnJCF4yQiQ+szDDuz2v1lFmn41zSF3pBzrx99rKNyCHLfCz+xNHExmwUaieY6GoB zaLcByoN+8KMNIuSfcgccbl6Tfv3k/ssub/+5b6A4Gv7bde26Cvq7k/lWd9GExqm9Wfx2M YFiEP4xauiPwJJhI/QaFbO0bEb/yeck= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-244-NqPSFr5SMCmR4e_pAxVENg-1; Fri, 26 Aug 2022 13:02:09 -0400 X-MC-Unique: NqPSFr5SMCmR4e_pAxVENg-1 Received: by mail-wm1-f72.google.com with SMTP id c66-20020a1c3545000000b003a5f6dd6a25so4331934wma.1 for ; Fri, 26 Aug 2022 10:02:09 -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:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=jD7hXmOLkBQH1CWMlWymLxkZmC0QqnhEG6nyPcsh0A4=; b=HaLvYemF30DcEyrP/LrgQPHUxTzIT5CpItjj37A5olRoMyqNgdilrzBKEVOCMnpiS1 BVNbfESkhsezXFNwFchMP1eBp2CgWcZf4FbqKJJZs2GKNr9d+2Fz6+W7Rw0j8yf1vwjA uv8eXwO1Ol7ubdNvqaZLZ1j9buBqa8qFw3q0I+l9Q5/gJaCvwxnq0VP3Zq2x9QYrj7Sj sWgivrYHiTDqVZNiWMIqIPNUR7pbrMGGpmjEl1tHH2+9niDVtMvTgU3ypfRQGcYXSFt9 KMyysnj5s6L5W4krpssOFs4OTvae6Y4UabnLjrEcbc8fzp8ZqP8+DEyNFzYMd5VI/BCf NprQ== X-Gm-Message-State: ACgBeo0PJ4ttZgRK4Uwxa4TuMkVj/MQ4BSJnIyU0qjpOc0R69aUX4iT1 msnARBXHS2F+9niI65jMTqqUAFHn2YPWy4ncmPMgfV2GiLcz+hXA/J8kFvLqn14XV1zujgAUsJb 91i6mOSqHZa/lZdxWhH1TKhsG X-Received: by 2002:a05:600c:8a7:b0:3a6:85b1:2275 with SMTP id l39-20020a05600c08a700b003a685b12275mr360776wmp.30.1661533328599; Fri, 26 Aug 2022 10:02:08 -0700 (PDT) X-Received: by 2002:a05:600c:8a7:b0:3a6:85b1:2275 with SMTP id l39-20020a05600c08a700b003a685b12275mr360750wmp.30.1661533328294; Fri, 26 Aug 2022 10:02:08 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:f600:abad:360:c840:33fa? (p200300cbc708f600abad0360c84033fa.dip0.t-ipconnect.de. [2003:cb:c708:f600:abad:360:c840:33fa]) by smtp.gmail.com with ESMTPSA id l3-20020a1ced03000000b003a32251c3f9sm277131wmh.5.2022.08.26.10.02.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Aug 2022 10:02:07 -0700 (PDT) Message-ID: Date: Fri, 26 Aug 2022 19:02:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: en-US To: Dave Young Cc: John Hubbard , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, kexec@lists.infradead.org, Linus Torvalds , Andrew Morton , Ingo Molnar , David Laight , Jonathan Corbet , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Baoquan He , Vivek Goyal , Stephen Johnston , Prarit Bhargava References: <20220824163100.224449-1-david@redhat.com> <20220824163100.224449-2-david@redhat.com> <0db131cf-013e-6f0e-c90b-5c1e840d869c@nvidia.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH RFC 1/2] coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel") In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.08.22 03:43, Dave Young wrote: > Hi David, > > [Added more people in cc] > Hi Dave, thanks for your input! [...] >> Side note: especially with kdump() I feel like we might see much more >> widespread use of panic_on_warn to be able to actually extract debug >> information in a controlled manner -- for example on enterprise distros. >> ... which would then make these systems more likely to crash, because >> there is no way to distinguish a rather harmless warning from a severe >> warning :/ . But let's see if some kdump() folks will share their >> opinion as reply to the cover letter. > > I can understand the intention of this patch, and I totally agree that > BUG() should be used carefully, this is a good proposal if we can > clearly define the standard about when to use BUG(). But I do have Essentially, the general rule from Linus is "absolutely no new BUG_ON() calls ever" -- but I think the consensus in that thread was that there are corner cases when it comes to unavoidable data corruption/security issues. And these are rare cases, not the usual case where we'd have used BUG_ON()/VM_BUG_ON(). > some worries, I think this standard is different for different sub > components, it is not clear to me at least, so this may introduce an > unstable running kernel and cause troubles (eg. data corruption) with > a WARN instead of a BUG. Probably it would be better to say "Do not > WARN lightly, and do not hesitate to use BUG if it is really needed"? Well, I don't make the rules, I document them and share them for general awareness/comments :) Documenting this is valuable, because there seem to be quite some different opinions floating around in the community -- and I've been learning different rules from different people over the years. > > About "patch_on_warn", it will depend on the admin/end user to set it, > it is not a good idea for distribution to set it. It seems we are > leaving it to end users to take the risk of a kernel panic even with > all kernel WARN even if it is sometimes not necessary. My question would be what we could add/improve to keep systems with kdump armed running as expected for end users, that is most probably: 1) don't crash on harmless WARN() that can just be reported and the machine will continue running mostly fine without real issues. 2) crash on severe issues (previously BUG) such that we can properly capture a system dump via kdump. The restart the machine. Of course, once one would run into 2), one could try reproducing with "panic_on_warn" to get a reasonable system dump. But I guess that's not what enterprise customers expect. One wild idea (in the cover letter) was to add something new that can be configured by user space and that expresses that something is more severe than just some warning that can be recovered easily. But it can eventually be recovered to keep the system running to some degree. But still, it's configurable if we want to trigger a panic or let the system run. John mentioned PANIC_ON(). What would be your expectation for kdump users under which conditions we want to trigger kdump and when not? Regarding panic_on_warn, how often do e.g., RHEL users observe warnings that we're not able to catch during testing, such that "panic_on_warn" would be a real no-go? -- Thanks, David / dhildenb