Sounds to me like there needs to be a flush of the processor cache<div>by using memory barriers.</div><div><br><div><div>I&#39;m guessing that the IRQ is taken on a different thread and possibly</div><div>a different processor and the value needs to be flushed. You might</div>

<div>try having devid be an atomic_t and then use atomic_set</div><div>and atomic_read so that the &quot;proper&quot; memory barriers are used.</div><div><br></div><div>See: <a href="http://www.kernel.org/doc/Documentation/atomic_ops.txt">http://www.kernel.org/doc/Documentation/atomic_ops.txt</a></div>

<div><br></div><div>-- Wink</div><div><br><div><br><div class="gmail_quote">On Tue, Apr 10, 2012 at 1:22 PM, Christopher Harvey <span dir="ltr">&lt;<a href="mailto:chris@basementcode.com">chris@basementcode.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a high level question about how IRQs work in the kernel.<br>
<br>
I have a struct that was kmalloc&#39;d into ram. Within this struct there<br>
is an int, called devid. When I set this devid to a number that isn&#39;t<br>
0, I print the following:<br>
<br>
checking devid value....327683 in 0xcb6953d4<br>
<br>
where 327683 is the value of the int and 0xcb6953d4 is the address of<br>
the struct that the devid value is in.<br>
<br>
Then an interrupt happens and when I print this value again at the<br>
beginning of the interrupt handler I get the following printed text:<br>
<br>
checking devid value....0 in 0xcb6953d4<br>
<br>
notice that the devid has been set to 0. I can&#39;t find any code on my<br>
end that would do this. Is there something, maybe related to memory<br>
address spaces in IRQ handlers that I don&#39;t know about?<br>
<br>
The IRQ and the setting of the devid value happen fairly close to<br>
each other in time. (like less than a second, or closer)<br>
<br>
Any ideas or guesses are appreciated.<br>
<br>
-Chris<br>
<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div></div></div></div>