All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Mike Christie <mchristi@redhat.com>, Jens Axboe <axboe@fb.com>,
	regressions@leemhuis.info
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: 4.8-rc1 REGRESSION mmc-blk triggers WARN_ON(!host->claimed), related to: "drivers: use req op accessor" ?
Date: Sun, 21 Aug 2016 17:15:43 +0200	[thread overview]
Message-ID: <6e68ae5a-4b79-a636-2c46-5726cf2cc44b@redhat.com> (raw)

Hi All,

With 4.8-rc1 I'm seeing WARN_ON(!host->claimed) triggering in both
mmc_start_request() as well as in mmc_release_host(). The first
indicating that we're executing mmc commands without doing
mmc_claim_host() and the second one indicating that we're
releasing the host without having claimed it first.

The backtraces all point to mmc_blk_issue_rq(). I've done
a very naive hack / workaround:

--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2151,9 +2151,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
  	struct mmc_host *host = card->host;
  	unsigned long flags;

-	if (req && !mq->mqrq_prev->req)
-		/* claim host only for the first request */
-		mmc_get_card(card);
+	mmc_get_card(card);

  	ret = mmc_blk_part_switch(card, md);
  	if (ret) {
@@ -2190,15 +2188,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
  	}

  out:
-	if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) ||
-	    mmc_req_is_special(req))
-		/*
-		 * Release host when there are no more requests
-		 * and after special request(discard, flush) is done.
-		 * In case sepecial request, there is no reentry to
-		 * the 'mmc_blk_issue_rq' with 'mqrq_prev->req'.
-		 */
-		mmc_put_card(card);
+	mmc_put_card(card);
+
  	return ret;
  }


Which fixes this, further pointing to the somewhat magical claim / release
code in mmc_blk_issue_rq() being the culprit.

Looking at recent commits these 2 stand out as possible causes of this:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c2df40dfb8c015211ec55f4b1dd0587f875c7b34
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3a5e02ced11e22ecd9da3d6710afe15bcfee1d10

I've the feeling that one of these is making mmc_blk_issue_rq() not claiming
the host while it should do so ...

Maybe instead of the magic at the top we need a simple bool to check
if the host is already claimed by the mmc_queue code ?

I can reproduce the WARN_ON's pretty much at will (running 4.8-rc1 on
Allwinner ARM devices with rootfs on a sdcard), let me know if you've
a fix you want me to test.

Regards,

Hans


p.s.

Besides the WARN_ON triggering another side-effect of this is that the
machines will hang at poweroff.


             reply	other threads:[~2016-08-21 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-21 15:15 Hans de Goede [this message]
2016-08-22 16:09 ` 4.8-rc1 REGRESSION mmc-blk triggers WARN_ON(!host->claimed), related to: "drivers: use req op accessor" ? Mike Christie
2016-08-24  8:47   ` Hans de Goede
2016-08-25  8:19     ` Adrian Hunter
2016-08-25 14:16       ` Jens Axboe
2016-08-25 18:26       ` Hans de Goede
2016-08-25 20:12         ` Jens Axboe
2016-08-26  7:13           ` Ulf Hansson
2016-08-26  8:25             ` Mike Christie

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=6e68ae5a-4b79-a636-2c46-5726cf2cc44b@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=axboe@fb.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=regressions@leemhuis.info \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.