linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+
@ 2018-05-07 13:06 Ville Syrjala
  2018-05-07 17:44 ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
  2018-06-20 16:42 ` [PATCH v2] " Ville Syrjala
  0 siblings, 2 replies; 14+ messages in thread
From: Ville Syrjala @ 2018-05-07 13:06 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, Marcel Holtmann,
	Kay Sievers, systemd-devel, linux-kernel, Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@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 <dmitry.torokhov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: systemd-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@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

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

* Re: [systemd-devel] [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+
  2018-05-07 13:06 [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+ Ville Syrjala
@ 2018-05-07 17:44 ` Zbigniew Jędrzejewski-Szmek
  2018-06-20 16:46   ` Ville Syrjälä
  2018-06-20 16:42 ` [PATCH v2] " Ville Syrjala
  1 sibling, 1 reply; 14+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2018-05-07 17:44 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: linux-bluetooth, Kay Sievers, systemd-devel, linux-kernel

On Mon, May 07, 2018 at 04:06:38PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@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 <dmitry.torokhov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Kay Sievers <kay.sievers@vrfy.org>
> Cc: systemd-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-bluetooth@vger.kernel.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@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

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

* [PATCH v2] hid2hci: Fix udev rules for linux-4.14+
  2018-05-07 13:06 [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+ Ville Syrjala
  2018-05-07 17:44 ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
@ 2018-06-20 16:42 ` Ville Syrjala
  2018-11-05 17:54   ` Ville Syrjälä
  2018-12-04 20:41   ` [PATCH v2 BlueZ] " Ville Syrjala
  1 sibling, 2 replies; 14+ messages in thread
From: Ville Syrjala @ 2018-06-20 16:42 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, Marcel Holtmann,
	Kay Sievers, Zbigniew Jędrzejewski-Szmek, systemd-devel,
	linux-kernel, Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@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 <dmitry.torokhov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Cc: systemd-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@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

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

* Re: [systemd-devel] [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+
  2018-05-07 17:44 ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
@ 2018-06-20 16:46   ` Ville Syrjälä
  0 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2018-06-20 16:46 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek
  Cc: linux-bluetooth, Kay Sievers, systemd-devel, linux-kernel

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ä <ville.syrjala@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 <dmitry.torokhov@gmail.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Marcel Holtmann <marcel@holtmann.org>
> > Cc: Kay Sievers <kay.sievers@vrfy.org>
> > Cc: systemd-devel@lists.freedesktop.org
> > Cc: linux-kernel@vger.kernel.org
> > Cc: linux-bluetooth@vger.kernel.org
> > Signed-off-by: Ville Syrjälä <ville.syrjala@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

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

* Re: [PATCH v2] hid2hci: Fix udev rules for linux-4.14+
  2018-06-20 16:42 ` [PATCH v2] " Ville Syrjala
@ 2018-11-05 17:54   ` Ville Syrjälä
  2018-12-04 20:41   ` [PATCH v2 BlueZ] " Ville Syrjala
  1 sibling, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2018-11-05 17:54 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, Marcel Holtmann,
	Kay Sievers, Zbigniew Jędrzejewski-Szmek, systemd-devel,
	linux-kernel

On Wed, Jun 20, 2018 at 07:42:40PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@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

Ping. Can someone push this?

> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Kay Sievers <kay.sievers@vrfy.org>
> Cc: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> Cc: systemd-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-bluetooth@vger.kernel.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@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ä
Intel

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

* [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-06-20 16:42 ` [PATCH v2] " Ville Syrjala
  2018-11-05 17:54   ` Ville Syrjälä
@ 2018-12-04 20:41   ` Ville Syrjala
  2018-12-05  7:06     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 14+ messages in thread
From: Ville Syrjala @ 2018-12-04 20:41 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Dmitry Torokhov, Greg Kroah-Hartman, Marcel Holtmann,
	Kay Sievers, Zbigniew Jędrzejewski-Szmek, systemd-devel,
	linux-kernel

From: Ville Syrjälä <ville.syrjala@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 <dmitry.torokhov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Cc: systemd-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-bluetooth@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


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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-04 20:41   ` [PATCH v2 BlueZ] " Ville Syrjala
@ 2018-12-05  7:06     ` Greg Kroah-Hartman
  2018-12-05 15:40       ` Ville Syrjälä
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-05  7:06 UTC (permalink / raw)
  To: Ville Syrjala
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

On Tue, Dec 04, 2018 at 10:41:17PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@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.

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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05  7:06     ` Greg Kroah-Hartman
@ 2018-12-05 15:40       ` Ville Syrjälä
  2018-12-05 19:09         ` Dag B
  2018-12-05 19:20         ` Greg Kroah-Hartman
  0 siblings, 2 replies; 14+ messages in thread
From: Ville Syrjälä @ 2018-12-05 15:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

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ä <ville.syrjala@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.
> 
> 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 15:40       ` Ville Syrjälä
@ 2018-12-05 19:09         ` Dag B
  2018-12-05 19:21           ` Greg Kroah-Hartman
  2018-12-05 19:20         ` Greg Kroah-Hartman
  1 sibling, 1 reply; 14+ messages in thread
From: Dag B @ 2018-12-05 19:09 UTC (permalink / raw)
  To: Ville Syrjälä, Greg Kroah-Hartman
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel



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ä <ville.syrjala@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.
>> 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 15:40       ` Ville Syrjälä
  2018-12-05 19:09         ` Dag B
@ 2018-12-05 19:20         ` Greg Kroah-Hartman
  2018-12-05 19:40           ` Ville Syrjälä
  1 sibling, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-05 19:20 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

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ä <ville.syrjala@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.
> > 
> > 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 19:09         ` Dag B
@ 2018-12-05 19:21           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-05 19:21 UTC (permalink / raw)
  To: Dag B
  Cc: Ville Syrjälä,
	linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

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ä <ville.syrjala@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.
> > > 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 19:20         ` Greg Kroah-Hartman
@ 2018-12-05 19:40           ` Ville Syrjälä
  2018-12-05 19:49             ` Greg Kroah-Hartman
  0 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjälä @ 2018-12-05 19:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

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ä <ville.syrjala@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.
> > > 
> > > 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 19:40           ` Ville Syrjälä
@ 2018-12-05 19:49             ` Greg Kroah-Hartman
  2019-04-23 15:41               ` Ville Syrjälä
  0 siblings, 1 reply; 14+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-05 19:49 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

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ä <ville.syrjala@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.
> > > > 
> > > > 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

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

* Re: [PATCH v2 BlueZ] hid2hci: Fix udev rules for linux-4.14+
  2018-12-05 19:49             ` Greg Kroah-Hartman
@ 2019-04-23 15:41               ` Ville Syrjälä
  0 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2019-04-23 15:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-bluetooth, Dmitry Torokhov, Marcel Holtmann, Kay Sievers,
	Zbigniew Jędrzejewski-Szmek, systemd-devel, linux-kernel

On Wed, Dec 05, 2018 at 08:49:16PM +0100, Greg Kroah-Hartman wrote:
> 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ä <ville.syrjala@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.
> > > > > 
> > > > > 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?

I totally forgot about this until another bluez update happened
and the CPU hog came back.

I had another look at this and I suppose the problem is caused by
USBFS_IOCTL_DISCONNECT being called for every bind/unbind event.
So I think this patch is still the right way to go.

I did find a few more bugs in hid2hci but those don't actually make
any real difference here. I'll send separate patches for those anyway.

-- 
Ville Syrjälä
Intel

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

end of thread, other threads:[~2019-04-23 15:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 13:06 [PATCH bluez] hid2hci: Fix udev rules for linux-4.14+ Ville Syrjala
2018-05-07 17:44 ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
2018-06-20 16:46   ` Ville Syrjälä
2018-06-20 16:42 ` [PATCH v2] " Ville Syrjala
2018-11-05 17:54   ` Ville Syrjälä
2018-12-04 20:41   ` [PATCH v2 BlueZ] " Ville Syrjala
2018-12-05  7:06     ` Greg Kroah-Hartman
2018-12-05 15:40       ` Ville Syrjälä
2018-12-05 19:09         ` Dag B
2018-12-05 19:21           ` Greg Kroah-Hartman
2018-12-05 19:20         ` Greg Kroah-Hartman
2018-12-05 19:40           ` Ville Syrjälä
2018-12-05 19:49             ` Greg Kroah-Hartman
2019-04-23 15:41               ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).