From: Stanislav Meduna <stano@meduna.org>
To: Jacky Lam <lamshuyin@gmail.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: Protection of critical section in PREEMPT_RT
Date: Tue, 22 Jan 2013 11:24:47 +0100 [thread overview]
Message-ID: <50FE68EF.8060909@meduna.org> (raw)
In-Reply-To: <CAHX1yNTSObcxNrvsBnPw8QzUWTb4zzs_faZZ1bbGU1L8xzgpsQ@mail.gmail.com>
On 22.01.2013 04:29, Jacky Lam wrote:
> I have a kernel driver needed to do a indirect register access
> to a hardware interface. In past, I use spinlock to protect
> those code. After turning on PREEMPT_RT, the driver doesn't
> work anymore.
I'm not an expert but AFAIK the spinlock still does the protection,
it just can be preempted. If your driver does not work, there
is either a timing issue as well (i.e. you have time constraints
that are not met when the spinlock is preempted) or there is
a bug that is triggered by the preemption (such as unprotected
access in the code that preempts your spinlock).
> I know spinlock is now preemptible, but how can I protect a "really"
> critical section in PREEMPT_RT? If it is a bad design, could give me
> some tutorial/readings on how to modify my driver?
https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
says
Critical sections protected by i.e. spinlock_t and rwlock_t are now
preemptible. The creation of non-preemptible sections (in kernel) is
still possible with raw_spinlock_t (same APIs like spinlock_t)
However, try to identify the real culprit first.
--
Stano
next prev parent reply other threads:[~2013-01-22 10:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 3:29 Protection of critical section in PREEMPT_RT Jacky Lam
2013-01-22 10:24 ` Stanislav Meduna [this message]
2013-01-31 9:27 ` Jacky Lam
2013-01-31 19:52 ` Frank Rowand
2013-02-04 7:27 ` Jacky Lam
2013-02-04 10:40 ` Thomas Gleixner
2013-02-05 1:40 ` Jacky Lam
2013-02-05 10:05 ` Thomas Gleixner
2013-02-06 1:59 ` Jacky Lam
2013-02-06 8:56 ` Stanislav Meduna
2013-02-13 11:31 ` Thomas Gleixner
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=50FE68EF.8060909@meduna.org \
--to=stano@meduna.org \
--cc=lamshuyin@gmail.com \
--cc=linux-rt-users@vger.kernel.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).