public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* possible scsi driver bugs with atomic_set/atomic_read and missing barrier
@ 2009-03-11  3:25 Mike Christie
  2009-03-11  3:39 ` Matthew Wilcox
  2009-03-11  8:45 ` Stefan Richter
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Christie @ 2009-03-11  3:25 UTC (permalink / raw)
  To: SCSI Mailing List

Hi,

A couple scsi drivers will use a atomic_t for some host/device state.

They will do:

atomic_set(&hba->state, SOME_STATE_VALUE);

in a interrupt or thread or tasklet then in another thread they will do


if (atomic_read(&hba->state) == SOME_STATE_VALUE))



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();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-11  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-11  3:25 possible scsi driver bugs with atomic_set/atomic_read and missing barrier Mike Christie
2009-03-11  3:39 ` Matthew Wilcox
2009-03-11  9:36   ` Stefan Richter
2009-03-11  8:45 ` Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox