On Mon, Mar 23, 2020 at 10:31:02AM +0100, Guennadi Liakhovetski wrote:
Ok, understand, but do you see any problems with this specific use case? Thinking about possible replacements - it isn't a case for a ref-count, because it isn't a get-put scenario. We really just need to count a specific event - DSP reboots. It can be the case that this counter doesn't need to be atomic at all. When it is read, the DSP is guaranteed to be up and running - I think. So no race would be possible. I can try to think about this more carefully and maybe make it a normal unprotected counter. But I don't think it has to be protected even better than what these patches are doing.
I think at the very least it probably needs more documentation in the code since I don't recall being able to work out what it was supposed to be doing quickly.