Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp712090pxv; Thu, 15 Jul 2021 14:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc9MX6c8LYyKxhOgYcNDd1HUDNkhU7AK8UInRpvLPi2FXJK+LofuOQlfUyOiY0Dc3o2HCs X-Received: by 2002:a05:6402:498:: with SMTP id k24mr9926263edv.25.1626383418738; Thu, 15 Jul 2021 14:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383418; cv=none; d=google.com; s=arc-20160816; b=0Ws2Ng0q7ESbeOIwM4DlOrivDXUlTuwlI2Oa0UzuteuxnyZ1cciWjqaC2iJkEaerys Nqo5k9RM5LVfpV/qjIjAvqCRIO1hhE6YxkRaXsDt6VCSH7cIVHF86/7nfg8hZNMk5QC1 bz1HyKkVUHayHkUxaVFooaBMMIrJ2+iiEMXcH/J8BKN5Nn/N1kRO0/V3g+VTYiMtm36y t4xwTT4cjc6i2CihaKkfK4UedOm2q1t3JM+wexbwI2WDtTNajvK8j0hmxvuqUeCG0V6x ov3EbYwOMGdp2Zx/rfT9cR2W2hG07kJe3Tf9BLzH3PrgCxfoPXJ8Prjo5DDVLxqa/GJs nJsw== 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=+vaamoViHsH+G69Wya8d3Kb75VdoMmQIOdNWgpl2bGA=; b=nE79GxMeYLSqKHMEenjfDp248+LN/BbdZIpFmvsVoeGR3N/fTIlHHTIw7TwPoRiEqz P7bJ0/vsL+MKP7RUFGYtjKBlLJah06LwE6FaWhR5he9s8zswNk6xDp/Z9oTd/iiMtB7P pNQRHTtdpqQPL4ZvAnFC4q01xz85jeH+7Q24z8eGXQpvYy6CJeY9aeGYz4Jmfvy+7c/P gNijbv32d88z26U7WN4tjtZdpvYngxK4LPUwrFoWvaKuZegNPGHRbQVJ9Pf9QV1H+Xxl Ksmbu2bLtCnc42ggRHtHryH6b1beqO1bXOBtRn7KBxhTOp9KJKzymadFXv9nkbAP8fMk q5Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E0uZfS05; 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 v3si8723082edx.413.2021.07.15.14.09.55; Thu, 15 Jul 2021 14:10:18 -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=E0uZfS05; 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 S245661AbhGOTT6 (ORCPT + 99 others); Thu, 15 Jul 2021 15:19:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:38160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242158AbhGOTFK (ORCPT ); Thu, 15 Jul 2021 15:05:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE44861415; Thu, 15 Jul 2021 19:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375668; bh=EGdQPc8OlX8kWlU3VQgA63gB5PagL84NDe5Jk5DgzZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0uZfS05KQAQyCd83KnVbcYW5LP/1zoFV9CndmAAUHTdIXGh7UPrNV4RQ/EQecKKl beukrOMEtE/c7sRCVQsanwE+y7pj4s4jSk27mfZpIkFtZOlIybblgHEUYmGGDd5rvz vI0GTukp0YuIJg0H3g52mU2SfNzp3Sxk5drrFWU8= 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.12 185/242] mmc: core: clear flags before allowing to retune Date: Thu, 15 Jul 2021 20:39:07 +0200 Message-Id: <20210715182625.906251805@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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 @@ -937,11 +937,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; }