Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1048198rdf; Wed, 22 Nov 2023 04:27:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQOL/BUGsoJiU74xunvGg9bhORykmJncfa0jNDW5vzISQ1keduUWrge5aD6L+bHwQMrMLQ X-Received: by 2002:a05:6a20:729e:b0:180:f9c4:a796 with SMTP id o30-20020a056a20729e00b00180f9c4a796mr1826127pzk.54.1700656036360; Wed, 22 Nov 2023 04:27:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700656036; cv=none; d=google.com; s=arc-20160816; b=qCL5h61R0NFKfSTfpdjZvcA9Lj2/767N0GOsEdYe7NUf6jfogCzfkwDuxK4+jFiRFp 3aV6NTgI2TOMlB3LEhkXS4k/isgoXlPSkU+LyNiiSMSRom+agWiCUoWkuFE5zdmQ/1Ua cieRIsfRB/cBlL4VcZfJg+/wuLuc6AMwyNxAYhKCTvFb5vGpmW9sp9BKnP0xSQojf5TA tTLvJEKCGBU81BhiQUtn4H/jG9QkD45X6uVsF/1OLCC0+baE0oAcEQnbbgb4wUnMKtv7 VWNxaLO2sQ4HRmS4vFRzjeV/7vXoVVWEtyPzxtsw69B7osacCdRB1J59ykKBaqadBxYP 6BUQ== 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=01afahw3B/7yQKDoAJJJD7sMd7REtquKJvBoDWcG6nY=; fh=nNwwfn69p7i/Ahp0O2cLap3G6WvcYQa/GPU27UapmSc=; b=jz2TkECZagVa1gryUx78ljaakTTbgoTisbLSEKMC6zl55IaNVfqXTG9+XuZAoaYKqp i1Zr1qEzTtbwa7Kg8rAJwFLe44MCGeUa2NPK/zuI6oRKEh1nzma4fKiQ2xCVMCM5ZuFN WNNiLkzcEiXcy6X7S9R5zi9TJLGy+kJyHDt+pPZanav6NbxFPNa6pasi1cliHoLS7yYz Gtkja108VHDes+djye2az5sqZJf/TDrI8jLXkqc1Uac49maSxIwlgNHmvXDMMdjkYKYA vpGU+M8PmbzovgonVUgiBPY2PXF/nO+H+Ae6w785fXOOZt0A0CB+Jh48GPxY1tZhMUTw hwXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AhTOfsuJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x1-20020a63fe41000000b005b8de051ac6si12394999pgj.111.2023.11.22.04.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 04:27:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AhTOfsuJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 75C7B8074425; Wed, 22 Nov 2023 04:27:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344076AbjKVM1A (ORCPT + 99 others); Wed, 22 Nov 2023 07:27:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344065AbjKVM07 (ORCPT ); Wed, 22 Nov 2023 07:26:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44140D69 for ; Wed, 22 Nov 2023 04:26:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F08AC433C7; Wed, 22 Nov 2023 12:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700656015; bh=7C94KGgqCbAA+PUlPyfufke9xGPCyJuKoPOwMFmpILc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AhTOfsuJH4uNL1dxrl8w5XllqdE/f5P54GaWxyRB4RLrlVOx4OyzJwbd6Gc4C0qoc 2Xzg/stYnSjW+1yxZNxWDcAYThqfSNZGkvn072cy+9S7PCy1DxLfO5WnFrM4sglE4g EuZC1EWJwysoGdyUFGg5RLFi86qdKMxadsVE7CU1Jjc8qMWIzG4yHLhIuuE0rKZSQ7 NqT314x2NNAPQt/bksxbzuhb5k9BmoxRKLTBS+b69yrPvvHLfymaaDCmqGBTY0NX4f cDXxKth36fatyNGSrEVz8QGzuXhCd95sNhXtTb/LABHPfeC2qDN6Jz2bV0b8GEMhAr ESh4d4/F0DKAg== Date: Wed, 22 Nov 2023 12:26:51 +0000 From: Mark Brown To: Oleksij Rempel Cc: Ulf Hansson , Yang Yingliang , linux-mmc@vger.kernel.org, kernel@pengutronix.de, Ye Bin , Heiner Kallweit , Matti Vaittinen , Liam Girdwood , Conor Dooley , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Naresh Solanki , zev@bewilderbeest.net, Sebastian Reichel , linux-pm@vger.kernel.org, =?iso-8859-1?Q?S=F8ren?= Andersen Subject: Re: mmc: handling of Under-Voltage Events in eMMC Message-ID: References: <20230929130028.GB2825985@pengutronix.de> <20231122112212.GA783262@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GytIA0m4jn6r4+oY" Content-Disposition: inline In-Reply-To: <20231122112212.GA783262@pengutronix.de> X-Cookie: Slow day. Practice crawling. X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 04:27:10 -0800 (PST) --GytIA0m4jn6r4+oY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 22, 2023 at 12:22:12PM +0100, Oleksij Rempel wrote: > Some puzzle parts are now mainline, for example regulator framework > can be configured to detect under-voltage events and execute > hw_protection_shutdown(). So far it worked good enough to complete > mmc_poweroff_notify() withing 100ms window. The problem is, the chance to > execute mmc_poweroff_notify() depends on kernel configuration. If there are too > many drivers and devices, mmc_poweroff_notify() will be not executed in time. > For now, I workaround it by registering a reboot notifier for mmc shutdown. > It works, because kernel_power_off() is executing all registered reboot > notifiers at first place and there are no other slow reboot notifiers. > But, it seems to be not reliable enough. Probably notifier prioritization > is needed to make it more predictable. > So far, I have two variants to implement it in more predictable way: > variant 1 - forward the under-voltage notification to the mmc framework and > execute mmc_poweroff_notify() or bus shutdown. > variant 2 - use reboot notifier and introduce reboot notifier prioritization. > Are there other options? What are your preferences? My instinct is that we want to have prioritisation scheme rather than something MMC specific, I'd guess that this issue applies in some way to at least most storage. It's not a super strongly held opinion though. --GytIA0m4jn6r4+oY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVd84sACgkQJNaLcl1U h9Bf8wf/R6d4p2XKeuQW+1xTu9FLSsr7+z0oM/onpGR9JY0w2ky0IFjZjmbxN9U8 YMxvuqD/mgLNzjJe7arFUiIpbNe7VNVSM56znjxHg8UadfPHYW9ImNUO14OwkCZN qXzMYsNpQhrc5/kNxs2pNso4Cg0Emm/8Hnk97vqFpR1d5AV9hlxsd7xjUlJ5Ah67 3n+VSty5DszMvSQfxW93Xihv4V3BwQ8dRyCIYac+BUG+sXCrDp/VV3t+2EorXL76 JLZizRhRKta002htsgAlqRNRZZL1NwI6JGlHD6Rm2WSSAEMDjudiPjJn5KNsEjuP bhqR/YN5SXZsTjHC3y/qmZJrkoYWsw== =WFJZ -----END PGP SIGNATURE----- --GytIA0m4jn6r4+oY--