* Peter Zijlstra <pet...@infradead.org> wrote:

> On Thu, Jan 26, 2017 at 08:19:37AM +0100, Ingo Molnar wrote:
> > 
> > * Lu Baolu <baolu...@linux.intel.com> wrote:
> > 
> > > Fair enough.
> > > 
> > > USB connection is stable enough, unless the user unplugs the
> > > USB cable during debugging.
> > 
> > What does the hardware do in this case? The XHCI registers are in the host 
> > hardware, so they won't disappear, right? Is there some cable connection 
> > status 
> > bit we can extract without interrupts?
> > 
> > I.e. if there's any polling component then it would be reasonable to add an 
> > error 
> > component: poll the status and if it goes 'disconnected' then disable 
> > early-printk 
> > altogether in this case and trigger an emergency printk() so that there's 
> > chance 
> > that the user notices [if the system does not misbehave otherwise].
> 
> That'll be fun when printk() == early_printk() :-)

My suggestion would be to just print into the printk buffer directly in this 
case, 
without console output - the developer will notice it in 'dmesg'.

> I myself wouldn't mind the system getting stuck until the link is
> re-established. My own damn fault for taking that cable out etc.

That's fine too, although beyond the obvious "yanked the cable without 
realizing 
it" case there are corner cases where usability is increased massively if the 
kernel is more proactive about error conditions: for example there are 
sub-standard USB cables and there are too long USB pathways from overloaded USB 
hubs which can result in intermittent behavior, etc.

A clear diagnostic message in 'dmesg' that the USB host controller is unhappy 
about the USB-debug dongle device is a _lot_ more useful when troubleshooting 
such 
problems than the occasional weird, non-deterministic hang...

Thanks,

        Ingo

Reply via email to