Re: spinlock & volatile

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

 



On Tue, May 13, 2003 at 08:03:30PM +0200, Frank A. Uepping wrote:
> Hi,
> assume we have this:
> 
> struct {
> 	spinlock_t lock;
> 	int flag;
> 	/* Some other stuff... */
> } v;
> 
> v is accessed from different execution contexts including from ISR.
> While accessing v the lock will be held.
> However, do I have to qualify flag (and the other stuff) volatile
> to make sure that the users of v always see the most recent
> version of it?
> Or does spin_un/lock() imply *memory sync* (some form of
> barrier() or whatever)?

spin_lock is specified to have effect of mb().

AFAIK volatile is too waek on SMP anyway so you would need to use
mb() anyway...

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux