Re: race conditions

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

 



Jan Hudec <bulb@ucw.cz> writes:

> On Thu, Jun 10, 2004 at 13:23:50 -0400, Ed L Cashin wrote:
>> Can anybody point out a specific problem with the (2.4) code below?
>> When I saw it, it made me uneasy because I'd heard somewhat vague
>> warnings against doing stuff like this.  I can't see how the x86
>> implementation could have a problem, but maybe some other architecture
>> would?
>
> Sure I can -- I have looked at actual implementations when I was
> answering previous question....
>
>> static struct mylock {
>>        spinlock_t lock;
>>        unsigned long flags;
>> } mylock;

Thanks for that great explanation! 

I should have seen immediately that by sharing the flags variable in
a static data structure, multiple CPUs would race.

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/


--
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