Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp663965pxv; Thu, 15 Jul 2021 12:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA048SoU1x21DlTB/V8jRcoNC+shz32rppQ5aRW4RvPaMrXH0KgL62iI+Uxg2Qh9cY4pMM X-Received: by 2002:a17:906:830a:: with SMTP id j10mr7309362ejx.11.1626378688491; Thu, 15 Jul 2021 12:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378688; cv=none; d=google.com; s=arc-20160816; b=Zzv1508byKz7Q8eeNlIUIy6k/Scrr8Pqnsif2Djugon3ybkESEt+Mj2fqgT19ET2WH DU+3J6axa45PSymQIvD8PYHKyurX0sov0+T05nmPHu1Bqd3uUDE7O5FLTewwHBfs2bQB rS5FKkcKhOr0sBrwRkeApb7z0+Zt8Tm0sTNgDWm5IuWB2Y36DRS2IzFqnc6Mok8RF1VU kEDY4U1rW5qie2G9yVmXcODJF+JtpA9K3eKR0t53hmik0juh5Z+FE3rV2RaD7N5saYYg LVfsI1tWdYTusoDWTWPxCdeAOr9pbZyfti93MVxIly1jzxHEtVzjiISSbHBPaA0sW1s2 oknA== 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=Ent0kFKkfHoSEI5r0yPOluzMY5i9G4lnYy+UiXrtQPg0H1l0Ym1NM6eIm9rGDmUUsc ImlKXqG+X8NFrGEOrgyiujXvB2pszg0leYJLkiWvV7o9a4eQ7+qN8tpTbvQhT6r0M00A 5lSpegJG2uGyatpOZoTbHqmDJXOKbl/tL58pgiXUWmw+XPZX+4M6h1FfNQFRa5ulZzYC fpbZGX9jopsSOSInwvbU3o3m1B7xku4r3/wYaDwt6D5ebkFINkDYvrrYw+xGYkEULhbq bDVuSff0iLQmpmLmzM3Ivd8KC9ARtR9I9iwNPrGpo516Rwke38DK0W4ci01Mdkm198L5 XnUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RLvogxp8; 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 c7si8487967ejc.177.2021.07.15.12.51.05; Thu, 15 Jul 2021 12:51:28 -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=RLvogxp8; 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 S244507AbhGOTsr (ORCPT + 99 others); Thu, 15 Jul 2021 15:48:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244704AbhGOTR6 (ORCPT ); Thu, 15 Jul 2021 15:17:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC004613F9; Thu, 15 Jul 2021 19:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376379; bh=EGdQPc8OlX8kWlU3VQgA63gB5PagL84NDe5Jk5DgzZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RLvogxp88PKcfbCbzCj/IZ3IzDb+qQM9fCNeQF5I6CjhlzH/r1L41fNdrMxMBphIb +s3ywSREmLKyx5eaKyE8aTpKgoJM9DS/JqOtwTC5Y32fu4wp8rFhotIZ7klgzVhkrN fp0tqZRW5CqeJ8CX2dTF3gj3PoHQX0EySfO8sulg= 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.13 209/266] mmc: core: clear flags before allowing to retune Date: Thu, 15 Jul 2021 20:39:24 +0200 Message-Id: <20210715182646.738473523@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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; }