2018-05-07 13:08:10

by Ville Syrjälä

[permalink] [raw]
Subject: [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+

From: Ville Syrjälä <[email protected]>

Since commit 1455cf8dbfd0 ("driver core: emit uevents when
device is bound to a driver") the kernel started emitting
"bound" and "unbound" uevents which confuse the hid2hci
udev rules.

The symptoms on an affected machine (Dell E5400 in my case)
include bluetooth devices not appearing and udev hogging
the cpu as it's busy processing a constant stream of these
"bound"+"unbound" uevents.

Change the udev rules only kick in for an "add" event.
This seems to cure my machine at least.

Cc: Dmitry Torokhov <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Marcel Holtmann <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Ville Syrjälä <[email protected]>
---
tools/hid2hci.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index db6bb03d2ef3..daa381d77387 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update

-ACTION=="remove", GOTO="hid2hci_end"
+ACTION!="add", GOTO="hid2hci_end"
SUBSYSTEM!="usb*", GOTO="hid2hci_end"

# Variety of Dell Bluetooth devices - match on a mouse device that is
--
2.16.1



Subject: Re: [systemd-devel] [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+

On Mon, May 07, 2018 at 04:06:38PM +0300, Ville Syrjala wrote:
> From: Ville Syrj?l? <[email protected]>
>
> Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> device is bound to a driver") the kernel started emitting
> "bound" and "unbound" uevents which confuse the hid2hci
> udev rules.
>
> The symptoms on an affected machine (Dell E5400 in my case)
> include bluetooth devices not appearing and udev hogging
> the cpu as it's busy processing a constant stream of these
> "bound"+"unbound" uevents.
>
> Change the udev rules only kick in for an "add" event.
> This seems to cure my machine at least.
>
> Cc: Dmitry Torokhov <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Marcel Holtmann <[email protected]>
> Cc: Kay Sievers <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Ville Syrj?l? <[email protected]>
> ---
> tools/hid2hci.rules | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
> index db6bb03d2ef3..daa381d77387 100644
> --- a/tools/hid2hci.rules
> +++ b/tools/hid2hci.rules
> @@ -1,6 +1,6 @@
> # do not edit this file, it will be overwritten on update
>
> -ACTION=="remove", GOTO="hid2hci_end"
> +ACTION!="add", GOTO="hid2hci_end"
> SUBSYSTEM!="usb*", GOTO="hid2hci_end"

This will skip over lines 22-23. Is the rule there supposed to
work for ACTION==add only (in which case your patch would be OK),
or also for ACTION==change? Maybe it'd be safer to just add the GOTO
for bind/unbind.

Zbyszek

2018-06-20 16:44:37

by Ville Syrjälä

[permalink] [raw]
Subject: [PATCH v2] hid2hci: Fix udev rules for linux-4.14+

From: Ville Syrjälä <[email protected]>

Since commit 1455cf8dbfd0 ("driver core: emit uevents when
device is bound to a driver") the kernel started emitting
"bind" and "unbind" uevents which confuse the hid2hci
udev rules.

The symptoms on an affected machine (Dell E5400 in my case)
include bluetooth devices not appearing and udev hogging
the cpu as it's busy processing a constant stream of these
"bind"+"unbind" uevents.

Change the udev rules not do anything except for "add" and
"change" events. This seems to cure my machine at least.

v2: Don't mess up "change" (Zbyszek)
Fix up the commit message a bit

Cc: Dmitry Torokhov <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Marcel Holtmann <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Zbigniew Jędrzejewski-Szmek <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Ville Syrjälä <[email protected]>
---
tools/hid2hci.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index db6bb03d2ef3..5c7208af7a02 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update

-ACTION=="remove", GOTO="hid2hci_end"
+ACTION!="add|change", GOTO="hid2hci_end"
SUBSYSTEM!="usb*", GOTO="hid2hci_end"

# Variety of Dell Bluetooth devices - match on a mouse device that is
--
2.16.4


2018-06-20 16:47:21

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [systemd-devel] [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+

On Mon, May 07, 2018 at 05:44:59PM +0000, Zbigniew Jędrzejewski-Szmek wrote:
> On Mon, May 07, 2018 at 04:06:38PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <[email protected]>
> >
> > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > device is bound to a driver") the kernel started emitting
> > "bound" and "unbound" uevents which confuse the hid2hci
> > udev rules.
> >
> > The symptoms on an affected machine (Dell E5400 in my case)
> > include bluetooth devices not appearing and udev hogging
> > the cpu as it's busy processing a constant stream of these
> > "bound"+"unbound" uevents.
> >
> > Change the udev rules only kick in for an "add" event.
> > This seems to cure my machine at least.
> >
> > Cc: Dmitry Torokhov <[email protected]>
> > Cc: Greg Kroah-Hartman <[email protected]>
> > Cc: Marcel Holtmann <[email protected]>
> > Cc: Kay Sievers <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Ville Syrjälä <[email protected]>
> > ---
> > tools/hid2hci.rules | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
> > index db6bb03d2ef3..daa381d77387 100644
> > --- a/tools/hid2hci.rules
> > +++ b/tools/hid2hci.rules
> > @@ -1,6 +1,6 @@
> > # do not edit this file, it will be overwritten on update
> >
> > -ACTION=="remove", GOTO="hid2hci_end"
> > +ACTION!="add", GOTO="hid2hci_end"
> > SUBSYSTEM!="usb*", GOTO="hid2hci_end"
>
> This will skip over lines 22-23. Is the rule there supposed to
> work for ACTION==add only (in which case your patch would be OK),
> or also for ACTION==change? Maybe it'd be safer to just add the GOTO
> for bind/unbind.

Forgot about this one. Thanks for catching that. I think checking for
"add|change" is the sanest approach. I fired off a v2 with that
approach.

Actually I'm not sure if this change stuff is working at all in any
case. On my systems udevadm is in /bin, but this rules file
hardcodes /sbin/udevadm as the path.

--
Ville Syrjälä
Intel

2018-11-05 17:58:55

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH v2] hid2hci: Fix udev rules for linux-4.14+

On Wed, Jun 20, 2018 at 07:42:40PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <[email protected]>
>
> Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> device is bound to a driver") the kernel started emitting
> "bind" and "unbind" uevents which confuse the hid2hci
> udev rules.
>
> The symptoms on an affected machine (Dell E5400 in my case)
> include bluetooth devices not appearing and udev hogging
> the cpu as it's busy processing a constant stream of these
> "bind"+"unbind" uevents.
>
> Change the udev rules not do anything except for "add" and
> "change" events. This seems to cure my machine at least.
>
> v2: Don't mess up "change" (Zbyszek)
> Fix up the commit message a bit

Ping. Can someone push this?

>
> Cc: Dmitry Torokhov <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Marcel Holtmann <[email protected]>
> Cc: Kay Sievers <[email protected]>
> Cc: Zbigniew Jędrzejewski-Szmek <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Ville Syrjälä <[email protected]>
> ---
> tools/hid2hci.rules | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
> index db6bb03d2ef3..5c7208af7a02 100644
> --- a/tools/hid2hci.rules
> +++ b/tools/hid2hci.rules
> @@ -1,6 +1,6 @@
> # do not edit this file, it will be overwritten on update
>
> -ACTION=="remove", GOTO="hid2hci_end"
> +ACTION!="add|change", GOTO="hid2hci_end"
> SUBSYSTEM!="usb*", GOTO="hid2hci_end"
>
> # Variety of Dell Bluetooth devices - match on a mouse device that is
> --
> 2.16.4

--
Ville Syrjälä
Intel

2018-12-04 21:07:33

by Ville Syrjälä

[permalink] [raw]
Subject: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

From: Ville Syrjälä <[email protected]>

Since commit 1455cf8dbfd0 ("driver core: emit uevents when
device is bound to a driver") the kernel started emitting
"bind" and "unbind" uevents which confuse the hid2hci
udev rules.

The symptoms on an affected machine (Dell E5400 in my case)
include bluetooth devices not appearing and udev hogging
the cpu as it's busy processing a constant stream of these
"bind"+"unbind" uevents.

Change the udev rules not do anything except for "add" and
"change" events. This seems to cure my machine at least.

v2: Don't mess up "change" (Zbyszek)
Fix up the commit message a bit

Cc: Dmitry Torokhov <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Marcel Holtmann <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Zbigniew Jędrzejewski-Szmek <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Reposting with BlueZ in subject and sob stripped. Maybe that helps in
getting a oneliner merged?

tools/hid2hci.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index db6bb03d2ef3..5c7208af7a02 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update

-ACTION=="remove", GOTO="hid2hci_end"
+ACTION!="add|change", GOTO="hid2hci_end"
SUBSYSTEM!="usb*", GOTO="hid2hci_end"

# Variety of Dell Bluetooth devices - match on a mouse device that is
--
2.16.4


2018-12-05 07:07:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> From: Ville Syrj?l? <[email protected]>
>
> Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> device is bound to a driver") the kernel started emitting
> "bind" and "unbind" uevents which confuse the hid2hci
> udev rules.
>
> The symptoms on an affected machine (Dell E5400 in my case)
> include bluetooth devices not appearing and udev hogging
> the cpu as it's busy processing a constant stream of these
> "bind"+"unbind" uevents.

What is causing a "stream" of bind and unbind events? This only happens
when a device is attached to a driver or removed from a driver, which is
caused by something else happening. This should not be a normal
occurance, unless something odd is happening to your hardware?

thanks,

greg k-h

2018-12-05 15:42:09

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> > From: Ville Syrj?l? <[email protected]>
> >
> > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > device is bound to a driver") the kernel started emitting
> > "bind" and "unbind" uevents which confuse the hid2hci
> > udev rules.
> >
> > The symptoms on an affected machine (Dell E5400 in my case)
> > include bluetooth devices not appearing and udev hogging
> > the cpu as it's busy processing a constant stream of these
> > "bind"+"unbind" uevents.
>
> What is causing a "stream" of bind and unbind events? This only happens
> when a device is attached to a driver or removed from a driver, which is
> caused by something else happening.

Not sure if it's just due to this thing causing devices to
appear/disappear during bind/unbind events or what.

> This should not be a normal
> occurance, unless something odd is happening to your hardware?

It's not specific to my hardware. Lot's of people are affected.
See eg.
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836

Acutally looking through that bug it seems someone else noticed
hid2hci failing lot in the logs. So maybe it's just that we already
switched the mode during "add", and then we try to redo the same
thing during "bind" which fails, and that then causes and unbind?
Dunno, udev is beyond me.

--
Ville Syrj?l?
Intel

2018-12-05 19:14:49

by Dag B

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+



On 05.12.2018 16:40, Ville Syrjälä wrote:
> On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
>> On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
>>> From: Ville Syrjälä <[email protected]>
>>>
>>> Since commit 1455cf8dbfd0 ("driver core: emit uevents when
>>> device is bound to a driver") the kernel started emitting
>>> "bind" and "unbind" uevents which confuse the hid2hci
>>> udev rules.
>>>
>>> The symptoms on an affected machine (Dell E5400 in my case)
>>> include bluetooth devices not appearing and udev hogging
>>> the cpu as it's busy processing a constant stream of these
>>> "bind"+"unbind" uevents.
>> What is causing a "stream" of bind and unbind events? This only happens
>> when a device is attached to a driver or removed from a driver, which is
>> caused by something else happening.
> Not sure if it's just due to this thing causing devices to
> appear/disappear during bind/unbind events or what.
>
>> This should not be a normal
>> occurance, unless something odd is happening to your hardware?
> It's not specific to my hardware. Lot's of people are affected.
> See eg.
> https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
>
> Acutally looking through that bug it seems someone else noticed
> hid2hci failing lot in the logs. So maybe it's just that we already
> switched the mode during "add", and then we try to redo the same
> thing during "bind" which fails, and that then causes and unbind?
> Dunno, udev is beyond me.
>
>
There is another bluetooth scenario where a cpu core peaks at 100%.
This is when a bluetooth keyboard goes out to lunch/suspends/disappears.
No idea if this is related to the original issue, asking forgiveness if
it is not.
I have found it challenging to attract any attention to the problem,
despite it not being an entirely new or uncommon occurence.

Google the following terms: bluetooth keyboard bluetoothd linux 100% cpu



By chance, I discovered a supposed fix for this on github today. I have
not had the chance to test it (or if it even applies) yet:

https://github.com/peak3d/bluez/commit/9cc3c1afd793e40b1a0cdc4a13e08b5e2575759e

Could someone please shine a light on the sanity of this patch?



Dag B

2018-12-05 19:22:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Wed, Dec 05, 2018 at 05:40:32PM +0200, Ville Syrj?l? wrote:
> On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> > > From: Ville Syrj?l? <[email protected]>
> > >
> > > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > > device is bound to a driver") the kernel started emitting
> > > "bind" and "unbind" uevents which confuse the hid2hci
> > > udev rules.
> > >
> > > The symptoms on an affected machine (Dell E5400 in my case)
> > > include bluetooth devices not appearing and udev hogging
> > > the cpu as it's busy processing a constant stream of these
> > > "bind"+"unbind" uevents.
> >
> > What is causing a "stream" of bind and unbind events? This only happens
> > when a device is attached to a driver or removed from a driver, which is
> > caused by something else happening.
>
> Not sure if it's just due to this thing causing devices to
> appear/disappear during bind/unbind events or what.

Someone has to be telling the kernel to bind/unbind from a driver to
a device, it doesn't do it on its own. Look at your other rules/scripts
for that.

Also note that the kernel has been doing this for over a year now (since
4.l4), what just happened in 4.19 to cause this to be an issue?

> > This should not be a normal
> > occurance, unless something odd is happening to your hardware?
>
> It's not specific to my hardware. Lot's of people are affected.
> See eg.
> https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
>
> Acutally looking through that bug it seems someone else noticed
> hid2hci failing lot in the logs. So maybe it's just that we already
> switched the mode during "add", and then we try to redo the same
> thing during "bind" which fails, and that then causes and unbind?

You have to manually unbind the device, the kernel does not do that. So
perhaps you have a broken udev rule somewhere else that would do
something odd like unbind/bind?

I don't see this happening on my systems, but hey, I know better than to
run Ubuntu :)

thanks,

greg k-h

2018-12-05 19:22:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Wed, Dec 05, 2018 at 08:09:35PM +0100, Dag B wrote:
>
>
> On 05.12.2018 16:40, Ville Syrj?l? wrote:
> > On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> > > > From: Ville Syrj?l? <[email protected]>
> > > >
> > > > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > > > device is bound to a driver") the kernel started emitting
> > > > "bind" and "unbind" uevents which confuse the hid2hci
> > > > udev rules.
> > > >
> > > > The symptoms on an affected machine (Dell E5400 in my case)
> > > > include bluetooth devices not appearing and udev hogging
> > > > the cpu as it's busy processing a constant stream of these
> > > > "bind"+"unbind" uevents.
> > > What is causing a "stream" of bind and unbind events? This only happens
> > > when a device is attached to a driver or removed from a driver, which is
> > > caused by something else happening.
> > Not sure if it's just due to this thing causing devices to
> > appear/disappear during bind/unbind events or what.
> >
> > > This should not be a normal
> > > occurance, unless something odd is happening to your hardware?
> > It's not specific to my hardware. Lot's of people are affected.
> > See eg.
> > https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
> >
> > Acutally looking through that bug it seems someone else noticed
> > hid2hci failing lot in the logs. So maybe it's just that we already
> > switched the mode during "add", and then we try to redo the same
> > thing during "bind" which fails, and that then causes and unbind?
> > Dunno, udev is beyond me.
> >
> >
> There is another bluetooth scenario where a cpu core peaks at 100%.
> This is when a bluetooth keyboard goes out to lunch/suspends/disappears.
> No idea if this is related to the original issue, asking forgiveness if it
> is not.

I have bluetooth keyboards working just fine here, again, more specifics
would be good to have.

> I have found it challenging to attract any attention to the problem, despite
> it not being an entirely new or uncommon occurence.
>
> Google the following terms: bluetooth keyboard bluetoothd linux 100% cpu
>
>
>
> By chance, I discovered a supposed fix for this on github today. I have not
> had the chance to test it (or if it even applies) yet:
>
> https://github.com/peak3d/bluez/commit/9cc3c1afd793e40b1a0cdc4a13e08b5e2575759e
>
> Could someone please shine a light on the sanity of this patch?

That's a userspace bluez patch, I think you are asking on the wrong
list, sorry.

greg k-h

2018-12-05 19:43:01

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Wed, Dec 05, 2018 at 08:20:36PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 05, 2018 at 05:40:32PM +0200, Ville Syrj?l? wrote:
> > On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> > > > From: Ville Syrj?l? <[email protected]>
> > > >
> > > > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > > > device is bound to a driver") the kernel started emitting
> > > > "bind" and "unbind" uevents which confuse the hid2hci
> > > > udev rules.
> > > >
> > > > The symptoms on an affected machine (Dell E5400 in my case)
> > > > include bluetooth devices not appearing and udev hogging
> > > > the cpu as it's busy processing a constant stream of these
> > > > "bind"+"unbind" uevents.
> > >
> > > What is causing a "stream" of bind and unbind events? This only happens
> > > when a device is attached to a driver or removed from a driver, which is
> > > caused by something else happening.
> >
> > Not sure if it's just due to this thing causing devices to
> > appear/disappear during bind/unbind events or what.
>
> Someone has to be telling the kernel to bind/unbind from a driver to
> a device, it doesn't do it on its own. Look at your other rules/scripts
> for that.
>
> Also note that the kernel has been doing this for over a year now (since
> 4.l4), what just happened in 4.19 to cause this to be an issue?

It became an issue for me after I got a machine that suffers from
this. The regression has been present ever since commit 1455cf8dbfd0
("driver core: emit uevents when device is bound to a driver").

You need a Dell E5400 or something similar to see it since those
have these magic bluetooth devices or whatever.

>
> > > This should not be a normal
> > > occurance, unless something odd is happening to your hardware?
> >
> > It's not specific to my hardware. Lot's of people are affected.
> > See eg.
> > https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
> >
> > Acutally looking through that bug it seems someone else noticed
> > hid2hci failing lot in the logs. So maybe it's just that we already
> > switched the mode during "add", and then we try to redo the same
> > thing during "bind" which fails, and that then causes and unbind?
>
> You have to manually unbind the device, the kernel does not do that. So
> perhaps you have a broken udev rule somewhere else that would do
> something odd like unbind/bind?
>
> I don't see this happening on my systems, but hey, I know better than to
> run Ubuntu :)

As do I. And you don't see it because you don't have the right
hardware.

--
Ville Syrj?l?
Intel

2018-12-05 19:50:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+

On Wed, Dec 05, 2018 at 09:40:51PM +0200, Ville Syrj?l? wrote:
> On Wed, Dec 05, 2018 at 08:20:36PM +0100, Greg Kroah-Hartman wrote:
> > On Wed, Dec 05, 2018 at 05:40:32PM +0200, Ville Syrj?l? wrote:
> > > On Wed, Dec 05, 2018 at 08:06:21AM +0100, Greg Kroah-Hartman wrote:
> > > > On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> > > > > From: Ville Syrj?l? <[email protected]>
> > > > >
> > > > > Since commit 1455cf8dbfd0 ("driver core: emit uevents when
> > > > > device is bound to a driver") the kernel started emitting
> > > > > "bind" and "unbind" uevents which confuse the hid2hci
> > > > > udev rules.
> > > > >
> > > > > The symptoms on an affected machine (Dell E5400 in my case)
> > > > > include bluetooth devices not appearing and udev hogging
> > > > > the cpu as it's busy processing a constant stream of these
> > > > > "bind"+"unbind" uevents.
> > > >
> > > > What is causing a "stream" of bind and unbind events? This only happens
> > > > when a device is attached to a driver or removed from a driver, which is
> > > > caused by something else happening.
> > >
> > > Not sure if it's just due to this thing causing devices to
> > > appear/disappear during bind/unbind events or what.
> >
> > Someone has to be telling the kernel to bind/unbind from a driver to
> > a device, it doesn't do it on its own. Look at your other rules/scripts
> > for that.
> >
> > Also note that the kernel has been doing this for over a year now (since
> > 4.l4), what just happened in 4.19 to cause this to be an issue?
>
> It became an issue for me after I got a machine that suffers from
> this. The regression has been present ever since commit 1455cf8dbfd0
> ("driver core: emit uevents when device is bound to a driver").
>
> You need a Dell E5400 or something similar to see it since those
> have these magic bluetooth devices or whatever.

What does the kernel log say is going on? Is the device "bouncing" from
being added/removed from the system all the time?

What makes this system "magic"?

> > > > This should not be a normal
> > > > occurance, unless something odd is happening to your hardware?
> > >
> > > It's not specific to my hardware. Lot's of people are affected.
> > > See eg.
> > > https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
> > >
> > > Acutally looking through that bug it seems someone else noticed
> > > hid2hci failing lot in the logs. So maybe it's just that we already
> > > switched the mode during "add", and then we try to redo the same
> > > thing during "bind" which fails, and that then causes and unbind?
> >
> > You have to manually unbind the device, the kernel does not do that. So
> > perhaps you have a broken udev rule somewhere else that would do
> > something odd like unbind/bind?
> >
> > I don't see this happening on my systems, but hey, I know better than to
> > run Ubuntu :)
>
> As do I. And you don't see it because you don't have the right
> hardware.

Fair enough, what makes my hardware different from yours?

thanks,

greg k-h