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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98DC2C43219 for ; Fri, 10 Dec 2021 19:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343660AbhLJTls (ORCPT ); Fri, 10 Dec 2021 14:41:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343644AbhLJTlr (ORCPT ); Fri, 10 Dec 2021 14:41:47 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662C4C0617A1; Fri, 10 Dec 2021 11:38:11 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id i63so15236254lji.3; Fri, 10 Dec 2021 11:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Vz91z0+ORqGgdBCzgXjvRZ+BnKWf40l2Uiz2VnVlq8k=; b=eZMbcUXJM6JFal7aKwXhI/zy2v2hsv6rjyETVziUEcyYhNcg6LAUN09SVbxxTQlCdu 48ThdZHjH5oN83Vb3L4mJIfoBjma15qEEhMbLCJ9enFQmERgo4lteVUQPAb4Y8JgOjsq 7ZmOQ7grPhjGYig7dCgOjLZZBHSDH75bpeiQUz0UkPGOU7rsqJhk71e0rLD6TE0flZ2X dazEIm86TjOs0vu1kBQHUAQAqwylSJZ01JBHT6WLG7J/LOnVfkO/7b9CPxeuZ6NJ8BMo jKCmkVO9SLg4PsHP720p1V12OBYdWJK0lEqLDpCAuJd3HSFk0stATZ42n3vOpzDj4hRW GlVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Vz91z0+ORqGgdBCzgXjvRZ+BnKWf40l2Uiz2VnVlq8k=; b=XNXZTAcATvJ7LDMcCiPxQBX4bVMwvktM4DdjelqrME/455xdq5s6k+iqEjQNSE9OIf FgYFApoyr2H7NKeTgIW0ZzslCDoHkMEVHjtn5P3kCnr/SgscF4w/zsk+OMSCDnQvlSaf R8Y3XDhTLv7Ix1bSl8vKTU7yAktbvz5WGcVb+9UMJJ6jFbymFdtIPb7vhZymquPzPl/X oifDf21VzYIaN2HSiluieAGyz1DeF+Pyv6FyUeMSYDIMQDcolQyQvceiMd12JSK/MxTL IvRxpn2nkJndmXEO2PcLDwcF+bAKKjXtC+uOC3AJb0ewqIN8Mn6njCBobYikTYmMdzML c/yg== X-Gm-Message-State: AOAM5318aDx8xDVjF3JC67I1HiepCVmQUXkBKTxln2Q0hTElN67bqqnO jchVBO+A0noR3rXsSqJD0U7SnyBxMGk= X-Google-Smtp-Source: ABdhPJwmRMsITckKyfKcY5/bceJH9ZYTPTjj0S432HFHTKbLTU9WPpBsAnrN2ZIngDo5MzFGTcTiYQ== X-Received: by 2002:a2e:5c46:: with SMTP id q67mr14941958ljb.271.1639165089500; Fri, 10 Dec 2021 11:38:09 -0800 (PST) Received: from [192.168.2.145] (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.googlemail.com with ESMTPSA id g26sm381590ljn.107.2021.12.10.11.38.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Dec 2021 11:38:09 -0800 (PST) Subject: Re: [PATCH v4 06/25] reboot: Warn if unregister_restart_handler() fails To: "Rafael J. Wysocki" Cc: Thierry Reding , Jonathan Hunter , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Geert Uytterhoeven , Greg Ungerer , Joshua Thompson , Thomas Bogendoerfer , Sebastian Reichel , Linus Walleij , Philipp Zabel , Greentime Hu , Vincent Chen , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Len Brown , Santosh Shilimkar , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Pavel Machek , Lee Jones , Andrew Morton , Guenter Roeck , Daniel Lezcano , Andy Shevchenko , Ulf Hansson , alankao@andestech.com, "K . C . Kuen-Chern Lin" , Linux ARM , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev , linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra References: <20211126180101.27818-1-digetx@gmail.com> <20211126180101.27818-7-digetx@gmail.com> From: Dmitry Osipenko Message-ID: <41415df9-0d08-2944-5cf2-493468e21a22@gmail.com> Date: Fri, 10 Dec 2021 22:38:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 10.12.2021 22:08, Rafael J. Wysocki пишет: > On Fri, Dec 10, 2021 at 7:54 PM Dmitry Osipenko wrote: >> >> 10.12.2021 21:32, Rafael J. Wysocki пишет: >>> On Fri, Nov 26, 2021 at 7:02 PM Dmitry Osipenko wrote: >>>> >>>> Emit warning if unregister_restart_handler() fails since it never should >>>> fail. This will ease further API development by catching mistakes early. >>>> >>>> Signed-off-by: Dmitry Osipenko >>>> --- >>>> kernel/reboot.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/kernel/reboot.c b/kernel/reboot.c >>>> index e6659ae329f1..f0e7b9c13f6b 100644 >>>> --- a/kernel/reboot.c >>>> +++ b/kernel/reboot.c >>>> @@ -210,7 +210,7 @@ EXPORT_SYMBOL(register_restart_handler); >>>> */ >>>> int unregister_restart_handler(struct notifier_block *nb) >>>> { >>>> - return atomic_notifier_chain_unregister(&restart_handler_list, nb); >>>> + return WARN_ON(atomic_notifier_chain_unregister(&restart_handler_list, nb)); >>> >>> The only reason why it can fail is if the object pointed to by nb is >>> not in the chain. >> >> I had exactly this case where object wasn't in the chain due to a bug >> and this warning was very helpful. > > During the development. In production it would be rather annoying. > >>> Why WARN() about this? And what about systems with >>> panic_on_warn set? >> >> That warning condition will never happen normally, only when something >> is seriously wrong. >> >> Those systems with panic_on_warn will get what was they asked for. > > They may not be asking for panicking on bugs in the reboot notifier > code, though. That's what your change is making them panic on. > Alright, I'll drop the warnings and turn the warning about uniqueness into error or warning message.