linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device
@ 2020-11-03  8:39 bugzilla-daemon
  2020-11-03  9:02 ` [Bug 210015] " bugzilla-daemon
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-03  8:39 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

            Bug ID: 210015
           Summary: page allocation failure in usb_hub_wq hub_event when
                    adding HID device
           Product: Drivers
           Version: 2.5
    Kernel Version: 5.8.16-300.fc33.x86_64
          Hardware: x86-64
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: USB
          Assignee: drivers_usb@kernel-bugs.kernel.org
          Reporter: jadahl@gmail.com
        Regression: No

Created attachment 293411
  --> https://bugzilla.kernel.org/attachment.cgi?id=293411&action=edit
journal -k during the error

When docking my laptop (Lenovo T470s, to a traditional docking station),
running 5.8.16-300.fc33.x86_64, sometimes (every other time or so), the kernel
runs into a page allocation failure when adding one of the HID device
associated with the USB keyboard attached to the docking station.

When this does *not* happen, three evdev devices appear for the keyboard:

/dev/input/event11:     TypeMatrix.com USB Keyboard
/dev/input/event12:     TypeMatrix.com USB Keyboard System Control
/dev/input/event13:     TypeMatrix.com USB Keyboard Consumer Control

The third device emits events such as Volume Up, Volume Down etc. The first
emits events such as regular A-Z keys.

Available HID devices are 

/dev/hidraw3:   TypeMatrix.com USB Keyboard
/dev/hidraw4:   TypeMatrix.com USB Keyboard

The first emits A-Z keys etc, while the second emits Volume up/down etc.

When the page allocation failure happens, the raw HID devices remain the same
and functioning, but the only evdev devices that appear are event11 and
event12, missing event13, thus missing Volume up/down events.

Replugging the keyboard enough times will make it work correctly again, most of
the times.

I'm attaching a journal -k for when it happens, containing the backtrace to the
page allocation failure.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 210015] page allocation failure in usb_hub_wq hub_event when adding HID device
  2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
@ 2020-11-03  9:02 ` bugzilla-daemon
  2020-11-03 17:53 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-03  9:02 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

Michel Dänzer (michel@daenzer.net) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michel@daenzer.net

--- Comment #1 from Michel Dänzer (michel@daenzer.net) ---
Unless the memory allocated by the hid driver needs to be physically
contiguous, it should use kvmalloc(_array) instead of kmalloc(_array) (and
kvfree instead of kfree) where it can be larger than a single page.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 210015] page allocation failure in usb_hub_wq hub_event when adding HID device
  2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
  2020-11-03  9:02 ` [Bug 210015] " bugzilla-daemon
@ 2020-11-03 17:53 ` bugzilla-daemon
  2020-11-03 18:07 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-03 17:53 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

Benjamin Tissoires (benjamin.tissoires@gmail.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benjamin.tissoires@gmail.co
                   |                            |m

--- Comment #2 from Benjamin Tissoires (benjamin.tissoires@gmail.com) ---
> Unless the memory allocated by the hid driver needs to be physically
> contiguous, it should use kvmalloc(_array) instead of kmalloc(_array) (and
> kvfree instead of kfree) where it can be larger than a single page.

hmm, that is a good lead. I'll have to double check but I don't think the
allocated memory should be that big. I am worried that using kvmalloc would
paper over an other problem and we'll eat up all the memory by just plugging a
keyboard...

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 210015] page allocation failure in usb_hub_wq hub_event when adding HID device
  2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
  2020-11-03  9:02 ` [Bug 210015] " bugzilla-daemon
  2020-11-03 17:53 ` bugzilla-daemon
@ 2020-11-03 18:07 ` bugzilla-daemon
  2020-11-04  8:34 ` bugzilla-daemon
  2020-11-09 22:00 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-03 18:07 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

--- Comment #3 from Michel Dänzer (michel@daenzer.net) ---
(In reply to Benjamin Tissoires from comment #2)
> I'll have to double check but I don't think the allocated memory should be
> that big.

order:5 means 32 physically contiguous pages.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 210015] page allocation failure in usb_hub_wq hub_event when adding HID device
  2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
                   ` (2 preceding siblings ...)
  2020-11-03 18:07 ` bugzilla-daemon
@ 2020-11-04  8:34 ` bugzilla-daemon
  2020-11-09 22:00 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-04  8:34 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

--- Comment #4 from Michel Dänzer (michel@daenzer.net) ---
... and allocating 32 physically contiguous pages can be difficult/expensive
under any circumstances.

(I happen to be aware of this issue because DRM drivers keep hitting it as well
:)

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 210015] page allocation failure in usb_hub_wq hub_event when adding HID device
  2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
                   ` (3 preceding siblings ...)
  2020-11-04  8:34 ` bugzilla-daemon
@ 2020-11-09 22:00 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-11-09 22:00 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=210015

Dmitry Torokhov (dmitry.torokhov@gmail.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.torokhov@gmail.com

--- Comment #5 from Dmitry Torokhov (dmitry.torokhov@gmail.com) ---
32 pages for a single field suggests that there is a garbage in the descriptor
and blindly converting to kvmalloc_array() is indeed simply papering over the
problem.

I suggest you post hid report descriptor and maybe instrument
hid-core.c::hid_register_field() to see what number of usages and values it is
being asjed to allocate.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-09 22:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  8:39 [Bug 210015] New: page allocation failure in usb_hub_wq hub_event when adding HID device bugzilla-daemon
2020-11-03  9:02 ` [Bug 210015] " bugzilla-daemon
2020-11-03 17:53 ` bugzilla-daemon
2020-11-03 18:07 ` bugzilla-daemon
2020-11-04  8:34 ` bugzilla-daemon
2020-11-09 22:00 ` bugzilla-daemon

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).