> On Tue, Mar 12, 2002 at 06:39:52PM +0530, V Ganesh wrote: > > I'm halfway through. this is the approach I'm using, please comment: > > 1. all *_callback() functions must use GFP_ATOMIC. > > Good. > > > 2. anything inside a spinlock must use GFP_ATOMIC. > > No, we should not be calling usb_submit_urb() with a spinlock held. > Which usb-serial driver is doing this?
ipaq. mea culpa, I'll fix it. also digi_accelport.c where practically all urbs are submitted holding a spinlock. > > 3. *_open(), *_startup(), *_set_termios() use GFP_KERNEL. > > Good. > > > 4. *_write(), *_unthrottle() can be called from user context as well as > > bottom half context. so I define a macro in usb-serial.h > > #define ALLOC_FLAGS (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) > > and use it in these functions. the alternative is to always do a > > GFP_ATOMIC. > > What would cause it to be called from a bottom half? The pppd driver? > For some reason I thought this had been changed. I don't know much about ppp, but strace of pppd shows it completely idle and waiting on a select() throughout the entire session (except the lcp bits). I thought this implied all packets were sent/received in bh/irq context. in any case, I don't think it's right for a low-level driver to constrain what the ldisc may do. e.g. an ldisc might echo characters, and this would happen immediately in the read_callback() context because many drivers call tty_flip_buffer_push(). so the only question seems to be to use GFP_ATOMIC or ALLOC_FLAGS. ganesh _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel