* [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep @ 2012-12-18 14:35 alex alex 2012-12-18 14:40 ` Gilles Chanteperdrix 2012-12-18 15:27 ` Gilles Chanteperdrix 0 siblings, 2 replies; 9+ messages in thread From: alex alex @ 2012-12-18 14:35 UTC (permalink / raw) To: xenomai Hi all, The attached program shows an interraction bug between malloc and nanosleep. The use of these two functions in a rt thread leads to a page fault. The dmesg output is: Xenomai: Switching test to secondary mode after exception #14 from user-space at 0xb760393e (pid 30730) I need to remove this switch because it prevents me to used the rtdm_sem_down function ( which return -1) in my RTDM driver and I guess it must also deteriorate the real time performance of my application. Thanks for your help. Alex. -------------- next part -------------- A non-text attachment was scrubbed... Name: Bug_switch.bz2 Type: application/x-bzip2 Size: 1208 bytes Desc: not available URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20121218/66ca8915/attachment.bin> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 14:35 [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep alex alex @ 2012-12-18 14:40 ` Gilles Chanteperdrix 2012-12-18 15:27 ` Gilles Chanteperdrix 1 sibling, 0 replies; 9+ messages in thread From: Gilles Chanteperdrix @ 2012-12-18 14:40 UTC (permalink / raw) To: alex alex; +Cc: xenomai On 12/18/2012 03:35 PM, alex alex wrote: > Hi all, > > The attached program shows an interraction bug between malloc and nanosleep. You can not use malloc in an rt thread. -- Gilles. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 14:35 [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep alex alex 2012-12-18 14:40 ` Gilles Chanteperdrix @ 2012-12-18 15:27 ` Gilles Chanteperdrix 2012-12-18 15:30 ` Gilles Chanteperdrix 1 sibling, 1 reply; 9+ messages in thread From: Gilles Chanteperdrix @ 2012-12-18 15:27 UTC (permalink / raw) To: alex alex; +Cc: xenomai On 12/18/2012 03:35 PM, alex alex wrote: > Hi all, > > The attached program shows an interraction bug between malloc and nanosleep. > The use of these two functions in a rt thread leads to a page fault. > The dmesg output is: > > Xenomai: Switching test to secondary mode after exception #14 from > user-space at 0xb760393e (pid 30730) > > I need to remove this switch because it prevents me to used the > rtdm_sem_down function ( which return -1) in my RTDM driver and I guess it > must also deteriorate the real time performance of my application. > > Thanks for your help. If you are compiling with the Makefile in the attachment, your rt thread is not in fact using xenomai. -- Gilles. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 15:27 ` Gilles Chanteperdrix @ 2012-12-18 15:30 ` Gilles Chanteperdrix 2012-12-18 16:16 ` alex alex 0 siblings, 1 reply; 9+ messages in thread From: Gilles Chanteperdrix @ 2012-12-18 15:30 UTC (permalink / raw) To: alex alex; +Cc: xenomai On 12/18/2012 04:27 PM, Gilles Chanteperdrix wrote: > On 12/18/2012 03:35 PM, alex alex wrote: >> Hi all, >> >> The attached program shows an interraction bug between malloc and nanosleep. >> The use of these two functions in a rt thread leads to a page fault. >> The dmesg output is: >> >> Xenomai: Switching test to secondary mode after exception #14 from >> user-space at 0xb760393e (pid 30730) >> >> I need to remove this switch because it prevents me to used the >> rtdm_sem_down function ( which return -1) in my RTDM driver and I guess it >> must also deteriorate the real time performance of my application. >> >> Thanks for your help. > > If you are compiling with the Makefile in the attachment, your rt thread > is not in fact using xenomai. > Sorry, I mixed LDFLAGS and CFLAGS. Anyway, please try adding -Wl,--wrap,malloc to the LDFLAGS to see if you get the same issue. Also, if there is really an issue, I would expect this issue to be dependent on the architecture and I-pipe patch used, so, please give us this information. -- Gilles. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 15:30 ` Gilles Chanteperdrix @ 2012-12-18 16:16 ` alex alex 2012-12-18 16:28 ` Gilles Chanteperdrix 0 siblings, 1 reply; 9+ messages in thread From: alex alex @ 2012-12-18 16:16 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai My LDFLAGS is : -Wl,@/usr/lib/posix.wrappers -L/usr/lib -lpthread_rt -lxenomai -lpthread -lrt and I use : xenomai-2.6.1/ksrc/arch/x86/patches/adeos-ipipe-2.6.38.8-x86-2.11-01.patch I guess "--wrap,malloc" is similar to @/usr/lib/posix.wrappers. Anyway, malloc, nanosleep and pthread_create are well wrapped. nm -g test | grep wrap U __wrap_malloc U __wrap_nanosleep U __wrap_pthread_create U __wrap_pthread_setschedparam U __wrap_puts Actually, I realize a porting of a robotics software platform to xenomai and allocations are made in an initial phase where the real-time performance is not important, however I need to open my RTDM driver with blocking open during this phase,I usenativeskin semaphore for it. This page fault causes the blocking malfunction of the semaphores (rt_sem_p returns EPERM). 2012/12/18 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> > On 12/18/2012 04:27 PM, Gilles Chanteperdrix wrote: > >> On 12/18/2012 03:35 PM, alex alex wrote: >> >>> Hi all, >>> >>> The attached program shows an interraction bug between malloc and >>> nanosleep. >>> The use of these two functions in a rt thread leads to a page fault. >>> The dmesg output is: >>> >>> Xenomai: Switching test to secondary mode after exception #14 from >>> user-space at 0xb760393e (pid 30730) >>> >>> I need to remove this switch because it prevents me to used the >>> rtdm_sem_down function ( which return -1) in my RTDM driver and I guess >>> it >>> must also deteriorate the real time performance of my application. >>> >>> Thanks for your help. >>> >> >> If you are compiling with the Makefile in the attachment, your rt thread >> is not in fact using xenomai. >> >> Sorry, I mixed LDFLAGS and CFLAGS. Anyway, please try adding > -Wl,--wrap,malloc to the LDFLAGS to see if you get the same issue. > > Also, if there is really an issue, I would expect this issue to be > dependent on the architecture and I-pipe patch used, so, please give us > this information. > > -- > Gilles. > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 16:16 ` alex alex @ 2012-12-18 16:28 ` Gilles Chanteperdrix 2012-12-18 19:27 ` alex alex 0 siblings, 1 reply; 9+ messages in thread From: Gilles Chanteperdrix @ 2012-12-18 16:28 UTC (permalink / raw) To: alex alex; +Cc: xenomai On 12/18/2012 05:16 PM, alex alex wrote: > My LDFLAGS is : > -Wl,@/usr/lib/posix.wrappers -L/usr/lib -lpthread_rt -lxenomai -lpthread > -lrt > > and I use : > xenomai-2.6.1/ksrc/arch/x86/patches/adeos-ipipe-2.6.38.8-x86-2.11-01.patch This patch is known to be bogus, try: http://download.gna.org/adeos/patches/v2.6/x86/adeos-ipipe-2.6.38.8-x86-2.11-03.patch > > however I need to open my RTDM driver with blocking open during this > phase,I usenativeskin > semaphore for it. This page fault causes the blocking malfunction of the > semaphores (rt_sem_p returns EPERM). Using native skin semaphore is deprecated. If writing an RTDM driver, why not using an RTDM semaphore? -- Gilles. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 16:28 ` Gilles Chanteperdrix @ 2012-12-18 19:27 ` alex alex 2012-12-18 20:19 ` Gilles Chanteperdrix 0 siblings, 1 reply; 9+ messages in thread From: alex alex @ 2012-12-18 19:27 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai In fact, this is what I intend to use when the bug will be solved. I use native because RTDM semaphore freezes my PC while with native, semaphore is just no longer blocking (so native helped me to find out the bug and it keeps me from restart the PC when it bugs... ) Thanks for the link. 2012/12/18 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> > On 12/18/2012 05:16 PM, alex alex wrote: > >> My LDFLAGS is : >> -Wl,@/usr/lib/posix.wrappers -L/usr/lib -lpthread_rt -lxenomai -lpthread >> -lrt >> >> and I use : >> xenomai-2.6.1/ksrc/arch/x86/**patches/adeos-ipipe-2.6.38.8-** >> x86-2.11-01.patch >> > > This patch is known to be bogus, try: > http://download.gna.org/adeos/**patches/v2.6/x86/adeos-ipipe-** > 2.6.38.8-x86-2.11-03.patch<http://download.gna.org/adeos/patches/v2.6/x86/adeos-ipipe-2.6.38.8-x86-2.11-03.patch> > > > >> however I need to open my RTDM driver with blocking open during this >> phase,I usenativeskin >> semaphore for it. This page fault causes the blocking malfunction of the >> semaphores (rt_sem_p returns EPERM). >> > > Using native skin semaphore is deprecated. If writing an RTDM driver, why > not using an RTDM semaphore? > > -- > Gilles. > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep 2012-12-18 19:27 ` alex alex @ 2012-12-18 20:19 ` Gilles Chanteperdrix [not found] ` <CAPpP=rNbsH+iXBrK+vs3CZG3T0sxOw-NZ1Px=1unOLjZq3QgAQ@mail.gmail.com> 0 siblings, 1 reply; 9+ messages in thread From: Gilles Chanteperdrix @ 2012-12-18 20:19 UTC (permalink / raw) To: alex alex; +Cc: xenomai On 12/18/2012 08:27 PM, alex alex wrote: > In fact, this is what I intend to use when the bug will be solved. I use > native because RTDM semaphore freezes my PC while with native, semaphore > is just no longer blocking (so native helped me to find out the bug and > it keeps me from restart the PC when it bugs... ) > > Thanks for the link. Please try the patch to see if it still causes the bug. -- Gilles. ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CAPpP=rNbsH+iXBrK+vs3CZG3T0sxOw-NZ1Px=1unOLjZq3QgAQ@mail.gmail.com>]
[parent not found: <50D1CFD0.9080500@xenomai.org>]
[parent not found: <CAPpP=rNtKwL3ifNx5iABmzXpKpSeYuHnw8asRY8xiicpvn4P2g@mail.gmail.com>]
[parent not found: <50D2E611.1040404@xenomai.org>]
* Re: [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep [not found] ` <50D2E611.1040404@xenomai.org> @ 2013-01-02 8:21 ` alex alex 0 siblings, 0 replies; 9+ messages in thread From: alex alex @ 2013-01-02 8:21 UTC (permalink / raw) To: Xenomai > >> If you want to avoid mode when using malloc, pre-allocate some memory > for > >> RT tasks, > >> then use a custom allocator (not malloc), such as the TLSF allocator for > >> instance. > >> > > > > > > Actually I carry out a frameworks portage so unfortunately I can not > change > > the malloc function. > > Yes you can, simply use the same --wrap technique as Xenomai. > I wrapped the malloc,calloc, realloc and free functions with those of the TLSF allocator and I don't have the page fault any more then the rtdm semaphore works properly since I stay in the primary mode. Thank you for your advices. Alex. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-02 8:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 14:35 [Xenomai] [Page fault - POSIX skin] Interraction between malloc en nanosleep alex alex
2012-12-18 14:40 ` Gilles Chanteperdrix
2012-12-18 15:27 ` Gilles Chanteperdrix
2012-12-18 15:30 ` Gilles Chanteperdrix
2012-12-18 16:16 ` alex alex
2012-12-18 16:28 ` Gilles Chanteperdrix
2012-12-18 19:27 ` alex alex
2012-12-18 20:19 ` Gilles Chanteperdrix
[not found] ` <CAPpP=rNbsH+iXBrK+vs3CZG3T0sxOw-NZ1Px=1unOLjZq3QgAQ@mail.gmail.com>
[not found] ` <50D1CFD0.9080500@xenomai.org>
[not found] ` <CAPpP=rNtKwL3ifNx5iABmzXpKpSeYuHnw8asRY8xiicpvn4P2g@mail.gmail.com>
[not found] ` <50D2E611.1040404@xenomai.org>
2013-01-02 8:21 ` alex alex
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.