Bluetooth: handle device reset event
Subsystems (2)
PATCH v2 1/1 Bluetooth: handle device reset event
From: Gregory Paskar <[email protected]>
A Bluetooth device experiencing hardware failure may issue a HARDWARE_ERROR hci event. The reaction to this event is device reset flow implemented in following sequence.
1. Notify: HCI_DEV_DOWN
2. Reinitialize internal structures.
3. Call driver flush function
4. Send HCI reset request to the device.
5. Send HCI init sequence reset to the device.
6. Notify HCI_DEV_UP.
---
V2:
1. Fix email typo
2. Fix style issues
include/net/bluetooth/hci.h | 5 ++++ include/net/bluetooth/hci_core.h | 2 + net/bluetooth/hci_core.c | 47 +++++++++++++++++++++++++++++++++++++- net/bluetooth/hci_event.c | 3 ++ 4 files changed, 56 insertions(+), 1 deletions(-)
include/net/bluetooth/hci.h +5 -0
@@ -691,6 +691,11 @@ struct hci_ev_cmd_status {__le16 opcode; } __attribute__ ((packed)); +#define HCI_EV_HARDWARE_ERROR 0x10 +struct hci_ev_hw_error { +__u8 hw_code; +} __attribute__ ((packed)); +#define HCI_EV_ROLE_CHANGE 0x12struct hci_ev_role_change {__u8 status;
include/net/bluetooth/hci_core.h +2 -0
@@ -110,6 +110,8 @@ struct hci_dev {struct tasklet_struct rx_task;struct tasklet_struct tx_task; +struct work_struct hw_err_work; +struct sk_buff_head rx_q;struct sk_buff_head raw_q;struct sk_buff_head cmd_q;
net/bluetooth/hci_core.c +46 -1
59 lines not on this page · raw message
net/bluetooth/hci_event.c +3 -0
@@ -1953,6 +1953,9 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)case HCI_EV_REMOTE_HOST_FEATURES :hci_remote_host_features_evt (hdev, skb);break ; +case HCI_EV_HARDWARE_ERROR : +schedule_work (&hdev->hw_err_work); +break ;default :BT_DBG ("%s event 0x%x" , hdev->name, event);
Signature · 9 lines
1.6.0.6 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
[bluetooth-next] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul
--- net/bluetooth/hci_sysfs.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
net/bluetooth/hci_sysfs.c +12 -12
@@ -286,11 +286,11 @@ static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *atstatic ssize_t store_idle_timeout (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct hci_dev *hdev =dev_get_drvdata (dev); -char *ptr; -__u32 val; +unsigned long val; +int ret; - val =simple_strtoul (buf, &ptr,10 ); -if (ptr == buf) + ret =strict_strtoul (buf,0 , &val); +if (ret)return -EINVAL ;if (val !=0 && (val <500 || val >3600000 ))
@@ -310,11 +310,11 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribustatic ssize_t store_sniff_max_interval (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct hci_dev *hdev =dev_get_drvdata (dev); -char *ptr; -__u16 val; +unsigned long val; +int ret; - val =simple_strtoul (buf, &ptr,10 ); -if (ptr == buf) + ret =strict_strtoul (buf,0 , &val); +if (ret)return -EINVAL ;if (val <0x0002 || val >0xFFFE || val %2 )
@@ -337,11 +337,11 @@ static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribustatic ssize_t store_sniff_min_interval (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct hci_dev *hdev =dev_get_drvdata (dev); -char *ptr; -__u16 val; +unsigned long val; +int ret; - val =simple_strtoul (buf, &ptr,10 ); -if (ptr == buf) + ret =strict_strtoul (buf,0 , &val); +if (ret)return -EINVAL ;if (val <0x0002 || val >0xFFFE || val %2 )
Signature · 9 lines
1.6.0.6 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Marcel Holtmann
maintainerHi Tomas,
Quoted 10 lines
A Bluetooth device experiencing hardware failure may issue a
HARDWARE_ERRORhci event. The reaction to this event is device reset flow implemented in following sequence.1. Notify:
HCI_DEV_DOWN
2. Reinitialize internal structures.
3. Call driver flush function
4. Send HCI reset request to the device.
5. Send HCI init sequence reset to the device.
6. NotifyHCI_DEV_UP.
I prefer if we create a generic per controller workqueue first before having a workqueue for every task. Something similar to what the mac80211 layer offers right now.
Also in a second step we might wanna move the HCI event processing completely into a workqueue. If we get no performance hit with that, then sysfs handling and device reset becomes a lot simpler and less prone to race conditions with device removal.
Regards
Marcel
Marcel Holtmann
maintainerRe: [bluetooth-next] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul
In reply to Tomas WinklerHi Tomas,
Quoted 4 lines
Signed-off-by Tomas Winkler <[email protected]>--- net/bluetooth/hci_sysfs.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
can you please explain the rational behind this change. What is the benefit? I just fail to see it right away.
Regards
Marcel
RE: [bluetooth-next] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogTWFyY2VsIEhvbHRtYW5u IFttYWlsdG86bWFyY2VsQGhvbHRtYW5uLm9yZ10NCj4gU2VudDogVHVlc2RheSwgTWFyY2ggMDks IDIwMTAgMzowNCBBTQ0KPiBUbzogV2lua2xlciwgVG9tYXMNCj4gQ2M6IGxpbnV4LWJsdWV0b290 aEB2Z2VyLmtlcm5lbC5vcmc7IENvaGVuLCBHdXk7IFJpbmRqdW5za3ksIFJvbg0KPiBTdWJqZWN0 OiBSZTogW2JsdWV0b290aC1uZXh0XSBibHVldG9vdGg6IGhjaV9zeXNmczogdXNlIHN0cmljdF9z dHJ0b3VsDQo+IGluc3RlYWQgb2Ygc2ltcGxlX3N0cnRvdWwNCj4gDQo+IEhpIFRvbWFzLA0KPiAN Cj4gPiBTaWduZWQtb2ZmLWJ5OiBUb21hcyBXaW5rbGVyIDx0b21hcy53aW5rbGVyQGludGVsLmNv bT4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z dHJpYnV0aW9uCmJ5IG90aGVycyBpcyBzdHJpY3RseSBwcm9oaWJpdGVkLiBJZiB5b3UgYXJlIG5v dCB0aGUgaW50ZW5kZWQKcmVjaXBpZW50LCBwbGVhc2UgY29udGFjdCB0aGUgc2VuZGVyIGFuZCBk ZWxldGUgYWxsIGNvcGllcy4K
Marcel Holtmann
maintainerRE: [bluetooth-next] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul
Hi Tomas,
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Signed-off-by Tomas Winkler <[email protected]>--- net/bluetooth/hci_sysfs.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)can you please explain the rational behind this change. What is the benefit? I just fail to see it right away.
The real reason using strict instead of simple strtoul is explained here thttp://www.kernel.org/doc/htmldocs/kernel-api/re42.html
In the bottom line it just something a chackpatch is complain about. I've touched the file to insert some test hook for the HCI reset so I fixed that on the way.
I am fine with that. However please use the following constructs:
if (strict_strtoul(...) < 0) return -EINVAL;
There is no point in having ret variable if you don't use it.
Also I like to have a commit body and not only a subject line. It doesn't have to be a novel, but only the subject is not good enough for me.
Regards
Marcel
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogTWFyY2VsIEhvbHRtYW5u IFttYWlsdG86bWFyY2VsQGhvbHRtYW5uLm9yZ10NCj4gU2VudDogVHVlc2RheSwgTWFyY2ggMDks IDIwMTAgMzowMyBBTQ0KPiBUbzogV2lua2xlciwgVG9tYXMNCj4gQ2M6IGxpbnV4LWJsdWV0b290 aEB2Z2VyLmtlcm5lbC5vcmc7IENvaGVuLCBHdXk7IFJpbmRqdW5za3ksIFJvbjsgUGFza2FyLA0K PiBHcmVnb3J5DQo+IFN1YmplY3Q6IFJlOiBbYmx1ZXRvb3RoLW5leHQgVjJdIEJsdWV0b290aDog aGFuZGxlIGRldmljZSByZXNldCBldmVudA0KPiANCj4gSGkgVG9tYXMsDQo+IA0KPiA+I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ing hardware failure may issue a
HARDWARE_ERRORhci event. The reaction to this event is device reset flow implemented in following sequence.1. Notify:
HCI_DEV_DOWN
2. Reinitialize internal structures.
3. Call driver flush function
4. Send HCI reset request to the device.
5. Send HCI init sequence reset to the device.
6. NotifyHCI_DEV_UP.
Quoted 6 lines
Quoted 3 lines
I prefer if we create a generic per controller workqueue first before having a workqueue for every task. Something similar to what the mac80211 layer offers right now.
That would be good approach but we are using default kernel workqueue in this solution so there is no workqueue for every task. I'm not sure if this effort should block this patch.
I have an initial patch that I have to dig out. It is actually not that complicated. And I would prefer to get that one first before we apply this patch.
The reason why I really wanna solve this is because of potential race conditions between the workqueue and a device removal. I have a bad feeling that even with the current sysfs workqueue we have a race condition hiding somewhere. So if going forward we have to shift more and more code into workqueues we need a single point where this can be fixed.
Quoted 6 lines
Quoted 4 lines
Also in a second step we might wanna move the HCI event processing completely into a workqueue. If we get no performance hit with that, then sysfs handling and device reset becomes a lot simpler and less prone to race conditions with device removal.
Looks good to me. So when this is ready we can move also the reset also to per controller queue.
I haven't done any performance testing with this approach. So I hope we are not shooting ourselves in the foot with it.
Regards
Marcel
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogTWFyY2VsIEhvbHRtYW5u IFttYWlsdG86bWFyY2VsQGhvbHRtYW5uLm9yZ10NCj4gU2VudDogV2VkbmVzZGF5LCBNYXJjaCAx MCwgMjAxMCA2OjQ5IFBNDQo+IFRvOiBXaW5rbGVyLCBUb21hcw0KPiBDYzogbGludXgtYmx1ZXRv b3RoQHZnZXIua2VybmVsLm9yZzsgQ29oZW4sIEd1eTsgUmluZGp1bnNreSwgUm9uOyBQYXNrYXIs DQo+IEdyZWdvcnkNCj4gU3ViamVjdDogUkU6IFtibHVldG9vdGgtbmV4dCBWMl0gQmx1ZXRvb3Ro OiBoYW5kbGUgZGV2aWNlIHJlc2V0IGV2ZW50DQo+IA0KPiBIaSBUb21hcywNCj4gDQo+ID4gPiA+ IEEg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5IG90aGVycyBpcyBzdHJpY3RseSBwcm9oaWJp dGVkLiBJZiB5b3UgYXJlIG5vdCB0aGUgaW50ZW5kZWQKcmVjaXBpZW50LCBwbGVhc2UgY29udGFj dCB0aGUgc2VuZGVyIGFuZCBkZWxldGUgYWxsIGNvcGllcy4K
Marcel Holtmann
maintainerHi Tomas,
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 10 lines
A Bluetooth device experiencing hardware failure may issue a
HARDWARE_ERRORhci event. The reaction to this event is device reset flow implemented in following sequence.1. Notify:
HCI_DEV_DOWN
2. Reinitialize internal structures.
3. Call driver flush function
4. Send HCI reset request to the device.
5. Send HCI init sequence reset to the device.
6. NotifyHCI_DEV_UP.Quoted 3 lines
I prefer if we create a generic per controller workqueue first before having a workqueue for every task. Something similar to what the mac80211 layer offers right now.
That would be good approach but we are using default kernel workqueue in
Quoted 8 lines
Quoted 6 lines
this solution so there is no workqueue for every task.
Quoted 1 line
I'm not sure if this effort should block this patch.
I have an initial patch that I have to dig out. It is actually not that complicated. And I would prefer to get that one first before we apply this patch.
Okay, I can test this particular flow with your patch if you send it to me.
I pushed the per controller workqueue patch into bluetooth-testing.git tree. Please adapt your patch to that and test it.
Quoted 10 lines
Quoted 6 lines
The reason why I really wanna solve this is because of potential race conditions between the workqueue and a device removal. I have a bad feeling that even with the current sysfs workqueue we have a race condition hiding somewhere. So if going forward we have to shift more and more code into workqueues we need a single point where this can be fixed.
Understood.
In that context I would need to do some more instrumentation to test this kind of race for this feature.
I could be very well that we are protected against such a race. However with moving from tasklet into workqueue I am always cautious. And I wanna make sure that we keep the complexity simple. I want one place to fix if it breaks and not twenty.
Regards
Marcel