From: Rik van Riel <riel@surriel.com>
To: Rick Brown <rick.brown.3@gmail.com>
Cc: kernelnewbies@nl.linux.org, linux-kernel@vger.kernel.org
Subject: Re: Spinlock query
Date: Tue, 29 Aug 2006 23:10:43 -0400 [thread overview]
Message-ID: <44F501B3.9070200@surriel.com> (raw)
In-Reply-To: <7783925d0608291912i3f04d460kc9edebf9d358dbc3@mail.gmail.com>
Rick Brown wrote:
> Hi,
>
> In my driver (Process context), I have written the following code:
>
> --------------------------------------------
> spin_lock(lock)
> ...
> //Critical section to manipulate driver data
... interrupt hits here
interrupt handler tries to grab the spinlock, which is already taken
*BOOM*
> spin_u lock(lock)
> ---------------------------------------------
>
> I have written similar code in my interrupt handler (Interrupt
> context). The driver data is not accessed from anywhere else. Is my
> code safe from any potential concurrency issues? Is there a need to
> use spin_lock_irqsave()? In both the places?
You need to use spin_lock_irqsave() from process context.
From the interrupt handler itself it doesn't hurt, but it
shouldn't matter much since interrupt handlers should not
get preempted.
--
What is important? What you want to be true, or what is true?
next prev parent reply other threads:[~2006-08-30 3:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 2:12 Spinlock query Rick Brown
2006-08-30 3:10 ` Rik van Riel [this message]
2006-08-30 5:31 ` Rajat Jain
2006-08-30 6:04 ` Vin
2006-08-30 12:03 ` Rik van Riel
[not found] ` <fa2bedd60608292159ra9fce70wd1dbc8231d9c052c@mail.gmail.com>
2006-09-01 2:31 ` Rajat Jain
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=44F501B3.9070200@surriel.com \
--to=riel@surriel.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rick.brown.3@gmail.com \
/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