Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp492748pxb; Wed, 11 Nov 2020 08:39:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6FSYomF1JEzmzhZhl++R6pcdG9j/OjZ/3DS9QAS1Z/8yUvwoLsSlHhKQ0qiIEINHsneCg X-Received: by 2002:a05:6402:94f:: with SMTP id h15mr253966edz.177.1605112773500; Wed, 11 Nov 2020 08:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605112773; cv=none; d=google.com; s=arc-20160816; b=rUitDMOK4KRPonCzT7WrefcgeTRG+hGhmU0rdc8a7Pr2TWNryNFGxz4AjDM2fDgViD wumrqNXX5nYtt/Bdz6BsioxyhQ850BJaSvL8eNjnjG9sytpAYVhd1SnOXQpbLtTZyu5t hwV2u2gzKdD/Y+0fsRbUX4Y9r1eJNoyVBOAlryWVz/X7qlLwceu43uyUzgUNzdVznZ5m Nk0dK37/GbnLcl+9d5D3Dz+9W0RqrhLDXM/jlpKoO9nRmv32AgvynLBmfpreeKldzRpY If8BOPMxkgWgbnz1Zwk1s3lq8AF5A3Ixj8wihGI9AdVaGWywdGR0+U9kwm8XQ2EmRl2g fIJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=0MTZNm0gtvDrGwPQUJrq8djAu9H1QIhfhQ6Ri7dD6yI=; b=LQ8MzuGWKoNhc0vvq956AixSkBIP91PM+ypYAeIcJ6NSPUSdGm/9o1P+z3gUrGYbfl OP+YabY9xpurZhvuOu8u8ynwfoWS3ur08HJkMGIClhrJkF1k+KUux55aTL3kT8Y8abh+ +PkWm9VUTpftAcvRPfNpjFzR0k1FUDDwqz6lFVNl8K1/9ji5eYI0W9VHA1Hnjon7oR/X vFNFUr1FNljMMleT1OR9zzjjRlHu0jdPsVmbRZcfzgX/Z8K0E6406pgtwCFOVEwxjYCA 5wOspMiS2kFYFz5R3Hwlbsa+jMzZyGGwJSi4YUH3WtPiVQZrDnmV/ddqVyFpveECVm6t D/VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ssZwUWdY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a35si1841633edf.202.2020.11.11.08.39.08; Wed, 11 Nov 2020 08:39:33 -0800 (PST) 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=@mg.codeaurora.org header.s=smtp header.b=ssZwUWdY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbgKKQhV (ORCPT + 99 others); Wed, 11 Nov 2020 11:37:21 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:24591 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725979AbgKKQhV (ORCPT ); Wed, 11 Nov 2020 11:37:21 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605112640; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=0MTZNm0gtvDrGwPQUJrq8djAu9H1QIhfhQ6Ri7dD6yI=; b=ssZwUWdYUBIBmxFW1StrxUvfWpXr7yUjrpCHIYrczu+fSsxug3OSlhC2GFTy0a+lfzoBill1 xUD/AnATZpikvHxAmtkJpwK0C+EqTo0hJB2TfYf9KUH8kCFCdyCU2MeZ4loxeahVd9QVqdFw xSm7dJ3NPYwBl/+QFEBgJofuRLs= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5fac0fe71b0f99048360dbf2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 11 Nov 2020 16:22:48 GMT Sender: vbadigan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2402AC43385; Wed, 11 Nov 2020 16:22:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.0.105] (unknown [49.205.245.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vbadigan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 34773C433C6; Wed, 11 Nov 2020 16:22:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 34773C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=vbadigan@codeaurora.org Subject: Re: [PATCH] mmc: block: Prevent new req entering queue while freeing up the queue To: Ulf Hansson Cc: Adrian Hunter , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , linux-arm-msm , Jens Axboe , Baolin Wang , Chaotian Jing , Peng Hao References: <1603883984-24333-1-git-send-email-vbadigan@codeaurora.org> From: Veerabhadrarao Badiganti Message-ID: <4f27eecd-3d10-796c-6b6c-594770502037@codeaurora.org> Date: Wed, 11 Nov 2020 21:52:35 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/2020 8:55 PM, Ulf Hansson wrote: > On Wed, 28 Oct 2020 at 12:20, Veerabhadrarao Badiganti > wrote: >> The commit bbdc74dc19e0 ("mmc: block: Prevent new req entering queue >> after its cleanup") has introduced this change but it got moved after >> del_gendisk() with commit 57678e5a3d51 ("mmc: block: Delete gendisk >> before cleaning up the request queue"). > This isn't the first time we have spotted errors in this path. Seems > like a difficult path to get correct. :-) > >> It is blocking reboot with below Call stack(). >> >> INFO: task reboot:3086 blocked for more than 122 seconds. >> __schedule >> schedule >> schedule_timeout >> io_schedule_timeout >> do_wait_for_common >> wait_for_completion_io >> submit_bio_wait >> blkdev_issue_flush >> ext4_sync_fs >> __sync_filesystem >> sync_filesystem >> fsync_bdev >> invalidate_partition >> del_gendisk >> mmc_blk_remove_req >> mmc_blk_remove >> mmc_bus_remove >> device_release_driver_internal >> device_release_driver >> bus_remove_device >> device_del >> mmc_remove_card >> mmc_remove >> mmc_stop_host >> mmc_remove_host >> sdhci_remove_host >> sdhci_msm_remove > Why do you call sdhci_msm_remove() from the shutdown callback? What > specific operations do you need to run in the shutdown path for sdhci > msm? I was suggested to add shutdown callback by memory team to gracefully de-register with smmu driver during reboot/shutdown. So tried adding it. Since SMMU team. I just need to ensure that controller is not active anymore and not accessing memory related to any requests and de-register with smmu driver during shutdown. > > The important part should be to do a graceful shutdown of the card > (and the block device) - is there anything else? > > Or you are just using the shutdown callback as a simple way to trigger > this problem? Could unbinding the driver trigger the same issue? > >> sdhci_msm_shutdown >> platform_drv_shutdown >> device_shutdown >> kernel_restart_prepare >> kernel_restart >> >> So bringing this change back. >> >> Signed-off-by: Veerabhadrarao Badiganti >> --- >> >> I'm observing this issue 100% of the time with shutdown callback added to sdhci-msm driver. >> I'm trying on 5.4 kernel with ChromeOS. >> >> Please let me know if this can be fixed in a better way. > I don't know yet, but I will have a closer look. Let's also see if > Adrian has some thoughts. > > Kind regards > Uffe > >> --- >> >> drivers/mmc/core/block.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c >> index 8d3df0be0355..76dbb2b8a13b 100644 >> --- a/drivers/mmc/core/block.c >> +++ b/drivers/mmc/core/block.c >> @@ -2627,6 +2627,7 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md) >> * from being accepted. >> */ >> card = md->queue.card; >> + blk_set_queue_dying(md->queue.queue); >> if (md->disk->flags & GENHD_FL_UP) { >> device_remove_file(disk_to_dev(md->disk), &md->force_ro); >> if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && >> -- >> Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project >>