All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] about  "xnshadow_harden" puzzle, when and where the "rthal_current_domain" became head domain?
@ 2017-03-24 12:05 曹子龙
  2017-03-26 14:41 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: 曹子龙 @ 2017-03-24 12:05 UTC (permalink / raw)
  To: xenomai

i encounter a problem when reading the xenomai 2.6.5 code about the "xnshaode_harden" implement ion,  when a thread running in root domain migrate to the head domain, usually by calling "xnshadow_harden" interface to do this.

the the operation completed by wakeup the "gatekeeper_thread" and then call the "xnpod_schedule", finally, the shadow thread comeback from "schedule". 


look at the red worlds below, it seems it was surely that the current domain is head, but, during these operation, i did not see anywhere  change the current domain from root to  head,  so did i miss something about the flow? any one can help me, thanks for your kindly help.
int xnshadow_harden(void)
{


       ................................
sched->gktarget = curr;
xnthread_set_info(curr, XNATOMIC);
set_current_state(TASK_INTERRUPTIBLE | TASK_ATOMICSWITCH);


wake_up_process(sched->gatekeeper);


schedule();
      ...........................
if (rthal_current_domain == rthal_root_domain) {
                          // exceptions, rarely happen.
       }

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

* Re: [Xenomai] about "xnshadow_harden" puzzle, when and where the "rthal_current_domain" became head domain?
  2017-03-24 12:05 [Xenomai] about "xnshadow_harden" puzzle, when and where the "rthal_current_domain" became head domain? 曹子龙
@ 2017-03-26 14:41 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2017-03-26 14:41 UTC (permalink / raw)
  To: 曹子龙, xenomai

On 03/24/2017 01:05 PM, 曹子龙 wrote:
> i encounter a problem when reading the xenomai 2.6.5 code about the "xnshaode_harden" implement ion,  when a thread running in root domain migrate to the head domain, usually by calling "xnshadow_harden" interface to do this.
> 
> the the operation completed by wakeup the "gatekeeper_thread" and then call the "xnpod_schedule", finally, the shadow thread comeback from "schedule". 
> 
> 
> look at the red worlds below, it seems it was surely that the current domain is head, but, during these operation, i did not see anywhere  change the current domain from root to  head,  so did i miss something about the flow? any one can help me, thanks for your kindly help.
> int xnshadow_harden(void)
> {
> 
> 
>        ................................
> sched->gktarget = curr;
> xnthread_set_info(curr, XNATOMIC);
> set_current_state(TASK_INTERRUPTIBLE | TASK_ATOMICSWITCH);
> 
> 
> wake_up_process(sched->gatekeeper);
> 
> 
> schedule();
>       ...........................
> if (rthal_current_domain == rthal_root_domain) {
>                           // exceptions, rarely happen.
>        }

This is too complex to explain only in a few words and time is a scarce
resource, so you will have to figure out the details by yourself, but
basically:

- the gatekeeper calls xnpod_schedule(), which notices that the root
domain is current, therefore escalates the request to the primary domain
via a pseudo IRQ.

- the interrupt pipeline dispatches the pseudo IRQ back to the Xenomai
core (xnpod_schedule_handler()), after a switch to the head domain. See
dispatch_irq_head() from kernel/ipipe/core.c.

-- 
Philippe.


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

end of thread, other threads:[~2017-03-26 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 12:05 [Xenomai] about "xnshadow_harden" puzzle, when and where the "rthal_current_domain" became head domain? 曹子龙
2017-03-26 14:41 ` Philippe Gerum

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.