Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1627429pxb; Thu, 14 Apr 2022 10:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMJwWkMYoYzt1m/oMwh27rBtKMvqQTcsCT8LAZDSgqoSP7JAejy15TFWW8H1sqU9JAVWjN X-Received: by 2002:a05:6a00:16c5:b0:505:c572:7c2a with SMTP id l5-20020a056a0016c500b00505c5727c2amr15830617pfc.46.1649956749581; Thu, 14 Apr 2022 10:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649956749; cv=none; d=google.com; s=arc-20160816; b=QRCw5cDPEbrDMYHl9ivija3Qy3/VHq83o4Yc96qGqXIG/0O9braHrIIgLmSJyS53Nd GafBAvoAs1LSPn7btFk7TKY+R9ZGOW8BXP09q8krjJ10mNAMRAf6Bys/U6zwyTtrbZMo 4tnBXwP3O0dYSYm3K0YH56OafcEzf4MDN8dNXVCKnvyu+R5s9cJXzwN6bkVbuVMxHJRW eqtWw3GbJZJsMhbdpkyYI0v27pHst75JWnZ08J7PfhK1AeNzoU3x89O2U2u5pbhfGa5B VsG+KHOLgw3a8EMOqxiCxyI8TrSuiBn/DxSOhdTDA9bH9clfqHK32181cjA519HhXMBX euUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=dY83H0aPEfDTdUo23MndvBRZZwuNuwRYnVKAWx3MFcc=; b=oj+4BxXgpl2M42Rntk+ihbeXIP0muTGYp125YaM1ijpJD2Gk4/PZik+zLz/3uD8oTF 9TAin/Ki0ryDh7hUxMcpglBCsUj5ej4y4kkvZDyfLbJ/YvwqV/LLYTsnPzi5c4uvnCF3 v4BYImhsr/R5y/RHO29N4oN0Lu04BwQSf8icKuMX6mIojHV4HkHvHR2EFxLSCiU0HjMh ZfjLfTfpa+dvjXAYyYfdcvwqzCIwnKEDEYE1+thvyjFvr33iXngU1Zw9Pg2KcXDRc4Le gAZhZm4dr8Q5f9HyBb9MMPboqZaO/vk8cMzzBlQzGDk23lYtViw1Pd1/Q2uxer1YGPuY gkvw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s188-20020a6377c5000000b00382b21d7ab8si3959434pgc.761.2022.04.14.10.18.49; Thu, 14 Apr 2022 10:19:09 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242615AbiDNLWM (ORCPT + 99 others); Thu, 14 Apr 2022 07:22:12 -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-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" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 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?