All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Jan-Marek Glogowski <glogow@fbihome.de>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
	linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
	Jon Flatley <jflat@chromium.org>,
	Oliver Neukum <oneukum@suse.com>
Subject: [v3] usb: warm-reset ports on hub resume, if requested
Date: Thu, 31 Jan 2019 16:11:09 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1901311604430.1287-100000@iolanthe.rowland.org> (raw)

On Thu, 31 Jan 2019, Jan-Marek Glogowski wrote:

> >Perhaps you didn't notice that at the end, hub_activate() calls
> >kick_hub_wq().  That routine calls
> >usb_autopm_get_interface_no_resume(), which will prevent the hub trim
> >suspending until hub_event() calls usb_autopm_put_interface().  
> >Therefore to make things work correctly, hub_activate() has to ensure
> >that the hub->event_bits and hub->change_bits fields are set correctly,
> >so that hub_event() will do the right thing when it runs (before the 
> >hub is allowed to go back into suspend).
> >
> >Therefore if a port is in a funny state, hub_activate() should detect
> >this and set one of these bit fields appropriately.  That's one reason
> >why it contains all those tests for portstatus and portchange.  If a
> >missing test needs to be added, that's what you should do.
> 
> That would be like the v3 of my patch, which started this thread and
> detected and handled the warm-reset request of the port in
> hub_activate() on resume. Maybe we can set some of these bits
> instead, or its already handled by the hub_port_reset() call; have to
> check.

Suppose instead of making hub_activate() do the warm reset during
resume, you merely have it set the port's bit in hub->event_bits.  
Then hub_event() would see that it needed to call port_event() for that
port.  Near the end of port_event() there is code that checks whether a
warm reset is needed; would that existing code be able to solve your
problem?

> I also included a patch in some previous mail after Mathias Nyman
> commented about the NULL status_urb, which added
> usb_hcd_poll_rh_status directly after the root hubs usb_remote_wakeup
> call.
> 
> A lot of stuff is deferred via workqueue or polled. As I understand
> it - in my case - resume, suspend and status race and miss each other
> in some endless loop.

This indicates that something is not using the existing synchronization 
mechanisms properly.  For example, something sees that a status request 
is needed but doesn't store that information in the right way to 
prevent a suspend from happening before the status information has been 
retrieved.

> As things are, I just have the new desktop HWs and a single usb-c
> device to test the ports of them. I have no idea what would happen
> with an additional non-root hub, but I can probably organize one, if
> I have to test it.

I don't know if it would tell us anything, but if you want to get a 
USB-C hub and see how well it works, that would be great.

Alan Stern

             reply	other threads:[~2019-01-31 21:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 21:11 Alan Stern [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-02-01 11:46 [v3] usb: warm-reset ports on hub resume, if requested Mathias Nyman
2019-01-31 18:52 Jan-Marek Glogowski
2019-01-31 16:53 Alan Stern
2019-01-31 15:13 Jan-Marek Glogowski
2019-01-31 14:56 Mathias Nyman
2019-01-31 10:42 Jan-Marek Glogowski
2019-01-30 16:56 Jan-Marek Glogowski
2019-01-30 14:58 Mathias Nyman
2019-01-30 12:38 Jan-Marek Glogowski
2019-01-25 16:21 Jan-Marek Glogowski
2019-01-25 15:14 Mathias Nyman
2019-01-18 11:28 Jan-Marek Glogowski
2019-01-16 17:07 Jan-Marek Glogowski

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=Pine.LNX.4.44L0.1901311604430.1287-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=drinkcat@chromium.org \
    --cc=glogow@fbihome.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jflat@chromium.org \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=oneukum@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.