Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 Dec 2017, Geert Uytterhoeven wrote:

> Hi Alan,
> 
> On Thu, Dec 7, 2017 at 10:26 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, 7 Dec 2017, Dan Carpenter wrote:
> >> The standard is to treat them like errors and try press forward in a
> >> degraded mode but don't print a message.  Checkpatch.pl complains if you
> >> print a warning for allocation failures.  A lot of low level functions
> >> handle their own messages pretty well but especially kmalloc() does.
> >
> > Which brings us back to my original objection.  If an allocation
> > failure has localized effects, but the low-level warning is unable to
> > specify what will be affected, how is the user supposed to connect the
> > effect to the cause?
> 
> The backtrace would include usb_hub_clear_tt_buffer, so the user will
> know USB is affected.
> Note that the cause of the memory exhaustion is usually not the caller.
> Unless it requests a real big block of memory, in which case that will be
> mentioned in the backtrace, too.
> 
> In this particular case, the driver uses GFP_ATOMIC, so allocation failures
> aren't that rare, and I think the driver should be prepared for that, and try
> to recover gracefully.
> 
> The comment
> 
>                 /* FIXME recover somehow ... RESET_TT? */
> 
> makes me think it isn't.
> 
> As this is a pretty small allocation, perhaps it can be done beforehand, without
> GFP_ATOMIC?

I can't see how to make that work.  We don't know beforehand how many
structures will be needed at any time.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux