Re: [PATCH 1/9] macintosh/via-macii: Access autopoll_devs when inside lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 9 Aug 2020, Guenter Roeck wrote:

Hi,

On Sun, Jun 28, 2020 at 02:23:12PM +1000, Finn Thain wrote:
The interrupt handler should be excluded when accessing the 
autopoll_devs variable.


I am quite baffled by this patch. Other than adding an unnecessary lock 
/ unlock sequence,

The new lock/unlock sequence means that the expression (autopoll_devs && 
!current_req) can be understood to be atomic. That makes it easier for me 
to follow (being that both variables are shared state).

accessing a variable (which is derived from another variable) from 
inside or outside a lock does not make a difference. If autopoll_devs = 
devs & 0xfffe is 0 inside the lock, it will just as much be 0 outside 
the lock, and vice versa.

Can you explain this in some more detail ? Not that is matters much 
since the change already made it into mainline, but I would like to 
understand what if anything I am missing here.


I think the new code is more readable and is obviously free of race 
conditions. It's not obvious to me why the old code was free of race 
conditions but if you can easily establish that by inspection then you are 
a better auditor than I am. Regardless, I'll stick with "Keep It Simple, 
Stupid".



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux