Discussion:
[PATCH bluez] hid2hci: Fix udev rules for linux-4.14+
(too old to reply)
Ville Syrjala
2018-05-07 13:06:38 UTC
Permalink
Raw Message
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
Raw Message
On Mon, May 07, 2018 at 04:06:38PM +0300, Ville Syrjala wrote:
> 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"

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
Raw Message
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ä <***@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"
>
> 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
Raw Message
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
Loading...