On 15/01/2019 21:25, Mark Brown wrote: > On Tue, Jan 15, 2019 at 09:58:55PM +0100, Martin Sperl wrote: > >> Maybe a bigger change to the reduce the complexity of >> the state machine would solve that problem and also >> reduce code complexity... > > Yeah, that's where I was getting to with that test patch I posted. > >> I may find some time over the weekend if no solution >> has been found until then. > > Thanks for volunteering :) > >> The way I would envision it it would have a “state” >> as a level (0=shutdown, 1=hw enabled, 2=in pump, >> 3=in transfer, 4=in hw-mode,...) and a complete >> to allow waking the shutdown thread (and by this >> avoiding the busy wait loop we have now). >> This would replace those idling, busy, and running flags. > > That's a good idea, yes - a single enum much more reflects what we can > actually do in terms of transitions. > >> Drawback: it is invasive, but let us see what it >> really looks like... > > I think we need to either drop your change (which would be bad since it > is a big performance improvement, I'd punted it for later when I did the > original refactoring to push the work into the caller threads then never > got around to it) or have a invasive changes to make the new situation > clearer. Right now things are just far too complex to reason about > which isn't helping anyone. What I am seeing on Tegra is that the SPI controller is no longer runtime-pm suspended and so while this may improve performance, I think that this change is going to have a negative impact on idle power. I would be surprised if this problem is specific to Tegra because I don't see how the controller's busy state can ever be cleared :-( Cheers Jon -- nvpublic