kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: chris@basementcode.com (Christopher Harvey)
To: kernelnewbies@lists.kernelnewbies.org
Subject: IRQs and memory consistency
Date: Wed, 11 Apr 2012 06:53:27 -0500	[thread overview]
Message-ID: <7f3d57699a606aa5f9d4b73bd89b58ab@basementcode.com> (raw)
In-Reply-To: <CAGdaadYCNy5B14xe+Wrpc6cOsXx7K-4pFaOvrhFt+TAN8VwSOA@mail.gmail.com>

On 10.04.2012 22:18, Mulyadi Santosa wrote:
> 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.

well, actually my does does this:

set variable->init hardware->interrupt

the interrupt can't happen until 'init hardware'

      reply	other threads:[~2012-04-11 11:53 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
2012-04-11 11:53   ` Christopher Harvey [this message]

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=7f3d57699a606aa5f9d4b73bd89b58ab@basementcode.com \
    --to=chris@basementcode.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).