Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1195225rdh; Fri, 24 Nov 2023 07:10:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHARTm+MUM02P+aYo3Z/uDQJ2RNUj2rqoIpX4Cmgsw4xK+XV2FFIgs1zUoadsWFo2I7lbf X-Received: by 2002:a05:6808:4485:b0:3b6:d1cc:4c6 with SMTP id eq5-20020a056808448500b003b6d1cc04c6mr4109193oib.16.1700838621734; Fri, 24 Nov 2023 07:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700838621; cv=none; d=google.com; s=arc-20160816; b=do/sdjsM7Dm+ZF3IZH18xTP0GiroIE/scxaeT0HijJy08rjIgstxqQv5eM0a+Is9Og DqNd3+RjnDq2j41pSl3u3AvuU8hP6uY/65AHSHX9jy8hKp9USugiZFFQdNjC7YLu2I1R pfeFsCptdfxArG5M9cOdqhj4oJCvd/BGUKDnCdaUny+xN0xqb4tUoUrsIK6+ft4K0REZ N9xhBVMDGDW9eSNA8UpqQEB4i642Bbjj31SWI6b9OmjxMcIxhJ3dU0uKJE4eECZ0FyUs eibk6yMAdYvTr/EynYUmYFO5zdyYu1AtsIS1+YOjUYe69wWB9FoTsOrH/1g5L9Baleyy DkHw== 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=a+/uJS4lUDE9nc8/TaG3O1TLqv1Hdi8Q8cYRSK4btMY=; fh=hSu+8KU0168zzUws9zgTri7hFazRzXhQ+G08DwqfupU=; b=wSMFpdxr4gy0zAMmgD+EqIwTzSeYXUSPBqAaMw1t6wj6J1vbTTCtrnOJ6iOCzRmdKD gNIo3Pv/fPL6Dov8D3ya+nukN5xNg3y9EJ1puMhFJeJ8TaRKkR+/0D5QUBBBjxz/Hyjg aOEVchpUUgTsCT0G1x6QIO3bKIom5ItKF59ABpntWlDmc3i0YogqLPmOELeuAugUGfkH Gp9MchuiLsYWYt5j/bztGl9HL0bHdjYilrDRLbXIa9yPX7/RqiXDxhJbGPFf9bfUPdA4 Sl0PCen7+VdmT9vZRicvGcfpD+SNKNel/yBZmXQAzWTA6MaCMrffAzhn5x1tP9SYV6aj vLoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fadlzKon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u5-20020a656705000000b0059b64b153f6si3568011pgf.845.2023.11.24.07.10.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 07:10:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fadlzKon; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 0724B80B2D57; Fri, 24 Nov 2023 07:10:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345674AbjKXPKE (ORCPT + 99 others); Fri, 24 Nov 2023 10:10:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345563AbjKXPKC (ORCPT ); Fri, 24 Nov 2023 10:10:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCB099E for ; Fri, 24 Nov 2023 07:10:08 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D03CC4339A; Fri, 24 Nov 2023 15:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700838608; bh=QxrbIT5Wo7+n11EAmFM6PF7w4fT/TeJFxzoyxl9Pbpw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fadlzKonJvR3LMvMuZsWgk0kZdxbJ5yscnILoUTkQEHT3VFuMC7bkHbnIhQvMKRvS e4hIolAn+ge2y8/NGb6gXrfR52TzA0vw2A/Rs4WeEratB9x/xGiZfVphD/2onlmxDW 5sg7CPvfnzOfrFhfUWunchhjarIiS8g5LP666VE8= Date: Fri, 24 Nov 2023 15:10:06 +0000 From: Greg Kroah-Hartman To: Oleksij Rempel Cc: "Rafael J. Wysocki" , Ulf Hansson , Mark Brown , 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 2/3] driver core: introduce prioritized device shutdown sequence Message-ID: <2023112425-prepaid-diffusive-aced@gregkh> References: <20231124145338.3112416-1-o.rempel@pengutronix.de> <20231124145338.3112416-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231124145338.3112416-3-o.rempel@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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 24 Nov 2023 07:10:19 -0800 (PST) On Fri, Nov 24, 2023 at 03:53:37PM +0100, Oleksij Rempel wrote: > This commit revises the device shutdown mechanism to implement a > prioritized shutdown sequence. The new function, > prioritized_device_shutdown, ensures devices are shut down in reverse > order, mirroring the system construction order. Within this process, > devices are shut down based on their assigned priority levels. > Additionally, this patch ensures that a device inherits its shutdown > priority from its parent, maintaining hierarchy integrity. This is > crucial to prevent child nodes of high-priority parents from being > orphaned in the shutdown sequence. > > This change is vital in scenarios like power drops with limited backup > energy, where shutdown time is constrained. By prioritizing critical > devices, particularly storage, the focus is on maintaining device > integrity by ensuring they are properly shut down. This approach reduces > the risk of hardware damage and enhances system resilience during > emergency shutdowns. So you are going to race the power drain and just hope and pray that the kernel gets to shut down the hardware before the capacitors discharge? That seems ripe for loads of problems, as you are trying to achive something that software just can not do, as the hardware isn't supporting it at all. You are making a promise here that the kernel can never achive, sorry. I understand your wish to try to fix broken hardware with software, but please go back and tell those hardware engineers that they need to fix this properly if they don't want broken devices as this is just not going to work at all. One naming nit: > -void device_shutdown(void) > +void prioritized_device_shutdown(void) It's the driver core, please prefix stuff correctly, so this would be device_shutdown_prioritized() if we were to take this. Anyway, good luck with the hardware engineers! greg k-h