Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp18973ybh; Sat, 11 Jul 2020 20:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA7w7i0nyG2APThRLdMcMS/+JYg+eXMheBUNvdSsLQZ7WN/z3PYfY735yJH5AcjVffNgaF X-Received: by 2002:a17:907:94c4:: with SMTP id dn4mr65790454ejc.150.1594524138710; Sat, 11 Jul 2020 20:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594524138; cv=none; d=google.com; s=arc-20160816; b=IffSQJDNFMmIaB35I4McNYab+vwoz6e4WdWvJ2JHv7uGXbB2MLxMfB+TEHzdQ12urJ KL+1PAg15u8dHwFEuZcy0ZtbtOZOg2NwkWIUb4nBob1UCvV/VSJHhPzkzJgkte2hrNSH 5e8gqtHVH6vWXGwos0RTuJgHMeqUAOgH8xXS0zwU4fGxHNh5d+7j/9y70P6i4XmET0Qz ETOevIy9T8V48JG8AmrdT6FQwNm1Rkw9loM4/uh3k7SVizBYEmdlIrBvpcE7PYKMP8yW 6r1OoFDjAmsPjNBWV5JPTezQW0oO6x4+lrMcNk8DkjR3OH6h90HDwmgshrG0c4vB9f4Z 0hYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=/xlF8D0YRhQkJt0cwXY5nQaiVavowdpy7MweO/IsN48=; b=Bb/xnEjqC26TmLeZ8kbNJjCTXZ9/a78b2Or9whUqNk1RDoAcasCpCp77Fkg++MyNXl 9TygTwDDgmMCG/TDNoujDYaHqRuvPbbeCmwitIz5LdG0h882rPU62QwHZg0LBUezZX9V rrqDRUHWEqH8qyyEoVE7jBaO/f4tqqCOCVxCVDVZ72fVkbIjHE6ss6z6G0/jD3U0SvO4 fD5oyAWUReJh+fia3ZVNMaFDBBEafAqeyxvchAEKC4SHW1DbdfxaLrtDTNXcAeZhZegE s7a2mLeAqtyREaKzyq+UTJLHd+DCnEjyafZ6aDwrcy8FogzjBat/2/pw83b7c5P6MS9q Mcwg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nk4si6667193ejb.593.2020.07.11.20.21.39; Sat, 11 Jul 2020 20:22:18 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbgGLDVV (ORCPT + 99 others); Sat, 11 Jul 2020 23:21:21 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:37981 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgGLDVV (ORCPT ); Sat, 11 Jul 2020 23:21:21 -0400 Received: by mail-pj1-f68.google.com with SMTP id k5so4538803pjg.3; Sat, 11 Jul 2020 20:21:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/xlF8D0YRhQkJt0cwXY5nQaiVavowdpy7MweO/IsN48=; b=i/+cYjrtV3PSXd9nRA3f0h6yZAK1CQcFc9qyy9zZ0u1fX2rSq08JRJMezBRHPvlM5q s2VzSFiKCIbsQetZk6vkGcXDEUQrpG3Kx5yQ/7KZmQAM2088wkN0uMuyhzZ0wdEFfCMG wmpOxQScGdeLdmUvC69ulAOsOBLWTyuh+whmtvuSymD9slrKwBzXdt0Z+rUz+ifqZy10 khPjUJAv6PVkmPyKv6RR3OojPAlqKjjmk6yS8wDdxLz5g082bVRoXYhgYNb72k3mkIra vFP6MWxmP1rWFqhscbr1bZUvxSfkSur2LKuqguyhZzJdZ2v5+F/q9T/QqYoZT++ho0jq 9P5g== X-Gm-Message-State: AOAM53175e0U9aBWrtSx1HMshnGgzVGd2Abkc/JTZRW2G/opjVWZ6E45 CgqPRw42/yth0DDhqjEbcP3RPEU0 X-Received: by 2002:a17:90a:db0b:: with SMTP id g11mr13404424pjv.11.1594524080197; Sat, 11 Jul 2020 20:21:20 -0700 (PDT) Received: from [192.168.50.147] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id z26sm10462649pfr.187.2020.07.11.20.21.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jul 2020 20:21:19 -0700 (PDT) Subject: Re: [RFC PATCH v3] scsi: ufs: Quiesce all scsi devices before shutdown To: Stanley Chu , linux-scsi@vger.kernel.org, martin.petersen@oracle.com, avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com Cc: beanhuo@micron.com, asutoshd@codeaurora.org, cang@codeaurora.org, matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com, peter.wang@mediatek.com, chun-hung.wu@mediatek.com, andy.teng@mediatek.com, chaotian.jing@mediatek.com, cc.chou@mediatek.com References: <20200706132218.21171-1-stanley.chu@mediatek.com> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfo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kAEQEAAYkBHwQYAQIACQUCVI67igIbDAAK CRBxXD01xc4QCZ4dB/0QrnEasxjM0PGeXK5hcZMT9Eo998alUfn5XU0RQDYdwp6/kMEXMdmT oH0F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <2465978d-28d3-e30f-248e-87333c789743@acm.org> Date: Sat, 11 Jul 2020 20:21:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200706132218.21171-1-stanley.chu@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-07-06 06:22, Stanley Chu wrote: > +static void ufshcd_cleanup_queue(struct scsi_device *sdev, void *data) > +{ > + if (sdev->request_queue) > + blk_cleanup_queue(sdev->request_queue); > +} No SCSI LLD should ever call blk_cleanup_queue() directly for sdev->request_queue. Only the SCSI core should call blk_cleanup_queue() directly for that queue. > int ufshcd_shutdown(struct ufs_hba *hba) > { > int ret = 0; > + struct scsi_target *starget; > > if (!hba->is_powered) > goto out; > @@ -8612,7 +8632,25 @@ int ufshcd_shutdown(struct ufs_hba *hba) > goto out; > } > > + /* > + * Quiesce all SCSI devices to prevent any non-PM requests sending > + * from block layer during and after shutdown. > + * > + * Here we can not use blk_cleanup_queue() since PM requests > + * (with BLK_MQ_REQ_PREEMPT flag) are still required to be sent > + * through block layer. Therefore SCSI command queued after the > + * scsi_target_quiesce() call returned will block until > + * blk_cleanup_queue() is called. > + * > + * Besides, scsi_target_"un"quiesce (e.g., scsi_target_resume) can > + * be ignored since shutdown is one-way flow. > + */ > + ufshcd_scsi_for_each_sdev(ufshcd_quiece_sdev); > + > ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM); > + > + /* Set queue as dying to not block queueing commands */ > + ufshcd_scsi_for_each_sdev(ufshcd_cleanup_queue); > out: > if (ret) > dev_err(hba->dev, "%s failed, err %d\n", __func__, ret); > What is the purpose of ufshcd_shutdown()? Why does this function exist? How about removing the calls to ufshcd_shutdown() and invoking power down code from inside sd_suspend_common() instead? Thanks, Bart.