public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] bypass DSR, sem_post from ISR
@ 2001-05-24 13:28 Phung Te Ha
  2001-05-25  3:01 ` Hugo Tyson
  2001-05-25  3:15 ` Nick Garnett
  0 siblings, 2 replies; 3+ messages in thread
From: Phung Te Ha @ 2001-05-24 13:28 UTC (permalink / raw)
  To: ecos-discuss

Hi everyone,

I have an interrupt handling which needs reschedule
(cyg_thread_delay and mutex_lock) so I have the real
service in a thread.

My question is that is it safe to call cyg_sem_post
directly from the ISR and start my service thread
rather than start the DSR and wait for this one to
call cyg_sem_post?

Thanks for your ideas.

Phungte

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] bypass DSR, sem_post from ISR
  2001-05-24 13:28 [ECOS] bypass DSR, sem_post from ISR Phung Te Ha
@ 2001-05-25  3:01 ` Hugo Tyson
  2001-05-25  3:15 ` Nick Garnett
  1 sibling, 0 replies; 3+ messages in thread
From: Hugo Tyson @ 2001-05-25  3:01 UTC (permalink / raw)
  To: ecos-discuss

Phung Te Ha <phungte@yahoo.com> writes:

> Hi everyone,
> 
> I have an interrupt handling which needs reschedule
> (cyg_thread_delay and mutex_lock) so I have the real
> service in a thread.
> 
> My question is that is it safe to call cyg_sem_post
> directly from the ISR and start my service thread
> rather than start the DSR and wait for this one to
> call cyg_sem_post?

No.

You should understand that the delay to calling the DSR is usually zero.
DSRs are called during the return-from-interrupt sequence - if it is safe
to do so.

DSRs are only delayed if the thread that was interrupted had locked the
scheduler for some other reason - such as doing scheduling operations
itself.  If all your threads are asleep, or just doing "calculations"
ie. not calls in to eCos' scheduler, then DSRs will certainly run
immediately, right after the ISR.

	- Huge

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] bypass DSR, sem_post from ISR
  2001-05-24 13:28 [ECOS] bypass DSR, sem_post from ISR Phung Te Ha
  2001-05-25  3:01 ` Hugo Tyson
@ 2001-05-25  3:15 ` Nick Garnett
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Garnett @ 2001-05-25  3:15 UTC (permalink / raw)
  To: ecos-discuss

Phung Te Ha <phungte@yahoo.com> writes:

> Hi everyone,
> 
> I have an interrupt handling which needs reschedule
> (cyg_thread_delay and mutex_lock) so I have the real
> service in a thread.
> 
> My question is that is it safe to call cyg_sem_post
> directly from the ISR and start my service thread
> rather than start the DSR and wait for this one to
> call cyg_sem_post?
> 

No, you cannot do that. Interrupts are allowed at any time even when
the kernel is in the middle of a thread switch and the scheduler data
structures are inconsistent. Calling any function in an ISR that might
also try to manipulate the same data would result in unpredicatable
behaviour.

Do not worry about the performance of the DSR mechanism. It is at
least as efficient as any other mechanism we might have chosen to
solve these problems, and a good deal more efficient than some.

-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-05-25  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-24 13:28 [ECOS] bypass DSR, sem_post from ISR Phung Te Ha
2001-05-25  3:01 ` Hugo Tyson
2001-05-25  3:15 ` Nick Garnett

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 read-only IMAP folder(s) and NNTP newsgroup(s).