Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp632778pxv; Thu, 15 Jul 2021 12:02:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv56J0GjCvaUNrpJSOgk2o5Kq6yp+dVg+3yvpxAq1rdOUjRrtAPfRd5g76nmj+IZrMgomo X-Received: by 2002:a5d:8747:: with SMTP id k7mr4397342iol.83.1626375744270; Thu, 15 Jul 2021 12:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375744; cv=none; d=google.com; s=arc-20160816; b=oz1au+hz5w17KV0ZsbJ4a+RNgUu4JtWO8/nzH7hrd+RvjY/DalM70Mh7V9gZ1ywDUk Zmuya/HsQIZwPm3O+qT49EnyyP92kgBSerO181dFwl8WGLo9H8pMNtEcRv/jwTWa+KI+ qCjsfmxa0UhRmLMso4SyzX/OA9KBYu6AlUdrz512Lcl359884WF+m5uCbknHYNPiLQtE zUJEocShTJcYTHkKOJgW/MygiqISUUUSAjmIXbkSfKHbVao48rwIqKzeWCfQrqWcgwan Y3UeNGzAfG0I87MKBEB6nnMaI9X3mLmFyiybj3M75+c1OchR9IJDTItB7FIqADcpu0UY Dugw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9x6DmnRA+tyfkKuDSeXMBlhGlWgUeJfhJgmNTdK030E=; b=SCmHJgjHOB19eqCBUqDKR0tGXbCvR6k4Ssz2gwdbnk8lgSxgkdD0bo2IMUljLtFz9T F5B15j34CuoZ2LSQJ0XZsKxUJsEmr+opypbaUUdwU7Ppmql4+Q/HxY2aTtwojMZjKjns HyIboNlT3qzhXBS2axekFIX/LgOxR+c8nkzWxLHNrbxdHFbcnYUXqa2fmv/06F9kZNXp JXj4fAMM3vqYEp9m2T7fxRl01wa5/OoWoMe089Ol8qdTLe/b/KT5NTGIhiDiORagonHf YTNHo0/WWdBMclidh+zwcTK7qzeikAKCNGwEM+Dn+sUNroKtfS/yG8Wqm/5aXDgCk6Nh U4tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nuhtJtcF; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si7023659ilb.149.2021.07.15.12.02.11; Thu, 15 Jul 2021 12:02:24 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=nuhtJtcF; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241854AbhGOTDN (ORCPT + 99 others); Thu, 15 Jul 2021 15:03:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:59154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242195AbhGOSyz (ORCPT ); Thu, 15 Jul 2021 14:54:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C663613CA; Thu, 15 Jul 2021 18:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375120; bh=vrWCRUN54XIlnAEmBXlL3XZX3sR5uelmfCjCD5jFokg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nuhtJtcFJzPC4KRemse/ZwGG4XMkbmLqR9HxUkXWlcuZulXV4pX8LDV4gIahs8eFO yuNXh6LtfpTYUUi36XcAZAcjFgXQr8TOH5tjYbnKPmnb74HpcFLj9YQmQZ1C0qWLh4 IJ/YjAgKkVfdjzCR2LVqTKOpGSmiLjoB8nSBxOgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Wolfram Sang , Yoshihiro Shimoda , Ulf Hansson Subject: [PATCH 5.10 168/215] mmc: core: clear flags before allowing to retune Date: Thu, 15 Jul 2021 20:39:00 +0200 Message-Id: <20210715182629.279205806@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang commit 77347eda64ed5c9383961d1de9165f9d0b7d8df6 upstream. It might be that something goes wrong during tuning so the MMC core will immediately trigger a retune. In our case it was: - we sent a tuning block - there was an error so we need to send an abort cmd to the eMMC - the abort cmd had a CRC error - retune was set by the MMC core This lead to a vicious circle causing a performance regression of 75%. So, clear retuning flags before we enable retuning to start with a known cleared state. Reported-by Yoshihiro Shimoda Suggested-by: Adrian Hunter Signed-off-by: Wolfram Sang Acked-by: Adrian Hunter Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210624151616.38770-2-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -936,11 +936,14 @@ int mmc_execute_tuning(struct mmc_card * err = host->ops->execute_tuning(host, opcode); - if (err) + if (err) { pr_err("%s: tuning execution failed: %d\n", mmc_hostname(host), err); - else + } else { + host->retune_now = 0; + host->need_retune = 0; mmc_retune_enable(host); + } return err; }