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 61147C433F5 for ; Thu, 14 Apr 2022 11:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242598AbiDNLWN (ORCPT ); Thu, 14 Apr 2022 07:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242597AbiDNLWJ (ORCPT ); Thu, 14 Apr 2022 07:22:09 -0400 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A841FCE5; Thu, 14 Apr 2022 04:19:44 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id j2so8883136ybu.0; Thu, 14 Apr 2022 04:19:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dY83H0aPEfDTdUo23MndvBRZZwuNuwRYnVKAWx3MFcc=; b=hTLRdySs3CnpaoymfFiM0y+PetDtOzg8joG6JeTvcOymw/WDpAF5uzwknJ8t0LRBVT I+kcuzIn9LHA4QMYkgS/A+mCY0jUBayfLSo+EgS2HECKTepTptyEdA7DCjIuMujFBvth h6DI7Mv4D2wnOc7xe0cCa2NOPDRYjH4MvwDAHO9Eoe9QPeFLUBmvjLWEduB1VwuQ4qML xRJUP6xAKE1Ydo/qwllNsbCj3Q9D5xUUiUe4zDWillfZfEUHsV4efvowMqqlArMOJnh+ 8kOex9vW9o7n0FVP+InF2nbmwQo0UHWvtMfQiGghY5VpaPT3mgullEHZfsNRWODIqQnA P5gA== X-Gm-Message-State: AOAM530oo9GlqneVIjgHSjGfNsZkw70uXNGYqI9O/wtyNwppNCSte/dV ssEsNqqPvNRMFPyjXj4KDxjmR06F+u8Wu2REZEE= X-Google-Smtp-Source: ABdhPJyXV07maZap62IutTg/mwVDj/CfiQiLME5IwIFkAJnTY85PIrUap0WcF7eity1wAkpRDD0UVobPG71n48VtbjA= X-Received: by 2002:a05:6902:187:b0:63d:9c95:edca with SMTP id t7-20020a056902018700b0063d9c95edcamr1246534ybh.81.1649935183962; Thu, 14 Apr 2022 04:19:43 -0700 (PDT) MIME-Version: 1.0 References: <20220411233832.391817-1-dmitry.osipenko@collabora.com> <20220411233832.391817-4-dmitry.osipenko@collabora.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 14 Apr 2022 13:19:32 +0200 Message-ID: Subject: Re: [PATCH v7 03/20] reboot: Print error message if restart handler has duplicated priority To: Dmitry Osipenko Cc: "Rafael J. Wysocki" , 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 , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, "open list:BROADCOM NVRAM DRIVER" , linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, Linux-sh list , xen-devel@lists.xenproject.org, ACPI Devel Maling List , Linux PM , linux-tegra Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 14, 2022 at 12:24 AM Dmitry Osipenko wrote: > > On 4/13/22 21:48, Rafael J. Wysocki wrote: > > On Tue, Apr 12, 2022 at 1:39 AM Dmitry Osipenko > > wrote: > >> > >> Add sanity check which ensures that there are no two restart handlers > >> registered using the same priority. This requirement will become mandatory > >> once all drivers will be converted to the new API and such errors will be > >> fixed. > >> > >> Signed-off-by: Dmitry Osipenko > > > > The first two patches in the series are fine with me and there's only > > one minor nit regarding this one (below). > > > >> --- > >> kernel/reboot.c | 15 +++++++++++++++ > >> 1 file changed, 15 insertions(+) > >> > >> diff --git a/kernel/reboot.c b/kernel/reboot.c > >> index ed4e6dfb7d44..acdae4e95061 100644 > >> --- a/kernel/reboot.c > >> +++ b/kernel/reboot.c > >> @@ -182,6 +182,21 @@ static ATOMIC_NOTIFIER_HEAD(restart_handler_list); > >> */ > >> int register_restart_handler(struct notifier_block *nb) > >> { > >> + int ret; > >> + > >> + ret = atomic_notifier_chain_register_unique_prio(&restart_handler_list, nb); > >> + if (ret != -EBUSY) > >> + return ret; > >> + > >> + /* > >> + * Handler must have unique priority. Otherwise call order is > >> + * determined by registration order, which is unreliable. > >> + * > >> + * This requirement will become mandatory once all drivers > >> + * will be converted to use new sys-off API. > >> + */ > >> + pr_err("failed to register restart handler using unique priority\n"); > > > > I would use pr_info() here, because this is not a substantial error AFAICS. > > It's indeed not a substantial error so far, but it will become > substantial later on once only unique priorities will be allowed. The > pr_warn() could be a good compromise here, pr_info() is too mild, IMO. Well, I'm still unconvinced about requiring all of the users of this interface to use unique priorities. Arguably, there are some of them who don't really care about the ordering, so could there be an option for them to specify the lack of care by, say, passing 0 as the priority that would be regarded as a special case? IOW, if you pass 0, you'll be run along the others who've also passed 0, but if you pass anything different from 0, it must be unique. What do you think?