Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp539891rdb; Tue, 5 Dec 2023 12:14:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdOKWAJC6c8amAofhJ2t+9IdM8KsPRIbtTYiQiQQ6mxrVRr+CxE/ZJ/iz6J/Te7WWg9VKY X-Received: by 2002:a05:6a20:728a:b0:18f:97c:975b with SMTP id o10-20020a056a20728a00b0018f097c975bmr7008855pzk.67.1701807296396; Tue, 05 Dec 2023 12:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701807296; cv=none; d=google.com; s=arc-20160816; b=QsTwuzk6xOaRdojv/qLsOcRDcGFkwLvmXio1aXESRhy2ciXAwJeNhw9pAfxzt9BEQs xkLR9lXk6OsVeHSePVFVOiz5Q28t3PRHUn9EqIYDG2TCOujkrhF4zTfjtyoy8swuEytY pAP7VPnihD5y5p2MQB7cqzk88hu4DdtNLA8rypDJ8dTqhMlmaG78lhdpa2jw0ItnRmrM JROg42jIDkEbweMc4NktVIwkNMwozA31zr44iE1lnA+bIX5aWefr507NdVNRNOLMR7w2 FOoF5MJKby7tgYjsXUu7nHQ9ucMrYyrKuVMF92ckMILMvAzUOkYCJ9ZZuYEHhaPlh6Pr wNLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:references:cc:to:from:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=0ml9UX6t9odSxvHTtA4LZAFAZGcNsvyTbYSb97rI4tg=; fh=A8rggQLMVRLADx5dAMSZW1MHI12lYV6O99PTsM+v6Ts=; b=dtZ5mkwTw/V2Uxp3w3arxBM/jHb2iUQZfHylyUCxup5XieBd81cgVNxDua8jYL4tV0 TJsRDJz8T4PZ0F+X5WKiV3Jm7eS5xNQPU+84aVVYZsqz+wkjtKaSHZbWXiRWNLnX/VZ9 jBlAAAxDiSbABZo3o9nanf0AItJo05Fw/TNHIQj65MFuN+ureveXo7gfUXLlcaGQ8qfJ 5xSUX6hhzakQ+hk17q0e9UnvprfI0C7EUmCDC4Gu5WJmBT3MAfPdKFaLUf4uc3ECfemC 0b+2XEMML9hevexc2P92shcHcprGV3sDmRWQcG6bwF2uHRWyxc3VVFdxsfGylXYDaYUH dbhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hKCRG6Ti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id a34-20020a631a62000000b005c6b4091c32si797872pgm.385.2023.12.05.12.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 12:14:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hKCRG6Ti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 84A1180AE22F; Tue, 5 Dec 2023 12:14:53 -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 S231680AbjLEUOh (ORCPT + 99 others); Tue, 5 Dec 2023 15:14:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjLEUOg (ORCPT ); Tue, 5 Dec 2023 15:14:36 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50948C0; Tue, 5 Dec 2023 12:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701807282; x=1733343282; h=message-id:date:mime-version:subject:from:to:cc: references:in-reply-to:content-transfer-encoding; bh=GnGrvzu1UAF60Na557V8KUh1lDWJwr/3iOhwXpIVSuE=; b=hKCRG6TiQ9XtUy/tRslOSMZ1gnMitRKcD4BhSvcswJdCKKy1EEDKEFI0 mjrj9QSQfzeb6LgVoEUrlu0+IHJJHoPZbd/3vVwRHWuYd4QEbqCyc1Q+D ta2pTDW9WEpHNw/lYKuvRQrD+JdH+mocwLu84NqrqetTmMZ4D/gxbttA8 4b3SuutEKOWlPv78/A1hJI6SBGuQ8augj1aLjZwFQdfdqEeDFBu0vR5NF 3yrGXwJ83oSHGmm9mL4+SP+KdhbG1Q7gk76ZtgB2yAO3MpU9TcqdTJD9B MJ99FqhiWVMCXbNhXkAv7NzbTk1oKICs6F8btEdKaLXL02ywPS6s2NhFx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="460444233" X-IronPort-AV: E=Sophos;i="6.04,253,1695711600"; d="scan'208";a="460444233" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 12:14:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="1018326903" X-IronPort-AV: E=Sophos;i="6.04,253,1695711600"; d="scan'208";a="1018326903" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.46.77]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 12:14:37 -0800 Message-ID: Date: Tue, 5 Dec 2023 22:14:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mmc: rpmb: do not force a retune before RPMB switch Content-Language: en-US From: Adrian Hunter To: Jorge Ramirez-Ortiz , Avri.Altman@wdc.com, ulf.hansson@linaro.org, christian.loehle@arm.com Cc: jinpu.wang@ionos.com, axboe@kernel.dk, beanhuo@micron.com, yibin.ding@unisoc.com, victor.shih@genesyslogic.com.tw, asuk4.q@gmail.com, hkallweit1@gmail.com, yangyingliang@huawei.com, yebin10@huawei.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231204150111.3320071-1-jorge@foundries.io> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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]); Tue, 05 Dec 2023 12:14:53 -0800 (PST) On 5/12/23 22:12, Adrian Hunter wrote: > On 4/12/23 17:01, Jorge Ramirez-Ortiz wrote: >> Requesting a retune before switching to the RPMB partition has been >> observed to cause CRC errors on the RPMB reads (-EILSEQ). > > There are still 2 concerns: > 1) We don't really know the root cause. Have you determined > if here are CRC errors in the main partition also? > 2) Forcing this on everyone > > The original idea was that because re-tuning cannot be > done in RPMB, the need to re-rune in RPMB could be avoided > by always re-tuning before switching to RPMB and then switching > straight back. IIRC re-tuning should guarantee at least 4MB > more I/O without issue. > > The alternative to dropping re-tuning in this case could > be to add a retry loop for MMC_DRV_OP_IOCTL_RPMB if the error > is -EILSEQ Actually, you could still do this patch as well because a CRC error would cause re-tuning before the next retry. > > >> >> Since RPMB reads can not be retried, the clients would be directly >> affected by the errors. >> >> This commit disables the request prior to RPMB switching while allowing >> the pause interface to still request a retune before the pause for other >> use cases. >> >> This was verified with the sdhci-of-arasan driver (ZynqMP) configured >> for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both >> cases, the error was easy to reproduce triggering every few tenths of >> reads. >> >> Signed-off-by: Jorge Ramirez-Ortiz >> --- >> drivers/mmc/core/block.c | 2 +- >> drivers/mmc/core/host.c | 7 ++++--- >> drivers/mmc/core/host.h | 2 +- >> 3 files changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c >> index f9a5cffa64b1..1d69078ad9b2 100644 >> --- a/drivers/mmc/core/block.c >> +++ b/drivers/mmc/core/block.c >> @@ -859,7 +859,7 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card, >> if (ret) >> return ret; >> } >> - mmc_retune_pause(card->host); >> + mmc_retune_pause(card->host, false); >> } >> >> return ret; >> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c >> index 096093f7be00..a9b95aaa2235 100644 >> --- a/drivers/mmc/core/host.c >> +++ b/drivers/mmc/core/host.c >> @@ -119,13 +119,14 @@ void mmc_retune_enable(struct mmc_host *host) >> >> /* >> * Pause re-tuning for a small set of operations. The pause begins after the >> - * next command and after first doing re-tuning. >> + * next command and, if retune is set, after first doing re-tuning. >> */ >> -void mmc_retune_pause(struct mmc_host *host) >> +void mmc_retune_pause(struct mmc_host *host, bool retune) >> { >> if (!host->retune_paused) { >> host->retune_paused = 1; >> - mmc_retune_needed(host); >> + if (retune) >> + mmc_retune_needed(host); > > Better to just drop mmc_retune_needed(host); > >> mmc_retune_hold(host); > > There is still a small chance that re-tuning > is needed anyway in which case it will still be done. > >> } >> } >> diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h >> index 48c4952512a5..321776b52270 100644 >> --- a/drivers/mmc/core/host.h >> +++ b/drivers/mmc/core/host.h >> @@ -18,7 +18,7 @@ void mmc_retune_disable(struct mmc_host *host); >> void mmc_retune_hold(struct mmc_host *host); >> void mmc_retune_release(struct mmc_host *host); >> int mmc_retune(struct mmc_host *host); >> -void mmc_retune_pause(struct mmc_host *host); >> +void mmc_retune_pause(struct mmc_host *host, bool retune); >> void mmc_retune_unpause(struct mmc_host *host); >> >> static inline void mmc_retune_clear(struct mmc_host *host) >