public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Massive ISR to DSR delay caused by free()
@ 2013-12-03 10:19 Peter Graf
  2013-12-03 13:37 ` Bernd Edlinger
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Graf @ 2013-12-03 10:19 UTC (permalink / raw)
  To: ecos-discuss

Hi,

under rare circumstances, we experienced a massive timing overflow of a cyclical DSR. It turned out to be an issue with JFFS2, occurring after a system reboot if  long files had been written to the filesystem before. 

I found that the issue was only caused by JFFS2's 

malloc-ecos.c: jffs2_free_full_dnode() 

By using an oscilloscope, I could see that after the ISR was served, the DSR was delayed, just because free() was called by  jffs2_free_full_dnode(). More precisely, the CPU time was spent in memalloc's 

mvarimpl.inl: Cyg_Mempool_Variable_Implementation::insert_free_block()

At first I thought it was a locking issue within JFFS2. But in the end I could not see any scheduler locks which might have caused it.

I now have indications, that it could be a general issue with free(). A call to free() from even a low priority thread seems to delay DSR execution after the ISR!

The allocator is compiled to be thread-safe, but in my opinion it would be a major drawback if even a low priority thread could not call free() without delaying a critical DSR.

Can someone confirm this behaviour? Is it intended?

Many thanks,
Peter


 

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* RE: [ECOS] Massive ISR to DSR delay caused by free()
  2013-12-03 10:19 [ECOS] Massive ISR to DSR delay caused by free() Peter Graf
@ 2013-12-03 13:37 ` Bernd Edlinger
  2013-12-03 15:36   ` Antw: " Peter Graf
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Edlinger @ 2013-12-03 13:37 UTC (permalink / raw)
  To: Peter Graf, ecos-discuss

On Tue, 3 Dec 2013 11:19:17, Peter Graf wrote:
>
> Hi,
>
> under rare circumstances, we experienced a massive timing overflow of a cyclical DSR. It turned out to be an issue with JFFS2, occurring after a system reboot if long files had been written to the filesystem before.
>
> I found that the issue was only caused by JFFS2's
>
> malloc-ecos.c: jffs2_free_full_dnode()
>
> By using an oscilloscope, I could see that after the ISR was served, the DSR was delayed, just because free() was called by jffs2_free_full_dnode(). More precisely, the CPU time was spent in memalloc's
>
> mvarimpl.inl: Cyg_Mempool_Variable_Implementation::insert_free_block()
>
> At first I thought it was a locking issue within JFFS2. But in the end I could not see any scheduler locks which might have caused it.
>
> I now have indications, that it could be a general issue with free(). A call to free() from even a low priority thread seems to delay DSR execution after the ISR!
>
> The allocator is compiled to be thread-safe, but in my opinion it would be a major drawback if even a low priority thread could not call free() without delaying a critical DSR.
>
> Can someone confirm this behaviour? Is it intended?
>
> Many thanks,
> Peter
>
>
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

This sounds like a know deficiency of the very first Doug-Lee Malloc.

Maybe you want check if this patch works for you?

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001634


Regards
Bernd Edlinger. 		 	   		  
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Antw: RE: [ECOS] Massive ISR to DSR delay caused by free()
  2013-12-03 13:37 ` Bernd Edlinger
@ 2013-12-03 15:36   ` Peter Graf
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Graf @ 2013-12-03 15:36 UTC (permalink / raw)
  To: ecos-discuss

Thanks Bernd,

I already tried the latest dlmalloc.cxx earlier, but apparently the simple variable block implementation is used. Do you know in general, wether a DSR gets delayed if free() is called from a thread?

Kind regards,
Peter




>>> Bernd Edlinger <bernd.edlinger@hotmail.de> schrieb am Dienstag, 3. Dezember
2013 um 14:37 in Nachricht <DUB122-W523DBD494B0C708798E81AE4D50@phx.gbl>:
> On Tue, 3 Dec 2013 11:19:17, Peter Graf wrote:
>>
>> Hi,
>>
>> under rare circumstances, we experienced a massive timing overflow of a 
> cyclical DSR. It turned out to be an issue with JFFS2, occurring after a 
> system reboot if long files had been written to the filesystem before.
>>
>> I found that the issue was only caused by JFFS2's
>>
>> malloc-ecos.c: jffs2_free_full_dnode()
>>
>> By using an oscilloscope, I could see that after the ISR was served, the DSR 
> was delayed, just because free() was called by jffs2_free_full_dnode(). More 
> precisely, the CPU time was spent in memalloc's
>>
>> mvarimpl.inl: Cyg_Mempool_Variable_Implementation::insert_free_block()
>>
>> At first I thought it was a locking issue within JFFS2. But in the end I 
> could not see any scheduler locks which might have caused it.
>>
>> I now have indications, that it could be a general issue with free(). A call 
> to free() from even a low priority thread seems to delay DSR execution after 
> the ISR!
>>
>> The allocator is compiled to be thread-safe, but in my opinion it would be a 
> major drawback if even a low priority thread could not call free() without 
> delaying a critical DSR.
>>
>> Can someone confirm this behaviour? Is it intended?
>>
>> Many thanks,
>> Peter
>>
>>
>>
>>
>> --
>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos 
>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss 
>>
> 
> This sounds like a know deficiency of the very first Doug-Lee Malloc.
> 
> Maybe you want check if this patch works for you?
> 
> http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001634 
> 
> 
> Regards
> Bernd Edlinger. 		 	   		  
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos 
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

 

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2013-12-03 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-03 10:19 [ECOS] Massive ISR to DSR delay caused by free() Peter Graf
2013-12-03 13:37 ` Bernd Edlinger
2013-12-03 15:36   ` Antw: " Peter Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).