Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1743165rdh; Sat, 25 Nov 2023 01:10:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+dTXXfPs+sg8aVFvfydZO1l4JfHW3VZEljg4y9pCn+HKSix0UWWY6f+0htlJSDVafsryT X-Received: by 2002:a05:6808:138c:b0:3ae:501e:a64a with SMTP id c12-20020a056808138c00b003ae501ea64amr8013326oiw.10.1700903439771; Sat, 25 Nov 2023 01:10:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700903439; cv=none; d=google.com; s=arc-20160816; b=solvMhsSkAUocFGk+RMvPHD3ygfQy5fC1cUHfwY13ANL4iTrPytNmTk7fiB6yirlQg YFlS1JukK955WZBHSlqJ0u2pMoHdDZRY8LKXNlaBzZ+bUk3bxFVbwubYvjumv6/DrEf4 5NCpvpPUO++zQ3N1CVJl0GwZyjXu9GA+2ymtvxUaJTyzD/O8tX85Zb7AxrTGj1ov30vN vnxZ1cQ3fsYdkNkiI+qFs1blq21qjR3j+VWhT3EIq4ANDlTHDFb2s6tMcOLeg6roetOU hm/SedHoLqYoB9TmQoAb+AtaYimCwkmaJ6xQ+ftMUld3jkNIZ4c/BJkbmQsHSeK1SoIB hYkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eYhdptB1zMaCHA6Oc/YGBd8OnBXK1AAR6nrOh1FFvBw=; fh=XlHAjcBfD07VJUs8XTD51+m8ZUIExcWR1oQ0FYS8xY0=; b=d9un99FoG57YwWGaholdR1CWByncn70I/VDBkoe60oZHzkh2UtBsZdNviUESzGvEPZ oh8Qqj/UT8vNEpwbdDqu+g+03o9ebfJqfG37p4hJ0ZH8+lfhVZ5L48aRDKKd7jn59diQ Z004cS7PNC3pFXu7PeqCcpRI3/ZV/Rvm9WRazjSLN4UtiO7y9aLSCK+dEAfsSBGEwpOV h+VvBV9qfeTMDrrNM5GPb90Q3RKro5shGXu4CFAwFtrDroQk8bMIdO4OoZ+U0G0bT3ur iymT2NIkhgaPKK8UGLjzXQyiatTaq6Ml6KPgQs6RHNSgg3L8JnAbBdZuVz9a8srY+b/M Zc8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JKY/4ilC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f129-20020a625187000000b006cbc1400a76si5355713pfb.349.2023.11.25.01.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 01:10:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JKY/4ilC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0E8F6807EAD4; Sat, 25 Nov 2023 01:10:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231800AbjKYJI7 (ORCPT + 99 others); Sat, 25 Nov 2023 04:08:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjKYJI6 (ORCPT ); Sat, 25 Nov 2023 04:08:58 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66CF7EA for ; Sat, 25 Nov 2023 01:09:04 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DAF0C433C8; Sat, 25 Nov 2023 09:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700903344; bh=MW8ZDrdn27gXIQAKUwEbdXYazJeTuzAYxnp0tKWlAGI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JKY/4ilC6JEquAcrxGLtsxIpaK2IIAJCb0VyL9wU4pIcQ4pIZ/M9ZSLdiatU+RLEP uXHrJqwUVriaZ57JiZfi2LkP8mZrQjFOExQyrSTVtrm8/OzsisVTOqjw9hV5hR6oK4 j0NAjZZZMH8bwHYB9E7s9eYuEs3cUt7i1XEmhm8o= Date: Sat, 25 Nov 2023 09:09:01 +0000 From: Greg Kroah-Hartman To: Oleksij Rempel Cc: 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, =?iso-8859-1?Q?S=F8ren?= Andersen Subject: Re: [PATCH v1 0/3] introduce priority-based shutdown support Message-ID: <2023112506-unselfish-unkind-adcb@gregkh> References: <2023112403-laxative-lustiness-6a7f@gregkh> <2023112458-stature-commuting-c66f@gregkh> <2023112435-dazzler-crisped-04a6@gregkh> <20231124163234.GC819414@pengutronix.de> <2023112453-flagstick-bullring-8511@gregkh> <20231124185725.GA872366@pengutronix.de> <2023112520-paper-image-ef5d@gregkh> <20231125085038.GA877872@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231125085038.GA877872@pengutronix.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 01:10:37 -0800 (PST) On Sat, Nov 25, 2023 at 09:50:38AM +0100, Oleksij Rempel wrote: > On Sat, Nov 25, 2023 at 06:51:55AM +0000, Greg Kroah-Hartman wrote: > > On Fri, Nov 24, 2023 at 07:57:25PM +0100, Oleksij Rempel wrote: > > > On Fri, Nov 24, 2023 at 05:26:30PM +0000, Greg Kroah-Hartman wrote: > > > > 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 see. Good point. > > > > > > In my case umount is not needed, there is not enough time to write down > > > the data. We should send a shutdown command to the eMMC ASAP. > > > > If you don't care about the data, why is a shutdown command to the > > hardware needed? What does that do that makes anything "safe" if your > > data is lost. > > It prevents HW damage. In a typical automotive under-voltage labor it is > usually possible to reproduce X amount of bricked eMMCs or NANDs on Y > amount of under-voltage cycles (I do not have exact numbers right now). > Even if the numbers not so high in the labor tests (sometimes something > like one bricked device in a month of tests), the field returns are > significant enough to care about software solution for this problem. So hardware is attempting to rely on software in order to prevent the destruction of that same hardware? Surely hardware designers aren't that crazy, right? (rhetorical question, I know...) > Same problem was seen not only in automotive devices, but also in > industrial or agricultural. With other words, it is important enough to bring > some kind of solution mainline. But you are not providing a real solution here, only a "I am going to attempt to shut down a specific type of device before the others, there are no time or ordering guarantees here, so good luck!" solution. And again, how are you going to prevent the in-fighting of all device types to be "first" in the list? thanks, greg k-h