Thread (7 messages) flat view 7 messages, 3 authors, 2012-04-11

IRQs and memory consistency

From: Christopher Harvey <hidden>
Date: 2012-04-11 11:53:27

On 10.04.2012 22:18, Mulyadi Santosa wrote:
Hi....

On Wed, Apr 11, 2012 at 03:22, Christopher Harvey
[off-list ref] wrote:
quoted
The IRQ and the setting of the devid value happen fairly close to
each other in time. (like less than a second, or closer)
Hmmm, and how about the order? which one do you guess go first?
setting value? or the IRQ handler?

I had a sense that your code flow might (in reality) goes like this

allocating struct RAM --> interrupted --> printing struct content -->
back to initialize struct

If that's true, then no wonder 0 (zero) is printed.

I suggest to grab a spin lock if you really need atomicity during
allocation and setting initial value, which in IRQ handler, you grab
the lock before printing. Oh and since memory allocation could go
slow, you might need to do allocation with GFP_ATOMIC.
well, actually my does does this:

set variable->init hardware->interrupt

the interrupt can't happen until 'init hardware'
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help