process safe qnx_hint_mask

Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted while
doing “stuff” (assume B and A are of same priority and running round-robin).
Value of old in process B contain disable (because A disable it). The A
manages to finish it renabling interrupt. Then once B finish is it it will
actually disable it, forever :wink:

Only solution I found to this is to create an “IRQ server” that will queue
the request. Am I making any kind of sense?

  • Mario

Mario Charest wrote:

Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted while
doing “stuff” (assume B and A are of same priority and running round-robin).
Value of old in process B contain disable (because A disable it). The A
manages to finish it renabling interrupt. Then once B finish is it it will
actually disable it, forever > :wink:

Only solution I found to this is to create an “IRQ server” that will queue
the request. Am I making any kind of sense?

You could move towards a reference count scheme, with a cover function
to do the mask/unmask (–refcnt == 0 meaning do the unmask) rather than
saving the old state.


\

Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>

“Adam Mallory” <amallory@qnx.com> wrote in message
news:ccgr3t$hpn$1@inn.qnx.com

Mario Charest wrote:
Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted
while doing “stuff” (assume B and A are of same priority and running
round-robin). Value of old in process B contain disable (because A
disable it). The A manages to finish it renabling interrupt. Then once
B finish is it it will actually disable it, forever > :wink:

Only solution I found to this is to create an “IRQ server” that will
queue the request. Am I making any kind of sense?


You could move towards a reference count scheme, with a cover function to
do the mask/unmask (–refcnt == 0 meaning do the unmask) rather than
saving the old state.

refcnt need to be stored in sharemem, things can get hairy if a program dies
in between the mask/unmaks which is why I think a “server” is more
appropriate since
it knows when a program dies.



Cheers,
Adam

QNX Software Systems Ltd.
[ > amallory@qnx.com > ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <> pschon@baste.magibox.net

Mario Charest <nowheretobefound@8thdimension.com> wrote:

MC > “Adam Mallory” <amallory@qnx.com> wrote in message
MC > news:ccgr3t$hpn$1@inn.qnx.com

Mario Charest wrote:
Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted
while doing “stuff” (assume B and A are of same priority and running
round-robin). Value of old in process B contain disable (because A
disable it). The A manages to finish it renabling interrupt. Then once
B finish is it it will actually disable it, forever > :wink:

Only solution I found to this is to create an “IRQ server” that will
queue the request. Am I making any kind of sense?


You could move towards a reference count scheme, with a cover function to
do the mask/unmask (–refcnt == 0 meaning do the unmask) rather than
saving the old state.

MC > refcnt need to be stored in sharemem, things can get hairy if a program dies
MC > in between the mask/unmaks which is why I think a “server” is more
MC > appropriate since
MC > it knows when a program dies.


I don’t think another process can begin execution if interrupts are
disabled. I.E. there effectivly is no timer.

Also, if a process volunterilly gives up the CPU and a task swap takes
place, interrupts are re-enabled.

Mario Charest wrote:

refcnt need to be stored in sharemem, things can get hairy if a program dies
in between the mask/unmaks which is why I think a “server” is more
appropriate since
it knows when a program dies.

The server just provides a single threaded, persistant state API - I
think you could still do it without. OTOH, I suppose it does provide a
cleaner interface in a network distributed senario.


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>

“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:ccjhf3$jth$3@inn.qnx.com

Mario Charest <> nowheretobefound@8thdimension.com> > wrote:

MC > “Adam Mallory” <> amallory@qnx.com> > wrote in message
MC > news:ccgr3t$hpn$> 1@inn.qnx.com> …
Mario Charest wrote:
Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted
while doing “stuff” (assume B and A are of same priority and running
round-robin). Value of old in process B contain disable (because A
disable it). The A manages to finish it renabling interrupt. Then
once
B finish is it it will actually disable it, forever > :wink:

Only solution I found to this is to create an “IRQ server” that will
queue the request. Am I making any kind of sense?


You could move towards a reference count scheme, with a cover function
to
do the mask/unmask (–refcnt == 0 meaning do the unmask) rather than
saving the old state.

MC > refcnt need to be stored in sharemem, things can get hairy if a
program dies
MC > in between the mask/unmaks which is why I think a “server” is more
MC > appropriate since
MC > it knows when a program dies.


I don’t think another process can begin execution if interrupts are
disabled. I.E. there effectivly is no timer.

AFAIK only interrupt 0 affects timers. Masking interrupt 3 for example as
no effet on process switching or other interrupt. Why is why I’m trying to
use
qnx_hint_mask instead of _enable()/_disable().


Also, if a process volunterilly gives up the CPU and a task swap takes
place, interrupts are re-enabled.

Mario Charest <nowheretobefound@8thdimension.com> wrote:

MC > “Bill Caroselli” <qtps@earthlink.net> wrote in message
MC > news:ccjhf3$jth$3@inn.qnx.com

Mario Charest <> nowheretobefound@8thdimension.com> > wrote:

MC > “Adam Mallory” <> amallory@qnx.com> > wrote in message
MC > news:ccgr3t$hpn$> 1@inn.qnx.com> …
Mario Charest wrote:
Is there a way to make qnx_hint_mask process safe.

Imagine process A and B doing

old = qnx_hint_mask( 3, disable )

stuff

qnx_hint_mask( 3, old )


Interrupt is enable when processes are launch. Process A is preempted
while doing “stuff” (assume B and A are of same priority and running
round-robin). Value of old in process B contain disable (because A
disable it). The A manages to finish it renabling interrupt. Then
once
B finish is it it will actually disable it, forever > :wink:

Only solution I found to this is to create an “IRQ server” that will
queue the request. Am I making any kind of sense?


You could move towards a reference count scheme, with a cover function
to
do the mask/unmask (–refcnt == 0 meaning do the unmask) rather than
saving the old state.

MC > refcnt need to be stored in sharemem, things can get hairy if a
program dies
MC > in between the mask/unmaks which is why I think a “server” is more
MC > appropriate since
MC > it knows when a program dies.


I don’t think another process can begin execution if interrupts are
disabled. I.E. there effectivly is no timer.

MC > AFAIK only interrupt 0 affects timers. Masking interrupt 3 for example as
MC > no effet on process switching or other interrupt. Why is why I’m trying to
MC > use
MC > qnx_hint_mask instead of _enable()/_disable().

Sorry. I missed tht point.

Adam Mallory <amallory@qnx.com> wrote:

Mario Charest wrote:

refcnt need to be stored in sharemem, things can get hairy if a program dies
in between the mask/unmaks which is why I think a “server” is more
appropriate since
it knows when a program dies.

The server just provides a single threaded, persistant state API - I
think you could still do it without. OTOH, I suppose it does provide a
cleaner interface in a network distributed senario.

I think that a network distributed mask/unmask server just might be
pushing things a bit, given we don’t have an API to mask/unmask an
interrupt accross the network. (And what would that do to the
latency?)

-David

Please follow-up to newsgroup, rather than personal email.
David Gibbs
QNX Training Services
dagibbs@qnx.com

David Gibbs wrote:

I think that a network distributed mask/unmask server just might be
pushing things a bit, given we don’t have an API to mask/unmask an
interrupt accross the network. (And what would that do to the
latency?)

The whole point of the server is to have a cover API, which just
messages the server to do the work of masking/unmasking. Doing this
messaging over the network would most definately work fine.

Besides, I wasn’t really being serious - it’s just an interesting data
point. :slight_smile:


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>

David Gibbs <dagibbs@qnx.com> wrote:
DG > Adam Mallory <amallory@qnx.com> wrote:

Mario Charest wrote:

refcnt need to be stored in sharemem, things can get hairy if a program dies
in between the mask/unmaks which is why I think a “server” is more
appropriate since
it knows when a program dies.

The server just provides a single threaded, persistant state API - I
think you could still do it without. OTOH, I suppose it does provide a
cleaner interface in a network distributed senario.

DG > I think that a network distributed mask/unmask server just might be
DG > pushing things a bit, given we don’t have an API to mask/unmask an
DG > interrupt accross the network. (And what would that do to the
DG > latency?)

Also, if you could disable interrupts on a node across the net, how would
you re-enable them? The remote node could not receive network traffic.

Bill Caroselli wrote:

Also, if you could disable interrupts on a node across the net, how would
you re-enable them? The remote node could not receive network traffic.

Well if disabling the interrupts which drove the network interface was a
real danger (in that someone was being pretty silly/careless), you’d
have to customize your driver a little. Either move it to a stricly
polled mode, or make a hybrid which would fall over to polled if forward
progress/lack of RX or some other trigger occured.

\

Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>