From: cang@codeaurora.org
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Bart Van Assche <bvanassche@acm.org>,
asutoshd@codeaurora.org, nguyenb@codeaurora.org,
rnayak@codeaurora.org, linux-scsi@vger.kernel.org,
kernel-team@android.com, saravanak@google.com,
salyzyn@google.com, Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Pedro Sousa <pedrom.sousa@synopsys.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Bean Huo <beanhuo@micron.com>,
Venkat Gopalakrishnan <venkatg@codeaurora.org>,
Tomas Winkler <tomas.winkler@intel.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] scsi: ufs: Put SCSI host after remove it
Date: Tue, 17 Dec 2019 08:50:08 +0800 [thread overview]
Message-ID: <bd900a0b3fdb8dd8b2cdb42a039f938b@codeaurora.org> (raw)
In-Reply-To: <20191216180502.GA2404915@kroah.com>
On 2019-12-17 02:05, Greg KH wrote:
> On Mon, Dec 16, 2019 at 10:31:29PM +0800, cang@codeaurora.org wrote:
>> On 2019-12-15 02:32, Bart Van Assche wrote:
>> > On 12/14/19 8:03 AM, Can Guo wrote:
>> > > In ufshcd_remove(), after SCSI host is removed, put it once so that
>> > > its
>> > > resources can be released.
>> > >
>> > > Signed-off-by: Can Guo <cang@codeaurora.org>
>> > >
>> > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > > index b5966fa..a86b0fd 100644
>> > > --- a/drivers/scsi/ufs/ufshcd.c
>> > > +++ b/drivers/scsi/ufs/ufshcd.c
>> > > @@ -8251,6 +8251,7 @@ void ufshcd_remove(struct ufs_hba *hba)
>> > > ufs_bsg_remove(hba);
>> > > ufs_sysfs_remove_nodes(hba->dev);
>> > > scsi_remove_host(hba->host);
>> > > + scsi_host_put(hba->host);
>> > > /* disable interrupts */
>> > > ufshcd_disable_intr(hba, hba->intr_mask);
>> > > ufshcd_hba_stop(hba, true);
>> >
>> > Hi Can,
>> >
>> > The UFS driver may queue work asynchronously and that asynchronous
>> > work may refer to the SCSI host, e.g. ufshcd_err_handler(). Is it
>> > guaranteed that all that asynchronous work has finished before
>> > scsi_host_put() is called?
>> >
>> > Thanks,
>> >
>> > Bart.
>>
>> Hi Bart,
>>
>> As SCSI host is allocated in ufshcd_platform_init() during platform
>> drive probe, it is much more appropriate if platform driver calls
>> ufshcd_dealloc_host() in their own drv->remove() path. How do you
>> think if I change it as below? If it is OK to you, please ignore my
>> previous mails.
>>
>> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
>> index 3d4582e..ea45756 100644
>> --- a/drivers/scsi/ufs/ufs-qcom.c
>> +++ b/drivers/scsi/ufs/ufs-qcom.c
>> @@ -3239,6 +3239,7 @@ static int ufs_qcom_remove(struct
>> platform_device
>> *pdev)
>>
>> pm_runtime_get_sync(&(pdev)->dev);
>> ufshcd_remove(hba);
>> + ufshcd_dealloc_host(hba);
>> return 0;
>> }
>
> Wait, why is this a platform device? Don't you hang off of a pci
> device? Or am I missing something earlier in this patchset?
>
> thanks,
>
> greg k-h
Hi Greg,
I am not saying someone is a platform device here. My point is
whoever allocates the SCSI host in its drv->probe(), should
de-allocate it in its own drv->remove(), just like what ufshcd-pci.c
does.
Thanks,
Can Guo.
next prev parent reply other threads:[~2019-12-17 0:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1576328616-30404-1-git-send-email-cang@codeaurora.org>
2019-12-14 13:03 ` [PATCH 1/2] scsi: ufs: Put SCSI host after remove it Can Guo
2019-12-14 18:32 ` Bart Van Assche
2019-12-14 22:24 ` cang
2019-12-15 21:55 ` Bart Van Assche
2019-12-16 1:34 ` cang
2019-12-16 2:39 ` Bart Van Assche
2019-12-16 3:12 ` cang
2019-12-16 5:46 ` cang
2019-12-16 17:44 ` Bart Van Assche
2019-12-16 14:31 ` cang
2019-12-16 17:39 ` Bart Van Assche
2019-12-17 0:46 ` cang
2019-12-17 1:15 ` Bart Van Assche
2019-12-17 1:31 ` cang
2019-12-16 18:05 ` Greg KH
2019-12-17 0:50 ` cang [this message]
2019-12-14 13:03 ` [PATCH 2/2] scsi: ufs: Modularize ufs-bsg Can Guo
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=bd900a0b3fdb8dd8b2cdb42a039f938b@codeaurora.org \
--to=cang@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=gregkh@linuxfoundation.org \
--cc=jejb@linux.ibm.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nguyenb@codeaurora.org \
--cc=pedrom.sousa@synopsys.com \
--cc=rnayak@codeaurora.org \
--cc=salyzyn@google.com \
--cc=saravanak@google.com \
--cc=stanley.chu@mediatek.com \
--cc=tomas.winkler@intel.com \
--cc=venkatg@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox