Re: possible scsi driver bugs with atomic_set/atomic_read and missing barrier

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

 



Mike Christie wrote:
...
> In the Documentation/atomic_ops.txt it says:
> 
> 	atomic_read does not guarantee that the runtime
> 	initialization by any other thread is visible yet, so the user of the
> 	interface must take care of that with a proper implicit or
> 	explicit memory barrier.
> 
> Does this mean that the drivers should be doing a
> 
> atomic_set(&hba->state, SOME_STATE_VALUE);
> smp_mb();

Barriers --- or locks even --- are required if there are dependencies
between the state variable and other data.

(Use a barrier if you need to ensure ordering of accesses.  Use a lock
if you need to combine multiple operations into an atomic whole.  Lock/
unlock also imply barriers.)
-- 
Stefan Richter
-=====-==--= --== -=-==
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux