* [patch 2/3] hci_usb: remove code obfuscation
@ 2008-04-18 20:46 akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
2008-04-18 21:07 ` Marcel Holtmann
[not found] ` <200804182046.m3IKks86014628-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
0 siblings, 2 replies; 10+ messages in thread
From: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b @ 2008-04-18 20:46 UTC (permalink / raw)
To: marcel-kz+m5ild9QBg9hUCZPvPmw
Cc: hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, pavel-+ZI9xUNit7I,
pavel-AlSwsSmVLrQ
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
_urb_free is an alias for kfree... making code longer & harder to
read. Remove it.
Signed-off-by: Pavel Machek <pavel-AlSwsSmVLrQ@public.gmane.org>
Cc: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
Cc: Dave Young <hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
---
drivers/bluetooth/hci_usb.c | 10 +++++-----
drivers/bluetooth/hci_usb.h | 5 -----
2 files changed, 5 insertions(+), 10 deletions(-)
diff -puN drivers/bluetooth/hci_usb.c~hci_usb-remove-code-obfuscation drivers/bluetooth/hci_usb.c
--- a/drivers/bluetooth/hci_usb.c~hci_usb-remove-code-obfuscation
+++ a/drivers/bluetooth/hci_usb.c
@@ -265,7 +265,7 @@ static int hci_usb_intr_rx_submit(struct
BT_ERR("%s intr rx submit failed urb %p err %d",
husb->hdev->name, urb, err);
_urb_unlink(_urb);
- _urb_free(_urb);
+ kfree(_urb);
kfree(buf);
}
return err;
@@ -302,7 +302,7 @@ static int hci_usb_bulk_rx_submit(struct
BT_ERR("%s bulk rx submit failed urb %p err %d",
husb->hdev->name, urb, err);
_urb_unlink(_urb);
- _urb_free(_urb);
+ kfree(_urb);
kfree(buf);
}
return err;
@@ -353,7 +353,7 @@ static int hci_usb_isoc_rx_submit(struct
BT_ERR("%s isoc rx submit failed urb %p err %d",
husb->hdev->name, urb, err);
_urb_unlink(_urb);
- _urb_free(_urb);
+ kfree(_urb);
kfree(buf);
}
return err;
@@ -431,7 +431,7 @@ static void hci_usb_unlink_urbs(struct h
husb->hdev->name, _urb, _urb->type, urb);
kfree(urb->setup_packet);
kfree(urb->transfer_buffer);
- _urb_free(_urb);
+ kfree(_urb);
}
}
}
@@ -490,7 +490,7 @@ static inline int hci_usb_send_ctrl(stru
dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
if (!dr) {
- _urb_free(_urb);
+ kfree(_urb);
return -ENOMEM;
}
} else
diff -puN drivers/bluetooth/hci_usb.h~hci_usb-remove-code-obfuscation drivers/bluetooth/hci_usb.h
--- a/drivers/bluetooth/hci_usb.h~hci_usb-remove-code-obfuscation
+++ a/drivers/bluetooth/hci_usb.h
@@ -60,11 +60,6 @@ struct _urb {
struct urb urb;
};
-static inline void _urb_free(struct _urb *_urb)
-{
- kfree(_urb);
-}
-
static inline void _urb_queue_init(struct _urb_queue *q)
{
INIT_LIST_HEAD(&q->head);
_
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-04-18 20:46 [patch 2/3] hci_usb: remove code obfuscation akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b @ 2008-04-18 21:07 ` Marcel Holtmann [not found] ` <9BEB490E-DE8A-4018-9696-E5074CC638AC-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> [not found] ` <200804182046.m3IKks86014628-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org> 1 sibling, 1 reply; 10+ messages in thread From: Marcel Holtmann @ 2008-04-18 21:07 UTC (permalink / raw) To: akpm; +Cc: hidave.darkstar, linux-bluetooth, netdev, pavel, pavel Hi Andrew, > From: Pavel Machek <pavel@ucw.cz> > > _urb_free is an alias for kfree... making code longer & harder to > read. Remove it. our own URB handling here is broken anyway. It was a bad idea when we did it, but at that time the USB susbsystem was not in that good shape that it is today. So I would say leave this code as it is and concentrate on the new btusb driver, but if it helps anybody I am happy to ACK this one. Regards Marcel ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <9BEB490E-DE8A-4018-9696-E5074CC638AC-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>]
* Re: [patch 2/3] hci_usb: remove code obfuscation [not found] ` <9BEB490E-DE8A-4018-9696-E5074CC638AC-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> @ 2008-04-18 22:34 ` Pavel Machek 2008-04-19 1:28 ` Marcel Holtmann 0 siblings, 1 reply; 10+ messages in thread From: Pavel Machek @ 2008-04-18 22:34 UTC (permalink / raw) To: Marcel Holtmann Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA On Fri 2008-04-18 23:07:10, Marcel Holtmann wrote: > Hi Andrew, > >> From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org> >> >> _urb_free is an alias for kfree... making code longer & harder to >> read. Remove it. > > our own URB handling here is broken anyway. It was a bad idea when we did > it, but at that time the USB susbsystem was not in that good shape that it > is today. So I would say leave this code as it is and concentrate on the > new btusb driver, but if it helps anybody I am happy to ACK this one. It currently corrupts memory (use after free) during suspend, and I'm trying to get that fixed. It is 90% reproducible. And yes, fixing clean code is easier. It could be easily fixed by just not freeing the urbs during disconnect (introducing very very slow memory leak). Would that be acceptable? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-04-18 22:34 ` Pavel Machek @ 2008-04-19 1:28 ` Marcel Holtmann 2008-04-19 16:14 ` Pavel Machek 0 siblings, 1 reply; 10+ messages in thread From: Marcel Holtmann @ 2008-04-19 1:28 UTC (permalink / raw) To: Pavel Machek; +Cc: akpm, hidave.darkstar, linux-bluetooth, netdev Hi Pavel, >>> _urb_free is an alias for kfree... making code longer & harder to >>> read. Remove it. >> >> our own URB handling here is broken anyway. It was a bad idea when >> we did >> it, but at that time the USB susbsystem was not in that good shape >> that it >> is today. So I would say leave this code as it is and concentrate >> on the >> new btusb driver, but if it helps anybody I am happy to ACK this one. > > It currently corrupts memory (use after free) during suspend, and I'm > trying to get that fixed. It is 90% reproducible. that is good, because I can't reproduce it with any of my system. Don't ask me why. I really simply works. So if you figure it out, it would be great. > It could be easily fixed by just not freeing the urbs during > disconnect (introducing very very slow memory leak). Would that be > acceptable? I don't think so. Have you ever tried btusb driver? That code is a lot cleaner and it uses USB anchors for the queued URBs (no home grown broken URB queues). Regards Marcel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-04-19 1:28 ` Marcel Holtmann @ 2008-04-19 16:14 ` Pavel Machek 2008-04-19 17:43 ` Marcel Holtmann 0 siblings, 1 reply; 10+ messages in thread From: Pavel Machek @ 2008-04-19 16:14 UTC (permalink / raw) To: Marcel Holtmann; +Cc: akpm, hidave.darkstar, linux-bluetooth, netdev Hi! >>>> _urb_free is an alias for kfree... making code longer & harder to >>>> read. Remove it. >>> >>> our own URB handling here is broken anyway. It was a bad idea when we did >>> it, but at that time the USB susbsystem was not in that good shape that >>> it >>> is today. So I would say leave this code as it is and concentrate on the >>> new btusb driver, but if it helps anybody I am happy to ACK this one. >> >> It currently corrupts memory (use after free) during suspend, and I'm >> trying to get that fixed. It is 90% reproducible. > > that is good, because I can't reproduce it with any of my system. Don't ask > me why. I really simply works. So if you figure it out, it would be great. There needs to be some load on the usb. I use rsync-over-bt-over-gprs/umts. >> It could be easily fixed by just not freeing the urbs during >> disconnect (introducing very very slow memory leak). Would that be >> acceptable? > > I don't think so. > > Have you ever tried btusb driver? That code is a lot cleaner and it uses > USB anchors for the queued URBs (no home grown broken URB queues). I wish I knew about this one earlier. Yes, it seems to work for me. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-04-19 16:14 ` Pavel Machek @ 2008-04-19 17:43 ` Marcel Holtmann 2008-05-20 15:24 ` Pavel Machek 0 siblings, 1 reply; 10+ messages in thread From: Marcel Holtmann @ 2008-04-19 17:43 UTC (permalink / raw) To: Pavel Machek; +Cc: akpm, hidave.darkstar, linux-bluetooth, netdev Hi Pavel, >>>>> _urb_free is an alias for kfree... making code longer & harder to >>>>> read. Remove it. >>>> >>>> our own URB handling here is broken anyway. It was a bad idea >>>> when we did >>>> it, but at that time the USB susbsystem was not in that good >>>> shape that >>>> it >>>> is today. So I would say leave this code as it is and concentrate >>>> on the >>>> new btusb driver, but if it helps anybody I am happy to ACK this >>>> one. >>> >>> It currently corrupts memory (use after free) during suspend, and >>> I'm >>> trying to get that fixed. It is 90% reproducible. >> >> that is good, because I can't reproduce it with any of my system. >> Don't ask >> me why. I really simply works. So if you figure it out, it would be >> great. > > There needs to be some load on the usb. I use > rsync-over-bt-over-gprs/umts. you told me before and I believe you. This driver is not in its best shape. Weird thing is that I never got it re-produced. If you find the real cause. That would be great. >>> It could be easily fixed by just not freeing the urbs during >>> disconnect (introducing very very slow memory leak). Would that be >>> acceptable? >> >> I don't think so. >> >> Have you ever tried btusb driver? That code is a lot cleaner and it >> uses >> USB anchors for the queued URBs (no home grown broken URB queues). > > I wish I knew about this one earlier. Yes, it seems to work for me. Does this mean you are not fixing hci_usb anymore ;) Regards Marcel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-04-19 17:43 ` Marcel Holtmann @ 2008-05-20 15:24 ` Pavel Machek [not found] ` <20080520152405.GC2067-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Pavel Machek @ 2008-05-20 15:24 UTC (permalink / raw) To: Marcel Holtmann; +Cc: akpm, hidave.darkstar, linux-bluetooth, netdev Hi! >> There needs to be some load on the usb. I use >> rsync-over-bt-over-gprs/umts. > > you told me before and I believe you. This driver is not in its best shape. > Weird thing is that I never got it re-produced. If you find the real cause. > That would be great. The cause seems to be hci_usb_close() racing with the USB core and completion handlers... >>>> It could be easily fixed by just not freeing the urbs during >>>> disconnect (introducing very very slow memory leak). Would that be >>>> acceptable? >>> >>> I don't think so. >>> >>> Have you ever tried btusb driver? That code is a lot cleaner and it uses >>> USB anchors for the queued URBs (no home grown broken URB queues). >> >> I wish I knew about this one earlier. Yes, it seems to work for me. > > Does this mean you are not fixing hci_usb anymore ;) I'm not sure what's next, as hci_usb is still in opensuse11... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <20080520152405.GC2067-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>]
* Re: [patch 2/3] hci_usb: remove code obfuscation [not found] ` <20080520152405.GC2067-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org> @ 2008-05-20 17:26 ` Marcel Holtmann 2008-05-22 22:45 ` Pavel Machek 0 siblings, 1 reply; 10+ messages in thread From: Marcel Holtmann @ 2008-05-20 17:26 UTC (permalink / raw) To: Pavel Machek Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA Hi Pavel, >>> There needs to be some load on the usb. I use >>> rsync-over-bt-over-gprs/umts. >> >> you told me before and I believe you. This driver is not in its >> best shape. >> Weird thing is that I never got it re-produced. If you find the >> real cause. >> That would be great. > > The cause seems to be hci_usb_close() racing with the USB core and > completion handlers... > >>>>> It could be easily fixed by just not freeing the urbs during >>>>> disconnect (introducing very very slow memory leak). Would that be >>>>> acceptable? >>>> >>>> I don't think so. >>>> >>>> Have you ever tried btusb driver? That code is a lot cleaner and >>>> it uses >>>> USB anchors for the queued URBs (no home grown broken URB queues). >>> >>> I wish I knew about this one earlier. Yes, it seems to work for me. >> >> Does this mean you are not fixing hci_usb anymore ;) > > I'm not sure what's next, as hci_usb is still in opensuse11... the goal should be improve btusb. Especially add all the needed quirks from the hci_usb driver to it. I have a patch for it, but I need to reverse the HCI_RESET logic. However if you have hci_usb patches, send them, I will review them and David will happily apply them I guess. Regards Marcel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 2/3] hci_usb: remove code obfuscation 2008-05-20 17:26 ` Marcel Holtmann @ 2008-05-22 22:45 ` Pavel Machek 0 siblings, 0 replies; 10+ messages in thread From: Pavel Machek @ 2008-05-22 22:45 UTC (permalink / raw) To: Marcel Holtmann; +Cc: akpm, hidave.darkstar, linux-bluetooth, netdev Hi! >>>>>> It could be easily fixed by just not freeing the urbs during >>>>>> disconnect (introducing very very slow memory leak). Would that be >>>>>> acceptable? >>>>> >>>>> I don't think so. >>>>> >>>>> Have you ever tried btusb driver? That code is a lot cleaner and it >>>>> uses >>>>> USB anchors for the queued URBs (no home grown broken URB queues). >>>> >>>> I wish I knew about this one earlier. Yes, it seems to work for me. >>> >>> Does this mean you are not fixing hci_usb anymore ;) >> >> I'm not sure what's next, as hci_usb is still in opensuse11... > > the goal should be improve btusb. Especially add all the needed quirks from > the hci_usb driver to it. I have a patch for it, but I need to reverse the > HCI_RESET logic. Could I get a copy of that patch? > However if you have hci_usb patches, send them, I will review them and > David will happily apply them I guess. No, I given up. I was not able to fix close vs. finishing urbs race in a reliable way :-(. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <200804182046.m3IKks86014628-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>]
* Re: [patch 2/3] hci_usb: remove code obfuscation [not found] ` <200804182046.m3IKks86014628-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org> @ 2008-04-20 1:16 ` David Miller 0 siblings, 0 replies; 10+ messages in thread From: David Miller @ 2008-04-20 1:16 UTC (permalink / raw) To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b Cc: marcel-kz+m5ild9QBg9hUCZPvPmw, hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, pavel-+ZI9xUNit7I, pavel-AlSwsSmVLrQ From: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org Date: Fri, 18 Apr 2008 13:46:53 -0700 > _urb_free is an alias for kfree... making code longer & harder to > read. Remove it. > > Signed-off-by: Pavel Machek <pavel-AlSwsSmVLrQ@public.gmane.org> > Cc: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org> > Cc: Dave Young <hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Signed-off-by: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> As long as the code is in the tree, we should accept simplifications that aid to code understanding. Marking drivers broken or deprecated or to-be-replaced is a secondary concern. Therefore I'm applying this patch, thanks Pavel. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-05-22 22:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-18 20:46 [patch 2/3] hci_usb: remove code obfuscation akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
2008-04-18 21:07 ` Marcel Holtmann
[not found] ` <9BEB490E-DE8A-4018-9696-E5074CC638AC-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2008-04-18 22:34 ` Pavel Machek
2008-04-19 1:28 ` Marcel Holtmann
2008-04-19 16:14 ` Pavel Machek
2008-04-19 17:43 ` Marcel Holtmann
2008-05-20 15:24 ` Pavel Machek
[not found] ` <20080520152405.GC2067-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2008-05-20 17:26 ` Marcel Holtmann
2008-05-22 22:45 ` Pavel Machek
[not found] ` <200804182046.m3IKks86014628-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-04-20 1:16 ` David Miller
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).