Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp460913pxb; Thu, 9 Sep 2021 05:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6X/cURuMb0N5bscUjIgWRoy8fd4a2LgfqLrEs1yE2XBlOpLSqNaJlNUG5dhKaCJbjqq48 X-Received: by 2002:a2e:9450:: with SMTP id o16mr1944525ljh.80.1631189217212; Thu, 09 Sep 2021 05:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189217; cv=none; d=google.com; s=arc-20160816; b=loYBsWuiEL0Cn1mJzrjlDEdpBD2lbNFv6rnYqnQc3E+kZqL9rku1fPLDm9LqNK3ESn 4ouutjS3CmdifDKdjDIAu55mRNsybVZ1DHB/rkYe4PTOHeQG6AFPUZb2AXUTvRJz3cxs /DKcJVCTReNUoKJKYNwLPG8c+lQMeOu4UoyaauXy4jEY6f+U1AgYE7Wpi4lSRaQDEZXL 6cbR0KLE+h3qKe55/vmbm89st0pDlACZ/ukKlb/9SHb0mJ3Aq9akSOMyrx2sXfcXYdMw Lw1eMKVIaZDf24yodx6LQsNMtv/gg3fAhAWSjSDOublKBbAAII3q6kc5cHPkwTVmc3/e QH1Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LtjOodIOG3hVBzk/FqQmrAtyoHwyrn0z2Vg2qhuB8QU=; b=sVnwQRZR08oZDNf0hZReenwHAEDgHkwX3j3q89vWHKAJjmydVOlYNgASKSuqYPu4EW BqNbNwyzbWJY+gn/zKlzP7S/sxBFckR4GxL+iL37Q+SRPdeSm8X0BQUxctf1fzzxiP/o q9QBslzhe6lRt8ZLfWzmrfC9rmVP06hLpHi9mo6zL6dHYlKWjD5BFogBfa0f65HF4Uk9 Vuv59Hyqu9H7Uij1FrLU0TdQein0hnRJ6K3qlZIkqsolIMHG+Om5RQswK4BrA3q4cFyl kySgBO890J6JIKH0JJ35xTtLzAxJWZKWsHJtuRC01cc+mhtu2N1xtDkwWij00ni6HYJR JcEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="UH6/I2rE"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1657190ejk.700.2021.09.09.05.06.14; Thu, 09 Sep 2021 05:06:57 -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=@kernel.org header.s=k20201202 header.b="UH6/I2rE"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238287AbhIIMBq (ORCPT + 99 others); Thu, 9 Sep 2021 08:01:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:34040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243903AbhIIL52 (ORCPT ); Thu, 9 Sep 2021 07:57:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CF656120C; Thu, 9 Sep 2021 11:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187934; bh=KGkS7OUjv67aEGceRwx3OK2/OzlLJ/+NxgxkJRzgIXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UH6/I2rEJATn/iMXg2eDsgPOOB89BN7gOTrdJI8cOTly0f1BTtKmZSvsucZaCtNLy vHJYhWfvsAESC8q+N4fADGyK0es397PiW3KebYeiR7i6d/oMSNRexjV2nQejzq8Gpi WtDfKtOvJc/aCyhOJpcXXrjUo8c2kjz+txbip9yHTA0eOPVMUMuRmuB62aaldzfHFw /EVQFY3+Mdpxj1OOz7NSFwkKSGMX/scUZ5eTWnYUxF6lzo9DTpHBJa6P1jzWWnR8LM 4Pc0l3T2MHT3IiN1vK4arNs1QPJG0tRAxl5Kg/H4cTsYZaRib6YFvfQHguad6DrP4U MUL2i0aTti7hA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Shawn Lin , Sasha Levin , 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 Message-Id: <20210909114106.141462-206-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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