On Monday 26 February 2007 9:51 am, Andrea Arcangeli wrote: > On Mon, Feb 26, 2007 at 09:36:55AM -0800, David Brownell wrote: > > That's not a heuristic ... as I assume you know. No guesswork > > You assume wrong, I know nothing about that code, ...
I was referring to the definition of a "heuristic". Quoting Wikipedia, the relevant part: Heuristics are intended to gain computational performance or conceptual simplicity, potentially at the cost of accuracy or precision. (Or more classically, trading off correctness in some cases to achive simplicity ... mostly when a correct algorithm would be a real PITA to implement; or is too slow; or hasn't been defined.) The relevant code is straightforward, and implements exactly the "max 90% bandwidth available for periodic transfers" requirement. Really simple stuff; no need to trade off aginst correctness. Ergo: "not a heuristic". > The resolution is choosed with the ioctl _after_ opening the device, > this the open syscall failing so there's no chance for the kernel to > even know what the peak usage of the camera will be, unless it _first_ > allows zoneminder to open the device (so than it can run the proper > ioctl setting the format and the resolution of the video grab). Sounds then like the open() is being weird. Nothing issued a read yet; nothing yet said how much bandwidth a read should consume. So it has no business submitting an URB (and thus causing ENOSPC). It may be that a case could be made that the error is in the relevant video driver... An "lsusb -v" of the devices on that bus, before you open, should help sort the details, also the relevant /sys/class/usb_host/usbN/periodic file (you may need to configure USB_DEBUG). You'll surely observe that everything behaves as long as you don't overcommit the bandwidth. And that the ENOSPC error is reported only if you try to overcommit. > And would you then please explain why the bug goes away with my patch? ;) You're replacing one bug ("operator error") by adding a kernel bug (overcommit of periodic bandwidth). I'm quite certain you've seen cases where one bug papers over another. This would be a case of wanting to introduce a bug to achieve that papering-over... - Dave ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel