On 09/01/2015 09:11 PM, Jorge Ramirez Ortiz wrote:
> On 09/01/2015 02:27 PM, Dmitriy Cherkasov wrote:
>> We have seen this before, but so far have not found a way to consistently
>> reproduce it.
>>
>> There are some caveats with the current way context switching is done in 
>> Xenomai.
>>
>> On armv7, there was a completely separate implementation of 
>> xnarch_switch_to(),
>> as well as separate fpu and TLS switching. At this stage for armv8 however, 
>> we
>> are doing a direct call to the kernel's __switch_to(), which then performs 
>> the
>> relevant register switches.
>>
>> Another possibility is that this may be lurking in the mm switch. During 
>> calls 
>> to check_and_switch_context(), the interrupt state may not always
>> match what is expected according to the comments in the original
>> version of that function. 
>>
>> Overall, this mechanism could definitely benefit from further review.
>>
> 
> 
> Thanks Dimitry.
> I'll also try to look into this for this specific platform (however I am 
> hopping
> that either Gilles or Philippe can spend some time on this soon)
> 
> Just for completeness, as things stand this is pretty much that value I am
> seeing over consecutive runs.
> 
> RTD|      4.167|      6.099|     11.667|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.217|     13.333|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.259|     11.667|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.226|     12.500|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.105|     11.667|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.181|     12.500|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.232|     12.500|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.483|     20.000|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      6.409|      9.167|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      5.707|     12.500|       0|     0|      3.333|     
> 66.667
> RTD|      4.167|      5.026|      6.667|       0|     0|      3.333|     
> 66.667
> RTT|  00:15:04  (periodic user-mode task, 1000 us period, priority 99)
> RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat 
> worst
> RTD|      4.167|      5.025|      6.667|       0|     0|      3.333|     
> 66.667
> Load script terminated, terminating checked scripts
> ---|-----------|-----------|-----------|--------|------|-------------------------
> RTS|      3.333|      6.540|     66.667|       0|     0|    00:15:04/00:15:04
> pipe_in: /tmp/xeno-test-in-9797
> 

This won't address the current issue, but the notification of the head
domain on memory aborts needs fixing:

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index f363368..e59da5e 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -517,10 +517,10 @@ asmlinkage void __exception do_mem_abort(unsigned
long addr, unsigned int esr,
        if (!inf->fn(addr, esr, regs))
                return;

-       irqflags = ipipe_fault_entry();
-
        if (__ipipe_report_trap(IPIPE_TRAP_UNKNOWN, regs))
-               goto out;
+               return;
+
+       irqflags = ipipe_fault_entry();

        pr_alert("Unhandled fault: %s (0x%08x) at 0x%016lx\n",
                 inf->name, esr, addr);
@@ -530,7 +530,7 @@ asmlinkage void __exception do_mem_abort(unsigned
long addr, unsigned int esr,
        info.si_code  = inf->code;
        info.si_addr  = (void __user *)addr;
        arm64_notify_die("", regs, &info, esr);
-out:
+
        ipipe_fault_exit(irqflags);
 }

@@ -544,17 +544,17 @@ asmlinkage void __exception
do_sp_pc_abort(unsigned long addr,
        struct siginfo info;
        unsigned long irqflags;

-       irqflags = ipipe_fault_entry();
-
        if (__ipipe_report_trap(IPIPE_TRAP_ALIGNMENT, regs))
-               goto out;
+               return;
+
+       irqflags = ipipe_fault_entry();

        info.si_signo = SIGBUS;
        info.si_errno = 0;
        info.si_code  = BUS_ADRALN;
        info.si_addr  = (void __user *)addr;
        arm64_notify_die("", regs, &info, esr);
-out:
+
        ipipe_fault_exit(irqflags);
 }
-- 
Philippe.

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai

Reply via email to