Re: [Xenomai-core] preemptive doesn't work

2012-04-12 Thread Roberto Bielli

Hi Gilles,

i found in my trace the function 'xnthread_timeout_handler' that is 
called in the code where there is the problem.
In xenomai there is a topic about that function. ( [Xenomai-core] [BUG?] 
stalled xeno domain 
http://www.opensubscriber.com/messages/xenomai-core@gna.org/39.html )


Do you think that can be a similar problem ?



Il 11/04/2012 14:10, Gilles Chanteperdrix ha scritto:

On 04/11/2012 08:59 AM, Roberto Bielli wrote:

Hi Gilles,

i try your workaround but nothing is changed.
I make another test. I try to comment out all the content of
mxc_mask_irq() but the result is the same.
(the mxc_mask_irq is used also for acking interrupts but is not correct
why it doesn't write in the processor manual)
Do you know if there is a code over the mxc_mask_irq that disable the
interrupts ?

About interrupt gpio it should be a link with this behaviour ? ( i don't
want gpio as interrupts )

No,  I do not think it is possible. You do not get to decide whether you
want gpio as interrupts or not, the design of the board you use does.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-12 Thread Gilles Chanteperdrix
On 04/12/2012 12:12 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i found in my trace the function 'xnthread_timeout_handler' that is 
 called in the code where there is the problem.
 In xenomai there is a topic about that function. ( [Xenomai-core] [BUG?] 
 stalled xeno domain 
 http://www.opensubscriber.com/messages/xenomai-core@gna.org/39.html )
 
 Do you think that can be a similar problem ?

No.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-11 Thread Roberto Bielli

Hi Gilles,

i try your workaround but nothing is changed.
I make another test. I try to comment out all the content of 
mxc_mask_irq() but the result is the same.
(the mxc_mask_irq is used also for acking interrupts but is not correct 
why it doesn't write in the processor manual)
Do you know if there is a code over the mxc_mask_irq that disable the 
interrupts ?


About interrupt gpio it should be a link with this behaviour ? ( i don't 
want gpio as interrupts )




Il 10/04/2012 14:40, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:33 PM, Roberto Bielli wrote:

Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:

On 04/10/2012 12:39 PM, Roberto Bielli wrote:

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.

In the exact same conditions? With the crunching task running with
SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
priority 99, and the linux real-time throttling disabled?


Yes, and i see that every LATCH ( about ~10ms ) period the task with
higher priority is wakeup.
So a task with lower priority is interrupted by timer interrupt and
reschedule the task with higher priority.


The only thing I can think is that the timer interrupt in fact stays
masked. You can try the following patch:

diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index 8aee763..7e4cc2e 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -94,12 +94,14 @@ EXPORT_SYMBOL(mxc_set_irq_fiq);
  static void mxc_mask_irq(unsigned int irq)
  {
 __raw_writel(irq, avic_base + AVIC_INTDISNUM);
+   __raw_readl(avic_base + AVIC_INTDISNUM);
  }

  /* Enable interrupt number irq in the AVIC */
  static void mxc_unmask_irq(unsigned int irq)
  {
 __raw_writel(irq, avic_base + AVIC_INTENNUM);
+   __raw_readl(avic_base + AVIC_INTENNUM);
  }

  static struct irq_chip mxc_avic_chip = {


If I had to debug this issue, I would look at all the timer and
interrupt controller registers value, to see what is wrong.

You can also try the plain linux example with CONFIG_IPIPE on, but
without CONFIG_XENOMAI.

Other than that, without access to the board, it is hard for me to
debug further, so I am afraid you are on your own.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-11 Thread Gilles Chanteperdrix
On 04/11/2012 08:59 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i try your workaround but nothing is changed.
 I make another test. I try to comment out all the content of 
 mxc_mask_irq() but the result is the same.
 (the mxc_mask_irq is used also for acking interrupts but is not correct 
 why it doesn't write in the processor manual)
 Do you know if there is a code over the mxc_mask_irq that disable the 
 interrupts ?

mxc_mask_irq disables the interrupt at interrupt controller level.
Generally, you can not avoid to do that.

Have you tried reproducing the problem with linux configured with
CONFIG_HIGH_RES_TIMERS?


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-11 Thread Gilles Chanteperdrix
On 04/11/2012 08:59 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i try your workaround but nothing is changed.
 I make another test. I try to comment out all the content of 
 mxc_mask_irq() but the result is the same.
 (the mxc_mask_irq is used also for acking interrupts but is not correct 
 why it doesn't write in the processor manual)
 Do you know if there is a code over the mxc_mask_irq that disable the 
 interrupts ?
 
 About interrupt gpio it should be a link with this behaviour ? ( i don't 
 want gpio as interrupts )

No,  I do not think it is possible. You do not get to decide whether you
want gpio as interrupts or not, the design of the board you use does.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i learned the ipipe trace that i send you but i don't unserstand why i 
have three timer reprogramming in few useconds.


Can you explain me the behaviour ?



Il 08/04/2012 00:17, Gilles Chanteperdrix ha scritto:

On 04/06/2012 06:59 PM, Roberto Bielli wrote:

Hi Gilles,

i made all your modifies and re-read all corect register but the problem
is the same.

Ok. What I would do at this point is check whether linux has the same
issue. You can also check the processor errata to see if there is no
issue with the timer.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:18 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i learned the ipipe trace that i send you but i don't unserstand why i 
 have three timer reprogramming in few useconds.
 
 Can you explain me the behaviour ?

Can you resend the trace and give us the time where this happens?
Anyway, the timer function must work even if the timer has already been
programmed, it is normal to reprogram the timer while it has been
programmed for instance when adding or removing a timer.


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

I don't find the end of last __ipipe_grab_irq in the trace that i send you.
Is it correct ?

Il 08/04/2012 00:17, Gilles Chanteperdrix ha scritto:

On 04/06/2012 06:59 PM, Roberto Bielli wrote:

Hi Gilles,

i made all your modifies and re-read all corect register but the problem
is the same.

Ok. What I would do at this point is check whether linux has the same
issue. You can also check the processor errata to see if there is no
issue with the timer.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:43 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 I don't find the end of last __ipipe_grab_irq in the trace that i send you.
 Is it correct ?

Yes, because the timer interrupt reschedules and wakes up the periodic
task. I had a look at the timer programming events, it is true that the
timer ticks more often than it should. Generally, this is an indication
that the timer frequency is not what xenomai believe it is. xenomai idea
of the timer frequency is given by __ipipe_mach_ticks_per_jiffy. Anyway,
this should not cause the timer not to tick, only to tick it more often.

What you should do now is try and reproduce the same conditions under an
unpatched linux to see if you get the same phenomenon.

Did you have a look a the processor errata ?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata 
elements on timer.

I see that tsc uses the same timer.

Does xenomai use the tsc for the next timer period ?



Il 10/04/2012 10:45, Gilles Chanteperdrix ha scritto:

On 04/10/2012 10:43 AM, Roberto Bielli wrote:

Hi Gilles,

I don't find the end of last __ipipe_grab_irq in the trace that i send you.
Is it correct ?

Yes, because the timer interrupt reschedules and wakes up the periodic
task. I had a look at the timer programming events, it is true that the
timer ticks more often than it should. Generally, this is an indication
that the timer frequency is not what xenomai believe it is. xenomai idea
of the timer frequency is given by __ipipe_mach_ticks_per_jiffy. Anyway,
this should not cause the timer not to tick, only to tick it more often.

What you should do now is try and reproduce the same conditions under an
unpatched linux to see if you get the same phenomenon.

Did you have a look a the processor errata ?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.
 I see that tsc uses the same timer.
 
 Does xenomai use the tsc for the next timer period ?

If you look at the trace, you will see that with the timer@ event that
the timer is supposedly programmed for the right time. For instance at
-84748, the timer is programmed to tick at -83749, which is around
1000us later and is what we would expect. So, the tsc is out of the
issue. The issue is the timer.

For the third time I tell you, you should now try and reproduce the same
issue with an unpatched linux.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:06 AM, Gilles Chanteperdrix wrote:
 On 04/10/2012 10:58 AM, Roberto Bielli wrote:
 Hi Gilles,

 i look at the processor errata but for the imx25 there are no errata 
 elements on timer.
 
 It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
 support imx25.
 
 The I-pipe support has not been written for imx25, so, it is entirely
 possible that you have to adapt it. See:
 http://www.xenomai.org/index.php/I-pipe:ArmPorting
 
Latest kernels support imx25, and imx25 works like an mx3, not an mx2,
can you show me arch/arm/plat-mxc/time.c for your (undoubtedly) patched
kernel?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

the steps for supporting imx25 have been:
1. We buy a board with imx25
2. Our supplier made the porting of linux 2.6.31 freescale with  imx25
3. we put a xenomai  2.5.6 and we have adapted for imx25. The only 
changes is this (because imx25 registers are identical to mx3 ):


old:
#define timer_is_v2()(cpu_is_mx3() || cpu_is_mx5())

new:
#define timer_is_v2()(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())





Il 10/04/2012 11:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 10:58 AM, Roberto Bielli wrote:

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata
elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

here is my time.c



Il 10/04/2012 11:11, Gilles Chanteperdrix ha scritto:

On 04/10/2012 11:06 AM, Gilles Chanteperdrix wrote:

On 04/10/2012 10:58 AM, Roberto Bielli wrote:

Hi Gilles,

i look at the processor errata but for the imx25 there are no errata
elements on timer.

It is strange that you use linux 2.6.31 on imx25: linux 2.6.31 does not
support imx25.

The I-pipe support has not been written for imx25, so, it is entirely
possible that you have to adapt it. See:
http://www.xenomai.org/index.php/I-pipe:ArmPorting


Latest kernels support imx25, and imx25 works like an mx3, not an mx2,
can you show me arch/arm/plat-mxc/time.c for your (undoubtedly) patched
kernel?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

/*
 *  linux/arch/arm/plat-mxc/time.c
 *
 *  Copyright (C) 2000-2001 Deep Blue Solutions
 *  Copyright (C) 2002 Shane Nay (sh...@minirl.com)
 *  Copyright (C) 2006-2007 Pavel Pisa (pp...@pikron.com)
 *  Copyright (C) 2008 Juergen Beisert (ker...@pengutronix.de)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#include linux/interrupt.h
#include linux/irq.h
#include linux/clockchips.h
#include linux/clk.h

#include mach/hardware.h
#include asm/mach/time.h
#include mach/common.h

/* defines common for all i.MX */
#define MXC_TCTL0x00
#define MXC_TCTL_TEN(1  0)
#define MXC_TPRER   0x04

/* MX1, MX21, MX27 */
#define MX1_2_TCTL_CLK_PCLK1(1  1)
#define MX1_2_TCTL_IRQEN(1  4)
#define MX1_2_TCTL_FRR  (1  8)
#define MX1_2_TCMP  0x08
#define MX1_2_TCN   0x10
#define MX1_2_TSTAT 0x14

/* MX21, MX27 */
#define MX2_TSTAT_CAPT  (1  1)
#define MX2_TSTAT_COMP  (1  0)

/* MX31, MX35, MX25 */
#define MX3_TCTL_WAITEN (1  3)
#define MX3_TCTL_CLK_IPG(1  6)
#define MX3_TCTL_CLK_PER(2  6)
#define MX3_TCTL_FRR(1  9)
#define MX3_IR  0x0c
#define MX3_TSTAT   0x08
#define MX3_TSTAT_OF1   (1  0)
#define MX3_TCN 0x24
#define MX3_TCMP0x10

#ifdef CONFIG_IPIPE
#ifdef CONFIG_NO_IDLE_HZ
#error dynamic tick timer not yet supported with IPIPE
#endif /* CONFIG_NO_IDLE_HZ */
int __ipipe_mach_timerint;

Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:19 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 the steps for supporting imx25 have been:
 1. We buy a board with imx25
 2. Our supplier made the porting of linux 2.6.31 freescale with  imx25
 3. we put a xenomai  2.5.6 and we have adapted for imx25. The only 
 changes is this (because imx25 registers are identical to mx3 ):
 
 old:
 #define timer_is_v2()(cpu_is_mx3() || cpu_is_mx5())
 
 new:
 #define timer_is_v2()(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())
 

Yes, but if you use the unchanged adeos patch, it uses if (cpu_is_mx3())
in tsc and timer code, whereas it should use if (timer_is_v2()),
timer_is_v2 is not present in vanilla linux code.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:21 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 here is my time.c

Looks fine, though I do not understand why you do not use timer_is_v2
instead of cpu_is_mx3 || cpu_is_mx25. I think the problem is elsewhere,
and I suggest you check whether linux without xenomai has or has not the
same issue.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 11:21 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 here is my time.c

Though you have not made all the changes I suggested. Here is the time.c
I would use.

-- 
Gilles.
/*
 *  linux/arch/arm/plat-mxc/time.c
 *
 *  Copyright (C) 2000-2001 Deep Blue Solutions
 *  Copyright (C) 2002 Shane Nay (sh...@minirl.com)
 *  Copyright (C) 2006-2007 Pavel Pisa (pp...@pikron.com)
 *  Copyright (C) 2008 Juergen Beisert (ker...@pengutronix.de)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#include linux/interrupt.h
#include linux/irq.h
#include linux/clockchips.h
#include linux/clk.h

#include mach/hardware.h
#include asm/mach/time.h
#include mach/common.h

/* defines common for all i.MX */
#define MXC_TCTL		0x00
#define MXC_TCTL_TEN		(1  0)
#define MXC_TPRER		0x04

/* MX1, MX21, MX27 */
#define MX1_2_TCTL_CLK_PCLK1	(1  1)
#define MX1_2_TCTL_IRQEN	(1  4)
#define MX1_2_TCTL_FRR		(1  8)
#define MX1_2_TCMP		0x08
#define MX1_2_TCN		0x10
#define MX1_2_TSTAT		0x14

/* MX21, MX27 */
#define MX2_TSTAT_CAPT		(1  1)
#define MX2_TSTAT_COMP		(1  0)

/* MX31, MX35, MX25 */
#define MX3_TCTL_WAITEN		(1  3)
#define MX3_TCTL_CLK_IPG	(1  6)
#define MX3_TCTL_CLK_PER	(2  6)
#define MX3_TCTL_FRR		(1  9)
#define MX3_IR			0x0c
#define MX3_TSTAT		0x08
#define MX3_TSTAT_OF1		(1  0)
#define MX3_TCN			0x24
#define MX3_TCMP		0x10

#ifdef CONFIG_IPIPE
#ifdef CONFIG_NO_IDLE_HZ
#error dynamic tick timer not yet supported with IPIPE
#endif /* CONFIG_NO_IDLE_HZ */
int __ipipe_mach_timerint;
EXPORT_SYMBOL(__ipipe_mach_timerint);

int __ipipe_mach_timerstolen = 0;
EXPORT_SYMBOL(__ipipe_mach_timerstolen);

unsigned int __ipipe_mach_ticks_per_jiffy = LATCH;
EXPORT_SYMBOL(__ipipe_mach_ticks_per_jiffy);

static int mxc_timer_initialized;
static unsigned mxc_min_delay;

union tsc_reg {
#ifdef __BIG_ENDIAN
	struct {
		unsigned long high;
		unsigned long low;
	};
#else /* __LITTLE_ENDIAN */
	struct {
		unsigned long low;
		unsigned long high;
	};
#endif /* __LITTLE_ENDIAN */
	unsigned long long full;
};

#ifdef CONFIG_SMP
static union tsc_reg tsc[NR_CPUS];

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
	info-type = IPIPE_TSC_TYPE_NONE;
}

#else /* !CONFIG_SMP */
static union tsc_reg *tsc;

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
	info-type = IPIPE_TSC_TYPE_FREERUNNING;
	if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
		info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
	} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
		info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
	} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
		info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
	}
	info-u.fr.mask = 0x;
	info-u.fr.tsc = tsc-full;
}
#endif /* !CONFIG_SMP */

static void ipipe_mach_update_tsc(void);
#endif /* CONFIG_IPIPE */

#define timer_is_v2()	(cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx5())

static struct clock_event_device clockevent_mxc;
static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;

static void __iomem *timer_base;

static inline void gpt_irq_disable(void)
{
	unsigned int tmp;

	if (timer_is_v2())
		__raw_writel(0, timer_base + MX3_IR);
	else {
		tmp = __raw_readl(timer_base + MXC_TCTL);
		__raw_writel(tmp  ~MX1_2_TCTL_IRQEN, timer_base + MXC_TCTL);
	}
}

static inline void gpt_irq_enable(void)
{
	if (timer_is_v2())
		__raw_writel(10, timer_base + MX3_IR);
	else {
		__raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN,
			timer_base + MXC_TCTL);
	}
}

static void gpt_irq_acknowledge(void)
{
	if (!timer_is_v2()) {
		if (cpu_is_mx1())
			__raw_writel(0, timer_base + MX1_2_TSTAT);
		else
			__raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP, timer_base + MX1_2_TSTAT);
	} else
		__raw_writel(MX3_TSTAT_OF1, timer_base + MX3_TSTAT);
}

static cycle_t timer_v1_get_cycles(struct clocksource *cs)
{
	return __raw_readl(timer_base + MX1_2_TCN);
}

static cycle_t timer_v2_get_cycles(struct clocksource *cs)
{
	return __raw_readl(timer_base + MX3_TCN);
}

static struct clocksource clocksource_mxc = {
	.name		= mxc_timer1,
	.rating		= 200,
	.read		= timer_v1_get_cycles,
	.mask		= CLOCKSOURCE_MASK(32),
	.shift		= 20,
	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
};


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.






Il 10/04/2012 11:37, Gilles Chanteperdrix ha scritto:

On 04/10/2012 11:21 AM, Roberto Bielli wrote:

Hi Gilles,

here is my time.c

Though you have not made all the changes I suggested. Here is the time.c
I would use.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i tried your code but th behavior is the same.
 
 Then i tried a linux base app and works correctly.

The tsc physical address passed to user-space looks wrong.

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
info-type = IPIPE_TSC_TYPE_FREERUNNING;
if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
}
info-u.fr.mask = 0x;
info-u.fr.tsc = tsc-full;
}

Here cpu_is_mx2() will return true, and we will not go to cpu_is_mx25().

Are you using the tsc in user-space?

If you are passing --enable-arm-mach=mx2 to xenomai configure 
script, you are using the tsc in user-space, and it is a wonder 
how it works.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i tried your code but th behavior is the same.
 
 Then i tried a linux base app and works correctly.

In the exact same conditions? With the crunching task running with
SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
priority 99, and the linux real-time throttling disabled?

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and 
imx25 is NOT mx2

#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i 
disable tsc and xenomai continue work correctly ?


However i cannot use tsc in my simple application. I resend the simple C 
application that doesn't work.



Il 10/04/2012 13:25, Gilles Chanteperdrix ha scritto:

On 04/10/2012 12:39 PM, Roberto Bielli wrote:

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.

The tsc physical address passed to user-space looks wrong.

void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
{
info-type = IPIPE_TSC_TYPE_FREERUNNING;
if (cpu_is_mx1()) {
#ifdef CONFIG_ARCH_MX1
info-u.fr.counter = (unsigned *) (TIM1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx2()) {
#ifdef CONFIG_ARCH_MX2
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX1_2_TCN);
#endif
} else if (cpu_is_mx3() || cpu_is_mx25() ) {
#if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX25
info-u.fr.counter = (unsigned *) (GPT1_BASE_ADDR + MX3_TCN);
#endif
}
info-u.fr.mask = 0x;
info-u.fr.tsc =tsc-full;
}

Here cpu_is_mx2() will return true, and we will not go to cpu_is_mx25().

Are you using the tsc in user-space?

If you are passing --enable-arm-mach=mx2 to xenomai configure
script, you are using the tsc in user-space, and it is a wonder
how it works.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

#include stdio.h
#include stdint.h
#include fcntl.h
#include sys/ioctl.h
#include string.h

#include stdlib.h
#include stdio.h
#include sys/mman.h   /* for MCL_CURRENT and MCL_FUTURE */
#include rtdm/rtdm.h
#include native/task.h
#include nucleus/trace.h

#define GPIO6_ON*Gpio2ValAddr |= 1  6
#define GPIO6_OFF   *Gpio2ValAddr = ~(1  6);

static RT_TASK rt_task_desc;
static RT_TASK tsk2ms;

//dati per la gestione memoria mappata
static unsigned long * Gpio2ValAddr = NULL;

volatile int cnt2ms = 0;
volatile int cntmain = 0;
volatile int x;

void funct2ms( void * params )
{
for(;;)
{
GPIO6_ON;
rt_task_sleep( 200 );
++ cnt2ms;
GPIO6_OFF;
}
}

int main(int argc, char *argv[])
{
int count = 0;
int traceOn = 0;
int fd, ret;

// no memory-swapping for this programm
ret = mlockall(MCL_CURRENT | MCL_FUTURE);
if( ret )
{
perror(ERROR : mlockall has failled);
exit(1);
}


fd = open( /dev/mem, O_RDWR | O_SYNC );

Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

Il 10/04/2012 14:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:05 PM, Roberto Bielli wrote:

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
  tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and
imx25 is NOT mx2
#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i
disable tsc and xenomai continue work correctly ?

Xenomai needs the tsc in kernel-space. Obviously, if you do not use the
tsc in user-space, you will not see that it is wrong. Correct physical
address is only needed for user-space.


However i cannot use tsc in my simple application. I resend the simple C
application that doesn't work.

What do you mean you can not use the tsc in your application? What
happens if you use it?


If i use tsc i have no error and i read a correct value.

--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli

here is some logs.

status=on:setup=616:clock=509343446344:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509413956366:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=50946186:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509493738137:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509642692217:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509889401336:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=509959233537:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510033716418:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510083589650:timerdev=mxc_timer1:clockdev=mxc_timer1
root@AXC25:/data# cat /proc/xenomai/timer
status=on:setup=616:clock=510145433674:timerdev=mxc_timer1:clockdev=mxc_timer1

Il 10/04/2012 14:12, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:11 PM, Roberto Bielli wrote:

Il 10/04/2012 14:06, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:05 PM, Roberto Bielli wrote:

Hi Gilles,

i added this in configure of xenomai so i pass --enable-arm-mach=imx25

imx25)arch=5
   tsc_type=__XN_TSC_TYPE_FREERUNNING;;

Furthermore in plat-mxc/include/mach/mxc.h explain which are cpumx2 and
imx25 is NOT mx2
#define cpu_is_mx2()(cpu_is_mx21() || cpu_is_mx27())

i don't understand a things.
Does the tsc necessary to calculate correct timer period, or can i
disable tsc and xenomai continue work correctly ?

Xenomai needs the tsc in kernel-space. Obviously, if you do not use the
tsc in user-space, you will not see that it is wrong. Correct physical
address is only needed for user-space.


However i cannot use tsc in my simple application. I resend the simple C
application that doesn't work.

What do you mean you can not use the tsc in your application? What
happens if you use it?


If i use tsc i have no error and i read a correct value.


So, it works. Good news. To know if it works as expected, you can try
the latency test.

Something I have not asked, could you type:
cat /proc/xenomai/timer

on the mx25 board?




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 02:33 PM, Roberto Bielli wrote:
 Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,

 i tried your code but th behavior is the same.

 Then i tried a linux base app and works correctly.
 In the exact same conditions? With the crunching task running with
 SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
 priority 99, and the linux real-time throttling disabled?

 Yes, and i see that every LATCH ( about ~10ms ) period the task with 
 higher priority is wakeup.
 So a task with lower priority is interrupted by timer interrupt and 
 reschedule the task with higher priority.
 
You need CONFIG_HIGH_RES_TIMERS to be in the same case as xenomai.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Roberto Bielli
In the xenomai example the task periodic is 2ms not 200us. ( 
rt_task_sleep( 2ms 000us 000ns ) );
And the 10ms is because the default system time period of the timer 
without xenomai is ~10ms.
So a process that execute in linux base can be re-scheduled only when 
the timer generate an interrupt , the task makes I/O, or sleeps.




Il 10/04/2012 14:36, Gilles Chanteperdrix ha scritto:

On 04/10/2012 02:33 PM, Roberto Bielli wrote:

Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:

On 04/10/2012 12:39 PM, Roberto Bielli wrote:

Hi Gilles,

i tried your code but th behavior is the same.

Then i tried a linux base app and works correctly.

In the exact same conditions? With the crunching task running with
SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
priority 99, and the linux real-time throttling disabled?


Yes, and i see that every LATCH ( about ~10ms ) period the task with
higher priority is wakeup.

In the example you sent the periodic task was running with a 200us
period, not 10ms.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-10 Thread Gilles Chanteperdrix
On 04/10/2012 02:58 PM, Roberto Bielli wrote:
 In the xenomai example the task periodic is 2ms not 200us. ( 
 rt_task_sleep( 2ms 000us 000ns ) );

sorry, I misred.

 And the 10ms is because the default system time period of the timer 
 without xenomai is ~10ms.
 So a process that execute in linux base can be re-scheduled only when 
 the timer generate an interrupt , the task makes I/O, or sleeps.

That is only if you do not use CONFIG_HIGH_RES_TIMERS, in which case you
are not in the same configuration as xenomai, and the test does not mean
anything.

 
 
 
 Il 10/04/2012 14:36, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 02:33 PM, Roberto Bielli wrote:
 Il 10/04/2012 13:49, Gilles Chanteperdrix ha scritto:
 On 04/10/2012 12:39 PM, Roberto Bielli wrote:
 Hi Gilles,

 i tried your code but th behavior is the same.

 Then i tried a linux base app and works correctly.
 In the exact same conditions? With the crunching task running with
 SCHED_FIFO, priority 1, and the periodic task running with SCHED_FIFO,
 priority 99, and the linux real-time throttling disabled?

 Yes, and i see that every LATCH ( about ~10ms ) period the task with
 higher priority is wakeup.
 In the example you sent the periodic task was running with a 200us
 period, not 10ms.

 
 


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-07 Thread Gilles Chanteperdrix
On 04/06/2012 06:59 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 i made all your modifies and re-read all corect register but the problem 
 is the same.

Ok. What I would do at this point is check whether linux has the same
issue. You can also check the processor errata to see if there is no
issue with the timer.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-06 Thread Gilles Chanteperdrix
On 04/06/2012 05:35 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 excuse me, but i don't understand why i have to read the register after 
 a write.
 In the imx processor manual i didn't find that behaviour.

Read again what I wrote: I do not say you have to, I say you may want
to, it is just a trick you may want to try, which I have already seen
solving this kind of issues. Besides, that is what the linux clockevent
driver does.

I would first try reading the status register in the
__ipipe_mach_acktimer , and if it does not fix the issue, try the
re-read trick.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-06 Thread Roberto Bielli

Hi Gilles,

i made all your modifies and re-read all corect register but the problem 
is the same.


Best Regards

Il 06/04/2012 17:40, Gilles Chanteperdrix ha scritto:

On 04/06/2012 05:35 PM, Roberto Bielli wrote:

Hi Gilles,

excuse me, but i don't understand why i have to read the register after
a write.
In the imx processor manual i didn't find that behaviour.

Read again what I wrote: I do not say you have to, I say you may want
to, it is just a trick you may want to try, which I have already seen
solving this kind of issues. Besides, that is what the linux clockevent
driver does.

I would first try reading the status register in the
__ipipe_mach_acktimer , and if it does not fix the issue, try the
re-read trick.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-04 Thread Gilles Chanteperdrix
On 03/07/2012 07:13 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 this is the trace and the test.
 
 It seems that '__ipipe_dispatch_event' last about ~84 milliseconds with 
 disable interrupts.
 
 
 Thanks a lot for your time.

Hi Roberto,

any news about this issue?

Regards.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-04 Thread Roberto Bielli

Hi Gilles,

i have always this big problem but the timer and the avic are programmed 
correctly.

There is something else but i don't know what.
In this moment i'm doing another work but soon i want to debug that error.

Thanks for all

Il 04/04/2012 11:21, Gilles Chanteperdrix ha scritto:

On 03/07/2012 07:13 PM, Roberto Bielli wrote:

Hi Gilles,

this is the trace and the test.

It seems that '__ipipe_dispatch_event' last about ~84 milliseconds with
disable interrupts.


Thanks a lot for your time.

Hi Roberto,

any news about this issue?

Regards.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-04-04 Thread Gilles Chanteperdrix
On 04/04/2012 11:29 AM, Roberto Bielli wrote:
 Hi Gilles,
 
 i have always this big problem but the timer and the avic are programmed 
 correctly.
 There is something else but i don't know what.
 In this moment i'm doing another work but soon i want to debug that error.

It is undoubtly a timer ack/program issue. There is no other problem,
the trace is quite clear: the timer is programmed, should tick, but
does not.

I had a look at the imx code again for other reasons, what may be also
missing in __ipipe_mach_acktimer function is a read of the timer status
register. As in:

void __ipipe_mach_acktimer(void)
{
uint32_t tstat;

if (timer_is_v2())
tstat = __raw_readl(timer_base + V2_TSTAT);
else
tstat = __raw_readl(timer_base + MX1_2_TSTAT);

gpt_irq_acknowledge();
}

And put that piece of code in mxc_timer_interrupt in the #ifndef
CONFIG_IPIPE section.

You may also want to issue a register read after programming the
compare register. As in:


void __ipipe_mach_set_dec(unsigned long delay)
{
 if (delay  mxc_min_delay) {
 unsigned long tcmp;
 
 if (!timer_is_v2()) {
 tcmp = __raw_readl(timer_base + MX1_2_TCN) + delay;
 __raw_writel(tcmp, timer_base + MX1_2_TCMP);
 __raw_readl(timer_base + MX1_2_TCN);
 } else {
 tcmp = __raw_readl(timer_base + V2_TCN) + delay;
 __raw_writel(tcmp, timer_base + V2_TCMP);
 __raw_readl(timer_base + V2_TCN);
 }
 } else
 ipipe_trigger_irq(__ipipe_mach_timerint);
}

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-13 Thread Gilles Chanteperdrix
On 03/07/2012 07:13 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 this is the trace and the test.
 
 It seems that '__ipipe_dispatch_event' last about ~84 milliseconds with 
 disable interrupts.

Sorry, I somehow missed this post.

I am afraid you are mis-reading the trace. The time spent in user-space
gets accounted to __ipipe_dispatch_event, because this is the last
instrumented function called before the return to user-space. Interrupts
are disabled at this point, this is perfectly normal, but they are
probably re-enabled when returning to user-space.

What is more problematic, however, is that the timer interrupt did not
tick at -83749 like it is supposed to. If it had ticked and the
interrupt had been disabled in user-space, you would have taken the
interrupt at -35, when __ipipe_syscall_root gets called with interrupts on.

So, now, you have to understand why the timer interrupt did not tick. I
suggest, when the problem happens, you look at:
* the interrupt controller register, to see if the timer interrupt is
still masked, if it is masked, then try first commenting out the snippet
in arch/arm/plat-mxc/avic.c which declares mxc_mask_irq as the
irq_mask_ack callback
* the timer registers, to see if the timer was programmed correctly, and
is still ticking when the issue happens.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-13 Thread Gilles Chanteperdrix
On 03/13/2012 12:44 PM, Gilles Chanteperdrix wrote:
 On 03/07/2012 07:13 PM, Roberto Bielli wrote:
 Hi Gilles,

 this is the trace and the test.

 It seems that '__ipipe_dispatch_event' last about ~84 milliseconds with 
 disable interrupts.
 
 Sorry, I somehow missed this post.
 
 I am afraid you are mis-reading the trace. The time spent in user-space
 gets accounted to __ipipe_dispatch_event, because this is the last
 instrumented function called before the return to user-space. Interrupts
 are disabled at this point, this is perfectly normal, but they are
 probably re-enabled when returning to user-space.
 
 What is more problematic, however, is that the timer interrupt did not
 tick at -83749 like it is supposed to. If it had ticked and the
 interrupt had been disabled in user-space, you would have taken the
 interrupt at -35, when __ipipe_syscall_root gets called with interrupts on.
 
 So, now, you have to understand why the timer interrupt did not tick. I
 suggest, when the problem happens, you look at:
 * the interrupt controller register, to see if the timer interrupt is
 still masked, if it is masked, then try first commenting out the snippet
 in arch/arm/plat-mxc/avic.c which declares mxc_mask_irq as the
 irq_mask_ack callback
 * the timer registers, to see if the timer was programmed correctly, and
 is still ticking when the issue happens.
 

You may also want, in __ipipe_mach_set_dec, to re-read the comparator
value after writing it. Sometimes, such things are needed for the write
to register to be really taken into account.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-07 Thread Roberto Bielli

Hi Gilles,

we are sure that when a task execute NO INTERRUPTS arrives in interrupt 
service routine in assembler in the kernel,

until it sleeps. It's not a problem of secondary mode.

So we tried the same application on another porting of xenomai with 
marvell ( kernel 2.6.31.8 - xenomai always 2.5.6 ) and there is no problem.


We cannot change the kernel so we must find the problem in this version 
2.6.31 with xenomai 2.5.6 .

The patch of ipipe used is for 2.6.31.8 instead 2.6.31.
Is there a problem for this ? There are the hw locks (spin_lock, etc...) 
in the 2.6.31 that are different in 2.6.31.8 ?


I repeat that seems that all interrupt are disabled, as if there are 
some irq_enable/irq_disable when execute a task,

or the interrupt line is not acked.

The hw implementation of read/write/ack timer are correct.

Can you explain me how work the scheduler of xenomai compared with the 
tasks and the timer ?


Thanks for all.




Il 06/03/2012 17:16, Gilles Chanteperdrix ha scritto:

On 03/06/2012 04:35 PM, Roberto Bielli wrote:

Hi Gilles,

about T_WARNSW i see in the /proc/xenomai/stat that my task hasn't change mode 
(the value of MSW is 0 )
so, it hasn't changed in secondary mode.

Or maybe it started in secondary mode and never switched mode?





--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-07 Thread Gilles Chanteperdrix
On 03/07/2012 01:59 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 we are sure that when a task execute NO INTERRUPTS arrives in interrupt 
 service routine in assembler in the kernel,
 until it sleeps. It's not a problem of secondary mode.

Show me the trace and I will believe you (approximately fourth time I ask).

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-07 Thread Roberto Bielli

Hi Gilles,

this is the trace and the test.

It seems that '__ipipe_dispatch_event' last about ~84 milliseconds with 
disable interrupts.



Thanks a lot for your time.



Il 07/03/2012 14:44, Gilles Chanteperdrix ha scritto:

On 03/07/2012 01:59 PM, Roberto Bielli wrote:

Hi Gilles,

we are sure that when a task execute NO INTERRUPTS arrives in interrupt
service routine in assembler in the kernel,
until it sleeps. It's not a problem of secondary mode.

Show me the trace and I will believe you (approximately fourth time I ask).




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

I-pipe frozen back-tracing service on 2.6.31/ipipe-1.16-02

CPU: 0, Freeze: 2038911849125 cycles, Trace Points: 100 (+10)
Calibrated minimum trace-point overhead: 1.044 us

 +- Hard IRQs ('|': locked)
 |+ unused
 ||+--- unused
 |||+-- Xenomai
 +- Linux ('*': domain stalled, '+': current, '#': current+stalled)
 |+-- Delay flag ('+':  1 us, '!':  10 us)
 ||+- NMI noise ('N')
 |||
  TypeUser Val.   TimeDelay  Function (Parent)
:|   #func   -84864+   1.313  __ipipe_handle_irq+0x14 
(__ipipe_grab_irq+0x68)
:|   #func   -84863+   1.164  __ipipe_ack_timerirq+0x10 
(__ipipe_handle_irq+0x9c)
:|   #func   -84862+   1.462  __ipipe_ack_level_irq+0x10 
(__ipipe_ack_timerirq+0x24)
:|   #func   -84860+   1.358  mxc_mask_irq+0x10 
(__ipipe_ack_level_irq+0x3c)
:|   #func   -84859+   1.432  mxc_mask_irq+0x10 
(__ipipe_ack_level_irq+0x54)
:|   #func   -84858+   1.268  __ipipe_mach_acktimer+0x10 
(__ipipe_ack_timerirq+0x28)
:|   #func   -84856+   1.298  __ipipe_end_level_irq+0x10 
(__ipipe_ack_timerirq+0x38)
:|   #func   -84855+   1.358  mxc_unmask_irq+0x10 
(__ipipe_end_level_irq+0x28)
:|   #func   -84854+   1.552  __ipipe_dispatch_wired+0x10 
(__ipipe_handle_irq+0xa8)
:|   #func   -84852+   1.238  __ipipe_dispatch_wired_nocheck+0x10 
(__ipipe_dispatch_wired+0x84)
:|  #*func   -84851+   1.507  xnintr_clock_handler+0x10 
(__ipipe_dispatch_wired_nocheck+0x68)
:|  #*func   -84849+   2.208  xntimer_tick_aperiodic+0x14 
(xnintr_clock_handler+0x44)
:|  #*func   -84847+   2.074  xntimer_next_local_shot+0x10 
(xntimer_tick_aperiodic+0x258)
:|  #*event   tick@-84784-84845+   1.164  xntimer_next_local_shot+0xcc 
(xntimer_tick_aperiodic+0x258)
:|  #*func   -84844+   2.268  __ipipe_mach_set_dec+0x10 
(xntimer_next_local_shot+0x110)
:|   #func   -84842+   1.552  __ipipe_walk_pipeline+0x10 
(__ipipe_dispatch_wired_nocheck+0xac)
:|   #end 0x -84840+   1.835  __ipipe_grab_irq+0x74 (__irq_svc+0x68)
:#func   -84838+   1.522  vma_prio_tree_remove+0x10 

Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Gilles Chanteperdrix
On 03/06/2012 08:55 AM, Roberto Bielli wrote:
 Hi,
 
 it seems that i have a big problem with preemption.  (kernel 2.6.31, arm 
 freescale imx25, xenomai 2.5.6 )
 I send a simple application that doesn't work.
 
 The task with name 'task2ms' has higher priority than 'taskPrintf', but 
 'taskPrintf' stop the task 'task2ms' until sleeps.
 
 I think i have a problem with ipipe porting.
 
 Any idea ?

Please try getting a trace with the I-pipe tracer.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Roberto Bielli

Hi Gilles,

here is the new trace.

Il 06/03/2012 13:09, Gilles Chanteperdrix ha scritto:

On 03/06/2012 11:14 AM, Roberto Bielli wrote:

Hi,

here is the trace.

Please try to capture the xntimer_next_local_shot which happens before
the bug to see if the timer ticks when expected.

Also note that if we are going through __ipipe_preempt_schedule_irq, it
means that the task eating the cpu is running in secondary mode. So, you
should use T_WARNSW to see.

Please keep the discussion on the mailing list. 




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

I-pipe worst-case tracing service on 2.6.31/ipipe-1.16-02

CPU: 0, Begin: 413559887374 cycles, Trace Points: 27 (-10/+1), Length: 81 us
Calibrated minimum trace-point overhead: 1.029 us

 +- Hard IRQs ('|': locked)
 |+ unused
 ||+--- unused
 |||+-- Xenomai
 +- Linux ('*': domain stalled, '+': current, '#': current+stalled)
 |+-- Delay flag ('+':  1 us, '!':  10 us)
 ||+- NMI noise ('N')
 |||
  TypeUser Val.   TimeDelay  Function (Parent)
 |   +begin   0x8001  -1262.313  __up_read+0x30 (up_read+0x18)
 |   #end 0x8001  -1241.880  __up_read+0x50 (up_read+0x18)
 #func-1221.850  ipipe_check_context+0x10 
(__up_read+0x5c)
 #func-1201.522  __ipipe_restore_root+0x10 
(__up_read+0x130)
 #func-1191.149  __ipipe_unstall_root+0x10 
(__ipipe_restore_root+0x94)
 |   #begin   0x8000  -1181.597  __ipipe_unstall_root+0x34 
(__ipipe_restore_root+0x94)
 |   +end 0x8000  -1161.432  __ipipe_unstall_root+0x98 
(__ipipe_restore_root+0x94)
 +func-1152.970  ipipe_check_context+0x10 
(__up_read+0x138)
 +func-112  107.507  __ipipe_check_root+0x10 
(ret_from_exception+0x4)
 |   +func  -44.656  __ipipe_grab_irq+0x10 (__irq_usr+0x70)
|   +begin   0x 0+   2.462  __ipipe_grab_irq+0x5c (__irq_usr+0x70)
:|   +func   2+   3.626  __ipipe_handle_irq+0x14 
(__ipipe_grab_irq+0x68)
:|   +func   6+   2.104  __ipipe_ack_timerirq+0x10 
(__ipipe_handle_irq+0x9c)
:|   +func   8+   2.805  __ipipe_ack_level_irq+0x10 
(__ipipe_ack_timerirq+0x24)
:|   +func  11+   1.776  mxc_mask_irq+0x10 
(__ipipe_ack_level_irq+0x3c)
:|   +func  12+   1.686  mxc_mask_irq+0x10 
(__ipipe_ack_level_irq+0x54)
:|   +func  14+   1.507  __ipipe_mach_acktimer+0x10 
(__ipipe_ack_timerirq+0x28)
:|   +func  15+   1.611  __ipipe_end_level_irq+0x10 
(__ipipe_ack_timerirq+0x38)
:|   +func  17+   2.253  mxc_unmask_irq+0x10 
(__ipipe_end_level_irq+0x28)
:|   +func  19+   2.283  __ipipe_dispatch_wired+0x10 

Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Gilles Chanteperdrix
On 03/06/2012 02:00 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 here is the new trace.

There is nothing to see on that trace. Please increase the number of
trace points, and trigger a trace when you detect a problem., the number
of trace points should be sufficient to get the timer programmation
which happens before the problem.

Also, did you try T_WANRSW ?

Please disable the configuration of you mail server which asks me to
send a receipt to each every mail you send me.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Roberto Bielli

Hi Gilles,

i changed the min value of the '__ipipe_mach_set_dec' but the situation 
is the same.

I see with the scope that the task with less priority is not interrupted.

It's difficult to see with the ipipe trace the problem so i put the 
xenomai trace in the application with 
|xntrace_user_start|/|xntrace_user_stop|.

Is the log of xenomai in the same place (/proc/ipipe/trace/max ) of ipipe ?

Thanks a lot



Il 06/03/2012 14:04, Gilles Chanteperdrix ha scritto:

On 03/06/2012 02:00 PM, Roberto Bielli wrote:

Hi Gilles,

here is the new trace.

There is nothing to see on that trace. Please increase the number of
trace points, and trigger a trace when you detect a problem., the number
of trace points should be sufficient to get the timer programmation
which happens before the problem.

Also, did you try T_WANRSW ?

Please disable the configuration of you mail server which asks me to
send a receipt to each every mail you send me.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Gilles Chanteperdrix
On 03/06/2012 04:14 PM, Roberto Bielli wrote:
  Hi Gilles,
 
 i changed the min value of the '__ipipe_mach_set_dec' but the situation
 is the same.
 I see with the scope that the task with less priority is not interrupted.

In the trace you sent, we clearly saw that it was interrupted by a timer
interrupt.

 
 It's difficult to see with the ipipe trace the problem so i put the
 xenomai trace in the application with
 |xntrace_user_start|/|xntrace_user_stop|.
 Is the log of xenomai in the same place (/proc/ipipe/trace/max ) of ipipe ?

See the latency test for an example of usage of the I-pipe tracer in
user-space. When using latency -f the trace is available in
/proc/ipipe/trace/frozen.

What about T_WARNSW (it is the third time I ask).

Also, it would be nice if you could try a more recent version of Xenomai
and of the I-pipe patch, say 2.6.0 with the I-pipe patch for 2.6.38.

-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Roberto Bielli

Hi Gilles,

about T_WARNSW i see in the /proc/xenomai/stat that my task hasn't change mode 
(the value of MSW is 0 )
so, it hasn't changed in secondary mode.

Correct ?



Il 06/03/2012 16:20, Gilles Chanteperdrix ha scritto:

On 03/06/2012 04:14 PM, Roberto Bielli wrote:

  Hi Gilles,

i changed the min value of the '__ipipe_mach_set_dec' but the situation
is the same.
I see with the scope that the task with less priority is not interrupted.

In the trace you sent, we clearly saw that it was interrupted by a timer
interrupt.


It's difficult to see with the ipipe trace the problem so i put the
xenomai trace in the application with
|xntrace_user_start|/|xntrace_user_stop|.
Is the log of xenomai in the same place (/proc/ipipe/trace/max ) of ipipe ?

See the latency test for an example of usage of the I-pipe tracer in
user-space. When using latency -f the trace is available in
/proc/ipipe/trace/frozen.

What about T_WARNSW (it is the third time I ask).

Also, it would be nice if you could try a more recent version of Xenomai
and of the I-pipe patch, say 2.6.0 with the I-pipe patch for 2.6.38.




--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++


___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] preemptive doesn't work

2012-03-06 Thread Gilles Chanteperdrix
On 03/06/2012 04:35 PM, Roberto Bielli wrote:
 Hi Gilles,
 
 about T_WARNSW i see in the /proc/xenomai/stat that my task hasn't change 
 mode (the value of MSW is 0 )
 so, it hasn't changed in secondary mode.

Or maybe it started in secondary mode and never switched mode?


-- 
Gilles.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


[Xenomai-core] preemptive doesn't work

2012-03-05 Thread Roberto Bielli

Hi,

it seems that i have a big problem with preemption.  (kernel 2.6.31, arm 
freescale imx25, xenomai 2.5.6 )

I send a simple application that doesn't work.

The task with name 'task2ms' has higher priority than 'taskPrintf', but 
'taskPrintf' stop the task 'task2ms' until sleeps.


I think i have a problem with ipipe porting.

Any idea ?

--
++

Roberto Bielli
Sviluppo Software   
Axel S.r.l. 

Via Del Cannino, 3  
21020 Crosio Della Valle
Varese - Italy  

Telefono: +39 0332 949600   
Fax:  +39 0332 969315   

E-mail:   roberto.bie...@axelsw.it  
Web Site: www.axelsw.it

++

Si precisa che le informazioni contenute in questo messaggio sono riservate e 
ad uso esclusivo del destinatario.
Qualora il messaggio in parola Le fosse pervenuto per errore, La preghiamo di 
eliminarlo senza copiarlo e di non inoltrarlo a terzi,
dandocene gentilmente comunicazione. Grazie.
Informativa sul trattamento dei dati personali (D. Lgs. 196/2003).
I dati utilizzati per la spedizione del presente messaggio sono utilizzati da 
Axel S.r.l., titolare del trattamento,
per l'invio delle comunicazioni dei diversi settori aziendali, non essendo 
autorizzata la divulgazione a terzi.
Potrete rivolgere alla seguente mail richieste di verifica, rettifica o 
cancellazione dei Vostri dati: i...@axelsw.it

This e-mail and any attachments is confidential and may contain privileged 
information
intended for the addressee(s) only. Dissemination, copying, printing or use by 
anybody
else is unauthorised. If you are not the intended recipient,
please delete this message and any attachments and advise the sender
by return e-mail.Thank you. 

++

#include stdio.h
#include stdint.h
#include fcntl.h
#include sys/ioctl.h
#include string.h

#include stdlib.h
#include stdio.h
#include sys/mman.h   /* for MCL_CURRENT and MCL_FUTURE */
#include rtdm/rtdm.h
#include native/task.h

#define RTXENDRIVER_TYPERTDM_CLASS_TESTING
#define RTXENDRIVER_SUBCLASS0
#define DEVICE_NAME 
axc25xendriverCAN

/*---PRIVATE DATA-*/

#define GPIO6_ON*Gpio2ValAddr |= 1  6
#define GPIO6_OFF   *Gpio2ValAddr = ~(1  6);

static RT_TASK rt_task_desc;

typedef unsigned int canid_t;

struct can_frame {
canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
unsigned charcan_dlc; /* data length code: 0 .. 8 */
unsigned chardata[8] __attribute__((aligned(8)));
};

/* valid bits in CAN ID for frame formats */
#define CAN_SFF_MASK 0x07FFU /* standard frame format (SFF) */
#define CAN_EFF_MASK 0x1FFFU /* extended frame format (EFF) */
#define CAN_ERR_MASK 0x1FFFU /* omit EFF, RTR, ERR flags */

/* special address description flags for the CAN_ID */
#define CAN_EFF_FLAG 0x8000U /* EFF/SFF is set in the MSB */
#define CAN_RTR_FLAG 0x4000U /* remote transmission request */
#define CAN_ERR_FLAG 0x2000U /* error frame */



int device;
//dati per la gestione memoria mappata
static unsigned long * Gpio2ValAddr = NULL;

/*---PUBLIC FUNCTIONS--*/
RT_TASK tskDesc;
RT_TASK tskCan;
RT_TASK tskDesc1;

int read_index =0;
int write_index =0;
#define SIZE_BUFFER 64

struct can_frame globCanFrameBuffer[SIZE_BUFFER];

volatile int x;
volatile int y;

/*void taskCan( void * params )
{
struct can_frame frame;
int nbytes;

for(;;)
{
nbytes = rt_dev_read( device, frame, sizeof( frame ));
}
}*/

void task2ms( void * params )
{
struct can_frame frame;
int nbytes;

for(;;)
{
GPIO6_ON;
rt_task_sleep( 200 );
GPIO6_OFF;
}
}

void taskPrintf( void * params )
{
for(;;)
{
for( x=0; x  100; x++ );
for( x=0; x  100; x++ );
rt_task_sleep( 1000 ); 
}
}



/*void taskRead( void * params )
{
struct can_frame frame;
int i;


while (1 )
{
//rt_task_sleep( 1000 );