Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] drivers: hid: Add a module description line to the hid_hyperv driver
From: Sasha Levin @ 2019-05-30 17:37 UTC (permalink / raw)
  To: jikos, benjamin.tissoires; +Cc: linux-input, linux-kernel

From: Joseph Salisbury <Joseph.Salisbury@microsoft.com>

This patch only adds a MODULE_DESCRIPTION statement to the driver.
This change is only cosmetic, so there should be no runtime impact.

Signed-off-by: Joseph Salisbury <joseph.salisbury@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-hyperv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index 704049e62d58a..d3311d714d359 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -614,5 +614,7 @@ static void __exit mousevsc_exit(void)
 }
 
 MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic HID Driver");
+
 module_init(mousevsc_init);
 module_exit(mousevsc_exit);
-- 
2.20.1

^ permalink raw reply related

* [PATCH] drivers: input: serio: Add a module desription to the hyperv_keyboard driver
From: Sasha Levin @ 2019-05-30 17:46 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel

From: Joseph Salisbury <Joseph.Salisbury@microsoft.com>

This patch only adds a MODULE_DESCRIPTION statement to the driver.
This change is only cosmetic, so there should be no runtime impact.

Signed-off-by: Joseph Salisbury <joseph.salisbury@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/serio/hyperv-keyboard.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index a8b9be3e28db7..7935e52b54358 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -440,5 +440,7 @@ static void __exit hv_kbd_exit(void)
 }
 
 MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic Keyboard Driver");
+
 module_init(hv_kbd_init);
 module_exit(hv_kbd_exit);
-- 
2.20.1

^ permalink raw reply related

* Re: hid-related 5.2-rc1 boot hang
From: Jiri Kosina @ 2019-05-31 22:15 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Hans de Goede, Benjamin Tissoires, open list:HID CORE LAYER, LKML
In-Reply-To: <a349dfac-be58-93bd-e44c-080ed935ab06@intel.com>

On Thu, 30 May 2019, Dave Hansen wrote:

> On 5/29/19 2:17 AM, Hans de Goede wrote:
> ...
> > Dave, can you try building your initrd without the hid-logitech-dj module
> > included in the initrd?
> 
> I did this on a vanilla 5.2-rc2 kernel (without the reverts) and still
> experienced the boot hang while the device was inserted.
> 
> > Also can you check if your modprobe is provided by module-init-tools
> > or by kmod ?
> 
> $ dpkg -S `which modprobe`
> kmod: /sbin/modprobe

Benjamin, Hans, are you looking into this?

If not, I think we should start reverting (at least the request_module() 
changes, not sure about the rest of logitech issues yet) next week.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH] drivers: hid: Add a module description line to the hid_hyperv driver
From: Jiri Kosina @ 2019-05-31 22:19 UTC (permalink / raw)
  To: Sasha Levin
  Cc: benjamin.tissoires, linux-input, linux-kernel, Joseph Salisbury
In-Reply-To: <20190530173720.17994-1-sashal@kernel.org>

On Thu, 30 May 2019, Sasha Levin wrote:

> From: Joseph Salisbury <Joseph.Salisbury@microsoft.com>
> 
> This patch only adds a MODULE_DESCRIPTION statement to the driver.
> This change is only cosmetic, so there should be no runtime impact.
> 
> Signed-off-by: Joseph Salisbury <joseph.salisbury@microsoft.com>
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/hid/hid-hyperv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> index 704049e62d58a..d3311d714d359 100644
> --- a/drivers/hid/hid-hyperv.c
> +++ b/drivers/hid/hid-hyperv.c
> @@ -614,5 +614,7 @@ static void __exit mousevsc_exit(void)
>  }
>  
>  MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic HID Driver");
> +

Is there a reason why you didn't CC Joseph on this submission?

CCing Joseph and applying. Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH v3] HID: fix A4Tech horizontal scrolling
From: Jiri Kosina @ 2019-05-31 22:28 UTC (permalink / raw)
  To: Błażej Szczygieł
  Cc: igorkuo, peter.hutterer, Benjamin Tissoires, linux-input,
	linux-kernel
In-Reply-To: <20190512203313.18756-1-spaz16@wp.pl>

On Sun, 12 May 2019, Błażej Szczygieł wrote:

> Since recent high resolution scrolling changes the A4Tech driver must
> check for the "REL_WHEEL_HI_RES" usage code.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=203369
> Fixes: 2dc702c991e3774af9d7ce410eef410ca9e2357e ("HID: input: use the
> Resolution Multiplier for high-resolution scrolling")
> 
> Signed-off-by: Błażej Szczygieł <spaz16@wp.pl>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH] drivers: hid: Add a module description line to the hid_hyperv driver
From: Sasha Levin @ 2019-06-01 18:30 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: benjamin.tissoires, linux-input, linux-kernel, Joseph Salisbury
In-Reply-To: <nycvar.YFH.7.76.1906010018310.1962@cbobk.fhfr.pm>

On Sat, Jun 01, 2019 at 12:19:11AM +0200, Jiri Kosina wrote:
>On Thu, 30 May 2019, Sasha Levin wrote:
>
>> From: Joseph Salisbury <Joseph.Salisbury@microsoft.com>
>>
>> This patch only adds a MODULE_DESCRIPTION statement to the driver.
>> This change is only cosmetic, so there should be no runtime impact.
>>
>> Signed-off-by: Joseph Salisbury <joseph.salisbury@microsoft.com>
>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>>  drivers/hid/hid-hyperv.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
>> index 704049e62d58a..d3311d714d359 100644
>> --- a/drivers/hid/hid-hyperv.c
>> +++ b/drivers/hid/hid-hyperv.c
>> @@ -614,5 +614,7 @@ static void __exit mousevsc_exit(void)
>>  }
>>
>>  MODULE_LICENSE("GPL");
>> +MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic HID Driver");
>> +
>
>Is there a reason why you didn't CC Joseph on this submission?

Hm, no, I just went with my usual get_maintainers.pl + whomever git
adds. Sorry Joe!

--
Thanks,
Sasha

^ permalink raw reply

* Re: [RFC 0/2] Support for buttons on newer MS Surface devices
From: Maximilian Luz @ 2019-06-01 19:07 UTC (permalink / raw)
  Cc: linux-kernel, linux-input, platform-driver-x86, Dmitry Torokhov,
	Hans de Goede, Chen Yu, Darren Hart, Andy Shevchenko
In-Reply-To: <20190516142523.117978-1-luzmaximilian@gmail.com>

Hi,

any comments on this?

I should also mention that this has been tested via
https://github.com/jakeday/linux-surface.

Maximilian


On 5/16/19 4:25 PM, Maximilian Luz wrote:
> This series adds suport for power and volume buttons on 5th and 6th
> generation Microsoft Surface devices. Specifically, it adds support for
> the power-button on the Surface Laptop 1 and Laptop 2, as well as
> support for power- and (on-device) volume-buttons on the Surface Pro 5
> (2017), Pro 6, and Book 2.
> 
> These devices use the same MSHW0040 device as on the Surface Pro 4,
> however, whereas the Pro 4 uses an ACPI notify handler, the newer
> devices use GPIO interrupts to signal these events.
> 
> The first patch of this series ensures that the surfacepro3_button
> driver, used for MSHW0040 on the Pro 4, does not probe for the newer
> devices. The second patch adapts soc_button_array to implement the
> actual button support.
> 
> I think the changes to soc_button_array in the second patch warrant a
> thorough review. I've tried to make things a bit more generic to be able
> to integrate arbitrary ACPI GPIO power-/volume-button devices more
> easily, I'm not sure if there may be reasons against this.
> 
> Maximilian Luz (2):
>    platform: Fix device check for surfacepro3_button
>    input: soc_button_array for newer surface devices
> 
>   drivers/input/misc/soc_button_array.c     | 134 ++++++++++++++++++++--
>   drivers/platform/x86/surfacepro3_button.c |  38 ++++++
>   2 files changed, 160 insertions(+), 12 deletions(-)
> 

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-03  9:11 UTC (permalink / raw)
  To: Jiri Kosina, Dave Hansen
  Cc: Benjamin Tissoires, open list:HID CORE LAYER, LKML
In-Reply-To: <nycvar.YFH.7.76.1906010014150.1962@cbobk.fhfr.pm>

Hi,

On 01-06-19 00:15, Jiri Kosina wrote:
> On Thu, 30 May 2019, Dave Hansen wrote:
> 
>> On 5/29/19 2:17 AM, Hans de Goede wrote:
>> ...
>>> Dave, can you try building your initrd without the hid-logitech-dj module
>>> included in the initrd?
>>
>> I did this on a vanilla 5.2-rc2 kernel (without the reverts) and still
>> experienced the boot hang while the device was inserted.
>>
>>> Also can you check if your modprobe is provided by module-init-tools
>>> or by kmod ?
>>
>> $ dpkg -S `which modprobe`
>> kmod: /sbin/modprobe
> 
> Benjamin, Hans, are you looking into this?

Not really, I cannot reproduce the request_module problem. I was hoping some
of the info from Dave would help to pinpoint it, but it does not :|

> If not, I think we should start reverting (at least the request_module()
> changes

I agree we need to do something about the request_module changes.

I myself was thinking about somehow making them conditional, e.g. we
could add a (temporary) module option defaulting to false for this
while we investigate further.

I'm afraid that if we just revert we will never find the root cause and then
we will be stuck with the suboptimal behavior of first the generic hid driver
binding followed by a unbind + bind of the new driver shortly afterwards,
which also leads to a ton of udev events being fired to userspace (well I
guess this does make for a good stress test of the userspace hotplug code).

> not sure about the rest of logitech issues yet) next week.

The main problem seems to be the request_module patches. Although I also
have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
so we may need to drop that product-id from hid-logitech-dj, I'm working on
that one...

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-03  9:32 UTC (permalink / raw)
  To: Jiri Kosina, Dave Hansen
  Cc: Benjamin Tissoires, open list:HID CORE LAYER, LKML
In-Reply-To: <e158d983-1e7e-4c49-aaab-ff2092d36438@redhat.com>

Hi,

On 03-06-19 11:11, Hans de Goede wrote:
> Hi,
> 
> On 01-06-19 00:15, Jiri Kosina wrote:
>> On Thu, 30 May 2019, Dave Hansen wrote:
>>
>>> On 5/29/19 2:17 AM, Hans de Goede wrote:
>>> ...
>>>> Dave, can you try building your initrd without the hid-logitech-dj module
>>>> included in the initrd?
>>>
>>> I did this on a vanilla 5.2-rc2 kernel (without the reverts) and still
>>> experienced the boot hang while the device was inserted.
>>>
>>>> Also can you check if your modprobe is provided by module-init-tools
>>>> or by kmod ?
>>>
>>> $ dpkg -S `which modprobe`
>>> kmod: /sbin/modprobe
>>
>> Benjamin, Hans, are you looking into this?
> 
> Not really, I cannot reproduce the request_module problem. I was hoping some
> of the info from Dave would help to pinpoint it, but it does not :|
> 
>> If not, I think we should start reverting (at least the request_module()
>> changes
> 
> I agree we need to do something about the request_module changes.
> 
> I myself was thinking about somehow making them conditional, e.g. we
> could add a (temporary) module option defaulting to false for this
> while we investigate further.
> 
> I'm afraid that if we just revert we will never find the root cause and then
> we will be stuck with the suboptimal behavior of first the generic hid driver
> binding followed by a unbind + bind of the new driver shortly afterwards,
> which also leads to a ton of udev events being fired to userspace (well I
> guess this does make for a good stress test of the userspace hotplug code).

Quick update, we have another report of module-loading related problems
which are likely related:

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

In this case there is no hang, instead there is a 1 to 3 minute delay.

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-03  9:51 UTC (permalink / raw)
  To: Jiri Kosina, Dave Hansen
  Cc: Benjamin Tissoires, open list:HID CORE LAYER, LKML
In-Reply-To: <e158d983-1e7e-4c49-aaab-ff2092d36438@redhat.com>

Hi Again,

On 03-06-19 11:11, Hans de Goede wrote:
<snip>

>> not sure about the rest of logitech issues yet) next week.
> 
> The main problem seems to be the request_module patches. Although I also
> have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
> so we may need to drop that product-id from hid-logitech-dj, I'm working on
> that one...

Besides the modprobe hanging issue, the only other issues all
(2 reporters) seem to be with 0xc52f receivers. We have a bug
open for this:

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

And I've asked the reporter of the second bug to add his logs
to that bug.

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Benjamin Tissoires @ 2019-06-03 13:55 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <5471f010-cb42-c548-37e2-2b9c9eba1184@redhat.com>

On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Again,
>
> On 03-06-19 11:11, Hans de Goede wrote:
> <snip>
>
> >> not sure about the rest of logitech issues yet) next week.
> >
> > The main problem seems to be the request_module patches. Although I also

Can't we use request_module_nowait() instead, and set a reasonable
timeout that we detect only once to check if userspace is compatible:

In pseudo-code:
if (!request_module_checked) {
  request_module_nowait(name);
  use_request_module = wait_event_timeout(wq,
        first_module_loaded, 10 seconds in jiffies);
  request_module_checked = true;
} else if (use_request_module) {
  request_module(name);
}


> > have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
> > so we may need to drop that product-id from hid-logitech-dj, I'm working on
> > that one...
>
> Besides the modprobe hanging issue, the only other issues all
> (2 reporters) seem to be with 0xc52f receivers. We have a bug
> open for this:
>
> https://bugzilla.kernel.org/show_bug.cgi?id=203619
>
> And I've asked the reporter of the second bug to add his logs
> to that bug.

We should likely just remove c52f from the list of supported devices.
C52f receivers seem to have a different firmware as they are meant to
work with different devices than C534. So I guess it is safer to not
handle those right now and get the code in when it is ready.

Cheers,
Benjamin

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-03 14:17 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <CAO-hwJKRRpsShw6B-YLmsEnjQ+iYtz+VmZK+VSRcDmiBwnS+oA@mail.gmail.com>

Hi,

On 03-06-19 15:55, Benjamin Tissoires wrote:
> On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Again,
>>
>> On 03-06-19 11:11, Hans de Goede wrote:
>> <snip>
>>
>>>> not sure about the rest of logitech issues yet) next week.
>>>
>>> The main problem seems to be the request_module patches. Although I also
> 
> Can't we use request_module_nowait() instead, and set a reasonable
> timeout that we detect only once to check if userspace is compatible:
> 
> In pseudo-code:
> if (!request_module_checked) {
>    request_module_nowait(name);
>    use_request_module = wait_event_timeout(wq,
>          first_module_loaded, 10 seconds in jiffies);
>    request_module_checked = true;
> } else if (use_request_module) {
>    request_module(name);
> }

Well looking at the just attached dmesg , the modprobe
when triggered by udev from userspace succeeds in about
0.5 seconds, so it seems that the modprobe hangs happens
when called from within the kernel rather then from within
userspace.

What I do not know if is the hang is inside userspace, or
maybe it happens when modprobe calls back into the kernel,
if the hang happens when modprobe calls back into the kernel,
then other modprobes (done from udev) likely will hang too
since I think only 1 modprobe can happen at a time.

I really wish we knew what distinguished working systems
from non working systems :|

I cannot find a common denominator; other then the systems
are not running Fedora. So far we've reports from both Ubuntu 16.04
and Tumbleweed, so software version wise these 2 are wide apart.

>>> have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
>>> so we may need to drop that product-id from hid-logitech-dj, I'm working on
>>> that one...
>>
>> Besides the modprobe hanging issue, the only other issues all
>> (2 reporters) seem to be with 0xc52f receivers. We have a bug
>> open for this:
>>
>> https://bugzilla.kernel.org/show_bug.cgi?id=203619
>>
>> And I've asked the reporter of the second bug to add his logs
>> to that bug.
> 
> We should likely just remove c52f from the list of supported devices.
> C52f receivers seem to have a different firmware as they are meant to
> work with different devices than C534. So I guess it is safer to not
> handle those right now and get the code in when it is ready.

Ack. Can you prepare a patch to drop the c52f id?

Regards,

Hans

^ permalink raw reply

* Re: [PATCH] HID: hid-logitech-hidpp: detect wireless lightspeed devices
From: Pedro Vanzella @ 2019-06-03 21:44 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: open list:HID CORE LAYER, Jiri Kosina, lkml
In-Reply-To: <CAO-hwJ+zAvDizJRpykky+D3pf1M1NhFGWztwyA4mJEv8C+nO-w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]

On 05/28, Benjamin Tissoires wrote:
> On Tue, May 28, 2019 at 6:30 PM Pedro Vanzella <pedro@pedrovanzella.com> wrote:
> >
> > Send a low device index when the device is connected via the lightspeed
> > receiver so that the receiver will pass the message along to the device
> > instead of responding. If we don't do that, we end up thinking it's a
> > hidpp10 device and miss out on all new features available to newer devices.
> >
> > This will enable correct detection of the following models:
> > G603, GPro, G305, G613, G900 and G903, and possibly others.
> 
> Thanks for the patch.
Thanks for reviewing it :)

> However, there is already support for this receiver in Linus' tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/hid/hid-logitech-dj.c?id=f5fb57a74e88bd1788f57bf77d587c91d4dc9d57
> 
> With kernel 5.2-rc1, the connected device should already be handled by
> hid-logitech-hidpp :)
Why are the wireless receivers handled by hid-logitech-dj and the wired
mice handled by hid-logitech-hidpp? They are, in the end, all hidpp
devices, and having them all handled by the -hidpp driver with a quirk
class would allow us to check for support for the battery voltage
feature, as it seems to be an either-or scenario here.

- Pedro
> 
> Cheers,
> Benjamin
> 
> >
> > Signed-off-by: Pedro Vanzella <pedro@pedrovanzella.com>
> > ---
> >  drivers/hid/hid-logitech-hidpp.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> > index 72fc9c0566db..621fce141d9f 100644
> > --- a/drivers/hid/hid-logitech-hidpp.c
> > +++ b/drivers/hid/hid-logitech-hidpp.c
> > @@ -62,6 +62,7 @@ MODULE_PARM_DESC(disable_tap_to_click,
> >  #define HIDPP_QUIRK_CLASS_K400                 BIT(2)
> >  #define HIDPP_QUIRK_CLASS_G920                 BIT(3)
> >  #define HIDPP_QUIRK_CLASS_K750                 BIT(4)
> > +#define HIDPP_QUIRK_CLASS_LIGHTSPEED           BIT(5)
> >
> >  /* bits 2..20 are reserved for classes */
> >  /* #define HIDPP_QUIRK_CONNECT_EVENTS          BIT(21) disabled */
> > @@ -236,7 +237,11 @@ static int __hidpp_send_report(struct hid_device *hdev,
> >          * set the device_index as the receiver, it will be overwritten by
> >          * hid_hw_request if needed
> >          */
> > -       hidpp_report->device_index = 0xff;
> > +       if (hidpp->quirks & HIDPP_QUIRK_CLASS_LIGHTSPEED) {
> > +               hidpp_report->device_index = 0x01;
> > +       } else {
> > +               hidpp_report->device_index = 0xff;
> > +       }
> >
> >         if (hidpp->quirks & HIDPP_QUIRK_FORCE_OUTPUT_REPORTS) {
> >                 ret = hid_hw_output_report(hdev, (u8 *)hidpp_report, fields_count);
> > @@ -3753,6 +3758,9 @@ static const struct hid_device_id hidpp_devices[] = {
> >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC06B) },
> >         { /* Logitech G900 Gaming Mouse over USB */
> >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
> > +       { /* Logitech Gaming Mice over Lightspeed Receiver */
> > +         HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC539),
> > +         .driver_data = HIDPP_QUIRK_CLASS_LIGHTSPEED },
> >         { /* Logitech G920 Wheel over USB */
> >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL),
> >                 .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS},
> > --
> > 2.21.0
> >

-- 
Pedro Vanzella
pedrovanzella.com
#include <paranoia.h>
Don't Panic

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs
From: Aaron Ma @ 2019-06-04  2:45 UTC (permalink / raw)
  To: Christopher Heiny, dmitry.torokhov@gmail.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Duggan, benjamin.tissoires@redhat.com
In-Reply-To: <9321df87-5bc5-0c75-2815-f8602ecf9d86@canonical.com>

Hi Christopher:

Have got time to review these 2 patches?
Users reported it works fine since I sent out this patch.

Thanks,
Aaron

On 4/3/19 9:58 PM, Aaron Ma wrote:
> Sure, take your time, if you have any questions let me know please.
> 
> Thanks,
> Aaron

^ permalink raw reply

* Re: [PATCH 1/2] Input: synaptics-rmi4 - clear irqs before set irqs
From: Christopher Heiny @ 2019-06-04  5:19 UTC (permalink / raw)
  To: Aaron Ma, dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, Andrew Duggan,
	benjamin.tissoires@redhat.com
In-Reply-To: <2995b27a-9ec8-eebe-78b6-2d3bf5098af8@canonical.com>

On Tue, 2019-06-04 at 10:45 +0800, Aaron Ma wrote:
> Hi Christopher:
> 
> Have got time to review these 2 patches?
> Users reported it works fine since I sent out this patch.

Hi Aaron,

I've been poking around with this off and on.  Unfortunately, more off
than on :-( but here's my current take:

rmi_driver_set_irq_bits() isn't going to be called all that often, and
it's not going to be called at all during normal operation, which is
where the most serious problem would occur.

I haven't entirely convinced myself that there couldn't be a problem
during repeated spontaneous device resets (for example, due to ESD, a
dodgy charger, or firmware bug, among other things).  On the other
hand, all the scenarios I have come up with are both unlikely and so
contrived that the system is probably hosed regardless of what we do in
the driver.

Given that, I'm willing to accept the patch as is.

					Cheers,
						Chris







> 
> Thanks,
> Aaron
> 
> On 4/3/19 9:58 PM, Aaron Ma wrote:
> > Sure, take your time, if you have any questions let me know please.
> > 
> > Thanks,
> > Aaron



^ permalink raw reply

* Re: [PATCH] HID: hid-logitech-hidpp: detect wireless lightspeed devices
From: Benjamin Tissoires @ 2019-06-04  7:02 UTC (permalink / raw)
  To: Pedro Vanzella; +Cc: open list:HID CORE LAYER, Jiri Kosina, lkml
In-Reply-To: <20190603214438.2cnmrx7g2sakjdr4@Fenrir>

On Mon, Jun 3, 2019 at 11:44 PM Pedro Vanzella <pedro@pedrovanzella.com> wrote:
>
> On 05/28, Benjamin Tissoires wrote:
> > On Tue, May 28, 2019 at 6:30 PM Pedro Vanzella <pedro@pedrovanzella.com> wrote:
> > >
> > > Send a low device index when the device is connected via the lightspeed
> > > receiver so that the receiver will pass the message along to the device
> > > instead of responding. If we don't do that, we end up thinking it's a
> > > hidpp10 device and miss out on all new features available to newer devices.
> > >
> > > This will enable correct detection of the following models:
> > > G603, GPro, G305, G613, G900 and G903, and possibly others.
> >
> > Thanks for the patch.
> Thanks for reviewing it :)
>
> > However, there is already support for this receiver in Linus' tree:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/hid/hid-logitech-dj.c?id=f5fb57a74e88bd1788f57bf77d587c91d4dc9d57
> >
> > With kernel 5.2-rc1, the connected device should already be handled by
> > hid-logitech-hidpp :)
> Why are the wireless receivers handled by hid-logitech-dj and the wired
> mice handled by hid-logitech-hidpp? They are, in the end, all hidpp
> devices, and having them all handled by the -hidpp driver with a quirk
> class would allow us to check for support for the battery voltage
> feature, as it seems to be an either-or scenario here.

Yep, and this is exactly what is happening:
- the receiver is handled through hid-logitech-dj -> it creates a
virtual HID device for the wireless physical device
- the actual wireless device is handled through hid-logitech-hidpp
(with the virtual HID device created above)

This has the advantage of presenting the wireless device in the same
way the wired device is. From hid-logitech-hidpp point of view, both
are regular HID++ devices.
Also, this makes sure each physical device gets its own product ID (we
are relying on the wireless product ID), meaning that userspace can
differentiate a G900 from a G613 when both are connected to a receiver
with the same product ID.

Hope that helps.

Cheers,
Benjamin


>
> - Pedro
> >
> > Cheers,
> > Benjamin
> >
> > >
> > > Signed-off-by: Pedro Vanzella <pedro@pedrovanzella.com>
> > > ---
> > >  drivers/hid/hid-logitech-hidpp.c | 10 +++++++++-
> > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> > > index 72fc9c0566db..621fce141d9f 100644
> > > --- a/drivers/hid/hid-logitech-hidpp.c
> > > +++ b/drivers/hid/hid-logitech-hidpp.c
> > > @@ -62,6 +62,7 @@ MODULE_PARM_DESC(disable_tap_to_click,
> > >  #define HIDPP_QUIRK_CLASS_K400                 BIT(2)
> > >  #define HIDPP_QUIRK_CLASS_G920                 BIT(3)
> > >  #define HIDPP_QUIRK_CLASS_K750                 BIT(4)
> > > +#define HIDPP_QUIRK_CLASS_LIGHTSPEED           BIT(5)
> > >
> > >  /* bits 2..20 are reserved for classes */
> > >  /* #define HIDPP_QUIRK_CONNECT_EVENTS          BIT(21) disabled */
> > > @@ -236,7 +237,11 @@ static int __hidpp_send_report(struct hid_device *hdev,
> > >          * set the device_index as the receiver, it will be overwritten by
> > >          * hid_hw_request if needed
> > >          */
> > > -       hidpp_report->device_index = 0xff;
> > > +       if (hidpp->quirks & HIDPP_QUIRK_CLASS_LIGHTSPEED) {
> > > +               hidpp_report->device_index = 0x01;
> > > +       } else {
> > > +               hidpp_report->device_index = 0xff;
> > > +       }
> > >
> > >         if (hidpp->quirks & HIDPP_QUIRK_FORCE_OUTPUT_REPORTS) {
> > >                 ret = hid_hw_output_report(hdev, (u8 *)hidpp_report, fields_count);
> > > @@ -3753,6 +3758,9 @@ static const struct hid_device_id hidpp_devices[] = {
> > >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC06B) },
> > >         { /* Logitech G900 Gaming Mouse over USB */
> > >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC081) },
> > > +       { /* Logitech Gaming Mice over Lightspeed Receiver */
> > > +         HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC539),
> > > +         .driver_data = HIDPP_QUIRK_CLASS_LIGHTSPEED },
> > >         { /* Logitech G920 Wheel over USB */
> > >           HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL),
> > >                 .driver_data = HIDPP_QUIRK_CLASS_G920 | HIDPP_QUIRK_FORCE_OUTPUT_REPORTS},
> > > --
> > > 2.21.0
> > >
>
> --
> Pedro Vanzella
> pedrovanzella.com
> #include <paranoia.h>
> Don't Panic

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Benjamin Tissoires @ 2019-06-04  7:51 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <e431dafc-0fb4-4be3-ac29-dcf125929090@redhat.com>

On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 03-06-19 15:55, Benjamin Tissoires wrote:
> > On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
> >>
> >> Hi Again,
> >>
> >> On 03-06-19 11:11, Hans de Goede wrote:
> >> <snip>
> >>
> >>>> not sure about the rest of logitech issues yet) next week.
> >>>
> >>> The main problem seems to be the request_module patches. Although I also
> >
> > Can't we use request_module_nowait() instead, and set a reasonable
> > timeout that we detect only once to check if userspace is compatible:
> >
> > In pseudo-code:
> > if (!request_module_checked) {
> >    request_module_nowait(name);
> >    use_request_module = wait_event_timeout(wq,
> >          first_module_loaded, 10 seconds in jiffies);
> >    request_module_checked = true;
> > } else if (use_request_module) {
> >    request_module(name);
> > }
>
> Well looking at the just attached dmesg , the modprobe
> when triggered by udev from userspace succeeds in about
> 0.5 seconds, so it seems that the modprobe hangs happens
> when called from within the kernel rather then from within
> userspace.
>
> What I do not know if is the hang is inside userspace, or
> maybe it happens when modprobe calls back into the kernel,
> if the hang happens when modprobe calls back into the kernel,
> then other modprobes (done from udev) likely will hang too
> since I think only 1 modprobe can happen at a time.
>
> I really wish we knew what distinguished working systems
> from non working systems :|
>
> I cannot find a common denominator; other then the systems
> are not running Fedora. So far we've reports from both Ubuntu 16.04
> and Tumbleweed, so software version wise these 2 are wide apart.

I am trying to reproduce the lock locally, and installed an opensuse
Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
do not see the lock with either my vanilla compiled kernel and the rpm
found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/

Next step is install Tumbleweed on bare metal, but I do not see how
this could introduce a difference (maybe USB2 vs 3).

>
> >>> have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
> >>> so we may need to drop that product-id from hid-logitech-dj, I'm working on
> >>> that one...
> >>
> >> Besides the modprobe hanging issue, the only other issues all
> >> (2 reporters) seem to be with 0xc52f receivers. We have a bug
> >> open for this:
> >>
> >> https://bugzilla.kernel.org/show_bug.cgi?id=203619
> >>
> >> And I've asked the reporter of the second bug to add his logs
> >> to that bug.
> >
> > We should likely just remove c52f from the list of supported devices.
> > C52f receivers seem to have a different firmware as they are meant to
> > work with different devices than C534. So I guess it is safer to not
> > handle those right now and get the code in when it is ready.
>
> Ack. Can you prepare a patch to drop the c52f id?

Yes. I have an other revert never submitted that I need to push, so I
guess I can do a revert session today.

I think I'll also buy one device with hopefully the C52F receiver as
the report descriptors attached in
https://bugzilla.kernel.org/show_bug.cgi?id=203619 seems different to
what I would have expected.

Cheers,
Benjamin

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-04  8:05 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <CAO-hwJ+5UYJMnuCS0UL4g45Xc181LraAzc-CMuYB2rcqKGe_Sw@mail.gmail.com>

Hi,

On 04-06-19 09:51, Benjamin Tissoires wrote:
> On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi,
>>
>> On 03-06-19 15:55, Benjamin Tissoires wrote:
>>> On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>
>>>> Hi Again,
>>>>
>>>> On 03-06-19 11:11, Hans de Goede wrote:
>>>> <snip>
>>>>
>>>>>> not sure about the rest of logitech issues yet) next week.
>>>>>
>>>>> The main problem seems to be the request_module patches. Although I also
>>>
>>> Can't we use request_module_nowait() instead, and set a reasonable
>>> timeout that we detect only once to check if userspace is compatible:
>>>
>>> In pseudo-code:
>>> if (!request_module_checked) {
>>>     request_module_nowait(name);
>>>     use_request_module = wait_event_timeout(wq,
>>>           first_module_loaded, 10 seconds in jiffies);
>>>     request_module_checked = true;
>>> } else if (use_request_module) {
>>>     request_module(name);
>>> }
>>
>> Well looking at the just attached dmesg , the modprobe
>> when triggered by udev from userspace succeeds in about
>> 0.5 seconds, so it seems that the modprobe hangs happens
>> when called from within the kernel rather then from within
>> userspace.
>>
>> What I do not know if is the hang is inside userspace, or
>> maybe it happens when modprobe calls back into the kernel,
>> if the hang happens when modprobe calls back into the kernel,
>> then other modprobes (done from udev) likely will hang too
>> since I think only 1 modprobe can happen at a time.
>>
>> I really wish we knew what distinguished working systems
>> from non working systems :|
>>
>> I cannot find a common denominator; other then the systems
>> are not running Fedora. So far we've reports from both Ubuntu 16.04
>> and Tumbleweed, so software version wise these 2 are wide apart.
> 
> I am trying to reproduce the lock locally, and installed an opensuse
> Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
> do not see the lock with either my vanilla compiled kernel and the rpm
> found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/
> 
> Next step is install Tumbleweed on bare metal, but I do not see how
> this could introduce a difference (maybe USB2 vs 3).

Ok, thank you for looking into this.

>>>>> have 2 reports of problems with hid-logitech-dj driving the 0xc52f product-id,
>>>>> so we may need to drop that product-id from hid-logitech-dj, I'm working on
>>>>> that one...
>>>>
>>>> Besides the modprobe hanging issue, the only other issues all
>>>> (2 reporters) seem to be with 0xc52f receivers. We have a bug
>>>> open for this:
>>>>
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=203619
>>>>
>>>> And I've asked the reporter of the second bug to add his logs
>>>> to that bug.
>>>
>>> We should likely just remove c52f from the list of supported devices.
>>> C52f receivers seem to have a different firmware as they are meant to
>>> work with different devices than C534. So I guess it is safer to not
>>> handle those right now and get the code in when it is ready.
>>
>> Ack. Can you prepare a patch to drop the c52f id?
> 
> Yes. I have an other revert never submitted that I need to push, so I
> guess I can do a revert session today.
> 
> I think I'll also buy one device with hopefully the C52F receiver as
> the report descriptors attached in
> https://bugzilla.kernel.org/show_bug.cgi?id=203619 seems different to
> what I would have expected.

They are actually what I expected :)

The first USB interface is a mouse boot class device, since this is a mouse
only receiver. This means that the mouse report is unnumbered and we need to
extend the unnumbered mouse-report handling to handle this case. Also the
device is using the same highres mouse-reports as the gaming receiver is.

I'm actually preparing a patch right now which should fix this. Still might
be better to do the revert for 5.2 and get proper support for the c52f
receiver into 5.3.

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-04  8:36 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <4548d196-b75f-c4d0-8f3c-3e734b9a758c@redhat.com>

Hi,

On 04-06-19 10:05, Hans de Goede wrote:

<snip>

>>>> We should likely just remove c52f from the list of supported devices.
>>>> C52f receivers seem to have a different firmware as they are meant to
>>>> work with different devices than C534. So I guess it is safer to not
>>>> handle those right now and get the code in when it is ready.
>>>
>>> Ack. Can you prepare a patch to drop the c52f id?
>>
>> Yes. I have an other revert never submitted that I need to push, so I
>> guess I can do a revert session today.
>>
>> I think I'll also buy one device with hopefully the C52F receiver as
>> the report descriptors attached in
>> https://bugzilla.kernel.org/show_bug.cgi?id=203619 seems different to
>> what I would have expected.
> 
> They are actually what I expected :)
> 
> The first USB interface is a mouse boot class device, since this is a mouse
> only receiver. This means that the mouse report is unnumbered and we need to
> extend the unnumbered mouse-report handling to handle this case. Also the
> device is using the same highres mouse-reports as the gaming receiver is.
> 
> I'm actually preparing a patch right now which should fix this. Still might
> be better to do the revert for 5.2 and get proper support for the c52f
> receiver into 5.3.

I've attached a patch to the bug:
https://bugzilla.kernel.org/show_bug.cgi?id=203619

Which should fix this. It is quite simple and safe, so if we get testing
feedback relatively soon, we could go with the fix instead of dropping the
product-id, your call.

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Benjamin Tissoires @ 2019-06-04  8:53 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <c05929f4-00b6-e098-cd69-cd6539ccd3f1@redhat.com>

On Tue, Jun 4, 2019 at 10:36 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 04-06-19 10:05, Hans de Goede wrote:
>
> <snip>
>
> >>>> We should likely just remove c52f from the list of supported devices.
> >>>> C52f receivers seem to have a different firmware as they are meant to
> >>>> work with different devices than C534. So I guess it is safer to not
> >>>> handle those right now and get the code in when it is ready.
> >>>
> >>> Ack. Can you prepare a patch to drop the c52f id?
> >>
> >> Yes. I have an other revert never submitted that I need to push, so I
> >> guess I can do a revert session today.
> >>
> >> I think I'll also buy one device with hopefully the C52F receiver as
> >> the report descriptors attached in
> >> https://bugzilla.kernel.org/show_bug.cgi?id=203619 seems different to
> >> what I would have expected.
> >
> > They are actually what I expected :)
> >
> > The first USB interface is a mouse boot class device, since this is a mouse
> > only receiver. This means that the mouse report is unnumbered and we need to
> > extend the unnumbered mouse-report handling to handle this case. Also the
> > device is using the same highres mouse-reports as the gaming receiver is.
> >
> > I'm actually preparing a patch right now which should fix this. Still might
> > be better to do the revert for 5.2 and get proper support for the c52f
> > receiver into 5.3.
>
> I've attached a patch to the bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=203619

Cool, thanks.

>
> Which should fix this. It is quite simple and safe, so if we get testing
> feedback relatively soon, we could go with the fix instead of dropping the
> product-id, your call.

I should receive the M280 tomorrow, hopefully with the C52F. If the
receiver is correct and the tests are successful, I'd prefer to take
this one over the revert :)

Cheers,
Benjamin

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Benjamin Tissoires @ 2019-06-04 10:08 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <CAO-hwJ+5UYJMnuCS0UL4g45Xc181LraAzc-CMuYB2rcqKGe_Sw@mail.gmail.com>

On Tue, Jun 4, 2019 at 9:51 AM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
> >
> > Hi,
> >
> > On 03-06-19 15:55, Benjamin Tissoires wrote:
> > > On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
> > >>
> > >> Hi Again,
> > >>
> > >> On 03-06-19 11:11, Hans de Goede wrote:
> > >> <snip>
> > >>
> > >>>> not sure about the rest of logitech issues yet) next week.
> > >>>
> > >>> The main problem seems to be the request_module patches. Although I also
> > >
> > > Can't we use request_module_nowait() instead, and set a reasonable
> > > timeout that we detect only once to check if userspace is compatible:
> > >
> > > In pseudo-code:
> > > if (!request_module_checked) {
> > >    request_module_nowait(name);
> > >    use_request_module = wait_event_timeout(wq,
> > >          first_module_loaded, 10 seconds in jiffies);
> > >    request_module_checked = true;
> > > } else if (use_request_module) {
> > >    request_module(name);
> > > }
> >
> > Well looking at the just attached dmesg , the modprobe
> > when triggered by udev from userspace succeeds in about
> > 0.5 seconds, so it seems that the modprobe hangs happens
> > when called from within the kernel rather then from within
> > userspace.
> >
> > What I do not know if is the hang is inside userspace, or
> > maybe it happens when modprobe calls back into the kernel,
> > if the hang happens when modprobe calls back into the kernel,
> > then other modprobes (done from udev) likely will hang too
> > since I think only 1 modprobe can happen at a time.
> >
> > I really wish we knew what distinguished working systems
> > from non working systems :|
> >
> > I cannot find a common denominator; other then the systems
> > are not running Fedora. So far we've reports from both Ubuntu 16.04
> > and Tumbleweed, so software version wise these 2 are wide apart.
>
> I am trying to reproduce the lock locally, and installed an opensuse
> Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
> do not see the lock with either my vanilla compiled kernel and the rpm
> found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/
>
> Next step is install Tumbleweed on bare metal, but I do not see how
> this could introduce a difference (maybe USB2 vs 3).

Making progress here.

The difference between Ubuntu/Tumbleweed and Fedora: usbhid is shipped
as a module while in Fedora usbhid is included in the kernel.

If I rmmod hid_* and usbhid, then modprobe usbhid, the command hangs
for 3 minutes.
If usbhid is already loaded, inserting a receiver is immediate
regarding the loading of the external modules.

So my assumption is that when the device gets detected at boot, usbhid
gets loaded by the kernel event, which in turns attempts to call
__request_module, but the modprobe can't be fulfilled because it's
already waiting for the initial usbhid modprobe to finish.

Still don't know how to solve that, but I thought I should share.

Cheers,
Benjamin

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-04 10:50 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <CAO-hwJK0j8SottiqCdDseBW_vR=GjKO4YrFCtjzYeUh-eKPOpA@mail.gmail.com>

Hi,

On 04-06-19 12:08, Benjamin Tissoires wrote:
> On Tue, Jun 4, 2019 at 9:51 AM Benjamin Tissoires
> <benjamin.tissoires@redhat.com> wrote:
>>
>> On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>>
>>> Hi,
>>>
>>> On 03-06-19 15:55, Benjamin Tissoires wrote:
>>>> On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>>
>>>>> Hi Again,
>>>>>
>>>>> On 03-06-19 11:11, Hans de Goede wrote:
>>>>> <snip>
>>>>>
>>>>>>> not sure about the rest of logitech issues yet) next week.
>>>>>>
>>>>>> The main problem seems to be the request_module patches. Although I also
>>>>
>>>> Can't we use request_module_nowait() instead, and set a reasonable
>>>> timeout that we detect only once to check if userspace is compatible:
>>>>
>>>> In pseudo-code:
>>>> if (!request_module_checked) {
>>>>     request_module_nowait(name);
>>>>     use_request_module = wait_event_timeout(wq,
>>>>           first_module_loaded, 10 seconds in jiffies);
>>>>     request_module_checked = true;
>>>> } else if (use_request_module) {
>>>>     request_module(name);
>>>> }
>>>
>>> Well looking at the just attached dmesg , the modprobe
>>> when triggered by udev from userspace succeeds in about
>>> 0.5 seconds, so it seems that the modprobe hangs happens
>>> when called from within the kernel rather then from within
>>> userspace.
>>>
>>> What I do not know if is the hang is inside userspace, or
>>> maybe it happens when modprobe calls back into the kernel,
>>> if the hang happens when modprobe calls back into the kernel,
>>> then other modprobes (done from udev) likely will hang too
>>> since I think only 1 modprobe can happen at a time.
>>>
>>> I really wish we knew what distinguished working systems
>>> from non working systems :|
>>>
>>> I cannot find a common denominator; other then the systems
>>> are not running Fedora. So far we've reports from both Ubuntu 16.04
>>> and Tumbleweed, so software version wise these 2 are wide apart.
>>
>> I am trying to reproduce the lock locally, and installed an opensuse
>> Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
>> do not see the lock with either my vanilla compiled kernel and the rpm
>> found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/
>>
>> Next step is install Tumbleweed on bare metal, but I do not see how
>> this could introduce a difference (maybe USB2 vs 3).
> 
> Making progress here.
> 
> The difference between Ubuntu/Tumbleweed and Fedora: usbhid is shipped
> as a module while in Fedora usbhid is included in the kernel.
> 
> If I rmmod hid_* and usbhid, then modprobe usbhid, the command hangs
> for 3 minutes.
> If usbhid is already loaded, inserting a receiver is immediate
> regarding the loading of the external modules.
> 
> So my assumption is that when the device gets detected at boot, usbhid
> gets loaded by the kernel event, which in turns attempts to call
> __request_module, but the modprobe can't be fulfilled because it's
> already waiting for the initial usbhid modprobe to finish.
> 
> Still don't know how to solve that, but I thought I should share.

Hmm, we may be hitting the scenario described in the big comment
around line 3500 of kernel/module.c.

But I'm not sure that is what is happening here.

Maybe you can put a WARN_ON(1) in request_module and look at the
backtrace ?  That may help to figure out what is going on; or
alternatively it might help to find some way to detect this and
if it happens skip the request_module...

Regards,

Hans

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Benjamin Tissoires @ 2019-06-04 12:25 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <ea7b2dee-15a6-9b52-fbff-558c36cd72df@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 6271 bytes --]

On Tue, Jun 4, 2019 at 12:50 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 04-06-19 12:08, Benjamin Tissoires wrote:
> > On Tue, Jun 4, 2019 at 9:51 AM Benjamin Tissoires
> > <benjamin.tissoires@redhat.com> wrote:
> >>
> >> On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> On 03-06-19 15:55, Benjamin Tissoires wrote:
> >>>> On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
> >>>>>
> >>>>> Hi Again,
> >>>>>
> >>>>> On 03-06-19 11:11, Hans de Goede wrote:
> >>>>> <snip>
> >>>>>
> >>>>>>> not sure about the rest of logitech issues yet) next week.
> >>>>>>
> >>>>>> The main problem seems to be the request_module patches. Although I also
> >>>>
> >>>> Can't we use request_module_nowait() instead, and set a reasonable
> >>>> timeout that we detect only once to check if userspace is compatible:
> >>>>
> >>>> In pseudo-code:
> >>>> if (!request_module_checked) {
> >>>>     request_module_nowait(name);
> >>>>     use_request_module = wait_event_timeout(wq,
> >>>>           first_module_loaded, 10 seconds in jiffies);
> >>>>     request_module_checked = true;
> >>>> } else if (use_request_module) {
> >>>>     request_module(name);
> >>>> }
> >>>
> >>> Well looking at the just attached dmesg , the modprobe
> >>> when triggered by udev from userspace succeeds in about
> >>> 0.5 seconds, so it seems that the modprobe hangs happens
> >>> when called from within the kernel rather then from within
> >>> userspace.
> >>>
> >>> What I do not know if is the hang is inside userspace, or
> >>> maybe it happens when modprobe calls back into the kernel,
> >>> if the hang happens when modprobe calls back into the kernel,
> >>> then other modprobes (done from udev) likely will hang too
> >>> since I think only 1 modprobe can happen at a time.
> >>>
> >>> I really wish we knew what distinguished working systems
> >>> from non working systems :|
> >>>
> >>> I cannot find a common denominator; other then the systems
> >>> are not running Fedora. So far we've reports from both Ubuntu 16.04
> >>> and Tumbleweed, so software version wise these 2 are wide apart.
> >>
> >> I am trying to reproduce the lock locally, and installed an opensuse
> >> Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
> >> do not see the lock with either my vanilla compiled kernel and the rpm
> >> found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/
> >>
> >> Next step is install Tumbleweed on bare metal, but I do not see how
> >> this could introduce a difference (maybe USB2 vs 3).
> >
> > Making progress here.
> >
> > The difference between Ubuntu/Tumbleweed and Fedora: usbhid is shipped
> > as a module while in Fedora usbhid is included in the kernel.
> >
> > If I rmmod hid_* and usbhid, then modprobe usbhid, the command hangs
> > for 3 minutes.
> > If usbhid is already loaded, inserting a receiver is immediate
> > regarding the loading of the external modules.
> >
> > So my assumption is that when the device gets detected at boot, usbhid
> > gets loaded by the kernel event, which in turns attempts to call
> > __request_module, but the modprobe can't be fulfilled because it's
> > already waiting for the initial usbhid modprobe to finish.
> >
> > Still don't know how to solve that, but I thought I should share.
>
> Hmm, we may be hitting the scenario described in the big comment
> around line 3500 of kernel/module.c.

Well, we are not locking during do_init_module(), but in waiting for
the completion of request_module(). So as I read the trace, we wait
for userspace to call/terminate modprobe.

>
> But I'm not sure that is what is happening here.
>
> Maybe you can put a WARN_ON(1) in request_module and look at the
> backtrace ?  That may help to figure out what is going on; or
> alternatively it might help to find some way to detect this and
> if it happens skip the request_module...

Ftrace is much easier to deal with:
---
/sys/kernel/debug/tracing # cat trace
# tracer: function
#
# entries-in-buffer/entries-written: 4/4   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
        modprobe-23236 [003] ....  9191.880917: __request_module
<-hid_add_device
        modprobe-23236 [003] ....  9191.880937: <stack trace>
 => 0xffffffffc0851061
 => __request_module
 => hid_add_device
 => usbhid_probe
 => usb_probe_interface
 => really_probe
 => driver_probe_device
 => device_driver_attach
 => __driver_attach
 => bus_for_each_dev
 => bus_add_driver
 => driver_register
 => usb_register_driver
 => hid_init
 => do_one_initcall
 => do_init_module
 => load_module
 => __do_sys_finit_module
 => do_syscall_64
 => entry_SYSCALL_64_after_hwframe
        modprobe-23236 [003] ....  9191.892765: __request_module
<-hid_add_device
        modprobe-23236 [003] ....  9191.892784: <stack trace>
 => 0xffffffffc0851061
 => __request_module
 => hid_add_device
 => usbhid_probe
 => usb_probe_interface
 => really_probe
 => driver_probe_device
 => device_driver_attach
 => __driver_attach
 => bus_for_each_dev
 => bus_add_driver
 => driver_register
 => usb_register_driver
 => hid_init
 => do_one_initcall
 => do_init_module
 => load_module
 => __do_sys_finit_module
 => do_syscall_64
 => entry_SYSCALL_64_after_hwframe
---

This is what happen with the logitech receiver plugged in and while
modprobing usbhid. The modprobe command hangs, and I took the trace
here.
If I hit Ctrl-C, the modprobe loading continue properly.

There is nothing special here in the stack trace, except that there
are 2 calls to request_module here (one for the touchscreen I guess
and one for the logitech receiver).

I have attached the call graph of the same sequence:
wait_for_completion_killable() seems to be the culprit, we are waiting
for userspace to notify it has done calling modprobe.

My idea would be to defer any call to hid_add_device() into a
workqueue and see if that unlocks the situation.

Cheers,
Benjamin

[-- Attachment #2: function_graph.txt --]
[-- Type: text/plain, Size: 21638 bytes --]

/sys/kernel/debug/tracing # cat trace
# tracer: function_graph
#
# CPU  DURATION                  FUNCTION CALLS
# |     |   |                     |   |   |   |
 0)               |  __request_module() {
 0)   0.256 us    |    current_is_async();
 0)               |    security_kernel_module_request() {
 0)   0.307 us    |      integrity_kernel_module_request();
 0)   0.625 us    |    }
 0)               |    kmem_cache_alloc_trace() {
 0)               |      _cond_resched() {
 0)   0.123 us    |        rcu_all_qs();
 0)   0.355 us    |      }
 0)   0.122 us    |      should_failslab();
 0)               |      _cond_resched() {
 0)   0.120 us    |        rcu_all_qs();
 0)   0.355 us    |      }
 0)   0.120 us    |      memcg_kmem_put_cache();
 0)   1.563 us    |    }
 0)               |    kstrdup() {
 0)               |      __kmalloc_track_caller() {
 0)   0.115 us    |        kmalloc_slab();
 0)               |        _cond_resched() {
 0)   0.118 us    |          rcu_all_qs();
 0)   0.348 us    |        }
 0)   0.119 us    |        should_failslab();
 0)               |        _cond_resched() {
 0)   0.115 us    |          rcu_all_qs();
 0)   0.345 us    |        }
 0)   0.119 us    |        memcg_kmem_put_cache();
 0)   1.757 us    |      }
 0)   2.040 us    |    }
 0)               |    call_usermodehelper_setup() {
 0)               |      kmem_cache_alloc_trace() {
 0)               |        _cond_resched() {
 0)   0.116 us    |          rcu_all_qs();
 0)   0.345 us    |        }
 0)   0.117 us    |        should_failslab();
 0)               |        _cond_resched() {
 0)   0.118 us    |          rcu_all_qs();
 0)   0.347 us    |        }
 0)   0.123 us    |        memcg_kmem_put_cache();
 0)   1.792 us    |      }
 0)   2.023 us    |    }
 0)               |    call_usermodehelper_exec() {
 0)               |      queue_work_on() {
 0)               |        __queue_work() {
 0)   0.126 us    |          get_work_pool();
 0)   0.183 us    |          _raw_spin_lock();
 0)               |          insert_work() {
 0)   0.121 us    |            get_pwq.isra.0();
 0)               |            wake_up_process() {
 0)               |              try_to_wake_up() {
 0)   0.227 us    |                _raw_spin_lock_irqsave();
 0)               |                select_task_rq_fair() {
 0)   0.133 us    |                  available_idle_cpu();
 0)   0.166 us    |                  update_cfs_rq_h_load();
 0)               |                  select_idle_sibling() {
 0)   0.137 us    |                    available_idle_cpu();
 0)   0.371 us    |                  }
 0)   1.299 us    |                }
 0)   0.133 us    |                _raw_spin_lock();
 0)   0.148 us    |                update_rq_clock();
 0)               |                ttwu_do_activate() {
 0)               |                  activate_task() {
 0)               |                    enqueue_task_fair() {
 0)               |                      enqueue_entity() {
 0)   0.123 us    |                        update_curr();
 0)               |                        __update_load_avg_se() {
 0)   0.118 us    |                          __accumulate_pelt_segments();
 0)   0.420 us    |                        }
 0)   0.125 us    |                        __update_load_avg_cfs_rq();
 0)   0.122 us    |                        update_cfs_group();
 0)   0.138 us    |                        account_entity_enqueue();
 0)   0.120 us    |                        place_entity();
 0)   0.119 us    |                        __enqueue_entity();
 0)   2.146 us    |                      }
 0)   0.115 us    |                      hrtick_update();
 0)   2.624 us    |                    }
 0)   2.890 us    |                  }
 0)               |                  ttwu_do_wakeup() {
 0)               |                    check_preempt_curr() {
 0)   0.130 us    |                      resched_curr();
 0)   0.417 us    |                    }
 0)   1.034 us    |                  }
 0)   4.269 us    |                }
 0)   0.410 us    |                _raw_spin_unlock_irqrestore();
 0)   7.466 us    |              }
 0)   7.702 us    |            }
 0)   8.164 us    |          }
 0)   9.079 us    |        }
 0)   9.370 us    |      }
 0)               |      wait_for_completion_killable() {
 0)               |        _cond_resched() {
 0)   0.118 us    |          rcu_all_qs();
 0)   0.365 us    |        }
 0)   0.122 us    |        _raw_spin_lock_irq();
 0)               |        schedule_timeout() {
 0)               |          schedule() {
 0)               |            rcu_note_context_switch() {
 0)   0.147 us    |              rcu_qs();
 0)   0.384 us    |            }
 0)   0.124 us    |            _raw_spin_lock();
 0)   0.144 us    |            update_rq_clock();
 0)               |            deactivate_task() {
 0)               |              dequeue_task_fair() {
 0)               |                dequeue_entity() {
 0)               |                  update_curr() {
 0)   0.121 us    |                    update_min_vruntime();
 0)   0.132 us    |                    cpuacct_charge();
 0)               |                    __cgroup_account_cputime() {
 0)   0.124 us    |                      cgroup_rstat_updated();
 0)   0.354 us    |                    }
 0)   1.088 us    |                  }
 0)   0.127 us    |                  __update_load_avg_se();
 0)   0.136 us    |                  __update_load_avg_cfs_rq();
 0)   0.118 us    |                  clear_buddies();
 0)   0.124 us    |                  account_entity_dequeue();
 0)   0.120 us    |                  update_cfs_group();
 0)   0.128 us    |                  update_min_vruntime();
 0)   2.780 us    |                }
 0)   0.114 us    |                hrtick_update();
 0)   3.242 us    |              }
 0)   3.503 us    |            }
 0)               |            pick_next_task_fair() {
 0)   0.121 us    |              __msecs_to_jiffies();
 0)   0.389 us    |            }
 0)               |            pick_next_task_idle() {
 0)               |              put_prev_task_fair() {
 0)               |                put_prev_entity() {
 0)   0.122 us    |                  check_cfs_rq_runtime();
 0)   0.355 us    |                }
 0)   0.581 us    |              }
 0)   0.123 us    |              __update_idle_core();
 0)   1.055 us    |            }
 0)   0.118 us    |            enter_lazy_tlb();
 2)               |            finish_task_switch() {
 2)               |              __mmdrop() {
 2)               |                pgd_free() {
 2)   0.248 us    |                  _raw_spin_lock();
 2)               |                  free_pages() {
 2)               |                    free_pages.part.0() {
 2)               |                      __free_pages() {
 2)               |                        __free_pages_ok() {
 2)               |                          free_one_page() {
 2)   0.213 us    |                            _raw_spin_lock();
 2)   0.219 us    |                            __mod_zone_page_state();
 2)   1.102 us    |                          }
 2)   1.839 us    |                        }
 2)   2.337 us    |                      }
 2)   2.672 us    |                    }
 2)   2.986 us    |                  }
 2)   4.044 us    |                }
 2)   0.218 us    |                destroy_context_ldt();
 2)               |                kmem_cache_free() {
 2)   0.416 us    |                  ___cache_free();
 2)   1.051 us    |                }
 2)   6.234 us    |              }
 2)   8.542 us    |            }
 2) * 13308.49 us |          } /* schedule */
 2) * 13308.85 us |        } /* schedule_timeout */
 2)   0.235 us    |        _raw_spin_lock_irq();
 2) * 13310.47 us |      } /* wait_for_completion_killable */
 2)               |      free_modprobe_argv() {
 2)               |        kfree() {
 2)   0.213 us    |          ___cache_free();
 2)   0.657 us    |        }
 2)               |        kfree() {
 2)   0.153 us    |          ___cache_free();
 2)   0.557 us    |        }
 2)   1.732 us    |      }
 2)               |      kfree() {
 2)   0.207 us    |        ___cache_free();
 2)   0.734 us    |      }
 2)               |      __wake_up() {
 2)               |        __wake_up_common_lock() {
 2)   0.265 us    |          _raw_spin_lock_irqsave();
 2)   0.199 us    |          __wake_up_common();
 2)   0.214 us    |          _raw_spin_unlock_irqrestore();
 2)   1.333 us    |        }
 2)   1.648 us    |      }
 2) * 13325.51 us |    } /* call_usermodehelper_exec */
 2)               |    __wake_up() {
 2)               |      __wake_up_common_lock() {
 2)   0.195 us    |        _raw_spin_lock_irqsave();
 2)   0.200 us    |        __wake_up_common();
 2)   0.189 us    |        _raw_spin_unlock_irqrestore();
 2)   1.274 us    |      }
 2)   1.629 us    |    }
 2) * 13337.37 us |  } /* __request_module */
 2)               |  __request_module() {
 2)   0.279 us    |    current_is_async();
 2)               |    security_kernel_module_request() {
 2)   0.310 us    |      integrity_kernel_module_request();
 2)   0.799 us    |    }
 2)               |    kmem_cache_alloc_trace() {
 2)               |      _cond_resched() {
 2)   0.209 us    |        rcu_all_qs();
 2)   0.598 us    |      }
 2)   0.208 us    |      should_failslab();
 2)               |      _cond_resched() {
 2)   0.202 us    |        rcu_all_qs();
 2)   0.597 us    |      }
 2)   0.206 us    |      memcg_kmem_put_cache();
 2)   2.596 us    |    }
 2)               |    kstrdup() {
 2)               |      __kmalloc_track_caller() {
 2)   0.209 us    |        kmalloc_slab();
 2)               |        _cond_resched() {
 2)   0.200 us    |          rcu_all_qs();
 2)   0.598 us    |        }
 2)   0.399 us    |        should_failslab();
 2)               |        _cond_resched() {
 2)   0.179 us    |          rcu_all_qs();
 2)   0.491 us    |        }
 2)   0.174 us    |        memcg_kmem_put_cache();
 2)   3.004 us    |      }
 2)   3.424 us    |    }
 2)               |    call_usermodehelper_setup() {
 2)               |      kmem_cache_alloc_trace() {
 2)               |        _cond_resched() {
 2)   0.171 us    |          rcu_all_qs();
 2)   0.816 us    |        }
 2)   0.173 us    |        should_failslab();
 2)               |        _cond_resched() {
 2)   0.188 us    |          rcu_all_qs();
 2)   0.544 us    |        }
 2)   0.205 us    |        memcg_kmem_put_cache();
 2)   2.728 us    |      }
 2)   3.100 us    |    }
 2)               |    call_usermodehelper_exec() {
 2)               |      queue_work_on() {
 2)               |        __queue_work() {
 2)   0.213 us    |          get_work_pool();
 2)   0.206 us    |          _raw_spin_lock();
 2)               |          insert_work() {
 2)   0.194 us    |            get_pwq.isra.0();
 2)               |            wake_up_process() {
 2)               |              try_to_wake_up() {
 2)   0.248 us    |                _raw_spin_lock_irqsave();
 2)               |                select_task_rq_fair() {
 2)   0.205 us    |                  available_idle_cpu();
 2)   0.252 us    |                  update_cfs_rq_h_load();
 2)               |                  select_idle_sibling() {
 2)   0.277 us    |                    available_idle_cpu();
 2)   0.666 us    |                  }
 2)   2.074 us    |                }
 2)   0.213 us    |                _raw_spin_lock();
 2)   0.240 us    |                update_rq_clock();
 2)               |                ttwu_do_activate() {
 2)               |                  activate_task() {
 2)               |                    enqueue_task_fair() {
 2)               |                      enqueue_entity() {
 2)   0.209 us    |                        update_curr();
 2)               |                        __update_load_avg_se() {
 2)   0.198 us    |                          __accumulate_pelt_segments();
 2)   0.715 us    |                        }
 2)   0.221 us    |                        __update_load_avg_cfs_rq();
 2)   0.205 us    |                        update_cfs_group();
 2)   0.274 us    |                        account_entity_enqueue();
 2)   0.209 us    |                        place_entity();
 2)   0.211 us    |                        __enqueue_entity();
 2)   3.718 us    |                      }
 2)   0.208 us    |                      hrtick_update();
 2)   4.568 us    |                    }
 2)   5.005 us    |                  }
 2)               |                  ttwu_do_wakeup() {
 2)               |                    check_preempt_curr() {
 2)   0.222 us    |                      resched_curr();
 2)   0.700 us    |                    }
 2)   1.473 us    |                  }
 2)   7.098 us    |                }
 2)   0.218 us    |                _raw_spin_unlock_irqrestore();
 2) + 11.605 us   |              }
 2) + 11.947 us   |            }
 2) + 12.730 us   |          }
 2) + 14.091 us   |        }
 2) + 14.527 us   |      }
 2)               |      wait_for_completion_killable() {
 2)               |        _cond_resched() {
 2)   0.210 us    |          rcu_all_qs();
 2)   0.636 us    |        }
 2)   0.241 us    |        _raw_spin_lock_irq();
 2)               |        schedule_timeout() {
 2)               |          schedule() {
 2)               |            rcu_note_context_switch() {
 2)   0.217 us    |              rcu_qs();
 2)   0.618 us    |            }
 2)   0.200 us    |            _raw_spin_lock();
 2)   0.213 us    |            update_rq_clock();
 2)               |            deactivate_task() {
 2)               |              dequeue_task_fair() {
 2)               |                dequeue_entity() {
 2)               |                  update_curr() {
 2)   0.196 us    |                    update_min_vruntime();
 2)   0.239 us    |                    cpuacct_charge();
 2)               |                    __cgroup_account_cputime() {
 2)   0.202 us    |                      cgroup_rstat_updated();
 2)   0.638 us    |                    }
 2)   1.946 us    |                  }
 2)   0.210 us    |                  __update_load_avg_se();
 2)   0.213 us    |                  __update_load_avg_cfs_rq();
 2)   0.200 us    |                  clear_buddies();
 2)   0.212 us    |                  account_entity_dequeue();
 2)   0.203 us    |                  update_cfs_group();
 2)   0.207 us    |                  update_min_vruntime();
 2)   5.029 us    |                }
 2)   0.194 us    |                hrtick_update();
 2)   5.793 us    |              }
 2)   6.205 us    |            }
 2)               |            pick_next_task_fair() {
 2)               |              update_blocked_averages() {
 2)   0.149 us    |                _raw_spin_lock_irqsave();
 2)   0.205 us    |                update_rq_clock();
 2)   0.167 us    |                __update_load_avg_cfs_rq();
 2)   0.206 us    |                update_rt_rq_load_avg();
 2)   0.184 us    |                update_dl_rq_load_avg();
 2)   0.183 us    |                _raw_spin_unlock_irqrestore();
 2)   2.510 us    |              }
 2)               |              load_balance() {
 2)               |                find_busiest_group() {
 2)   0.172 us    |                  update_nohz_stats();
 2)   0.176 us    |                  idle_cpu();
 2)   0.207 us    |                  update_nohz_stats();
 2)   1.818 us    |                }
 2)   2.339 us    |              }
 2)   0.171 us    |              __msecs_to_jiffies();
 2)               |              load_balance() {
 2)               |                find_busiest_group() {
 2)   0.211 us    |                  update_nohz_stats();
 2)   0.203 us    |                  update_nohz_stats();
 2)   0.190 us    |                  idle_cpu();
 2)   0.216 us    |                  update_nohz_stats();
 2)   0.222 us    |                  update_nohz_stats();
 2)   2.711 us    |                }
 2)   0.228 us    |                _raw_spin_lock_irqsave();
 2)   0.262 us    |                update_rq_clock();
 2)   0.233 us    |                can_migrate_task();
 2)   0.322 us    |                can_migrate_task();
 2)   0.222 us    |                update_cfs_rq_h_load();
 2)               |                deactivate_task() {
 2)               |                  dequeue_task_fair() {
 2)               |                    dequeue_entity() {
 2)               |                      update_curr() {
 2)   0.209 us    |                        update_min_vruntime();
 2)   0.259 us    |                        cpuacct_charge();
 2)               |                        __cgroup_account_cputime() {
 2)   0.193 us    |                          cgroup_rstat_updated();
 2)   0.738 us    |                        }
 2)   2.022 us    |                      }
 2)   0.223 us    |                      __update_load_avg_se();
 2)   0.213 us    |                      __update_load_avg_cfs_rq();
 2)   0.202 us    |                      clear_buddies();
 2)   0.215 us    |                      account_entity_dequeue();
 2)   0.204 us    |                      update_cfs_group();
 2)   0.202 us    |                      update_min_vruntime();
 2)   4.891 us    |                    }
 2)   0.205 us    |                    hrtick_update();
 2)   5.711 us    |                  }
 2)   6.143 us    |                }
 2)               |                set_task_cpu() {
 2)               |                  migrate_task_rq_fair() {
 2)               |                    detach_entity_cfs_rq() {
 2)   0.215 us    |                      __update_load_avg_se();
 2)   0.204 us    |                      __update_load_avg_cfs_rq();
 2)   0.219 us    |                      propagate_entity_cfs_rq.isra.0();
 2)   1.433 us    |                    }
 2)   1.814 us    |                  }
 2)   0.195 us    |                  set_task_rq_fair();
 2)   2.664 us    |                }
 2)   0.202 us    |                _raw_spin_lock();
 2)   0.219 us    |                update_rq_clock();
 2)               |                attach_task() {
 2)               |                  activate_task() {
 2)               |                    enqueue_task_fair() {
 2)               |                      enqueue_entity() {
 2)               |                        update_curr() {
 2)   0.225 us    |                          update_min_vruntime();
 2)   0.202 us    |                          cpuacct_charge();
 2)               |                          __cgroup_account_cputime() {
 2)   0.196 us    |                            cgroup_rstat_updated();
 2)   0.569 us    |                          }
 2)   2.120 us    |                        }
 2)   0.208 us    |                        __update_load_avg_cfs_rq();
 2)   0.219 us    |                        attach_entity_load_avg();
 2)   0.203 us    |                        update_cfs_group();
 2)   0.184 us    |                        account_entity_enqueue();
 2)   0.217 us    |                        __enqueue_entity();
 2)   4.678 us    |                      }
 2)   0.177 us    |                      hrtick_update();
 2)   5.408 us    |                    }
 2)   5.795 us    |                  }
 2)               |                  check_preempt_curr() {
 2)               |                    check_preempt_wakeup() {
 2)   0.205 us    |                      update_curr();
 2)   0.201 us    |                      wakeup_preempt_entity.isra.0();
 2)   0.970 us    |                    }
 2)   1.359 us    |                  }
 2)   7.688 us    |                }
 2) + 23.511 us   |              }
 2)   0.201 us    |              __msecs_to_jiffies();
 2)   0.205 us    |              _raw_spin_lock();
 2)   0.197 us    |              check_cfs_rq_runtime();
 2)               |              pick_next_entity() {
 2)   0.198 us    |                clear_buddies();
 2)   0.600 us    |              }
 2)               |              put_prev_entity() {
 2)   0.188 us    |                check_cfs_rq_runtime();
 2)   0.583 us    |              }
 2)               |              set_next_entity() {
 2)   0.209 us    |                __update_load_avg_se();
 2)   0.215 us    |                __update_load_avg_cfs_rq();
 2)   1.053 us    |              }
 2) + 33.704 us   |            }
 2)               |            switch_mm_irqs_off() {
 2)   0.607 us    |              load_new_mm_cr3();
 2)   2.798 us    |            }
 3)   5.150 us    |            finish_task_switch();

--------------------------------------------------------------------------------
Ctrl-C hit, notice the delay
--------------------------------------------------------------------------------
 
 3) $ 54568382 us |          } /* schedule */
 3) $ 54568383 us |        } /* schedule_timeout */
 3)   1.011 us    |        _raw_spin_lock_irq();
 3) $ 54568388 us |      } /* wait_for_completion_killable */
 3)               |      __wake_up() {
 3)               |        __wake_up_common_lock() {
 3)   0.911 us    |          _raw_spin_lock_irqsave();
 3)   1.015 us    |          __wake_up_common();
 3)   0.958 us    |          _raw_spin_unlock_irqrestore();
 3)   6.186 us    |        }
 3)   7.650 us    |      }
 3) $ 54568414 us |    } /* call_usermodehelper_exec */
 3)               |    __wake_up() {
 3)               |      __wake_up_common_lock() {
 3)   0.720 us    |        _raw_spin_lock_irqsave();
 3)   0.826 us    |        __wake_up_common();
 3)   0.850 us    |        _raw_spin_unlock_irqrestore();
 3)   5.655 us    |      }
 3)   7.309 us    |    }
 3) $ 54568437 us |  } /* __request_module */

^ permalink raw reply

* Re: hid-related 5.2-rc1 boot hang
From: Hans de Goede @ 2019-06-04 13:12 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, Dave Hansen, open list:HID CORE LAYER, LKML
In-Reply-To: <CAO-hwJ+ZBuXtuk+i1Q9DwO=uLXDh4oToQyMWhK-8t+ZTS-jUjA@mail.gmail.com>

Hi,

On 04-06-19 14:25, Benjamin Tissoires wrote:
> On Tue, Jun 4, 2019 at 12:50 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi,
>>
>> On 04-06-19 12:08, Benjamin Tissoires wrote:
>>> On Tue, Jun 4, 2019 at 9:51 AM Benjamin Tissoires
>>> <benjamin.tissoires@redhat.com> wrote:
>>>>
>>>> On Mon, Jun 3, 2019 at 4:17 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 03-06-19 15:55, Benjamin Tissoires wrote:
>>>>>> On Mon, Jun 3, 2019 at 11:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>>>>
>>>>>>> Hi Again,
>>>>>>>
>>>>>>> On 03-06-19 11:11, Hans de Goede wrote:
>>>>>>> <snip>
>>>>>>>
>>>>>>>>> not sure about the rest of logitech issues yet) next week.
>>>>>>>>
>>>>>>>> The main problem seems to be the request_module patches. Although I also
>>>>>>
>>>>>> Can't we use request_module_nowait() instead, and set a reasonable
>>>>>> timeout that we detect only once to check if userspace is compatible:
>>>>>>
>>>>>> In pseudo-code:
>>>>>> if (!request_module_checked) {
>>>>>>      request_module_nowait(name);
>>>>>>      use_request_module = wait_event_timeout(wq,
>>>>>>            first_module_loaded, 10 seconds in jiffies);
>>>>>>      request_module_checked = true;
>>>>>> } else if (use_request_module) {
>>>>>>      request_module(name);
>>>>>> }
>>>>>
>>>>> Well looking at the just attached dmesg , the modprobe
>>>>> when triggered by udev from userspace succeeds in about
>>>>> 0.5 seconds, so it seems that the modprobe hangs happens
>>>>> when called from within the kernel rather then from within
>>>>> userspace.
>>>>>
>>>>> What I do not know if is the hang is inside userspace, or
>>>>> maybe it happens when modprobe calls back into the kernel,
>>>>> if the hang happens when modprobe calls back into the kernel,
>>>>> then other modprobes (done from udev) likely will hang too
>>>>> since I think only 1 modprobe can happen at a time.
>>>>>
>>>>> I really wish we knew what distinguished working systems
>>>>> from non working systems :|
>>>>>
>>>>> I cannot find a common denominator; other then the systems
>>>>> are not running Fedora. So far we've reports from both Ubuntu 16.04
>>>>> and Tumbleweed, so software version wise these 2 are wide apart.
>>>>
>>>> I am trying to reproduce the lock locally, and installed an opensuse
>>>> Tumbleweed in a VM. When forwarding a Unifying receiver to the VM, I
>>>> do not see the lock with either my vanilla compiled kernel and the rpm
>>>> found in http://download.opensuse.org/repositories/Kernel:/HEAD/standard/x86_64/
>>>>
>>>> Next step is install Tumbleweed on bare metal, but I do not see how
>>>> this could introduce a difference (maybe USB2 vs 3).
>>>
>>> Making progress here.
>>>
>>> The difference between Ubuntu/Tumbleweed and Fedora: usbhid is shipped
>>> as a module while in Fedora usbhid is included in the kernel.
>>>
>>> If I rmmod hid_* and usbhid, then modprobe usbhid, the command hangs
>>> for 3 minutes.
>>> If usbhid is already loaded, inserting a receiver is immediate
>>> regarding the loading of the external modules.
>>>
>>> So my assumption is that when the device gets detected at boot, usbhid
>>> gets loaded by the kernel event, which in turns attempts to call
>>> __request_module, but the modprobe can't be fulfilled because it's
>>> already waiting for the initial usbhid modprobe to finish.
>>>
>>> Still don't know how to solve that, but I thought I should share.
>>
>> Hmm, we may be hitting the scenario described in the big comment
>> around line 3500 of kernel/module.c.
> 
> Well, we are not locking during do_init_module(), but in waiting for
> the completion of request_module(). So as I read the trace, we wait
> for userspace to call/terminate modprobe.
> 
>>
>> But I'm not sure that is what is happening here.
>>
>> Maybe you can put a WARN_ON(1) in request_module and look at the
>> backtrace ?  That may help to figure out what is going on; or
>> alternatively it might help to find some way to detect this and
>> if it happens skip the request_module...
> 
> Ftrace is much easier to deal with:
> ---
> /sys/kernel/debug/tracing # cat trace
> # tracer: function
> #
> # entries-in-buffer/entries-written: 4/4   #P:4
> #
> #                              _-----=> irqs-off
> #                             / _----=> need-resched
> #                            | / _---=> hardirq/softirq
> #                            || / _--=> preempt-depth
> #                            ||| /     delay
> #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
> #              | |       |   ||||       |         |
>          modprobe-23236 [003] ....  9191.880917: __request_module
> <-hid_add_device
>          modprobe-23236 [003] ....  9191.880937: <stack trace>
>   => 0xffffffffc0851061
>   => __request_module
>   => hid_add_device
>   => usbhid_probe
>   => usb_probe_interface
>   => really_probe
>   => driver_probe_device
>   => device_driver_attach
>   => __driver_attach
>   => bus_for_each_dev
>   => bus_add_driver
>   => driver_register
>   => usb_register_driver
>   => hid_init
>   => do_one_initcall
>   => do_init_module
>   => load_module
>   => __do_sys_finit_module
>   => do_syscall_64
>   => entry_SYSCALL_64_after_hwframe
>          modprobe-23236 [003] ....  9191.892765: __request_module
> <-hid_add_device
>          modprobe-23236 [003] ....  9191.892784: <stack trace>
>   => 0xffffffffc0851061
>   => __request_module
>   => hid_add_device
>   => usbhid_probe
>   => usb_probe_interface
>   => really_probe
>   => driver_probe_device
>   => device_driver_attach
>   => __driver_attach
>   => bus_for_each_dev
>   => bus_add_driver
>   => driver_register
>   => usb_register_driver
>   => hid_init
>   => do_one_initcall
>   => do_init_module
>   => load_module
>   => __do_sys_finit_module
>   => do_syscall_64
>   => entry_SYSCALL_64_after_hwframe
> ---
> 
> This is what happen with the logitech receiver plugged in and while
> modprobing usbhid. The modprobe command hangs, and I took the trace
> here.
> If I hit Ctrl-C, the modprobe loading continue properly.
> 
> There is nothing special here in the stack trace, except that there
> are 2 calls to request_module here (one for the touchscreen I guess
> and one for the logitech receiver).
> 
> I have attached the call graph of the same sequence:
> wait_for_completion_killable() seems to be the culprit, we are waiting
> for userspace to notify it has done calling modprobe.
> 
> My idea would be to defer any call to hid_add_device() into a
> workqueue and see if that unlocks the situation.

Yes that is probably a good solution. When the first bug reports came
in I was thinking that the nested hid_add_device calls from hid-logitech-dj
calling hid_add_device() were the problem, but those are already deferred
to a workqueue so those are not really nested.

Looking at various callers if hid_add_device, if we always defer, we also
need the caller to give a callback to call on add_device error, which would
then be used to free various resources related to the hid device.

If me make hid_add_device itself always defer, I guess we may want a non
deferred version of hid_add_device for the hid_add_device calls in
hid-logitech-dj.

In essence we are dealing with nested hid_add_device calls here right?

So another solution would be to have an atomic counter and call
atomic_long_inc_return on it before the hid_add_device and then if its
previous value was not 0, skip the request_module ?
This does mean though that we then may get inconsistent behavior if
2 unrelated hid_add_device-s are racing with each-other :|

Regards,

Hans

^ permalink raw reply

* [PATCH] arm64: dts: allwinner: a64: Add lradc node
From: Luca Weiss @ 2019-06-04 14:42 UTC (permalink / raw)
  Cc: Luca Weiss, Hans de Goede, Dmitry Torokhov, Rob Herring,
	Mark Rutland, Maxime Ripard, Chen-Yu Tsai,
	open list:SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Allwinner sunXi SoC support, open list

Add a node describing the KEYADC on the A64.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 .../devicetree/bindings/input/sun4i-lradc-keys.txt        | 1 +
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi             | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
index 496125c6bfb7..507b737612ea 100644
--- a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
+++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
@@ -5,6 +5,7 @@ Required properties:
  - compatible: should be one of the following string:
 		"allwinner,sun4i-a10-lradc-keys"
 		"allwinner,sun8i-a83t-r-lradc"
+		"allwinner,sun50i-a64-lradc", "allwinner,sun8i-a83t-r-lradc"
  - reg: mmio address range of the chip
  - interrupts: interrupt to which the chip is connected
  - vref-supply: powersupply for the lradc reference voltage
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 7734f70e1057..3a42352b5c9f 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -704,6 +704,14 @@
 			status = "disabled";
 		};
 
+		lradc: lradc@1c21800 {
+			compatible = "allwinner,sun50i-a64-lradc",
+				     "allwinner,sun8i-a83t-r-lradc";
+			reg = <0x01c21800 0x400>;
+			interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
 		i2s0: i2s@1c22000 {
 			#sound-dai-cells = <0>;
 			compatible = "allwinner,sun50i-a64-i2s",
-- 
2.21.0

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox