From patchwork Sun Aug 21 15:15:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9292215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B04B60574 for ; Sun, 21 Aug 2016 15:22:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CA4B289B9 for ; Sun, 21 Aug 2016 15:22:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 309E2289DB; Sun, 21 Aug 2016 15:22:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00,PLING_QUERY, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEBD8289B9 for ; Sun, 21 Aug 2016 15:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753192AbcHUPWL (ORCPT ); Sun, 21 Aug 2016 11:22:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50806 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbcHUPWK (ORCPT ); Sun, 21 Aug 2016 11:22:10 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4148585365; Sun, 21 Aug 2016 15:15:48 +0000 (UTC) Received: from shalem.localdomain (vpn1-5-149.ams2.redhat.com [10.36.5.149]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7LFFi91027451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Aug 2016 11:15:46 -0400 To: Ulf Hansson , Mike Christie , Jens Axboe , regressions@leemhuis.info Cc: "linux-mmc@vger.kernel.org" From: Hans de Goede Subject: 4.8-rc1 REGRESSION mmc-blk triggers WARN_ON(!host->claimed), related to: "drivers: use req op accessor" ? Message-ID: <6e68ae5a-4b79-a636-2c46-5726cf2cc44b@redhat.com> Date: Sun, 21 Aug 2016 17:15:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 21 Aug 2016 15:15:48 +0000 (UTC) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: 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. --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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; }