Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp294272pxb; Wed, 4 Nov 2020 23:26:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6GAHhRMejhb/uMb9ubzA6okYA6JR7iz49tGFjWl80N/Mq8UkoF4wkUnkxzKuyYGZwcSD/ X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr1012678ejh.168.1604561168241; Wed, 04 Nov 2020 23:26:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604561168; cv=none; d=google.com; s=arc-20160816; b=Y6GvqK6JvHWXpuCOocM0UXQmMGACJHnp89UzQ0NvxZqwr67HoOACt+jIba0RgY+eb8 dEQe4nIFl3bjxFNApZfxlmcN53lY3u7i02o5vCpjPjL5hK0skWbrBnAk1sNoF90aiE8M o76o+MELIXdxMfToiGlafjLmET2ZAictnmr9b7tPSt1oWGMkuIGbps0fv2SNDvfAUAaa B3ff909vMgVKi8NeN7EQRtVNBNZCrAyEsSrcoM+zT1TAEHtomAEDuMc4yDsWep1i52iE gMSlj2N5qwElmH0vTsPp9Oe7JIfMdbNQGg4pLQd14eKPemzxQG+iQahu1+MIGSRAeVlF 6wEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=M7rkNDkMhJJMOyUj/TH5BT3+Vy39z036zqo9GHc12r0=; b=sesZTiBbZvSYzcPVv/wzOA0WSKb8iG9dHX1VOxPSIcHRoO5DyMBAlc4Y4PDmEMBCS+ CtgQMLJmWvaOUASHwhiRqsPe+R8FhZ4VUh1P3b/QN6F1+Bc+QwFJQbttG0oYRQbm90mW KwT8EgJsyELyoZdkaaRmCwOSq5M5wxNWgZ7fr2s66P725g2vX3IuRkZh3/JfjWJAr04Z s7yY5WNhW3mKn0mbmJZoGRfATwVRIGRkosB1Sx7T3P4P+AtUIkM6bkmuW0sKjg1u82bd nLFV/qesuMxFnvlCzSGCALwxHsqCSFcer2ZggctfHIrHAUkd/tVX/nD6SEpuw87t/TXZ eCZg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si483231ejj.675.2020.11.04.23.25.45; Wed, 04 Nov 2020 23:26:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbgKEHYU (ORCPT + 99 others); Thu, 5 Nov 2020 02:24:20 -0500 Received: from mga02.intel.com ([134.134.136.20]:38784 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbgKEHYU (ORCPT ); Thu, 5 Nov 2020 02:24:20 -0500 IronPort-SDR: P8L6OJ4JKjpleLMErpRXSQS6PX3BxwxPzUBxd6GgJISVSQPve/pdjVB4fuyJy/EgrEE2OD+5Ah Lyhn3cUZUeDQ== X-IronPort-AV: E=McAfee;i="6000,8403,9795"; a="156331669" X-IronPort-AV: E=Sophos;i="5.77,452,1596524400"; d="scan'208";a="156331669" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2020 23:24:19 -0800 IronPort-SDR: /386lavZ1vDjUyLV983UWCzxDVLB6YJG3S1fhh9Nd9HZwNZaaTteistXwhJOtfy6ZyYi9CvIjG C5mXQfkDrzuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,452,1596524400"; d="scan'208";a="363722399" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.94]) ([10.237.72.94]) by FMSMGA003.fm.intel.com with ESMTP; 04 Nov 2020 23:24:16 -0800 Subject: Re: [PATCH] mmc: block: Prevent new req entering queue while freeing up the queue To: Ulf Hansson , Veerabhadrarao Badiganti Cc: "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: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Thu, 5 Nov 2020 09:24:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/11/20 5:25 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? Yes, the problem is that upper layers, like the mmc block driver, have already shut down, so doing operations like remove will get into deadlocks. > > 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 >>