Discussion:
[systemd-devel] [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+
Ville Syrjala
2018-05-07 13:06:38 UTC
Permalink
From: Ville Syrjälä <***@linux.intel.com>

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 <***@gmail.com>
Cc: Greg Kroah-Hartman <***@linuxfoundation.org>
Cc: Marcel Holtmann <***@holtmann.org>
Cc: Kay Sievers <***@vrfy.org>
Cc: systemd-***@lists.freedesktop.org
Cc: linux-***@vger.kernel.org
Cc: linux-***@vger.kernel.org
Signed-off-by: Ville Syrjälä <***@linux.intel.com>
---
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
Zbigniew Jędrzejewski-Szmek
2018-05-07 17:44:59 UTC
Permalink
Post by Ville Syrjala
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.
---
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
Ville Syrjälä
2018-06-20 16:46:21 UTC
Permalink
Post by Zbigniew Jędrzejewski-Szmek
Post by Ville Syrjala
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.
---
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
Ville Syrjala
2018-06-20 16:42:40 UTC
Permalink
From: Ville Syrjälä <***@linux.intel.com>

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 <***@gmail.com>
Cc: Greg Kroah-Hartman <***@linuxfoundation.org>
Cc: Marcel Holtmann <***@holtmann.org>
Cc: Kay Sievers <***@vrfy.org>
Cc: Zbigniew Jędrzejewski-Szmek <***@in.waw.pl>
Cc: systemd-***@lists.freedesktop.org
Cc: linux-***@vger.kernel.org
Cc: linux-***@vger.kernel.org
Signed-off-by: Ville Syrjälä <***@linux.intel.com>
---
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ä
2018-11-05 17:54:16 UTC
Permalink
Post by Ville Syrjala
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?
Post by Ville Syrjala
---
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
Ville Syrjala
2018-12-04 20:41:17 UTC
Permalink
From: Ville Syrjälä <***@linux.intel.com>

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 <***@gmail.com>
Cc: Greg Kroah-Hartman <***@linuxfoundation.org>
Cc: Marcel Holtmann <***@holtmann.org>
Cc: Kay Sievers <***@vrfy.org>
Cc: Zbigniew Jędrzejewski-Szmek <***@in.waw.pl>
Cc: systemd-***@lists.freedesktop.org
Cc: linux-***@vger.kernel.org
Cc: linux-***@vger.kernel.org
---
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
Greg Kroah-Hartman
2018-12-05 07:06:21 UTC
Permalink
Post by Ville Syrjala
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
Ville Syrjälä
2018-12-05 15:40:32 UTC
Permalink
Post by Greg Kroah-Hartman
Post by Ville Syrjala
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.
Post by Greg Kroah-Hartman
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
Greg Kroah-Hartman
2018-12-05 19:20:36 UTC
Permalink
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjala
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?
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
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
Ville Syrjälä
2018-12-05 19:40:51 UTC
Permalink
Post by Greg Kroah-Hartman
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjala
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.
Post by Greg Kroah-Hartman
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
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
Greg Kroah-Hartman
2018-12-05 19:49:16 UTC
Permalink
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjala
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"?
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
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

Greg Kroah-Hartman
2018-12-05 19:21:45 UTC
Permalink
Post by Ville Syrjälä
Post by Greg Kroah-Hartman
Post by Ville Syrjala
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.
Post by Greg Kroah-Hartman
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
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
Loading...