linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: EJ Hsu <ejh@nvidia.com>
To: Oliver Neukum <oneukum@suse.com>, Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [PATCH] usb: uas: fix a plug & unplug racing
Date: Wed, 22 Jan 2020 09:52:09 +0000	[thread overview]
Message-ID: <MN2PR12MB4126A6A761F168E03E751E5ACF0C0@MN2PR12MB4126.namprd12.prod.outlook.com> (raw)
In-Reply-To: <MN2PR12MB4126317E9BA1D269BE83E4EDCF0D0@MN2PR12MB4126.namprd12.prod.outlook.com>

EJ Hsu wrote:

> Oliver Neukum wrote:
> 
> > > I just checked the code, and the reference count will be incremented
> > > in scsi_scan_host(), precisely speaking, in scsi_autopm_get_host().
> > > So, I still think we need to manually add reference count of interface here.
> > > Please correct me if there is anything wrong.
> >
> > AFAICT the generic power model will not suspend a parent while a child
> > is active. The includes SCSI children of USB parents. So I think we
> > are safe. Could you resubmit your patch without the PM counter
> > manipulation and we can fix any issue that may exist in theory later?
> >
> 
> The child_count of usb device should be incremented in the scsi_scan_host().
> I can simulate this situation by forcibly enable the autosuspend of uas driver
> and add a delay before scsi_scan_host() is called in asynchronous way.
> 
> But for now, as uas driver does not support autosuspend, it is indeed safe to
> remove the PM counter manipulation. If you have concern about it, it's OK to
> me to re-submit it.
> 

By the way, if autosuspend will be enabled in uas driver in the future, 
the PM counter manipulation should be added before scsi_add_host(), 
just as MSC driver did. Otherwise, the child_count of usb device might be
accidentally decremented. (the rpm "idle" message will be propagated
from scsi host to usb interface and usb device)

Thanks,
EJ
--nvpublic

      reply	other threads:[~2020-01-22  9:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13  3:30 [PATCH] usb: uas: fix a plug & unplug racing EJ Hsu
2020-01-13  9:44 ` Oliver Neukum
2020-01-13 15:21   ` Alan Stern
2020-01-14  3:28   ` EJ Hsu
2020-01-14 14:41     ` Oliver Neukum
2020-01-14 15:04       ` Alan Stern
2020-01-15  9:31         ` Oliver Neukum
2020-01-15 15:17           ` Alan Stern
2020-01-15 15:54           ` EJ Hsu
2020-01-20  9:38             ` Oliver Neukum
2020-01-21 11:29               ` EJ Hsu
2020-01-22  9:52                 ` EJ Hsu [this message]

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=MN2PR12MB4126A6A761F168E03E751E5ACF0C0@MN2PR12MB4126.namprd12.prod.outlook.com \
    --to=ejh@nvidia.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).