All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
@ 2009-08-13 18:02 Henry Bausley
  2009-08-13 18:33 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Bausley @ 2009-08-13 18:02 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform
and getting 
the following message.

Xenomai Posix skin init: pthread_setschedparam: Resource temporarily
unavailable


It takes quite a while for this to happen.  The /proc/xenomai/heap value
for used keeps increasing.
Once the "used" gets very close to "size" the user space xenomai
applications can no longer run. 
I have isolated the problem to opening and closing shared memory areas.


  shmfd = shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777);
  if (shmfd == -1) {
    printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,
strerror(errno));
    return -1;
  }
  ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));

  pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
PROT_WRITE,MAP_SHARED, shmfd,0);

  munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM)));
  close(shmfd);
  shm_unlink(RTL_SHM_NAME);


The above calls are in a shared library that an applications call.

**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************

[-- Attachment #2: Type: text/html, Size: 1394 bytes --]

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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
  2009-08-13 18:02 [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable Henry Bausley
@ 2009-08-13 18:33 ` Gilles Chanteperdrix
  2009-08-16 23:07   ` Henry Bausley
       [not found]   ` <1250200537.28789.8.camel@domain.hid>
  0 siblings, 2 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2009-08-13 18:33 UTC (permalink / raw)
  To: Henry Bausley; +Cc: xenomai

Henry Bausley wrote:
> We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform
> and getting 
> the following message.
> 
> Xenomai Posix skin init: pthread_setschedparam: Resource temporarily
> unavailable
> 
> 
> It takes quite a while for this to happen.  The /proc/xenomai/heap value
> for used keeps increasing.
> Once the "used" gets very close to "size" the user space xenomai
> applications can no longer run. 
> I have isolated the problem to opening and closing shared memory areas.
> 
> 
>   shmfd = shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777);
>   if (shmfd == -1) {
>     printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,
> strerror(errno));
>     return -1;
>   }
>   ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));
> 
>   pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
> PROT_WRITE,MAP_SHARED, shmfd,0);
> 
>   munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM)));
>   close(shmfd);
>   shm_unlink(RTL_SHM_NAME);
> 
> 
> The above calls are in a shared library that an applications call.

Well, I am surprised, since I received no answer after trying and help
you with your last issue, I assumed you had stopped using Xenomai shared
memories.

Do you reproduce this issue with Xenomai 2.4.8?

-- 
					    Gilles.


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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
  2009-08-13 18:33 ` Gilles Chanteperdrix
@ 2009-08-16 23:07   ` Henry Bausley
       [not found]   ` <1250200537.28789.8.camel@domain.hid>
  1 sibling, 0 replies; 7+ messages in thread
From: Henry Bausley @ 2009-08-16 23:07 UTC (permalink / raw)
  To: xenomai

Yes I reproduced this issue with Xenomai 2.4.8.

----- Original Message ----- 
From: "Gilles Chanteperdrix" <gilles.chanteperdrix@xenomai.org>
To: "Henry Bausley" <hbausley@domain.hid>
Cc: <xenomai@xenomai.org>
Sent: Thursday, August 13, 2009 10:33 AM
Subject: Re: [Xenomai-help] pthread_setschedparam: Resource temporarily 
unavailable


> Henry Bausley wrote:
>> We are using 2.6.28.8 and xenomai 2.4.7 on a AMCC PowerPC 460EX platform
>> and getting
>> the following message.
>>
>> Xenomai Posix skin init: pthread_setschedparam: Resource temporarily
>> unavailable
>>
>>
>> It takes quite a while for this to happen.  The /proc/xenomai/heap value
>> for used keeps increasing.
>> Once the "used" gets very close to "size" the user space xenomai
>> applications can no longer run.
>> I have isolated the problem to opening and closing shared memory areas.
>>
>>
>>   shmfd = shm_open(RTL_SHM_NAME, O_CREAT | O_RDWR, 0777);
>>   if (shmfd == -1) {
>>     printf("Gp Share mem Open, Err: %d Msg: (%s)\n", errno,
>> strerror(errno));
>>     return -1;
>>   }
>>   ftruncate(shmfd,MAKE_PAGESIZE(sizeof(struct SHM)));
>>
>>   pshm = mmap(NULL,MAKE_PAGESIZE(sizeof(struct SHM)),PROT_READ |
>> PROT_WRITE,MAP_SHARED, shmfd,0);
>>
>>   munmap(pshm, MAKE_PAGESIZE(sizeof(struct SHM)));
>>   close(shmfd);
>>   shm_unlink(RTL_SHM_NAME);
>>
>>
>> The above calls are in a shared library that an applications call.
>
> Well, I am surprised, since I received no answer after trying and help
> you with your last issue, I assumed you had stopped using Xenomai shared
> memories.
>
> Do you reproduce this issue with Xenomai 2.4.8?
>
> -- 
>     Gilles.
> 




**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************


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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
       [not found]     ` <4A8808BA.4080504@domain.hid>
@ 2009-08-17 21:17       ` Henry Bausley
  2009-08-17 22:12         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Bausley @ 2009-08-17 21:17 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai help

I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05.
I'll rebuild the kernel with 2.6


root@domain.hid# dmesg | grep pipe ; dmesg | grep 2.4.8 ;
uname -a ; /opt/ppmac/tune/test ;
cat /proc/xenomai/heap ; /opt/ppmac/tune/test ; cat /proc/xenomai/heap
I-pipe 2.4-05: pipeline enabled.
I-pipe: Domain Xenomai registered.
Xenomai: real-time nucleus v2.4.8 (Lords Of Karma) loaded.
Linux powerpmac 2.6.28.8 #1 Mon Aug 17 11:51:01 PDT 2009 ppc GNU/Linux
size=4161536:used=23120:pagesz=512  (main heap)
size=32256:used=0:pagesz=512  (stack pool)
size=4161536:used=23152:pagesz=512  (main heap)
size=32256:used=0:pagesz=512  (stack pool)
root@domain.hid# 

scripts/prepare-kernel.sh --linux=../linux-2.6.28.8/ --arch=powerpc





On Sun, 2009-08-16 at 15:25 +0200, Gilles Chanteperdrix wrote:
> wrote:
> > Yes I can reproduce this on  xenomai 2.4.8.  Every time I call the
> > functions below I lose 32 bytes.
> > In my real application I actually have 6 different shared memory
> > segments so I lose 192 bytes every time
> > the app runs. 
> 
> There is no such leak on my test platforms, and it reminds me of a
> problem with automatic process cleanup which was fixed in the powerpc
> I-pipe patch some time ago. So, are you sure you are indeed running the
> latest I-pipe patch for powerpc which comes with xenomai 2.4.8?
> 
> My test program is the following:
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> #include <unistd.h>
> #include <sys/mman.h>
> #include <sys/fcntl.h>
> 
> #define SHM_NAME "/foo"
> #define SIZE 128 * 1024
> 
> int main(void)
> {
> 	int shmfd = shm_open(SHM_NAME, O_CREAT | O_RDWR, 0777);
> 	void *pshm;
> 	int rc;
> 
> 	if (shmfd == -1) {
> 		perror("shm_open");
> 		exit(EXIT_FAILURE);
> 	}
> 
> 	rc = ftruncate(shmfd, SIZE);
> 	if (rc == 1) {
> 		perror("ftruncate");
> 		exit(EXIT_FAILURE);
> 	}
> 
> 	pshm = mmap(NULL, SIZE,
> 		    PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0);
> 	if (pshm == MAP_FAILED) {
> 		perror("mmap");
> 		exit(EXIT_FAILURE);
> 	}
> 		
> 	rc = munmap(pshm, SIZE);
> 	if (rc == -1) {
> 		perror("munmap");
> 		exit(EXIT_FAILURE);
> 	}
> 		
> 	rc = close(shmfd);
> 	if (rc == -1) {
> 		perror("close");
> 		exit(EXIT_FAILURE);
> 	}
> 		
> 	rc = shm_unlink(SHM_NAME);
> 	if (rc == -1) {
> 		perror("shm_unlink");
> 		exit(EXIT_FAILURE);
> 	}
> }
> 



**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************


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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
  2009-08-17 21:17       ` Henry Bausley
@ 2009-08-17 22:12         ` Gilles Chanteperdrix
  2009-08-17 22:47           ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2009-08-17 22:12 UTC (permalink / raw)
  To: Henry Bausley; +Cc: Xenomai help

Henry Bausley wrote:
> I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05.
> I'll rebuild the kernel with 2.6

Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai
posix skin shared memories in the kernel configuration. The bug does not
happen on head though, only on 2.4. And this with the same version of
the I-pipe.


-- 
					    Gilles.


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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
  2009-08-17 22:12         ` Gilles Chanteperdrix
@ 2009-08-17 22:47           ` Gilles Chanteperdrix
  2009-08-18 15:29             ` Henry Bausley
  0 siblings, 1 reply; 7+ messages in thread
From: Gilles Chanteperdrix @ 2009-08-17 22:47 UTC (permalink / raw)
  To: Henry Bausley; +Cc: Xenomai help

Gilles Chanteperdrix wrote:
> Henry Bausley wrote:
>> I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05.
>> I'll rebuild the kernel with 2.6
> 
> Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai
> posix skin shared memories in the kernel configuration. The bug does not
> happen on head though, only on 2.4. And this with the same version of
> the I-pipe.

It should be fixed in the repository. Here is the patch:

diff --git a/ksrc/skins/posix/syscall.c b/ksrc/skins/posix/syscall.c
index ec0c102..898cc91 100644
--- a/ksrc/skins/posix/syscall.c
+++ b/ksrc/skins/posix/syscall.c
@@ -2717,6 +2717,8 @@ static int __munmap_epilogue(struct pt_regs *regs)
        xnlock_put_irqrestore(&pse51_assoc_lock, s);

        err = munmap(umap->kaddr, len);
+       if (!err)
+               xnfree(umap);

        return !err ? 0 : -thread_get_errno();
 }


-- 
					    Gilles.


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

* Re: [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable
  2009-08-17 22:47           ` Gilles Chanteperdrix
@ 2009-08-18 15:29             ` Henry Bausley
  0 siblings, 0 replies; 7+ messages in thread
From: Henry Bausley @ 2009-08-18 15:29 UTC (permalink / raw)
  To: Xenomai help

Thank you the memory leak is gone.

On Tue, 2009-08-18 at 00:47 +0200, Gilles Chanteperdrix wrote:
> Gilles Chanteperdrix wrote:
> > Henry Bausley wrote:
> >> I used the defaults that came up for my 2.6.28.8 kernel I-pipe 2.4-05.
> >> I'll rebuild the kernel with 2.6
> > 
> > Ok. Forget it, I can reproduce it. I simply forgot to enable Xenomai
> > posix skin shared memories in the kernel configuration. The bug does not
> > happen on head though, only on 2.4. And this with the same version of
> > the I-pipe.
> 
> It should be fixed in the repository. Here is the patch:
> 
> diff --git a/ksrc/skins/posix/syscall.c b/ksrc/skins/posix/syscall.c
> index ec0c102..898cc91 100644
> --- a/ksrc/skins/posix/syscall.c
> +++ b/ksrc/skins/posix/syscall.c
> @@ -2717,6 +2717,8 @@ static int __munmap_epilogue(struct pt_regs *regs)
>         xnlock_put_irqrestore(&pse51_assoc_lock, s);
> 
>         err = munmap(umap->kaddr, len);
> +       if (!err)
> +               xnfree(umap);
> 
>         return !err ? 0 : -thread_get_errno();
>  }
> 
> 



**********************************************************
Outbound scan for Spam or Virus by Barracuda at Delta Tau
**********************************************************


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

end of thread, other threads:[~2009-08-18 15:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-13 18:02 [Xenomai-help] pthread_setschedparam: Resource temporarily unavailable Henry Bausley
2009-08-13 18:33 ` Gilles Chanteperdrix
2009-08-16 23:07   ` Henry Bausley
     [not found]   ` <1250200537.28789.8.camel@domain.hid>
     [not found]     ` <4A8808BA.4080504@domain.hid>
2009-08-17 21:17       ` Henry Bausley
2009-08-17 22:12         ` Gilles Chanteperdrix
2009-08-17 22:47           ` Gilles Chanteperdrix
2009-08-18 15:29             ` Henry Bausley

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.