All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Dan Carpenter" <dan.carpenter@oracle.com>,
	"SF Markus Elfring" <elfring@users.sourceforge.net>,
	"USB list" <linux-usb@vger.kernel.org>,
	"Joe Perches" <joe@perches.com>,
	"Daniel Drake" <drake@endlessm.com>,
	"Dmitry Fleytman" <dmitry@daynix.com>,
	"Eugene Korenevsky" <ekorenevsky@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Günter Röck" <linux@roeck-us.net>,
	"Johan Hovold" <johan@kernel.org>,
	"Mathias Nyman" <mathias.nyman@linux.intel.com>,
	"Peter Chen" <peter.chen@nxp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()
Date: Fri, 8 Dec 2017 08:43:37 +0100	[thread overview]
Message-ID: <CAMuHMdW4-fKLiymBeKtMFM7g4VqEKOfugYzUe=6dP_XKegFWhw@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1712071624410.1280-100000@iolanthe.rowland.org>

Hi Alan,

On Thu, Dec 7, 2017 at 10:26 PM, Alan Stern <stern@rowland.harvard.edu> 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?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Dan Carpenter" <dan.carpenter@oracle.com>,
	"SF Markus Elfring" <elfring@users.sourceforge.net>,
	"USB list" <linux-usb@vger.kernel.org>,
	"Joe Perches" <joe@perches.com>,
	"Daniel Drake" <drake@endlessm.com>,
	"Dmitry Fleytman" <dmitry@daynix.com>,
	"Eugene Korenevsky" <ekorenevsky@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Günter Röck" <linux@roeck-us.net>,
	"Johan Hovold" <johan@kernel.org>,
	"Mathias Nyman" <mathias.nyman@linux.intel.com>,
	"Peter Chen" <peter.chen@nxp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()
Date: Fri, 08 Dec 2017 07:43:37 +0000	[thread overview]
Message-ID: <CAMuHMdW4-fKLiymBeKtMFM7g4VqEKOfugYzUe=6dP_XKegFWhw@mail.gmail.com> (raw)
In-Reply-To: <97b0eeb8-834e-61ca-01dd-afbbf18697db@users.sourceforge.net>

Hi Alan,

On Thu, Dec 7, 2017 at 10:26 PM, Alan Stern <stern@rowland.harvard.edu> 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?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Dan Carpenter" <dan.carpenter@oracle.com>,
	"SF Markus Elfring" <elfring@users.sourceforge.net>,
	"USB list" <linux-usb@vger.kernel.org>,
	"Joe Perches" <joe@perches.com>,
	"Daniel Drake" <drake@endlessm.com>,
	"Dmitry Fleytman" <dmitry@daynix.com>,
	"Eugene Korenevsky" <ekorenevsky@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Günter Röck" <linux@roeck-us.net>,
	"Johan Hovold" <johan@kernel.org>,
	"Mathias Nyman" <mathias.nyman@linux.intel.com>,
	"Peter Chen" <peter.chen@nxp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()
Date: Fri, 8 Dec 2017 08:43:37 +0100	[thread overview]
Message-ID: <CAMuHMdW4-fKLiymBeKtMFM7g4VqEKOfugYzUe=6dP_XKegFWhw@mail.gmail.com> (raw)

Hi Alan,

On Thu, Dec 7, 2017 at 10:26 PM, Alan Stern <stern@rowland.harvard.edu> 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?

Gr{oetje,eeting}s,

                        Geert
---
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-12-08  7:43 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 16:13 [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() SF Markus Elfring
2017-12-06 16:13 ` SF Markus Elfring
2017-12-06 16:13 ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer( SF Markus Elfring
2017-12-06 16:45 ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() Alan Stern
2017-12-06 16:45   ` Alan Stern
2017-12-06 16:45   ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buf Alan Stern
2017-12-06 16:57   ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() Greg Kroah-Hartman
2017-12-06 16:57     ` Greg Kroah-Hartman
2017-12-06 16:57     ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buf Greg Kroah-Hartman
2017-12-06 17:27   ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() Geert Uytterhoeven
2017-12-06 17:27     ` Geert Uytterhoeven
2017-12-06 17:27     ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buf Geert Uytterhoeven
2017-12-06 17:51     ` USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() SF Markus Elfring
2017-12-06 17:51       ` SF Markus Elfring
2017-12-06 17:51       ` SF Markus Elfring
2017-12-06 20:20       ` Geert Uytterhoeven
2017-12-06 20:20         ` Geert Uytterhoeven
2017-12-06 20:20         ` Geert Uytterhoeven
2017-12-08 11:11         ` Dan Carpenter
2017-12-08 11:11           ` Dan Carpenter
2017-12-08 11:11           ` Dan Carpenter
2017-12-08 12:00           ` USB: hub: Checking communication difficulties SF Markus Elfring
2017-12-08 12:00             ` USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() SF Markus Elfring
2017-12-08 12:00             ` USB: hub: Checking communication difficulties SF Markus Elfring
2017-12-06 20:05   ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() Joe Perches
2017-12-06 20:05     ` Joe Perches
2017-12-06 20:05     ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buf Joe Perches
2017-12-06 21:18     ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() Alan Stern
2017-12-06 21:18       ` Alan Stern
2017-12-06 21:18       ` [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buf Alan Stern
2017-12-06 21:33       ` USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer() SF Markus Elfring
2017-12-06 21:33         ` SF Markus Elfring
2017-12-06 21:33         ` SF Markus Elfring
2017-12-06 22:02         ` Alan Stern
2017-12-06 22:02           ` Alan Stern
2017-12-06 22:02           ` Alan Stern
2017-12-07  7:40           ` Geert Uytterhoeven
2017-12-07  7:40             ` Geert Uytterhoeven
2017-12-07  7:40             ` Geert Uytterhoeven
2017-12-07  8:35             ` Dan Carpenter
2017-12-07  8:35               ` Dan Carpenter
2017-12-07  8:35               ` Dan Carpenter
2017-12-07  8:45               ` Geert Uytterhoeven
2017-12-07  8:45                 ` Geert Uytterhoeven
2017-12-07  8:45                 ` Geert Uytterhoeven
2017-12-07  8:56                 ` Greg Kroah-Hartman
2017-12-07  8:56                   ` Greg Kroah-Hartman
2017-12-07  8:56                   ` Greg Kroah-Hartman
2017-12-07  9:17                   ` Oliver Neukum
2017-12-07  9:17                     ` Oliver Neukum
2017-12-07  9:17                     ` Oliver Neukum
2017-12-07  9:30                 ` Dan Carpenter
2017-12-07  9:30                   ` Dan Carpenter
2017-12-07  9:30                   ` Dan Carpenter
2017-12-07 15:12             ` Alan Stern
2017-12-07 15:12               ` Alan Stern
2017-12-07 15:12               ` Alan Stern
2017-12-07 16:20               ` Joe Perches
2017-12-07 16:20                 ` Joe Perches
2017-12-07 16:20                 ` Joe Perches
2017-12-07 20:51               ` Dan Carpenter
2017-12-07 20:51                 ` Dan Carpenter
2017-12-07 20:51                 ` Dan Carpenter
2017-12-07 21:26                 ` Alan Stern
2017-12-07 21:26                   ` Alan Stern
2017-12-07 21:26                   ` Alan Stern
2017-12-08  7:43                   ` Geert Uytterhoeven [this message]
2017-12-08  7:43                     ` Geert Uytterhoeven
2017-12-08  7:43                     ` Geert Uytterhoeven
2017-12-08 17:42                     ` Alan Stern
2017-12-08 17:42                       ` Alan Stern
2017-12-08 17:42                       ` Alan Stern
2017-12-07 13:38           ` SF Markus Elfring
2017-12-07 13:38             ` SF Markus Elfring
2017-12-07 13:38             ` SF Markus Elfring

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='CAMuHMdW4-fKLiymBeKtMFM7g4VqEKOfugYzUe=6dP_XKegFWhw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=dan.carpenter@oracle.com \
    --cc=dmitry@daynix.com \
    --cc=drake@endlessm.com \
    --cc=ekorenevsky@gmail.com \
    --cc=elfring@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=johan@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mathias.nyman@linux.intel.com \
    --cc=peter.chen@nxp.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 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.