From patchwork Tue Feb 27 11:22:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 129772 Delivered-To: patches@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1273224lja; Tue, 27 Feb 2018 03:22:37 -0800 (PST) X-Received: by 10.46.29.69 with SMTP id d66mr9980988ljd.22.1519730557661; Tue, 27 Feb 2018 03:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519730557; cv=none; d=google.com; s=arc-20160816; b=k/hj+HeCygprV2AwzgKUbIAvC1xpc25Fhr5Yss49ln/kuY6dG7mrLw9zfJPlVcw1AZ I9i1+opwGXIGuFdtUfo/GlmM/gv+avERN2XAe4JiusS5JQS+MUKckGxq3xm7eIEHBjbh qVH1vwFkHjx7TNsNea4/S3DhzUPSQnzX6rMabQyUcOx8Hw/4HqdgbcfXRWfk32Pl2JrX tXgv3aQ3s7qpvFYsLeDxkMoLdHsgMrV2/kgE+LoDNJaNwPLChIiI2txkE5yKivknfdBt /gaTZJ+jevjOlTiPBelHi5GkdGcyHYyWzwF9+VyQ3UTRLmgw3rkbop7W1/hwyeOjPVCn s9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0TCSYXa9Dkykv16P2C9AL9DSyaK3D4C3zgiVeQ7OgwU=; b=OstKBES8MO37VjKhqZxcUsBiSzT5A/hYLZuZKqCLLQI7xRQX1uGTrf81YruScYCLhD kHoYEVHEw2fvqEcyaPd3xvcOMAtbs6DR9jyyfyJWZuNZo+qBMWSX7RiU3kOWYhJTCqH5 SOUTqHcMM91v9g4uhBSNOoYy+ux7GEXYL4aMzuqBcCie9OcprIXaOd8X1Gp8YtP2fGBK /QY4yu7ywwtDpxLWiTAynC85U11F1t1JJ33oHxsX3Lu0y7hbAh5eII9Q6JrxQMbw+JFp YKtxiqvKEsQPdmKrBg7/wMOm/tpWJPiL/nQq180G3gUrph0U5WB5k0b3am+XcksUQA2Y qwGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PTTYYeHr; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x5sor2184910ljc.95.2018.02.27.03.22.37 for (Google Transport Security); Tue, 27 Feb 2018 03:22:37 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PTTYYeHr; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0TCSYXa9Dkykv16P2C9AL9DSyaK3D4C3zgiVeQ7OgwU=; b=PTTYYeHrJuOE+CQ292hePYfkGRDiPUuxOlDnYMDejvVQBHDK/o3trZ8jj6J8yPQLFb 4nnmuz95A8zAktefCC11Bnrg6Wj7Jc2AFqQWE8/3pmzKWuwwFmjTYr4MlTBfmJWrIBLt nsJx9ydV+bsIHh5JJb/LRst6JrwIPID6M6BaQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0TCSYXa9Dkykv16P2C9AL9DSyaK3D4C3zgiVeQ7OgwU=; b=k1u+7P/UssxoHRezX6ezipCitNn/xKi7FuNZgi3NVrFiwdgrDU7fwVo5df/Uwd1IH4 XjL8gg2lSiX4PQVJbyvOmwD7nQojyWSVR6iiaO6u2focto/Lm8PqFsnnCZ5c4t52qb/F 5sZC8eUXGqOWXb6zes3SlSOwNN3csTxVV2ZNK6JONa1e1WtLjXLaJDzU2yNHE2zQ0JBA nrP35FmgAPAN/H4x/hb3HayWeLLkegfc86FdY1CRogF51RG3IiocDR8UZhLR88aSTsET gyrjpUUqk2pmqJHvQSchPVXpNpvXLs33SIwT9wXPxosunbNR3fUmMI34LyYxv93J0IN6 /D9Q== X-Gm-Message-State: APf1xPCERnIIwe3vDpcZX1wRckKq+3xHY9IUT1gMCV21bEQyzk/AAaqU hpicYkzQsnroSKoie67M8AiqT+VM X-Google-Smtp-Source: AG47ELsZufPyqIWb1JP7uWsJB1eTqzwhKParFBWczeIko5r7oq11bdI3FzCTluqptM/4y0Grt+Wqwg== X-Received: by 10.46.145.72 with SMTP id q8mr10095261ljg.108.1519730557395; Tue, 27 Feb 2018 03:22:37 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b82sm2506750lfl.9.2018.02.27.03.22.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 03:22:36 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Adrian Hunter , Linus Walleij Cc: Ulf Hansson , Dmitry Osipenko Subject: [PATCH] mmc: core: Avoid hanging to claim host for mmc via some nested calls Date: Tue, 27 Feb 2018 12:22:15 +0100 Message-Id: <1519730535-9991-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 As the block layer, since the conversion to blkmq, claims the host using a context, a following nested call to mmc_claim_host(), which isn't using a context, may hang. Calling mmc_interrupt_hpi() and mmc_read_bkops_status() via the mmc block layer, may suffer from this problem, as these functions are calling mmc_claim|release_host(). Let's fix the problem by removing the calls to mmc_claim|release_host() from the above mentioned functions and instead make the callers responsible of claiming/releasing the host. As a matter of fact, the existing callers already deals with it. Fixes: 81196976ed94 ("mmc: block: Add blk-mq support") Reported-by: Dmitry Osipenko Suggested-by: Adrian Hunter Tested-by: Dmitry Osipenko Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.7.4 Acked-by: Adrian Hunter Reviewed-by: Shawn Lin diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 908e4db..42d6aa8 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -848,7 +848,6 @@ int mmc_interrupt_hpi(struct mmc_card *card) return 1; } - mmc_claim_host(card->host); err = mmc_send_status(card, &status); if (err) { pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); @@ -890,7 +889,6 @@ int mmc_interrupt_hpi(struct mmc_card *card) } while (!err); out: - mmc_release_host(card->host); return err; } @@ -932,9 +930,7 @@ static int mmc_read_bkops_status(struct mmc_card *card) int err; u8 *ext_csd; - mmc_claim_host(card->host); err = mmc_get_ext_csd(card, &ext_csd); - mmc_release_host(card->host); if (err) return err;