>-----Original Message----- >From: Alan Cox [mailto:[email protected]] >Sent: Wednesday, November 17, 2010 12:48 PM >To: Gorby, Russ >Cc: [email protected] >Subject: Re: [Meego-kernel] [PATCH] IFX runtime PM patch > >> instrumented and exercised. So if this seems like a wart I'll remove >> it. > >Not it seems like a nasty and subtle problem, but the code you have now >won't fix it merely limit it. > >If your suspend code and your mrdy code both did > > mutex_lock(&some_mutex); > if (!suspended) { > mrdy > } > mutex_unlock(&some_mutex); > >and > > mutex_lock(&some_mutex); > suspended = 1; > suspend_chip > mutex_unlock(&some_mutex) > >I think that would make the race between testing and suspend go away. [Gorby, Russ] I'm sorry I'm not being clear about this. The code you show will certainly interlock the assertion of MRDY and the suspend state within the ifx6x60 driver but I'm not sure if that is sufficient - rather it is the assertion of MRDY in the ifx6x60 driver, and the suspend state in the pw_spi3 driver (which clocks the data) that needs to be interlocked. Admittedly I don't know what guarantees there may be about ordering of suspend states between SPI drivers. If it were guaranteed that a SPI protocol driver is D3 suspended before it's controller driver, and D3 resume was the inverse then I see how this code would solve the problem. Do you know if such ordering guarantees exist for SPI protocol/controller drivers?
> >> >Ok that wants fixing in the SPI code, otherwise we have to fix every >> >SPI device for the same thing which is bonkers. >> > >> >Ok that requires more thought on how to do it properly. >> > >> [Gorby, Russ] OK, let me know what you think. >> >> >Ok so in fact at the point you hit the del_timer the timer cannot in >> >fact be running anyway but must have completed already ? >> >> [Gorby, Russ] correct > >Makes sense - might be worth adding a > > WARN_ON(timer_pending(&ifx_dev->spi_retry_timer)); > >before the del_timer, as it would both add a good debug check and >document very clearly the design assumption. [Gorby, Russ] that's a great idea - thank you. _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
