Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4083760pxb; Mon, 8 Feb 2021 07:33:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQbBwXEMT27GyAHFyEFMv1y5xoFtksxdbG3A4F4VB0nAaVAuuIPW4KSAmV3ofNzRCQLtHK X-Received: by 2002:a05:6402:1c0f:: with SMTP id ck15mr16030401edb.16.1612798439717; Mon, 08 Feb 2021 07:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612798439; cv=none; d=google.com; s=arc-20160816; b=KBPiCLHcNLaLU7JyLz3d5jK0CL1CvcLQsX2Q5v91OPRAkRAoOMZebMKs80eK9euzvA HlPMzvdNV6US06cb4DsdrScB+qalJg9XSCk+NPI2SM/SdsqYF/pgSnvOcbf1PJt64GEi Qhdyz9b1bmMmAJSyEbxzHGMJp4R5PARnilISRK4nwkvEcxR1C4WQ/jVvUwbQkyfghqfs p9UwRhRwafkkmU8JoWa0W0zhVSQ4oiwYH70EoxOZMcOOBg7yKCMD0UIVlwir+6rfNko8 0HWpk9XfctN9wT4ASgBExEm/LZV2TjUP9JeQnkLDWxUfE8QC6YyUgPI5JXHPCOMwpcu7 aMpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Jl1PZS6Z4xx6ic0CScHYnCftVci+4yGkziwnsAGCYoI=; b=YCjWcdzlx22KHhcoENDTJeYVwKllN3W5ECliBjh7WLum3VIaDipnHjukZwDTBhGV7N UDzXum3iifuffyQ8jQaIU3jH8Gd9SL5u86Va6uWhcQDqr5owpTH7FEfwV7tvVDL3p3nE fWDmWEffUV8o5eT0vIzD82bFDF/QuhnK/XZVwKgWXu6kluo1U0xATW37JTb9RGYt+4bM EeNgZAvLuxjoxTHszdeblGEReFcoPlYkAgTXCgPpFWHdeD9EXazr3Uz3738+ltU/21ZK iJt+ZJ/NLGdEeACYx867+JE8PuycvfBCw58za0/nMAPh4FGcSAwZUwcn5Bw87G1qF3TB MBig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cz6rcclI; 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 x2si11219232ejn.747.2021.02.08.07.33.35; Mon, 08 Feb 2021 07:33:59 -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=cz6rcclI; 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 S230170AbhBHPcH (ORCPT + 99 others); Mon, 8 Feb 2021 10:32:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbhBHPFL (ORCPT ); Mon, 8 Feb 2021 10:05:11 -0500 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989C1C06178A for ; Mon, 8 Feb 2021 07:04:30 -0800 (PST) Received: by mail-ua1-x932.google.com with SMTP id i3so4764914uai.3 for ; Mon, 08 Feb 2021 07:04:30 -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; bh=Jl1PZS6Z4xx6ic0CScHYnCftVci+4yGkziwnsAGCYoI=; b=cz6rcclIQelMUkfinCmu0NuCPhuVYHrGtze5sLLSgPjgCJyg+rSCmqs+30bCrV9PK1 UJktsXblbQNfPlD0E8STVOJg1Ww39HKBWBYAd8+ThRD5TiqK5Jqe8LDGvUk9VrqzQnJJ /PS714l61/Kw+HfpJTy2DucqZjk5Sa979Tzibskl/8VwY7f7A9FO5SGHBcRyvZ4ijl+J lTHYITvQ3bf7d+hrn20jSByzgeEy/sNGa87AS5vKuy5SMflPGsRrmMjjIjVoTzEATlkb zXMHBnwQPGC3jxav5OlckrNEStmfEj+roppi2X255c0XxBNkPhlKcpjgZUvBt0fFqxfX /nWw== 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; bh=Jl1PZS6Z4xx6ic0CScHYnCftVci+4yGkziwnsAGCYoI=; b=ZQzdykyjFLSaTvKD1rKRUVM9GIO9xuXcD9AY146uEAMLpMfS30bOGDSqg0PcFTztWP Cd4PVKNgtB/pyGgQCgCOpldyVqcWom3xoq14+XPKLD8Thaf1n9xKkR8UCwHyZgKetVap TaF40vU5Wpg13TjgrVio4YVSVwlR3NYMwwoxUm6A5FyR002P8Aj1UkSaayc7Dc1jnWg1 SE9l3Ap9aIYZ3CkYbq3fIlfAmXoJFaipctlcUrXBAD5VnK95IKxrNaiWMHdCeR6JJgQS 9FhU+fKYR3gL9KPtSkVjHtXILrVg2XKdvYj+VluinOOvwZ0et8nOp1af+TdFqBuj79Bv DK2g== X-Gm-Message-State: AOAM530UI6e4EDH/PNNBuIfX9KPf7X+TTChL5lg/2vsPJyyncRU6X4yt +kc2pr2VBan0WUUHWJmulnZvr1YgACa03RH/rWnkow== X-Received: by 2002:ab0:3496:: with SMTP id c22mr10780274uar.100.1612796669681; Mon, 08 Feb 2021 07:04:29 -0800 (PST) MIME-Version: 1.0 References: <20210204120547.15381-1-yann.gautier@foss.st.com> <20210204120547.15381-2-yann.gautier@foss.st.com> <1c1814dc-f87b-ef5c-24b4-b9a6ec570dbc@foss.st.com> In-Reply-To: <1c1814dc-f87b-ef5c-24b4-b9a6ec570dbc@foss.st.com> From: Ulf Hansson Date: Mon, 8 Feb 2021 16:03:53 +0100 Message-ID: Subject: Re: [PATCH 1/2] mmc: mmci: enable MMC_CAP_NEED_RSP_BUSY To: Yann GAUTIER Cc: Russell King , Linus Walleij , ludovic.barre@foss.st.com, =?UTF-8?B?TWFyZWsgVmHFoXV0?= , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Feb 2021 at 13:16, Yann GAUTIER wrote: > > On 2/5/21 1:19 PM, Yann GAUTIER wrote: > > On 2/5/21 10:53 AM, Ulf Hansson wrote: > >> - trimmed cc-list > >> > >> On Thu, 4 Feb 2021 at 13:08, wrote: > >>> > >>> From: Yann Gautier > >>> > >>> To properly manage commands awaiting R1B responses, the capability > >>> MMC_CAP_NEED_RSP_BUSY is enabled in mmci driver, for variants that > >>> manage busy detection. > >>> This R1B management needs both the flags MMC_CAP_NEED_RSP_BUSY and > >>> MMC_CAP_WAIT_WHILE_BUSY to be enabled together. > >> > >> Would it be possible for you to share a little bit more about the > >> problem? Like under what circumstances does things screw up? > >> > >> Is the issue only occurring when the cmd->busy_timeout becomes larger > >> than host->max_busy_timeout. Or even in other cases? > >> > >>> > >>> Signed-off-by: Yann Gautier > >>> --- > >>> drivers/mmc/host/mmci.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > >>> index 1bc674577ff9..bf6971fdd1a6 100644 > >>> --- a/drivers/mmc/host/mmci.c > >>> +++ b/drivers/mmc/host/mmci.c > >>> @@ -2148,7 +2148,7 @@ static int mmci_probe(struct amba_device *dev, > >>> if (variant->busy_dpsm_flag) > >>> mmci_write_datactrlreg(host, > >>> > >>> host->variant->busy_dpsm_flag); > >>> - mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; > >>> + mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | > >>> MMC_CAP_NEED_RSP_BUSY; > >> > >> This isn't correct as the ux500 (and likely also other legacy > >> variants) don't need this. I have tried it in the past and it works > >> fine for ux500 without MMC_CAP_NEED_RSP_BUSY. > >> > >> The difference is rather that the busy detection for stm32 variants > >> needs a corresponding HW busy timeout to be set (its > >> variant->busy_timeout flag is set). Perhaps we can use that > >> information instead? > >> > >> Note that, MMC_CAP_NEED_RSP_BUSY, means that cmd->busy_timeout will > >> not be set by the core for erase commands, CMD5 and CMD6. > >> > >> By looking at the code in mmci_start_command(), it looks like we will > >> default to a timeout of 10s, when cmd->busy_timeout isn't set. At > >> least for some erase requests, that won't be sufficient. Would it be > >> possible to disable the HW busy timeout in some way - and maybe use a > >> software timeout instead? Maybe I already asked Ludovic about this? > >> :-) > >> > >> BTW, did you check that the MMCIDATATIMER does get the correct value > >> set for the timer in mmci_start_command() and if > >> host->max_busy_timeout gets correctly set in > >> mmci_set_max_busy_timeout()? > >> > >> [...] > >> > >> Kind regards > >> Uffe > >> > > > > Hi Ulf, > > > > Thanks for the hints. > > I'll check all of that and get back with updated patches. > > > > As I tried to explain in the cover letter and in reply to Adrian, I saw > > a freeze (BUSYD0) in test 37 during MMC_ERASE command with > > SECURE_ERASE_ARG, when running this test just after test 36 (or any > > other write test). But maybe, as you said that's mostly a incorrect > > timeout issue. > > > > Regards, > > Yann > > Hi, > > I made some extra tests, and the timeout value set in MMCIDATATIMER > correspond to the one computed: > card->ext_csd.erase_group_def is set to 1 in mmc_init_card() > In mmc_mmc_erase_timeout(), we have: > erase_timeout = card->ext_csd.hc_erase_timeout; // 300ms * 0x07 (for the > eMMC card I have: THGBMDG5D1LBAIL > erase_timeout *= card->ext_csd.sec_erase_mult; // 0xDC > erase_timeout *= qty; // 32 (from = 0x1d0000, to = 0x20ffff) > > This leads to a timeout of 14784000ms (~4 hours). > The max_busy_timeout is 86767ms. > > After those 4 hours, I get this message: > mmc1: Card stuck being busy! __mmc_poll_for_busy Okay, I see. This means that we end up polling for busy in __mmc_poll_for_busy(). However, not by using CMD13 but rather with the ->card_busy() ops (as mmci has this callback set). Could it be that the ->card_busy() callback isn't working correctly for the stm32 variant? What happens if you temporarily drop the assignment of the ->card_busy() callback, thus force the mmc core to poll with CMD13 instead? Would this work? > > The second erase with MMC_ERASE_ARG finds an erase timeout of 67200ms, > and uses R1B command. > But as the first erase failed, the DPSMACT is still enabled, the busy > timeout doesn't seem to happen. Something may be missing in the error path. Assuming the eMMC card completed the first erase operation successfully, then yes, the second erase should work. However, what if the eMMC actually failed with the first erase? How can we know? > > Anyway, I'll push an update of the second patch of the series, and just > drop this first one. > > > Regards, > Yann Kind regards Uffe