?

Log in

No account? Create an account
Pete Zaitcev's Journal -- Day [entries|friends|calendar]
Pete Zaitcev

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

[20 Dec 2004|01:52pm]
The usbmon is unveiled today. The whole thing is scant 840 lines of patch.

It had a few precursors, notably Dave Harding's USBmon, which dates back to 2001. However, while doing the right thing at a general level, USBmon was so horrible that it wasn't likely to find its way into kernel.

One thing about usbmon which may not be apparent is how usbmon is a key to my ub strategy. Suppose that I wrote a driver which "never crashes" (quotes mean that this lofty goal was not actually attained and ub had about three oops scenarios at this date, one is still outstanding - sorry, Glenn Maynard!). But even then it still needs a lot of debugging, because it has to talk to a large number of kinky devices. In each case a reliable trace of relevant I/O has to be attained.

The usb-storage tackles this problem in the natural, but stupid way. It simply dumps wads of printks into the dmesg buffer, where they do a couple of things. First, they slow everything down and make the problem harder to reproduce, and second, they get lost just to confuse developer. To get this useful debugging facility, a user has to rebuild usb-storage with CONFIG_USB_STORAGE_DEBUG option enabled. Since this option makes everything so slow, no distro ships it enabled.

In contrast, ub should have no tracing facilities of its own. It simply relies on system-wide tracing such as usbmon. Among other things, it allows to have tracing available always, without a special debugging rebuild. In practice, ub came about too early, so it does have a rudimentary circular buffer of last N commands. Now this crutch can be dropped.

Obviously, usbmon is agnostic to ub, usb-storage, or any other protocol driver. It can be used to improve usb-storage, usb-serial, or whatnot. However, it is required for ub. Ironically, before coming to the help of ub, the usbmon has already been used to resolve a hard to understand bug in usb-storage with RHEL 4 Beta and a new spiffy IBM Bladecenter blade HS-20 (patch to follow).

I am rather pleased with myself at this point, even though the amount of coding involved was quite trivial. But the architecture of usbmon did require some thought. Did I just use the A-word? Hello, Bram Cohen! Your disciple hails you.
post comment

navigation
[ viewing | December 20th, 2004 ]
[ go | previous day|next day ]