linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-mmc@vger.kernel.org
Subject: [PATCH AUTOSEL 5.14 206/252] mmc: core: Avoid hogging the CPU while polling for busy for mmc ioctls
Date: Thu,  9 Sep 2021 07:40:20 -0400	[thread overview]
Message-ID: <20210909114106.141462-206-sashal@kernel.org> (raw)
In-Reply-To: <20210909114106.141462-1-sashal@kernel.org>

From: Ulf Hansson <ulf.hansson@linaro.org>

[ 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 <ulf.hansson@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Link: https://lore.kernel.org/r/20210702134229.357717-3-ulf.hansson@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/core/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
-- 
2.30.2


  parent reply	other threads:[~2021-09-09 11:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210909114106.141462-1-sashal@kernel.org>
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 203/252] mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP Sasha Levin
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 204/252] mmc: sdhci-of-arasan: Check return value of non-void funtions Sasha Levin
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 205/252] mmc: core: Avoid hogging the CPU while polling for busy in the I/O err path Sasha Levin
2021-09-09 11:40 ` Sasha Levin [this message]
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 207/252] mmc: core: Avoid hogging the CPU while polling for busy after I/O writes Sasha Levin
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 208/252] mmc: rtsx_pci: Fix long reads when clock is prescaled Sasha Levin
2021-09-09 11:40 ` [PATCH AUTOSEL 5.14 211/252] mmc: core: Return correct emmc response in case of ioctl error Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210909114106.141462-206-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=stable@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).