Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1434190pxb; Thu, 4 Mar 2021 11:08:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQAsiVAY001sM7lp98pXAC3dhJE5suNDIr+GSHsrNc4S+K82C5DC7zsr0n3kZS0tgjvqbH X-Received: by 2002:a05:6402:17e9:: with SMTP id t9mr6037498edy.211.1614884926951; Thu, 04 Mar 2021 11:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614884926; cv=none; d=google.com; s=arc-20160816; b=LorQfQWXpbCwNSvb21z/4Q3RCNQrx5jGhM+8neJioLrmJrwK9HM4z9XJPc5oDasrPY lc5sWNomFGJ1yjm7MhS/SFRyKgh3UxMWjjyt0BYHCrIde7a42NaSGxoiX4DvS8JQlS3S hmQBNijU5UqMQjcQ+jPgpKuwCWP4kozlusyRhe0WfBONHO1QpTuBOiIH61e0aYXj+jwb QZ8/cakJ//Lw282zudta6QhQd4gY7mBjQQCwytp82qRPk0bgqILkHVcWw13chTYkjnSt sQTvkqRcevqx3lXMorvQL1+0ND+NdaGzoY/wKKmi+6AbvbJ2YcAqXrip4lLROYBvQvXO 78lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ot0pBmNC9C2X+nBkx9lvZxGNQE3VnPlcBNxjMI2kl+A=; b=i5B+dJ1ZF4XM7CBUF0ylF7ATCl1vstyBFjgwaoZD8G3CVCr0ZXBJXGqd0a2RT4BZGL 13CeUVCaOApyXlWkD287VGHVUn9vD8GVbdQYS9pxMxlfl5GMQWJhmbi6dsyc7FbZwhK/ BUWRX4rzR18kLh7gJW7v4KUPEJI+wM3zbl6ZaPiJ6GKt14BQTfI/jURpVeLi1DGQ6hgp gC+yDodWNzVw6MRZGLsamTUbJBdQxYasX1cjkXxEH4xt0fjr+Cb3JCkQZb+CbEfBjqTA i3K0aA58QLKQfbBxGx0ZazHIXysYB3R1SeKA7O35BTB1Cli77ZeTqbDnKYiZ2vlEQ1wn dj4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fG6Yc8Bx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si220783ede.264.2021.03.04.11.08.24; Thu, 04 Mar 2021 11:08:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fG6Yc8Bx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbhCDSE3 (ORCPT + 99 others); Thu, 4 Mar 2021 13:04:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbhCDSD4 (ORCPT ); Thu, 4 Mar 2021 13:03:56 -0500 Received: from mail-ua1-x934.google.com (mail-ua1-x934.google.com [IPv6:2607:f8b0:4864:20::934]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B914C061760 for ; Thu, 4 Mar 2021 10:03:16 -0800 (PST) Received: by mail-ua1-x934.google.com with SMTP id u13so1588567uap.8 for ; Thu, 04 Mar 2021 10:03:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ot0pBmNC9C2X+nBkx9lvZxGNQE3VnPlcBNxjMI2kl+A=; b=fG6Yc8BxmivwsyBhxPN1l4Usla51wPxUb9C+NJKw79QMnmmdMxSKukhr9vHrPDsG9S 0g23BMN5bI2LBgTYDB4apV4a5icGjwB5ZqPDM+aHN3H5bE+G1mzAxLxqK8pItyJ3Tngy gTOWsJJVQlOhdqP328V3kJdm+R0lSBOBvQ5cIwXhEttI1D/l/hkg3O0tFsIvvp+hsKwu Bh2izbfPWkw7g5fVQ2ITw2dpwZSZXzwZ0SK2z4xftMe9Drhiyg4unRjrbfqT4SLTrsx1 X1U7O0O/7sUUuBqLaNWWFMmi/Fwsk8FvjcZ1G10xwccF/Um6gWFn4+Bpy+oWk6n/o0oX jKYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ot0pBmNC9C2X+nBkx9lvZxGNQE3VnPlcBNxjMI2kl+A=; b=I2lF0Nykb1IMMj1ZMXYrpvZeKveqYCaxVdfWgzT2CJsyILpjbbMP6GldQmPmdI5FcM G9xKsmh1pjKKqDEBza2iBI8amzBKUej6Zr8ItnNZ9MADYjh06qqegEPtByjzv4wEIGI4 7ra4tEBlBm99PQDA3WBEEse4VZFi49EwcOgvSKTGsVjRwwCt0T56fsFT7WHwrmeLGlbE 49ZQrZaNjhIJJf36S+BGdJPLt7PGH+1luzvMShcGOnOrhKD6Wy/iu8E/NB6A+qgFRQKs xda1qbRTuc6hKasLyyge7NbtAg8g3AtyD7oR3nL71KGJTeoR7BtS0g8VmvBtz1rGFS5P 46iQ== X-Gm-Message-State: AOAM533lqItIrWQtcnetqaljGeC3k+VH8gvv2BgBbswvJGmhPxXkGWKq mSb/+9n9WzLX3pshijktHgiIVBNLe7J3gKuSEvLc8Q== X-Received: by 2002:ab0:6045:: with SMTP id o5mr3525813ual.100.1614880995595; Thu, 04 Mar 2021 10:03:15 -0800 (PST) MIME-Version: 1.0 References: <20210216224252.22187-1-marten.lindahl@axis.com> <20210301215923.6jfg6mg5ntorttan@axis.com> <20210304134836.xlw7wbbvkc5bqzmm@axis.com> <20210304145946.tnbbd4qq6nvc2mcb@axis.com> In-Reply-To: <20210304145946.tnbbd4qq6nvc2mcb@axis.com> From: Ulf Hansson Date: Thu, 4 Mar 2021 19:02:38 +0100 Message-ID: Subject: Re: [PATCH] mmc: Try power cycling card if command request times out To: Marten Lindahl Cc: =?UTF-8?Q?M=C3=A5rten_Lindahl?= , Adrian Hunter , "linux-mmc@vger.kernel.org" , kernel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Mar 2021 at 15:59, Marten Lindahl wrote: > > On Thu, Mar 04, 2021 at 03:06:54PM +0100, Ulf Hansson wrote: > > On Thu, 4 Mar 2021 at 14:48, Marten Lindahl wrote: > > > > > > Hi Ulf! My apologies for the delay. > > > > > > On Tue, Mar 02, 2021 at 09:45:02AM +0100, Ulf Hansson wrote: > > > > On Mon, 1 Mar 2021 at 22:59, Marten Lindahl wro= te: > > > > > > > > > > Hi Ulf! > > > > > > > > > > Thank you for your comments! > > > > > > > > > > On Mon, Mar 01, 2021 at 09:50:56AM +0100, Ulf Hansson wrote: > > > > > > + Adrian > > > > > > > > > > > > On Tue, 16 Feb 2021 at 23:43, M=C3=A5rten Lindahl wrote: > > > > > > > > > > > > > > Sometimes SD cards that has been run for a long time enters a= state > > > > > > > where it cannot by itself be recovered, but needs a power cyc= le to be > > > > > > > operational again. Card status analysis has indicated that th= e card can > > > > > > > end up in a state where all external commands are ignored by = the card > > > > > > > since it is halted by data timeouts. > > > > > > > > > > > > > > If the card has been heavily used for a long time it can be w= eared out, > > > > > > > and should typically be replaced. But on some tests, it shows= that the > > > > > > > card can still be functional after a power cycle, but as it r= equires an > > > > > > > operator to do it, the card can remain in a non-operational s= tate for a > > > > > > > long time until the problem has been observed by the operator= . > > > > > > > > > > > > > > This patch adds function to power cycle the card in case it d= oes not > > > > > > > respond to a command, and then resend the command if the powe= r cycle > > > > > > > was successful. This procedure will be tested 1 time before g= iving up, > > > > > > > and resuming host operation as normal. > > > > > > > > > > > > I assume the context above is all about the ioctl interface? > > > > > > > > > > > > > > > > Yes, that's correct. The problem we have seen is triggered by ioc= tls. > > > > > > > > > > > So, when the card enters this non functional state, have you tr= ied > > > > > > just reading a block through the regular I/O interface. Does it > > > > > > trigger a power cycle of the card - and then makes it functiona= l > > > > > > again? > > > > > > > > > > > > > > > > Yes, we have tried that, and it does trigger a power cycle, makin= g the card > > > > > operational again. But as it requires an operator to trigger it, = I thought > > > > > it might be something that could be automated here. At least once= . > > > > > > > > Not sure what you mean by operator here? In the end it's a userspac= e > > > > program running and I assume it can deal with error paths. :-) > > > > > > > > In any case, I understand your point. > > > > > > > > > > Yes, we have a userspace program. So if the userspace program will tr= y to > > > restore the card in a situation such as the one we are trying to solv= e > > > here, how shall it perform it? Is it expected that a ioctl CMD0 reque= st > > > should be enough, or is there any other support for a userspace progr= am to > > > reset the card? > > > > Correct, there is no way for userspace to reset cards through an ioctl. > > > > > > > > If it falls on a ioctl command to reset the card, how do we handle th= e case > > > where the ioctl times out anyway? Or is the only way for a userspace = program > > > to restore the card, to make a block transfer that fails? > > > > Yes, that is what I was thinking. According to the use case you have > > described, this should be possible for you to implement as a part of > > your userspace program, no? > > Ok, I will discuss that with the people maintaining the userspace program= :) > > But would it be of interest to review a patch introducing a more clean ca= rd > reset request, without block transfers? Well, if you can solve it with block transfers that's the preferred option, in my opinion. As I stated earlier, my main issue with the HW reset through the ioctl interface, is that we don't know what combination of request/command/response we should be doing a reset for. Kind regards Uffe