All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Charles Kiorpes <ckiorpes@gmail.com>, xenomai@xenomai.org
Subject: Re: [Xenomai] Segfaults and ENOMEM during rt_event_create()
Date: Thu, 6 Aug 2015 10:00:35 +0200	[thread overview]
Message-ID: <55C31423.6070008@xenomai.org> (raw)
In-Reply-To: <20150806074939.GA20331@hermes.click-hack.org>

On 08/06/2015 09:49 AM, Gilles Chanteperdrix wrote:
> On Thu, Aug 06, 2015 at 09:40:53AM +0200, Philippe Gerum wrote:
>> On 08/05/2015 07:24 PM, Gilles Chanteperdrix wrote:
>>> On Wed, Aug 05, 2015 at 05:42:37PM +0200, Philippe Gerum wrote:
>>>> On 05/08/2015 15:09, Charles Kiorpes wrote:
>>>>> Hello,
>>>>>
>>>>> I am trying to port a fairly large application from Xenomai 2.6.4 to
>>>>> Xenomai 3.0-rc6
>>>>>
>>>>> Most of the port has been decently painless, but there is one issue I
>>>>> can't seem to get past.
>>>>>
>>>>> I am consistently getting ENOMEM errors and segfaults in
>>>>> libcopperplate.so during rt_event_create(), and always at the same
>>>>> spot in my application.
>>>>>
>>>>> If a segfault occurrs, the dmesg output from the segfault looks like this:
>>>>> [   235.422300] PortProcess[1502]: segfault at f1b3ebeb ip b76c14b7 sp
>>>>> bfeae498 error 5 in libcopperplate.so.0.0.0[b76b7000+14000]
>>>>>
>>>>> The application uses a large number of named event flag groups.  At
>>>>> the time that the error occurs, it is looping to create 32 new named
>>>>> event groups.
>>>>>
>>>>> I have increased these values in my kernel config:
>>>>> CONFIG_XENO_OPT_REGISTRY_NRSLOTS=4096
>>>>> CONFIG_XENO_OPT_SYS_HEAPSZ=512
>>>>> CONFIG_XENO_OPT_PRIVATE_HEAPSZ=128
>>>>> CONFIG_XENO_OPT_SHARED_HEAPSZ=128
>>>>>
>>>>> When I dig through the /proc/xenomai filesystem, I see that:
>>>>> - I am only using 383/4096 registry slots
>>>>> - My system heap is about half full (284160KB free of 524288KB)
>>>>> - My shared and private heaps are basically empty
>>>>>
>>>>> My application is launched with --mem-pool-size=400000.  The main heap
>>>>> (in /registry/user/session/system) has about 220KB used at the point
>>>>> that the error occurs.
>>>>> Increasing the mem-pool-size does not change the behavior.  I have
>>>>> also tried further increasing the values of my system (1024), private
>>>>> (256), and shared (256) heapsizes, with no effect.
>>>>>
>>>>> Obviously I've missed something, but I can't figure out where the
>>>>> error is occurring.
>>>>>
>>>>> System details:
>>>>> OS: Debian Jessie 32-bit
>>>>> Kernel: 3.18.12 - patched using Xenomai 3.0-rc6
>>>>> System: Intel Xeon W3503 (x86 architecture)
>>>>> I-Pipe version 1
>>>>>
>>>>
>>>> Any improvement with this patch in?
>>>>
>>>> commit 574c8e2edb99ff523e765cdb8749dd5259784627
>>>> Author: Philippe Gerum <rpm@xenomai.org>
>>>> Date:   Wed Aug 5 16:08:23 2015 +0200
>>>>
>>>>     lib/cobalt: fix private event state accessor
>>>>
>>>> diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
>>>> index 348ca14..62ecb4a 100644
>>>> --- a/lib/cobalt/internal.c
>>>> +++ b/lib/cobalt/internal.c
>>>> @@ -426,7 +426,7 @@ struct cobalt_event_state
>>>> *get_event_state(cobalt_event_t *event)
>>>>  {
>>>>  	return event->flags & COBALT_EVENT_SHARED ?
>>>
>>> I would put parens here.
>>>
>>
>> I'm trying hard, but I don't see why. The standard is pretty clear about
>> the ternary conditional (§6.5.15): its precedence is right above the
>> assignment operators and below anything else, expr0 is evaluated first
>> and followed by a sequence point.
> 
> I had trouble with if (a & b && c), so am now putting parens around
> (a & b) by principle, even if not needed.
> 

I agree in general, but the ternary operator is a bit special since by
design, it won't compete for precedence with the expressions it evaluates.

-- 
Philippe.


  reply	other threads:[~2015-08-06  8:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 13:09 [Xenomai] Segfaults and ENOMEM during rt_event_create() Charles Kiorpes
2015-08-05 15:42 ` Philippe Gerum
2015-08-05 16:34   ` Charles Kiorpes
2015-08-06  7:42     ` Philippe Gerum
2015-08-05 17:24   ` Gilles Chanteperdrix
2015-08-06  7:40     ` Philippe Gerum
2015-08-06  7:49       ` Gilles Chanteperdrix
2015-08-06  8:00         ` Philippe Gerum [this message]
2015-08-06  9:25           ` dietmar.schindler
2015-08-06 15:12             ` Philippe Gerum
     [not found]   ` <CAHoW4hHS2QS1td6mUiWid-unDrMDZaQMo3vkYsDynNze5YsaSw@mail.gmail.com>
     [not found]     ` <55C326C5.4070608@xenomai.org>
2015-08-06 15:00       ` Charles Kiorpes
2015-08-06 15:23         ` Philippe Gerum
2015-08-06 15:26           ` Philippe Gerum
2015-08-10 13:52           ` Charles Kiorpes
2015-08-10 15:01             ` Philippe Gerum
2015-08-10 15:17               ` Charles Kiorpes
2015-08-10 15:40                 ` Philippe Gerum
2015-08-13 11:14                 ` Philippe Gerum
2015-08-13 11:39                   ` Charles Kiorpes
2015-08-13 16:21                     ` Philippe Gerum
2015-08-10 15:50             ` Philippe Gerum
2015-08-11 15:17             ` Philippe Gerum
2015-08-11 15:14         ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C31423.6070008@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=ckiorpes@gmail.com \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.