kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: IRQs and memory consistency
Date: Wed, 11 Apr 2012 10:18:42 +0700	[thread overview]
Message-ID: <CAGdaadYCNy5B14xe+Wrpc6cOsXx7K-4pFaOvrhFt+TAN8VwSOA@mail.gmail.com> (raw)
In-Reply-To: <18680507ce5fe185f8355a813376bd26@basementcode.com>

Hi....

On Wed, Apr 11, 2012 at 03:22, Christopher Harvey
<chris@basementcode.com> wrote:
> 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.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

  parent reply	other threads:[~2012-04-11  3:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 20:22 IRQs and memory consistency Christopher Harvey
2012-04-11  0:58 ` Wink Saville
2012-04-11 11:59   ` Christopher Harvey
2012-04-11 15:35     ` Wink Saville
2012-04-11 20:14       ` Christopher Harvey
2012-04-11  3:18 ` Mulyadi Santosa [this message]
2012-04-11 11:53   ` Christopher Harvey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGdaadYCNy5B14xe+Wrpc6cOsXx7K-4pFaOvrhFt+TAN8VwSOA@mail.gmail.com \
    --to=mulyadi.santosa@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).