From: Lennert B. <bu...@gn...> - 2001-03-03 17:49:26
|
Hi, as SIGIO doesn't seem to be disabled during the SIGIO handler, it looks like there is a potential deadlock since 2.4.2 (as the 2.4.2 SIGIO handler keeps looping until all active descriptors have had all their input handled). - sigio_handler calls do_IRQ to handle input on a certain fd. - During the handling of that IRQ, another event on the same file descriptor comes in, so do_IRQ or one of its children is preempted by sigio_handler. - sigio_handler will call do_IRQ on the active fd, but do_IRQ will return immediately because the irq is marked INPROGRESS. sigio_handler will notice that the fd is still active, so will keep calling do_IRQ ad infinitum. Included is a patch which makes do_IRQ return 0 if the IRQ wasn't handled because it was in progress or disabled, and makes sigio_handler respect do_IRQ's return code. It seems to solve the deadlock for me rather nicely, as my test uml* is still up after about an hour of ping flooding, whereas it never took me more than about 10 seconds to hang it with vanilla 2.4.2. cheers, Lennert * Hostname dev0.math.leidenuniv.nl. It has an account 'guest' with password 'guest'. Feel free to check it out and give it a beating, but please don't abuse it. --- arch/um/kernel/irq_user.c.orig Sat Mar 3 18:33:57 2001 +++ arch/um/kernel/irq_user.c Sat Mar 3 18:33:37 2001 @@ -71,9 +71,11 @@ next = irq_fd->next; if(irq_fd->active){ irq_fd->active = 0; - do_IRQ(irq_fd->irq, user_mode); + if (!do_IRQ(irq_fd->irq, user_mode)) + count--; } } + if(count == 0) break; } if(user_mode){ interrupt_end(); --- arch/um/kernel/irq.c.orig Sat Mar 3 18:34:04 2001 +++ arch/um/kernel/irq.c Sat Mar 3 18:34:24 2001 @@ -328,7 +328,11 @@ if (softirq_active(cpu) & softirq_mask(cpu)) do_softirq(); - return 1; + + if (action != NULL) + return 1; + + return 0; } /** |