All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>
Cc: xenomai@xenomai.org
Subject: [Xenomai-core] Re: [REQUEST] eliminate the rthal_critical_enter/exit() from rthal_irq_request()
Date: Sat, 15 Apr 2006 23:44:35 +0200	[thread overview]
Message-ID: <44416943.4070702@domain.hid> (raw)
In-Reply-To: <b647ffbd0604120138p5088006aqf074c711a0478487@domain.hid>

Dmitry Adamushko wrote:
> Hi,
> 
> the following question/suggestion :
> 
> it could be good to eliminate the use of rthal_critical_enter/exit()
> from rthal_irq_request() if it's not
> strictly necessary.
> 
> 
> the proposal :
> 
> int rthal_irq_request (unsigned irq,
> 		       rthal_irq_handler_t handler,
> 		       rthal_irq_ackfn_t ackfn,
> 		       void *cookie)
> {
> -    unsigned long flags;
>     int err = 0;
> 
>     if (handler == NULL || irq >= IPIPE_NR_IRQS)
> 	return -EINVAL;
> 
> -    flags = rthal_critical_enter(NULL);
> -
> -    if (rthal_irq_handler(&rthal_domain, irq) != NULL)
> -	{
> -	err = -EBUSY;
> -	goto unlock_and_exit;
> -	}
> -
>     err = rthal_virtualize_irq(&rthal_domain,
> 			       irq,
> 			       handler,
> 			       cookie,
> 			       ackfn,
> -			       IPIPE_DYNAMIC_MASK);
> +				IPIPE_DYNAMIC_MASK|IPIPE_EXCLUSIVE_MASK);
> 
> - unlock_and_exit:
> -
> -    rthal_critical_exit(flags);
> -
>     return err;
> }
> 
> IPIPE_EXCLUSIVE_MASK causes a -EBUZY error to be returned by
> ipipe_virtualize_irq() when
> handler != NULL and the current ipd->irqs[irq].handler != NULL.
> 

Sounds reasonable. Using the synchronized inter-processor lock is most 
often a bad idea except in very specific initialization/shutdown stuff 
at Adeos level anyway, and this does introduce deadlock issues at 
Xenomai level when inadvertently using it with the nklock held, so let's 
get rid of this. In the rthal_irq_request() case, it's even useless indeed.

> (IPIPE_EXCLUSIVE_MASK is actually not used at the moment anywere,
> though ipipe_catch_event() is mentioned in comments).
>

The existing flag was aimed to implement self-directed events, but I 
eventually this support differently, so we can recycle it safely.

> Another variant :
> 
> ipipe_virtualize_irq() should always return -EBUZY when handler !=
> NULL and the current ipd->irqs[irq].handler != NULL,
> not taking into account the IPIPE_EXCLUSIVE_FLAG.
> 
>

<snip>

> --
> Best regards,
> Dmitry Adamushko
> 


-- 

Philippe.


  reply	other threads:[~2006-04-15 21:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12  8:38 [Xenomai-core] [REQUEST] eliminate the rthal_critical_enter/exit() from rthal_irq_request() Dmitry Adamushko
2006-04-15 21:44 ` Philippe Gerum [this message]
2006-04-22  9:54   ` [Xenomai-core] " Dmitry Adamushko
2006-04-24  8:19     ` Philippe Gerum
2006-04-24  9:28       ` Dmitry Adamushko
2006-04-27  8:16         ` Dmitry Adamushko
2006-04-27 12:21           ` Philippe Gerum

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=44416943.4070702@domain.hid \
    --to=rpm@xenomai.org \
    --cc=dmitry.adamushko@domain.hid \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.