From patchwork Thu Sep 16 16:01:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 513042 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1444239jao; Thu, 16 Sep 2021 10:44:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSy4xspkH2BfbCAYNwP94Dzinc9t9SRePzcBJoHGFeLieJfZXdXYnGqT35qkUVMH3RQFY+ X-Received: by 2002:a05:6e02:f13:: with SMTP id x19mr4997925ilj.216.1631814246165; Thu, 16 Sep 2021 10:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631814246; cv=none; d=google.com; s=arc-20160816; b=DHVWoNmBDnhtLf3QInPptZqGfcGEzT8Y45LKzph8pOyPmaQBOsm4DHkDdMyqiDsQmu RmwzY6Jfn14wevOoIjC6t15AGby7g0GOk/3pwnZtednujeSGoxvGRWqVyw7WTEvrjMUs 4ISz1uc8vBRbATRg+utG244fKLceDABbtgwAPS++ZJRReSq4MiUrPknAbG8lHEkgYPkt 5ROIRYDuiM+8oQBlVuYdiYVDbN0efUU2WHjWvFLH7Tmrfk+wgHsyRKKWO7TNbt8XGE/+ e5bEpV1kIvQ97jvi11u8l/JSKSJZ1Ga/NPY3H2NXbJ3Yvmk+FVbzSCUJtLvaYro/SLkw NWnA== 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=LtjOodIOG3hVBzk/FqQmrAtyoHwyrn0z2Vg2qhuB8QU=; b=CjMjJAZTSaYCxS1rIGCX3W/xXUmWpFTTdDtG0P3ZvcS9U76wuZ1MT5w2WPExIeGvCS 9kPKqJgwwQitkskmjrlCwwZ007mL2/hRVZGnFMS5N5yaib5unyOhgGmWzs8svCEs0UCO wvu87mcw+am8gRQheGNlpQUalom96rnz3iD4CQk4wMzUj9P1XnqgQrOeWXhkvo6kRj8F /DnDzaEcwnDN3QJsCerWLN5pBWp0Ry1GBYtDpllh4i9n2O2PslRXhKEhVX2xZTvuTYCi 8S9HL+IwYNxoaQKlEcvahrPrynTH1qROtnt9JVJPNi3gSN9NAYWTcQbrS9OJbngRMQ7Z 7mbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J21pAywJ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 c184si3522977iof.111.2021.09.16.10.44.05; Thu, 16 Sep 2021 10:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=J21pAywJ; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1349834AbhIPRnU (ORCPT + 11 others); Thu, 16 Sep 2021 13:43:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:53754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353971AbhIPRh7 (ORCPT ); Thu, 16 Sep 2021 13:37:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 99D4F63237; Thu, 16 Sep 2021 16:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810995; bh=KGkS7OUjv67aEGceRwx3OK2/OzlLJ/+NxgxkJRzgIXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J21pAywJtBw/Q1wRlVXMnbTpoUs8st0+AbvrTU6/oG3wvcFT158KqUUEjJ99as5QM hITLLCL4Rnrr1wC8z9v+1PXLVZOq0nvwVj9eXHRdA03Lu5HNo+1GMd6Ot5xPpdvO/e WUGxswluU04AqZZTMfXxMWhLbPUOxtEDftVcpkbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Shawn Lin , Sasha Levin Subject: [PATCH 5.14 345/432] mmc: core: Avoid hogging the CPU while polling for busy for mmc ioctls Date: Thu, 16 Sep 2021 18:01:34 +0200 Message-Id: <20210916155822.522528425@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit 468108155b0f89cc08189cc33f9bacfe9da8a125 ] When __mmc_blk_ioctl_cmd() calls card_busy_detect() to verify that the card's states moves back into transfer state, the polling with CMD13 is done without any delays in between the commands being sent. Rather than fixing card_busy_detect() in this regards, let's instead convert into using the common mmc_poll_for_busy(), which also helps us to avoid open-coding. Signed-off-by: Ulf Hansson Reviewed-by: Shawn Lin Link: https://lore.kernel.org/r/20210702134229.357717-3-ulf.hansson@linaro.org Signed-off-by: Sasha Levin --- drivers/mmc/core/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 170343411f53..c30d0ab15539 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -605,7 +605,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, * Ensure RPMB/R1B command has completed by polling CMD13 * "Send Status". */ - err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, NULL); + err = mmc_poll_for_busy(card, MMC_BLK_TIMEOUT_MS, false, + MMC_BUSY_IO); } return err;