On Tue, 02 Sep 2008, Zhao Yakui wrote: > On Tue, 2008-09-02 at 00:59 +0400, Alexey Starikovskiy wrote: > > Alexey Starikovskiy wrote: > In this patch when timeout happens, EC will try the GPE interrupt mode > after 5 seconds.Of course EC will be in polling mode before switching to > GPE interrupt mode. It seems reasonable. Yeah, the patch looks good. But we probably want to limit the number of times it will try to re-enable interrupt mode, otherwise it will keep firing on ECs that are permanently broken re. GPE interrupt mode. I think trying 5 times should be enough, that gives a 25s window for the EC to get its act together. And we should probably reset the "attempted tries to switch to GPE interrupt mode" counter (so that the code will retry interrupt mode again) after events that are likely to have done a lot of internal churning to the EC. Currently, those would be when resuming from S3 or S4, I think. > In fact there also exists the mode switch from polling mode to interrupt > mode after EC is initialized. Is it more appropriate that ec->gpe_retry > is initialized? We could use the same code to do the initial switch, indeed. The two other things that we probably want to make sure we are doing are: 1. Drain the entire EC queue at every poll cycle (this is a must, really). 2. Try to drain the entire EC queue also in interrupt mode, but be careful about dumb ECs that will sign 10 interrupts if there are 10 bytes to read in the queue, even when we have drained the queue when servicing the very first interrupt. I bet there are ECs which will give you just one interrupt and expect the queue to be drained, ECs which will give you interrupts until you drain the queue (but no more than necessary), and ECs which will give you interrupts for as many bytes as it stored in the queue, regardless of when they were read... and we mustn't think there is an interrupt storm happening because of this. -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html