Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3114131rdh; Mon, 27 Nov 2023 06:50:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxYzSc5vuHsOig2qzvTYaGh1ONne6awQKYRmHPvlEqFZnvhPQMxXWsNng0ZGPJ90I0uH97 X-Received: by 2002:a17:903:2642:b0:1cf:c389:74a2 with SMTP id je2-20020a170903264200b001cfc38974a2mr4779548plb.53.1701096601170; Mon, 27 Nov 2023 06:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701096601; cv=none; d=google.com; s=arc-20160816; b=fWJRm5Ye3XXl0ZEojt2BLmNhjQLlsu8j5iAHv8UEaT9VC/Wv6LeX7g0wsOoPrHltkV xh75hCXsdftCKkHhsGLslmisFyPT5gqWTC2U7f8DMLz6kLCjhkdEld0SwxOymHv7AqQ1 UmVoCHjo4HV+6gko0WxjeBS9G7DwVHxN8XIzyEPN6bhWPXSjrAohIcKFy3jBhYhbWi2E XUTFJ2CBwiwXOJV+mDm4kKPozxAeVSyoGUd3AHxBgm1433/FO+y21WJASjeHug6dlekH UdThnfOHLDb0PRfvZwEUzIokDtVP/ayA2GCcwZ36pjyzYRAe++3HAZ69p9bZouHd7nIp hKpA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=FOQKvfpY0DGJC1g0BayKPczKP7ZYbRdjmTgXJyhyTVw=; fh=bLXsxL46tAheTiES/B3oiaa+VK9dwRSVbQvXpc0nciA=; b=SEPQOtFGBNLt46nd6y7yx0KwjwVq5jf7iUXaYVJ/RJkr34MYS8/H5MDFZH9YPSpIKj 7KTOJ0hh711rDI90y9xSLXQaQAKnbLLPzSk0Sn3soFMM+jMmam93ekgpMiLJc3MVtQLF U2F1V2ex8d/B/KcC8aD6mwxORmuOaDkVglpfgUkBK5JzbKrISupkP1+5Ig8LC45vzO3P 8rFW/gDuWkoOtajVyO953rE2CfzzNv8aAm3d59KA/Bd0ibpz7+QBK+/tLsMMJ9HKLxXl z8DnrtoizCMvFw7ENFT02M32wuW1q8u8rGkfCIKGHR6gF3GZbvzgnLSOOlLJ3lPALhg8 JfXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X0MXHjx6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b18-20020a170903229200b001cf5572d972si8209814plh.210.2023.11.27.06.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:50:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X0MXHjx6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DC39F809FC8D; Mon, 27 Nov 2023 06:49:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233809AbjK0Ots (ORCPT + 99 others); Mon, 27 Nov 2023 09:49:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233504AbjK0Otr (ORCPT ); Mon, 27 Nov 2023 09:49:47 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD7FFA1; Mon, 27 Nov 2023 06:49:52 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-507e85ebf50so5811186e87.1; Mon, 27 Nov 2023 06:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701096591; x=1701701391; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=FOQKvfpY0DGJC1g0BayKPczKP7ZYbRdjmTgXJyhyTVw=; b=X0MXHjx63VXfqlmdDiQGnjkOJMt19dD2LVzJZ2DTR9+0znst2hAJ8gGz+AzZlPjae+ h0DT1AmCAHkODEcEmxetIF94iWTfHl3O8QPMaXFxITUt6jGNq8GJ0Y7XfLgBuGg4vQtw uzdmcYdMq7QR2E1UqdVLr8T5Yezj0uV4Wu4xaVJII0Gf3Rp7HrxsdJoS2DSXK6kfO8D3 B8ijRV8eoHWb21F06QrigkLf3H37ndK26U40xi2F2m1a3GpHdRMjv/5Msr/LfZm9pk5M c0mnyDj89iVpUIscHc0s/9b7LwxNisHpqMC4tE/onS1N27Zex+znst9MzDm9VMxbmJ8h Zp1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701096591; x=1701701391; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FOQKvfpY0DGJC1g0BayKPczKP7ZYbRdjmTgXJyhyTVw=; b=EE0trt/0vI3UEvXLneIChtNc+slIvC8n7msnR+D/2K8Al5aFKYtwbh1kr+5otqaNVl xF+xpkscvqwhEedwLh5d0Hr+tn2Wnb9w3rEkFmTQNWxNNp5PdFaez6Jw3HUCmMEOzcOU VLxFRY/A1Yjk/QVzXasZUZIjh2j7GnrP06/udGbGzYe2fvT2YYLH45nxQ+wkiuZHRvc1 zgBAPBGSW9HVYmSkx8EbpwUVsCMiXQJZG8Pl9zGuJR3dibtexJZxaNo8zpzOZvKzQ6Dg ADEzQxoduCYlg+I+3QEUfv9mdnJAPulxI+0A9nSl/3UMtu+G0YSFRddxMugJLD8rMjym JHVQ== X-Gm-Message-State: AOJu0YzapirctpnZ2za/aYHFj1mnUEEN5e5tRUzVhXaKL/EKBgHXhEgg j7im+2sKl73/a3Xzu/F22uw= X-Received: by 2002:a05:6512:ac2:b0:50b:a720:8ae4 with SMTP id n2-20020a0565120ac200b0050ba7208ae4mr7146108lfu.36.1701096590794; Mon, 27 Nov 2023 06:49:50 -0800 (PST) Received: from ?IPV6:2001:14ba:16f8:1500::2? (dc78bmyyyyyyyyyyyyyby-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::2]) by smtp.gmail.com with ESMTPSA id w4-20020ac24424000000b004fb7848bacbsm1484770lfl.46.2023.11.27.06.49.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Nov 2023 06:49:50 -0800 (PST) Message-ID: Date: Mon, 27 Nov 2023 16:49:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 0/3] introduce priority-based shutdown support Content-Language: en-US, en-GB To: Greg Kroah-Hartman Cc: Oleksij Rempel , Mark Brown , "Rafael J. Wysocki" , Ulf Hansson , kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-pm@vger.kernel.org, =?UTF-8?Q?S=C3=B8ren_Andersen?= References: <20231124145338.3112416-1-o.rempel@pengutronix.de> <2023112403-laxative-lustiness-6a7f@gregkh> <2023112458-stature-commuting-c66f@gregkh> <2023112435-dazzler-crisped-04a6@gregkh> <20231124163234.GC819414@pengutronix.de> <2023112453-flagstick-bullring-8511@gregkh> <2023112722-headdress-kissing-8c9f@gregkh> From: Matti Vaittinen In-Reply-To: <2023112722-headdress-kissing-8c9f@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:49:59 -0800 (PST) On 11/27/23 15:08, Greg Kroah-Hartman wrote: > On Mon, Nov 27, 2023 at 02:54:21PM +0200, Matti Vaittinen wrote: >> pe 24. marrask. 2023 klo 19.26 Greg Kroah-Hartman >> (gregkh@linuxfoundation.org) kirjoitti: >>> >>> On Fri, Nov 24, 2023 at 05:32:34PM +0100, Oleksij Rempel wrote: >>>> On Fri, Nov 24, 2023 at 03:56:19PM +0000, Greg Kroah-Hartman wrote: >>>>> On Fri, Nov 24, 2023 at 03:49:46PM +0000, Mark Brown wrote: >>>>>> On Fri, Nov 24, 2023 at 03:27:48PM +0000, Greg Kroah-Hartman wrote: >>>>>>> On Fri, Nov 24, 2023 at 03:21:40PM +0000, Mark Brown wrote: >>>>>> >>>>>>>> This came out of some discussions about trying to handle emergency power >>>>>>>> failure notifications. >>>>>> >>>>>>> I'm sorry, but I don't know what that means. Are you saying that the >>>>>>> kernel is now going to try to provide a hard guarantee that some devices >>>>>>> are going to be shut down in X number of seconds when asked? If so, why >>>>>>> not do this in userspace? >>>>>> >>>>>> No, it was initially (or when I initially saw it anyway) handling of >>>>>> notifications from regulators that they're in trouble and we have some >>>>>> small amount of time to do anything we might want to do about it before >>>>>> we expire. >>>>> >>>>> So we are going to guarantee a "time" in which we are going to do >>>>> something? Again, if that's required, why not do it in userspace using >>>>> a RT kernel? >>>> >>>> For the HW in question I have only 100ms time before power loss. By >>>> doing it over use space some we will have even less time to react. >>> >>> Why can't userspace react that fast? Why will the kernel be somehow >>> faster? Speed should be the same, just get the "power is cut" signal >>> and have userspace flush and unmount the disk before power is gone. Why >>> can the kernel do this any differently? >>> >>>> In fact, this is not a new requirement. It exist on different flavors of >>>> automotive Linux for about 10 years. Linux in cars should be able to >>>> handle voltage drops for example on ignition and so on. The only new thing is >>>> the attempt to mainline it. >>> >>> But your patch is not guaranteeing anything, it's just doing a "I want >>> this done before the other devices are handled", that's it. There is no >>> chance that 100ms is going to be a requirement, or that some other >>> device type is not going to come along and demand to be ahead of your >>> device in the list. >>> >>> So you are going to have a constant fight among device types over the >>> years, and people complaining that the kernel is now somehow going to >>> guarantee that a device is shutdown in a set amount of time, which >>> again, the kernel can not guarantee here. >>> >>> This might work as a one-off for a specific hardware platform, which is >>> odd, but not anything you really should be adding for anyone else to use >>> here as your reasoning for it does not reflect what the code does. >> >> I was (am) interested in knowing how/where the regulator error >> notifications are utilized - hence I asked this in ELCE last summer. >> Replies indeed mostly pointed to automotive and handling the under >> voltage events. >> >> As to what has changed (I think this was asked in another mail on this >> topic) - I understood from the discussions that the demand of running >> systems with as low power as possible is even more >> important/desirable. Hence, the under-voltage events are more usual >> than they were when cars used to be working by burning flammable >> liquids :) >> >> Anyways, what I thought I'd comment on is that the severity of the >> regulator error notifications can be given from device-tree. Rationale >> behind this is that figuring out whether a certain detected problem is >> fatal or not (in embedded systems) should be done by the board >> designers, per board. Maybe the understanding which hardware should >> react first is also a property of hardware and could come from the >> device-tree? Eg, instead of having a "DEVICE_SHUTDOWN_PRIO_STORAGE" >> set unconditionally for EMMC, systems could set shutdown priority per >> board and per device explicitly using device-tree? > > Yes, using device tree would be good, but now you have created something > that is device-tree-specific and not all the world is device tree :( True. However, my understanding is that the regulator subsystem is largely written to work with DT-based systems. Hence supporting the DT-based solution would probably fit to this specific use-case as source of problem notifications is the regulator subsystem. > Also, many devices are finally moving out to non-device-tree busses, > like PCI and USB, so how would you handle them in this type of scheme? I do readily admit I don't have [all ;) ] the answers. I also think that if we add support for prioritized shutdown on device-tree-based systems, people may eventually want to use this on non device-tree setups too. There may also be other use-cases for prioritized shutdown (Don't know what they would be though). For now I would leave that to be the problem of the folks who need non device-tree systems when (if) this needs realizes. Assuming there was the handling of priorities in place, the missing piece would then be to find out the place to store this hardware specific priority information. If this is solved for the non DT cases, then the DT-based and non DT-based solutions can co-exist. Just a suggestion though. I am not working on under-voltage "stuff" right now. Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~