linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jacky Lam <lamshuyin@gmail.com>
Cc: frank.rowand@am.sony.com, Stanislav Meduna <stano@meduna.org>,
	"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: Protection of critical section in PREEMPT_RT
Date: Wed, 13 Feb 2013 12:31:42 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1302131228320.11905@ionos> (raw)
In-Reply-To: <CAHX1yNSCba2wc7A2UOfdyzZ9z-YTYp+p16s8kHcA0e+r9sy+BQ@mail.gmail.com>

Jacky,

On Wed, 6 Feb 2013, Jacky Lam wrote:
> On Tue, Feb 5, 2013 at 6:05 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > If all issues are resolved, move over to RT and enable the same debug
> > options. Run your code and if it still explodes, post code and kernel
> > dump so we can have a look instead of having this completely pointless
> > discussion over and over.
> >
> 
> I try to make an example to show the problem. Our hardware  use
> indirect method to access the SATA/USB controller internal registers,
> i.e CPU has a SATA/USB IO Addr register and a DATA register. In order
> to read from controller's internal register, I need to put the offset
> into IO Addr register and then read from the IO Data register. As this
> process cannot be interrupted, I need to put a spin_lock_irqsave to
> protect the code.

Right. That's the usual way to solve this.
 
> When driver code is reading the controller's registers and interrupt
> comes, interrupt handler (not the interrupt thread) need to clear the
> interrupt source first and return IRQ_WAKE_THREAD to wait for
> interrupt thread to actually handle the interrupt task. But in order
> to clear the interrupt source, I need to access the controller's
> internal registers. This is the problem I have now.

Do I understand you correct, that you use a threaded interrupt handler
already in the driver?

If yes, then RT is of course not force threading your primary
handler. In that case the protection of the indirect HW access must
use a raw_spinlock not a spinlock.

Thanks,

	tglx

 

      parent reply	other threads:[~2013-02-13 11:31 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
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 [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=alpine.LFD.2.02.1302131228320.11905@ionos \
    --to=tglx@linutronix.de \
    --cc=frank.rowand@am.sony.com \
    --cc=lamshuyin@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=stano@meduna.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).