From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Garcia Jérémie" <GARCIAJ@3il.fr>
Cc: linuxppc-dev list <linuxppc-dev@ozlabs.org>
Subject: Re: Interrupt disabling design
Date: Fri, 08 Apr 2005 09:58:36 +1000 [thread overview]
Message-ID: <1112918316.9518.338.camel@gaston> (raw)
In-Reply-To: <D4FDDD1349B5AC46B68FC26AD8AF42D6226B1B@exnet.3il.fr>
On Thu, 2005-04-07 at 12:23 +0200, Garcia Jérémie wrote:
> Hi everybody,
> I'm trying to emulate a VxWorks-designed application under a linux montavista environment.
> In this application I have critical portion of code which need the interrupts disabled as below:
>
> -------------------------------------
> lockKey = OSIntrLock();some
> .
> . // my critical code
> .
> bsos1IntrUnlock(lockKey);
> -------------------------------------
> As you can see we use an OS encapsulation layer which is used to call the OS routines:
On Linux, you can disable interrupts only on the current CPU. If your HW
is SMP, that cannot work, you need to complement the interrupt disabling
with a spinlock.
> ----------------------------
> int OSIntrLock(void)
> {
> return (intLock()); // vxWorks routine
> }
>
> void OSIntrUnlock(int lockKey)
> {
> intUnlock(lockKey); // vxWorks routine
> }
> ----------------------------
>
> Furthermore, I'm running my "VxWorks emulator" in the user-space and I'm not allowed to modify files others than the OS encapsulation layer ones.
> So, how can I use the "cli() / sti()" functions from the user space as below:
You cannot. Never. Forget it. If you ever need to actually disable
interrupts, you have to be a kernel driver. Period. Wrong model.
>
> | USER-SPACE | --> | KERNEL-SPACE | --> | USER-SPACE | --> | KERNEL-SPACE | --> | USER-SPACE |
> | | | | | | | | | |
> | OSIntrLock() | | cli() | | my critical code | | sti() | | ..... |
> | OSIntrUnlock() |
>
> Is it possible to do that? Cause If I do a "cli()" call, I disable interrupts --> so, will the "sti()" call work?
> If yes, it allows me to make my own system call to use them from the user space but I'm not really sure...
>
> Tks a lot for your help
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
--
Benjamin Herrenschmidt <benh@kernel.crashing.org>
prev parent reply other threads:[~2005-04-07 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-07 10:23 Interrupt disabling design Garcia Jérémie
2005-04-07 10:19 ` Pantelis Antoniou
2005-04-07 23:58 ` Benjamin Herrenschmidt [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=1112918316.9518.338.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=GARCIAJ@3il.fr \
--cc=linuxppc-dev@ozlabs.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).