Re: [rtems commit] tools/build/*.c: Clean up issues reported by CodeSonar

2014-11-27 Thread Sebastian Huber

On 26/11/14 14:55, Joel Sherril wrote:

Module:rtems
Branch:master
Commit:b1643030121f5ea336670cc9474f4a4a0b2a21eb
Changeset:http://git.rtems.org/rtems/commit/?id=b1643030121f5ea336670cc9474f4a4a0b2a21eb

Author:Josh Oguin
Date:  Tue Nov 25 15:55:49 2014 -0600

tools/build/*.c: Clean up issues reported by CodeSonar

This code is built without warnings and ignored by Coverity Scan.
CodeSonar found a wide range of issues including buffer overruns,
buffer underruns, questionable type conversions, leaks, etc. This
set of patches addresses all reported issues.

---

  tools/build/binpatch.c| 144 ++--
  tools/build/cklength.c|  28 +++---
  tools/build/eolstrip.c|  14 ++-
  tools/build/rtems-bin2c.c | 233 --
  tools/build/unhex.c   | 196 +++---
  5 files changed, 309 insertions(+), 306 deletions(-)


This change leads to:

gmake[6]: Entering directory 
`/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'
../../../../../../tools/build/rtems-bin2c -C 
/home/sh/rtems-4.11/c/src/../../testsuites/libtests/mghttpd01/init_fs.tar init_fs
*** Error in `../../../../../../tools/build/rtems-bin2c': free(): 
invalid pointer: 0x012344ce ***

=== Backtrace: =
/lib64/libc.so.6(+0x73d8f)[0x7fa7f74c0d8f]
/lib64/libc.so.6(+0x795ee)[0x7fa7f74c65ee]
/lib64/libc.so.6(+0x7a2c7)[0x7fa7f74c72c7]
../../../../../../tools/build/rtems-bin2c[0x400ca0]
../../../../../../tools/build/rtems-bin2c[0x4008e0]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fa7f746ebe5]
../../../../../../tools/build/rtems-bin2c[0x4009c1]
=== Memory map: 
0040-00402000 r-xp  08:16 15466972 
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
00601000-00602000 r--p 1000 08:16 15466972 
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
00602000-00603000 rw-p 2000 08:16 15466972 
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
01234000-01255000 rw-p  00:00 0  
[heap]
7fa7f7236000-7fa7f724c000 r-xp  08:01 2490378
/lib64/libgcc_s.so.1
7fa7f724c000-7fa7f744b000 ---p 00016000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744b000-7fa7f744c000 r--p 00015000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744c000-7fa7f744d000 rw-p 00016000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744d000-7fa7f75f2000 r-xp  08:01 2490421
/lib64/libc-2.18.so
7fa7f75f2000-7fa7f77f1000 ---p 001a5000 08:01 2490421
/lib64/libc-2.18.so
7fa7f77f1000-7fa7f77f5000 r--p 001a4000 08:01 2490421
/lib64/libc-2.18.so
7fa7f77f5000-7fa7f77f7000 rw-p 001a8000 08:01 2490421
/lib64/libc-2.18.so

7fa7f77f7000-7fa7f77fb000 rw-p  00:00 0
7fa7f77fb000-7fa7f781b000 r-xp  08:01 2500696
/lib64/ld-2.18.so

7fa7f79f-7fa7f79f3000 rw-p  00:00 0
7fa7f7a18000-7fa7f7a1a000 rw-p  00:00 0
7fa7f7a1a000-7fa7f7a1b000 r--p 0001f000 08:01 2500696
/lib64/ld-2.18.so
7fa7f7a1b000-7fa7f7a1c000 rw-p 0002 08:01 2500696
/lib64/ld-2.18.so

7fa7f7a1c000-7fa7f7a1d000 rw-p  00:00 0
7fff2f17-7fff2f192000 rw-p  00:00 0  
[stack]
7fff2f1fe000-7fff2f20 r-xp  00:00 0  
[vdso]
ff60-ff601000 r-xp  00:00 0  
[vsyscall]

gmake[6]: *** [init_fs.c] Aborted
gmake[6]: *** Deleting file `init_fs.c'
gmake[6]: Leaving directory 
`/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'

gmake[5]: *** [all-local] Error 1

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/2] score: Return heap stats via _Heap_Get_information

2014-11-27 Thread Sebastian Huber
Print out heap statistics via the MALLOC and WKSPACE shell commands.
---
 cpukit/libmisc/shell/internal.h |  7 --
 cpukit/libmisc/shell/main_mallocinfo.c  |  1 +
 cpukit/libmisc/shell/main_wkspaceinfo.c |  3 ++-
 cpukit/libmisc/shell/print_heapinfo.c   | 39 +++--
 cpukit/score/include/rtems/score/heap.h |  3 ++-
 cpukit/score/src/heapgetinfo.c  |  1 +
 doc/shell/memory.t  | 31 +-
 7 files changed, 68 insertions(+), 17 deletions(-)

diff --git a/cpukit/libmisc/shell/internal.h b/cpukit/libmisc/shell/internal.h
index 0187e5f..8ec2da0 100644
--- a/cpukit/libmisc/shell/internal.h
+++ b/cpukit/libmisc/shell/internal.h
@@ -32,10 +32,13 @@ int rtems_shell_execute_cmd(const char *cmd, int argc, char 
*argv[]);
 extern void rtems_shell_register_monitor_commands(void);
 
 extern void rtems_shell_print_heap_info(
-  const char   *c,
-  Heap_Information *h
+  const char *c,
+  const Heap_Information *h
 );
 
+extern void rtems_shell_print_heap_stats(
+  const Heap_Statistics *s
+);
 
 extern void rtems_shell_print_unified_work_area_message(void);
 
diff --git a/cpukit/libmisc/shell/main_mallocinfo.c 
b/cpukit/libmisc/shell/main_mallocinfo.c
index 54c602a..43e9883 100644
--- a/cpukit/libmisc/shell/main_mallocinfo.c
+++ b/cpukit/libmisc/shell/main_mallocinfo.c
@@ -37,6 +37,7 @@ static int rtems_shell_main_malloc_info(
 malloc_info( &info );
 rtems_shell_print_heap_info( "free", &info.Free );
 rtems_shell_print_heap_info( "used", &info.Used );
+rtems_shell_print_heap_stats( &info.Stats );
   }
 
   return 0;
diff --git a/cpukit/libmisc/shell/main_wkspaceinfo.c 
b/cpukit/libmisc/shell/main_wkspaceinfo.c
index f4f6f4d..a990652 100644
--- a/cpukit/libmisc/shell/main_wkspaceinfo.c
+++ b/cpukit/libmisc/shell/main_wkspaceinfo.c
@@ -24,7 +24,7 @@
 
 void rtems_shell_print_unified_work_area_message(void)
 {
-  printf( "\nC Program Heap and RTEMS Workspace are %s.\n",
+  printf( "C Program Heap and RTEMS Workspace are %s.\n",
 rtems_configuration_get_unified_work_area() ? "the same" : "separate"
   );
 }
@@ -41,6 +41,7 @@ static int rtems_shell_main_wkspace_info(
   _Protected_heap_Get_information( &_Workspace_Area, &info );
   rtems_shell_print_heap_info( "free", &info.Free );
   rtems_shell_print_heap_info( "used", &info.Used );
+  rtems_shell_print_heap_stats( &info.Stats );
 
   return 0;
 }
diff --git a/cpukit/libmisc/shell/print_heapinfo.c 
b/cpukit/libmisc/shell/print_heapinfo.c
index 12bc363..4ac9c96 100644
--- a/cpukit/libmisc/shell/print_heapinfo.c
+++ b/cpukit/libmisc/shell/print_heapinfo.c
@@ -14,22 +14,47 @@
 #endif
 
 #include 
+#include 
 
-#include 
-#include 
 #include "internal.h"
 
 void rtems_shell_print_heap_info(
-  const char   *c,
-  Heap_Information *h
+  const char *c,
+  const Heap_Information *h
 )
 {
   printf(
-"Number of %s blocks: %" PRId32 "\n"
-"Largest %s block:%" PRId32 "\n"
-"Total bytes %s:  %" PRId32 "\n",
+"Number of %s blocks:%12" PRId32 "\n"
+"Largest %s block:   %12" PRId32 "\n"
+"Total bytes %s: %12" PRId32 "\n",
 c, h->number,
 c, h->largest,
 c, h->total
   );
 }
+
+void rtems_shell_print_heap_stats(
+  const Heap_Statistics *s
+)
+{
+  printf(
+"Instance number:  %12" PRIu32 "\n"
+"Size of the allocatable area in bytes:%12" PRIuPTR "\n"
+"Minimum free size ever in bytes:  %12" PRIuPTR "\n"
+"Maximum number of free blocks ever:   %12" PRIu32 "\n"
+"Maximum number of blocks searched ever:   %12" PRIu32 "\n"
+"Total number of successful allocations:   %12" PRIu32 "\n"
+"Total number of searches ever:%12" PRIu32 "\n"
+"Total number of successful calls to free: %12" PRIu32 "\n"
+"Total number of successful resizes:   %12" PRIu32 "\n",
+s->instance,
+s->size,
+s->min_free_size,
+s->max_free_blocks,
+s->max_search,
+s->allocs,
+s->searches,
+s->frees,
+s->resizes
+  );
+}
diff --git a/cpukit/score/include/rtems/score/heap.h 
b/cpukit/score/include/rtems/score/heap.h
index 0120a2b..6042a13 100644
--- a/cpukit/score/include/rtems/score/heap.h
+++ b/cpukit/score/include/rtems/score/heap.h
@@ -313,7 +313,7 @@ typedef struct {
   uint32_t searches;
 
   /**
-   * @brief Total number of suceessful calls to free.
+   * @brief Total number of successful calls to free.
*/
   uint32_t frees;
 
@@ -366,6 +366,7 @@ typedef struct {
 typedef struct {
   Heap_Information Free;
   Heap_Information Used;
+  Heap_Statistics Stats;
 } Heap_Information_block;
 
 /**
diff --git a/cpukit/score/src/heapgetinfo.c b/cpukit/score/src/heapgetinfo.c
index 8565be4..287d269 100644
--- a/cpukit/score/src/heapgetinfo.c
+++ b/cpukit/score/src/heapgetinfo.c
@@ -50,4 +50,5 @@ void _Heap_Get_information(
   memset( the_info, 0, sizeof(*the_info) );

[PATCH 1/2] libcsupport: Delete malloc statistics

2014-11-27 Thread Sebastian Huber
Use the heap handler statistics instead.  Add heap walk option to MALLOC
shell command.

close #1367
---
 cpukit/libcsupport/Makefile.am |  7 +-
 cpukit/libcsupport/include/rtems/malloc.h  | 63 -
 cpukit/libcsupport/src/calloc.c|  5 --
 cpukit/libcsupport/src/free.c  | 10 +--
 cpukit/libcsupport/src/malloc.c|  8 ---
 cpukit/libcsupport/src/malloc_get_statistics.c | 36 --
 cpukit/libcsupport/src/malloc_initialize.c | 11 ---
 cpukit/libcsupport/src/malloc_p.h  |  7 --
 cpukit/libcsupport/src/malloc_report_statistics.c  | 29 
 .../src/malloc_report_statistics_plugin.c  | 59 
 cpukit/libcsupport/src/malloc_statistics_helpers.c | 77 -
 cpukit/libcsupport/src/posix_memalign.c|  6 --
 cpukit/libcsupport/src/realloc.c   |  4 --
 .../libcsupport/src/rtems_heap_extend_via_sbrk.c   |  2 -
 cpukit/libcsupport/src/rtems_memalign.c|  6 --
 cpukit/libmisc/shell/main_mallocinfo.c | 32 -
 cpukit/sapi/include/confdefs.h | 13 
 doc/shell/memory.t | 79 --
 doc/user/conf.t| 31 -
 testsuites/libtests/Makefile.am|  2 +-
 testsuites/libtests/configure.ac   |  1 -
 testsuites/libtests/malloc05/Makefile.am   | 21 --
 testsuites/libtests/malloc05/init.c| 58 
 testsuites/libtests/malloc05/malloc05.doc  | 19 --
 testsuites/libtests/malloc05/malloc05.scn  |  4 --
 testsuites/libtests/malloctest/task1.c |  1 -
 26 files changed, 45 insertions(+), 546 deletions(-)
 delete mode 100644 cpukit/libcsupport/src/malloc_get_statistics.c
 delete mode 100644 cpukit/libcsupport/src/malloc_report_statistics.c
 delete mode 100644 cpukit/libcsupport/src/malloc_report_statistics_plugin.c
 delete mode 100644 cpukit/libcsupport/src/malloc_statistics_helpers.c
 delete mode 100644 testsuites/libtests/malloc05/Makefile.am
 delete mode 100644 testsuites/libtests/malloc05/init.c
 delete mode 100644 testsuites/libtests/malloc05/malloc05.doc
 delete mode 100644 testsuites/libtests/malloc05/malloc05.scn

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index dfa8736..1486194 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -98,10 +98,9 @@ MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c 
src/malloc.c \
 src/realloc.c src/_calloc_r.c src/_malloc_r.c \
 src/free.c src/_free_r.c \
 src/_realloc_r.c src/mallocfreespace.c \
-   src/mallocgetheapptr.c src/mallocsetheapptr.c \
-src/mallocinfo.c src/malloc_walk.c src/malloc_get_statistics.c \
-src/malloc_report_statistics.c src/malloc_report_statistics_plugin.c \
-src/malloc_statistics_helpers.c src/posix_memalign.c \
+src/mallocgetheapptr.c src/mallocsetheapptr.c \
+src/mallocinfo.c src/malloc_walk.c \
+src/posix_memalign.c \
 src/rtems_memalign.c src/malloc_deferred.c \
 src/malloc_dirtier.c src/malloc_p.h src/rtems_malloc.c \
 src/rtems_heap_extend_via_sbrk.c \
diff --git a/cpukit/libcsupport/include/rtems/malloc.h 
b/cpukit/libcsupport/include/rtems/malloc.h
index 25c2ead..7c00f21 100644
--- a/cpukit/libcsupport/include/rtems/malloc.h
+++ b/cpukit/libcsupport/include/rtems/malloc.h
@@ -48,34 +48,6 @@ void RTEMS_Malloc_Initialize(
   Heap_Initialization_or_extend_handler extend
 );
 
-/*
- *  Malloc Statistics Structure
- */
-typedef struct {
-uint32_tspace_available; /* current size of malloc area */
-uint32_tmalloc_calls;/* # calls to malloc */
-uint32_tmemalign_calls;  /* # calls to memalign */
-uint32_tfree_calls;
-uint32_trealloc_calls;
-uint32_tcalloc_calls;
-uint32_tmax_depth;  /* most ever malloc'd at 1 time */
-uintmax_t   lifetime_allocated;
-uintmax_t   lifetime_freed;
-} rtems_malloc_statistics_t;
-
-/*
- *  Malloc statistics plugin
- */
-typedef struct {
-  void (*initialize)(void);
-  void (*at_malloc)(void *);
-  void (*at_free)(void *);
-} rtems_malloc_statistics_functions_t;
-
-extern rtems_malloc_statistics_functions_t
-  rtems_malloc_statistics_helpers_table;
-extern rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers;
-
 extern ptrdiff_t RTEMS_Malloc_Sbrk_amount;
 
 static inline void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount )
@@ -122,41 +94,6 @@ void rtems_malloc_dirty_memory(
 );
 
 /**
- *  @brief Print Malloc Statistic Usage Report
- *
- *  This method fills in the called provided malloc statistics area.
- *
- *  @return This method returns 0 if successful and -1 on error.
- */
-int malloc_get_statistics(
-  rtems_malloc_statistics_t *stats
-);
-
-/**
- *  @bri

[PATCH] bdbuf: Fix race condition with sync active flag

2014-11-27 Thread Sebastian Huber
Bug report by Oleg Kravtsov:

In rtems_bdbuf_swapout_processing() function there is the following
lines:

if (bdbuf_cache.sync_active && !transfered_buffers)
{

rtems_id sync_requester;
rtems_bdbuf_lock_cache ();
...

}

Here access to bdbuf_cache.sync_active is not protected with anything.
Imagine the following test case:

1. Task1 releases buffer(s) with bdbuf_release_modified() calls;

2. After a while swapout task starts and flushes all buffers;

3. In the end of that swapout flush we are before that part of code, and
assume there is task switching (just before "if (bdbuf_cache.sync_active
&& !transfered_buffers)");

4. Some other task (with higher priority) does bdbuf_release_modified
and rtems_bdbuf_syncdev().

This task successfully gets both locks sync and pool (in
rtems_bdbuf_syncdev() function), sets sync_active to true and starts
waiting for RTEMS_BDBUF_TRANSFER_SYNC event with only sync lock got.

5. Task switching happens again and we are again before "if
(bdbuf_cache.sync_active && !transfered_buffers)".

As the result we check sync_active and we come inside that "if"
statement.

6. The result is that we send RTEMS_BDBUF_TRANSFER_SYNC event! Though
ALL modified messages of that task are not flushed yet!

close #1485
---
 cpukit/libblock/src/bdbuf.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index bae57e2..8ea8cba 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -2749,10 +2749,16 @@ rtems_bdbuf_swapout_processing (unsigned long   
  timer_delta,
 {
   rtems_bdbuf_swapout_worker* worker;
   booltransfered_buffers = false;
+  boolsync_active;
 
   rtems_bdbuf_lock_cache ();
 
   /*
+   * To set this to true you need the cache and the sync lock.
+   */
+  sync_active = bdbuf_cache.sync_active;
+
+  /*
* If a sync is active do not use a worker because the current code does not
* cleaning up after. We need to know the buffers have been written when
* syncing to release sync lock and currently worker threads do not return to
@@ -2761,7 +2767,7 @@ rtems_bdbuf_swapout_processing (unsigned long 
timer_delta,
* lock. The simplest solution is to get the main swap out task perform all
* sync operations.
*/
-  if (bdbuf_cache.sync_active)
+  if (sync_active)
 worker = NULL;
   else
   {
@@ -2773,14 +2779,14 @@ rtems_bdbuf_swapout_processing (unsigned long   
  timer_delta,
 
   rtems_chain_initialize_empty (&transfer->bds);
   transfer->dd = BDBUF_INVALID_DEV;
-  transfer->syncing = bdbuf_cache.sync_active;
+  transfer->syncing = sync_active;
 
   /*
* When the sync is for a device limit the sync to that device. If the sync
* is for a buffer handle process the devices in the order on the sync
* list. This means the dev is BDBUF_INVALID_DEV.
*/
-  if (bdbuf_cache.sync_active)
+  if (sync_active)
 transfer->dd = bdbuf_cache.sync_device;
 
   /*
@@ -2799,7 +2805,7 @@ rtems_bdbuf_swapout_processing (unsigned long 
timer_delta,
   rtems_bdbuf_swapout_modified_processing (&transfer->dd,
&bdbuf_cache.modified,
&transfer->bds,
-   bdbuf_cache.sync_active,
+   sync_active,
update_timers,
timer_delta);
 
@@ -2830,7 +2836,7 @@ rtems_bdbuf_swapout_processing (unsigned long 
timer_delta,
 transfered_buffers = true;
   }
 
-  if (bdbuf_cache.sync_active && !transfered_buffers)
+  if (sync_active && !transfered_buffers)
   {
 rtems_id sync_requester;
 rtems_bdbuf_lock_cache ();
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] sync.c: Add asserts to document and check assumptions

2014-11-27 Thread Joel Sherrill
---
 cpukit/libcsupport/src/sync.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index 653a177..e449cab 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -29,6 +29,7 @@ int fdatasync(int);/* still not always prototyped */
 #include 
 
 #include 
+#include 
 
 /* XXX check standards -- Linux version appears to be void */
 void _fwalk(struct _reent *, void *);
@@ -37,14 +38,20 @@ void _fwalk(struct _reent *, void *);
 static void sync_wrapper(FILE *f)
 {
   int fn = fileno(f);
+  int rc;
 
   /*
*  We are explicitly NOT checking the return values as it does not
*  matter if they succeed.  We are just making a best faith attempt
*  at both and trusting that we were passed a good FILE pointer.
*/
-  fsync(fn);
-  fdatasync(fn);
+  _Assert( fn != -1 );
+
+  rc = fsync(fn);
+  _Assert( rc == 0 );
+
+  rc = fdatasync(fn);
+  _Assert( rc == 0 );
 }
 
 /* iterate over all FILE *'s for this thread */
-- 
1.9.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [rtems commit] tools/build/*.c: Clean up issues reported by CodeSonar

2014-11-27 Thread Joel Sherrill

On 11/27/2014 02:26 AM, Sebastian Huber wrote:

On 26/11/14 14:55, Joel Sherril wrote:

Module:rtems
Branch:master
Commit:b1643030121f5ea336670cc9474f4a4a0b2a21eb
Changeset:http://git.rtems.org/rtems/commit/?id=b1643030121f5ea336670cc9474f4a4a0b2a21eb

Author:Josh Oguin
Date:  Tue Nov 25 15:55:49 2014 -0600

tools/build/*.c: Clean up issues reported by CodeSonar

This code is built without warnings and ignored by Coverity Scan.
CodeSonar found a wide range of issues including buffer overruns,
buffer underruns, questionable type conversions, leaks, etc. This
set of patches addresses all reported issues.

---

   tools/build/binpatch.c| 144 ++--
   tools/build/cklength.c|  28 +++---
   tools/build/eolstrip.c|  14 ++-
   tools/build/rtems-bin2c.c | 233 
--
   tools/build/unhex.c   | 196 +++---
   5 files changed, 309 insertions(+), 306 deletions(-)

This change leads to:


Sorry. Somehow the build sweeps I was doing either didn't build tests
or didn't build with networking enabled.

Fixed now. Turned out to be malloc'ed memory where the original
pointer was modified so it freed a pointer that was in the middle
of the block.

gmake[6]: Entering directory
`/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'
../../../../../../tools/build/rtems-bin2c -C
/home/sh/rtems-4.11/c/src/../../testsuites/libtests/mghttpd01/init_fs.tar 
init_fs
*** Error in `../../../../../../tools/build/rtems-bin2c': free():
invalid pointer: 0x012344ce ***
=== Backtrace: =
/lib64/libc.so.6(+0x73d8f)[0x7fa7f74c0d8f]
/lib64/libc.so.6(+0x795ee)[0x7fa7f74c65ee]
/lib64/libc.so.6(+0x7a2c7)[0x7fa7f74c72c7]
../../../../../../tools/build/rtems-bin2c[0x400ca0]
../../../../../../tools/build/rtems-bin2c[0x4008e0]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fa7f746ebe5]
../../../../../../tools/build/rtems-bin2c[0x4009c1]
=== Memory map: 
0040-00402000 r-xp  08:16 15466972
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
00601000-00602000 r--p 1000 08:16 15466972
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
00602000-00603000 rw-p 2000 08:16 15466972
/scratch/git-build/b-smp-ngmp/tools/build/rtems-bin2c
01234000-01255000 rw-p  00:00 0
[heap]
7fa7f7236000-7fa7f724c000 r-xp  08:01 2490378
/lib64/libgcc_s.so.1
7fa7f724c000-7fa7f744b000 ---p 00016000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744b000-7fa7f744c000 r--p 00015000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744c000-7fa7f744d000 rw-p 00016000 08:01 2490378
/lib64/libgcc_s.so.1
7fa7f744d000-7fa7f75f2000 r-xp  08:01 2490421
/lib64/libc-2.18.so
7fa7f75f2000-7fa7f77f1000 ---p 001a5000 08:01 2490421
/lib64/libc-2.18.so
7fa7f77f1000-7fa7f77f5000 r--p 001a4000 08:01 2490421
/lib64/libc-2.18.so
7fa7f77f5000-7fa7f77f7000 rw-p 001a8000 08:01 2490421
/lib64/libc-2.18.so
7fa7f77f7000-7fa7f77fb000 rw-p  00:00 0
7fa7f77fb000-7fa7f781b000 r-xp  08:01 2500696
/lib64/ld-2.18.so
7fa7f79f-7fa7f79f3000 rw-p  00:00 0
7fa7f7a18000-7fa7f7a1a000 rw-p  00:00 0
7fa7f7a1a000-7fa7f7a1b000 r--p 0001f000 08:01 2500696
/lib64/ld-2.18.so
7fa7f7a1b000-7fa7f7a1c000 rw-p 0002 08:01 2500696
/lib64/ld-2.18.so
7fa7f7a1c000-7fa7f7a1d000 rw-p  00:00 0
7fff2f17-7fff2f192000 rw-p  00:00 0
[stack]
7fff2f1fe000-7fff2f20 r-xp  00:00 0
[vdso]
ff60-ff601000 r-xp  00:00 0
[vsyscall]
gmake[6]: *** [init_fs.c] Aborted
gmake[6]: *** Deleting file `init_fs.c'
gmake[6]: Leaving directory
`/scratch/git-build/b-smp-ngmp/sparc-rtems4.11/c/ngmp/testsuites/libtests/mghttpd01'
gmake[5]: *** [all-local] Error 1



___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/2] score: Return heap stats via _Heap_Get_information

2014-11-27 Thread Gedare Bloom
OK. A general comment it it would be nice to unify RTEMS various
"statistics" into a common format for easier printing and transferring
off-board.

-gedare

On Thu, Nov 27, 2014 at 7:26 AM, Sebastian Huber
 wrote:
> Print out heap statistics via the MALLOC and WKSPACE shell commands.
> ---
>  cpukit/libmisc/shell/internal.h |  7 --
>  cpukit/libmisc/shell/main_mallocinfo.c  |  1 +
>  cpukit/libmisc/shell/main_wkspaceinfo.c |  3 ++-
>  cpukit/libmisc/shell/print_heapinfo.c   | 39 
> +++--
>  cpukit/score/include/rtems/score/heap.h |  3 ++-
>  cpukit/score/src/heapgetinfo.c  |  1 +
>  doc/shell/memory.t  | 31 +-
>  7 files changed, 68 insertions(+), 17 deletions(-)
>
> diff --git a/cpukit/libmisc/shell/internal.h b/cpukit/libmisc/shell/internal.h
> index 0187e5f..8ec2da0 100644
> --- a/cpukit/libmisc/shell/internal.h
> +++ b/cpukit/libmisc/shell/internal.h
> @@ -32,10 +32,13 @@ int rtems_shell_execute_cmd(const char *cmd, int argc, 
> char *argv[]);
>  extern void rtems_shell_register_monitor_commands(void);
>
>  extern void rtems_shell_print_heap_info(
> -  const char   *c,
> -  Heap_Information *h
> +  const char *c,
> +  const Heap_Information *h
>  );
>
> +extern void rtems_shell_print_heap_stats(
> +  const Heap_Statistics *s
> +);
>
>  extern void rtems_shell_print_unified_work_area_message(void);
>
> diff --git a/cpukit/libmisc/shell/main_mallocinfo.c 
> b/cpukit/libmisc/shell/main_mallocinfo.c
> index 54c602a..43e9883 100644
> --- a/cpukit/libmisc/shell/main_mallocinfo.c
> +++ b/cpukit/libmisc/shell/main_mallocinfo.c
> @@ -37,6 +37,7 @@ static int rtems_shell_main_malloc_info(
>  malloc_info( &info );
>  rtems_shell_print_heap_info( "free", &info.Free );
>  rtems_shell_print_heap_info( "used", &info.Used );
> +rtems_shell_print_heap_stats( &info.Stats );
>}
>
>return 0;
> diff --git a/cpukit/libmisc/shell/main_wkspaceinfo.c 
> b/cpukit/libmisc/shell/main_wkspaceinfo.c
> index f4f6f4d..a990652 100644
> --- a/cpukit/libmisc/shell/main_wkspaceinfo.c
> +++ b/cpukit/libmisc/shell/main_wkspaceinfo.c
> @@ -24,7 +24,7 @@
>
>  void rtems_shell_print_unified_work_area_message(void)
>  {
> -  printf( "\nC Program Heap and RTEMS Workspace are %s.\n",
> +  printf( "C Program Heap and RTEMS Workspace are %s.\n",
>  rtems_configuration_get_unified_work_area() ? "the same" : "separate"
>);
>  }
> @@ -41,6 +41,7 @@ static int rtems_shell_main_wkspace_info(
>_Protected_heap_Get_information( &_Workspace_Area, &info );
>rtems_shell_print_heap_info( "free", &info.Free );
>rtems_shell_print_heap_info( "used", &info.Used );
> +  rtems_shell_print_heap_stats( &info.Stats );
>
>return 0;
>  }
> diff --git a/cpukit/libmisc/shell/print_heapinfo.c 
> b/cpukit/libmisc/shell/print_heapinfo.c
> index 12bc363..4ac9c96 100644
> --- a/cpukit/libmisc/shell/print_heapinfo.c
> +++ b/cpukit/libmisc/shell/print_heapinfo.c
> @@ -14,22 +14,47 @@
>  #endif
>
>  #include 
> +#include 
>
> -#include 
> -#include 
>  #include "internal.h"
>
>  void rtems_shell_print_heap_info(
> -  const char   *c,
> -  Heap_Information *h
> +  const char *c,
> +  const Heap_Information *h
>  )
>  {
>printf(
> -"Number of %s blocks: %" PRId32 "\n"
> -"Largest %s block:%" PRId32 "\n"
> -"Total bytes %s:  %" PRId32 "\n",
> +"Number of %s blocks:%12" PRId32 "\n"
> +"Largest %s block:   %12" PRId32 "\n"
> +"Total bytes %s: %12" PRId32 "\n",
>  c, h->number,
>  c, h->largest,
>  c, h->total
>);
>  }
> +
> +void rtems_shell_print_heap_stats(
> +  const Heap_Statistics *s
> +)
> +{
> +  printf(
> +"Instance number:  %12" PRIu32 "\n"
> +"Size of the allocatable area in bytes:%12" PRIuPTR "\n"
> +"Minimum free size ever in bytes:  %12" PRIuPTR "\n"
> +"Maximum number of free blocks ever:   %12" PRIu32 "\n"
> +"Maximum number of blocks searched ever:   %12" PRIu32 "\n"
> +"Total number of successful allocations:   %12" PRIu32 "\n"
> +"Total number of searches ever:%12" PRIu32 "\n"
> +"Total number of successful calls to free: %12" PRIu32 "\n"
> +"Total number of successful resizes:   %12" PRIu32 "\n",
> +s->instance,
> +s->size,
> +s->min_free_size,
> +s->max_free_blocks,
> +s->max_search,
> +s->allocs,
> +s->searches,
> +s->frees,
> +s->resizes
> +  );
> +}
> diff --git a/cpukit/score/include/rtems/score/heap.h 
> b/cpukit/score/include/rtems/score/heap.h
> index 0120a2b..6042a13 100644
> --- a/cpukit/score/include/rtems/score/heap.h
> +++ b/cpukit/score/include/rtems/score/heap.h
> @@ -313,7 +313,7 @@ typedef struct {
>uint32_t searches;
>
>/**
> -   * @brief Total number of suceessful calls to free.
> +   * @brief Total number of successful calls to fr

Re: [PATCH 1/2] libcsupport: Delete malloc statistics

2014-11-27 Thread Gedare Bloom
Any particular reason for dropping memalign_calls?

Any other stats get dropped?

On Thu, Nov 27, 2014 at 7:26 AM, Sebastian Huber
 wrote:
> Use the heap handler statistics instead.  Add heap walk option to MALLOC
> shell command.
>
> close #1367
> ---
>  cpukit/libcsupport/Makefile.am |  7 +-
>  cpukit/libcsupport/include/rtems/malloc.h  | 63 -
>  cpukit/libcsupport/src/calloc.c|  5 --
>  cpukit/libcsupport/src/free.c  | 10 +--
>  cpukit/libcsupport/src/malloc.c|  8 ---
>  cpukit/libcsupport/src/malloc_get_statistics.c | 36 --
>  cpukit/libcsupport/src/malloc_initialize.c | 11 ---
>  cpukit/libcsupport/src/malloc_p.h  |  7 --
>  cpukit/libcsupport/src/malloc_report_statistics.c  | 29 
>  .../src/malloc_report_statistics_plugin.c  | 59 
>  cpukit/libcsupport/src/malloc_statistics_helpers.c | 77 -
>  cpukit/libcsupport/src/posix_memalign.c|  6 --
>  cpukit/libcsupport/src/realloc.c   |  4 --
>  .../libcsupport/src/rtems_heap_extend_via_sbrk.c   |  2 -
>  cpukit/libcsupport/src/rtems_memalign.c|  6 --
>  cpukit/libmisc/shell/main_mallocinfo.c | 32 -
>  cpukit/sapi/include/confdefs.h | 13 
>  doc/shell/memory.t | 79 
> --
>  doc/user/conf.t| 31 -
>  testsuites/libtests/Makefile.am|  2 +-
>  testsuites/libtests/configure.ac   |  1 -
>  testsuites/libtests/malloc05/Makefile.am   | 21 --
>  testsuites/libtests/malloc05/init.c| 58 
>  testsuites/libtests/malloc05/malloc05.doc  | 19 --
>  testsuites/libtests/malloc05/malloc05.scn  |  4 --
>  testsuites/libtests/malloctest/task1.c |  1 -
>  26 files changed, 45 insertions(+), 546 deletions(-)
>  delete mode 100644 cpukit/libcsupport/src/malloc_get_statistics.c
>  delete mode 100644 cpukit/libcsupport/src/malloc_report_statistics.c
>  delete mode 100644 cpukit/libcsupport/src/malloc_report_statistics_plugin.c
>  delete mode 100644 cpukit/libcsupport/src/malloc_statistics_helpers.c
>  delete mode 100644 testsuites/libtests/malloc05/Makefile.am
>  delete mode 100644 testsuites/libtests/malloc05/init.c
>  delete mode 100644 testsuites/libtests/malloc05/malloc05.doc
>  delete mode 100644 testsuites/libtests/malloc05/malloc05.scn
>
> diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
> index dfa8736..1486194 100644
> --- a/cpukit/libcsupport/Makefile.am
> +++ b/cpukit/libcsupport/Makefile.am
> @@ -98,10 +98,9 @@ MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c 
> src/malloc.c \
>  src/realloc.c src/_calloc_r.c src/_malloc_r.c \
>  src/free.c src/_free_r.c \
>  src/_realloc_r.c src/mallocfreespace.c \
> -   src/mallocgetheapptr.c src/mallocsetheapptr.c \
> -src/mallocinfo.c src/malloc_walk.c src/malloc_get_statistics.c \
> -src/malloc_report_statistics.c src/malloc_report_statistics_plugin.c \
> -src/malloc_statistics_helpers.c src/posix_memalign.c \
> +src/mallocgetheapptr.c src/mallocsetheapptr.c \
> +src/mallocinfo.c src/malloc_walk.c \
> +src/posix_memalign.c \
>  src/rtems_memalign.c src/malloc_deferred.c \
>  src/malloc_dirtier.c src/malloc_p.h src/rtems_malloc.c \
>  src/rtems_heap_extend_via_sbrk.c \
> diff --git a/cpukit/libcsupport/include/rtems/malloc.h 
> b/cpukit/libcsupport/include/rtems/malloc.h
> index 25c2ead..7c00f21 100644
> --- a/cpukit/libcsupport/include/rtems/malloc.h
> +++ b/cpukit/libcsupport/include/rtems/malloc.h
> @@ -48,34 +48,6 @@ void RTEMS_Malloc_Initialize(
>Heap_Initialization_or_extend_handler extend
>  );
>
> -/*
> - *  Malloc Statistics Structure
> - */
> -typedef struct {
> -uint32_tspace_available; /* current size of malloc area 
> */
> -uint32_tmalloc_calls;/* # calls to malloc */
> -uint32_tmemalign_calls;  /* # calls to memalign */
> -uint32_tfree_calls;
> -uint32_trealloc_calls;
> -uint32_tcalloc_calls;
> -uint32_tmax_depth;  /* most ever malloc'd at 1 time 
> */
> -uintmax_t   lifetime_allocated;
> -uintmax_t   lifetime_freed;
> -} rtems_malloc_statistics_t;
> -
> -/*
> - *  Malloc statistics plugin
> - */
> -typedef struct {
> -  void (*initialize)(void);
> -  void (*at_malloc)(void *);
> -  void (*at_free)(void *);
> -} rtems_malloc_statistics_functions_t;
> -
> -extern rtems_malloc_statistics_functions_t
> -  rtems_malloc_statistics_helpers_table;
> -extern rtems_malloc_statistics_functions_t *rtems_malloc_statistics_helpers;
> -
>  extern ptrdiff_t RTEMS_Malloc_Sbrk_amount;
>
>  static inline void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount )
> 

Re: [PATCH] sync.c: Add asserts to document and check assumptions

2014-11-27 Thread Sebastian Huber


On 27/11/14 16:31, Joel Sherrill wrote:

---
  cpukit/libcsupport/src/sync.c | 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index 653a177..e449cab 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -29,6 +29,7 @@ int fdatasync(int);/* still not always prototyped */
  #include 
  
  #include 

+#include 
  
  /* XXX check standards -- Linux version appears to be void */

  void _fwalk(struct _reent *, void *);
@@ -37,14 +38,20 @@ void _fwalk(struct _reent *, void *);
  static void sync_wrapper(FILE *f)
  {
int fn = fileno(f);
+  int rc;
  
/*

 *  We are explicitly NOT checking the return values as it does not
 *  matter if they succeed.  We are just making a best faith attempt
 *  at both and trusting that we were passed a good FILE pointer.
 */
-  fsync(fn);
-  fdatasync(fn);
+  _Assert( fn != -1 );


I don't think this assert is useful, what about -2 and ? Its the 
job of fsync() and fdatasync() to deal with this.



+
+  rc = fsync(fn);
+  _Assert( rc == 0 );
+
+  rc = fdatasync(fn);
+  _Assert( rc == 0 );
  }
  
  /* iterate over all FILE *'s for this thread */


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] bdbuf: Fix race condition with sync active flag

2014-11-27 Thread Gedare Bloom
Looks OK. Need to apply to releases?

On Thu, Nov 27, 2014 at 8:43 AM, Sebastian Huber
 wrote:
> Bug report by Oleg Kravtsov:
>
> In rtems_bdbuf_swapout_processing() function there is the following
> lines:
>
> if (bdbuf_cache.sync_active && !transfered_buffers)
> {
>
> rtems_id sync_requester;
> rtems_bdbuf_lock_cache ();
> ...
>
> }
>
> Here access to bdbuf_cache.sync_active is not protected with anything.
> Imagine the following test case:
>
> 1. Task1 releases buffer(s) with bdbuf_release_modified() calls;
>
> 2. After a while swapout task starts and flushes all buffers;
>
> 3. In the end of that swapout flush we are before that part of code, and
> assume there is task switching (just before "if (bdbuf_cache.sync_active
> && !transfered_buffers)");
>
> 4. Some other task (with higher priority) does bdbuf_release_modified
> and rtems_bdbuf_syncdev().
>
> This task successfully gets both locks sync and pool (in
> rtems_bdbuf_syncdev() function), sets sync_active to true and starts
> waiting for RTEMS_BDBUF_TRANSFER_SYNC event with only sync lock got.
>
> 5. Task switching happens again and we are again before "if
> (bdbuf_cache.sync_active && !transfered_buffers)".
>
> As the result we check sync_active and we come inside that "if"
> statement.
>
> 6. The result is that we send RTEMS_BDBUF_TRANSFER_SYNC event! Though
> ALL modified messages of that task are not flushed yet!
>
> close #1485
> ---
>  cpukit/libblock/src/bdbuf.c | 16 +++-
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
> index bae57e2..8ea8cba 100644
> --- a/cpukit/libblock/src/bdbuf.c
> +++ b/cpukit/libblock/src/bdbuf.c
> @@ -2749,10 +2749,16 @@ rtems_bdbuf_swapout_processing (unsigned long 
> timer_delta,
>  {
>rtems_bdbuf_swapout_worker* worker;
>booltransfered_buffers = false;
> +  boolsync_active;
>
>rtems_bdbuf_lock_cache ();
>
>/*
> +   * To set this to true you need the cache and the sync lock.
> +   */
> +  sync_active = bdbuf_cache.sync_active;
> +
> +  /*
> * If a sync is active do not use a worker because the current code does 
> not
> * cleaning up after. We need to know the buffers have been written when
> * syncing to release sync lock and currently worker threads do not return 
> to
> @@ -2761,7 +2767,7 @@ rtems_bdbuf_swapout_processing (unsigned long   
>   timer_delta,
> * lock. The simplest solution is to get the main swap out task perform all
> * sync operations.
> */
> -  if (bdbuf_cache.sync_active)
> +  if (sync_active)
>  worker = NULL;
>else
>{
> @@ -2773,14 +2779,14 @@ rtems_bdbuf_swapout_processing (unsigned long 
> timer_delta,
>
>rtems_chain_initialize_empty (&transfer->bds);
>transfer->dd = BDBUF_INVALID_DEV;
> -  transfer->syncing = bdbuf_cache.sync_active;
> +  transfer->syncing = sync_active;
>
>/*
> * When the sync is for a device limit the sync to that device. If the sync
> * is for a buffer handle process the devices in the order on the sync
> * list. This means the dev is BDBUF_INVALID_DEV.
> */
> -  if (bdbuf_cache.sync_active)
> +  if (sync_active)
>  transfer->dd = bdbuf_cache.sync_device;
>
>/*
> @@ -2799,7 +2805,7 @@ rtems_bdbuf_swapout_processing (unsigned long   
>   timer_delta,
>rtems_bdbuf_swapout_modified_processing (&transfer->dd,
> &bdbuf_cache.modified,
> &transfer->bds,
> -   bdbuf_cache.sync_active,
> +   sync_active,
> update_timers,
> timer_delta);
>
> @@ -2830,7 +2836,7 @@ rtems_bdbuf_swapout_processing (unsigned long   
>   timer_delta,
>  transfered_buffers = true;
>}
>
> -  if (bdbuf_cache.sync_active && !transfered_buffers)
> +  if (sync_active && !transfered_buffers)
>{
>  rtems_id sync_requester;
>  rtems_bdbuf_lock_cache ();
> --
> 1.8.4.5
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] sync.c: Add asserts to document and check assumptions

2014-11-27 Thread Joel Sherrill

On 11/27/2014 09:43 AM, Sebastian Huber wrote:

On 27/11/14 16:31, Joel Sherrill wrote:

---
   cpukit/libcsupport/src/sync.c | 11 +--
   1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index 653a177..e449cab 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -29,6 +29,7 @@ int fdatasync(int);/* still not always prototyped */
   #include

   #include
+#include

   /* XXX check standards -- Linux version appears to be void */
   void _fwalk(struct _reent *, void *);
@@ -37,14 +38,20 @@ void _fwalk(struct _reent *, void *);
   static void sync_wrapper(FILE *f)
   {
 int fn = fileno(f);
+  int rc;

 /*
  *  We are explicitly NOT checking the return values as it does not
  *  matter if they succeed.  We are just making a best faith attempt
  *  at both and trusting that we were passed a good FILE pointer.
  */
-  fsync(fn);
-  fdatasync(fn);
+  _Assert( fn != -1 );

I don't think this assert is useful, what about -2 and ? Its the
job of fsync() and fdatasync() to deal with this.


OK. Makes sense so I removed that one and updated the comment.
Pushed.

+
+  rc = fsync(fn);
+  _Assert( rc == 0 );
+
+  rc = fdatasync(fn);
+  _Assert( rc == 0 );
   }

   /* iterate over all FILE *'s for this thread */


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Where should _fini and _init be defined?

2014-11-27 Thread Hesham Moustafa
Hi all,

I had a compilation error when compiling RTEMS for Epiphany which is
undefined reference to _init, and _fini. I got over it by defining
dummy related functions at cpu.c, and hello world is working with it.
I know this is not the right way, so I'd like to ask here what's the
correct solution? Something relates to GCC port and included file or
what?

Thanks,
Hesham
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: Where should _fini and _init be defined?

2014-11-27 Thread Joel Sherrill

On 11/27/2014 10:56 AM, Hesham Moustafa wrote:

Hi all,

I had a compilation error when compiling RTEMS for Epiphany which is
undefined reference to _init, and _fini. I got over it by defining
dummy related functions at cpu.c, and hello world is working with it.
I know this is not the right way, so I'd like to ask here what's the
correct solution? Something relates to GCC port and included file or
what?


I see them in ./lib/gcc/epiphany-elf/5.0.0/crti.o as
"init" and "fini".

Look at your build log and see where they came from. If GCC
is automatically prepending _ to the name from C, then the
name in the crti.o needs to be different. This is IMO a bug
in GCC. They have names accessible from C on all other
architectures.

File a GCC PR and let the Ephiphany guys know. If they
are in Bugzilla, cc them. Add me as well.

But for now, do what you have to to keep moving and
ignore C++.


Thanks,
Hesham
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


sis, psim,anf jmr3904 test results

2014-11-27 Thread Joel Sherrill

Hi

I thought I would post these for commentary.

sparc/sis
===
Passed:   511
Failed: 3
Timeouts:   7
Invalid:0
-
Total:521

Failures:
 heapwalk.exe
 dl02.exe
 psx13.exe
Timeouts:
 *** Interactive
   termios.exe,  pppd.exe,  capture.exe,  top.exe, monitor.exe, fileio.exe
 *** Not Interactive:
crypt01.exe


mips/jmr3904
===

First fails to link dl01 with this error so built with "make -k"
to get the rest of the tests.

Passed:   492
Failed:19
Timeouts:   8
Invalid:0
-
Total:519

Failures:
 spintrcritical21.exe
 spintrcritical20.exe
 spintrcritical10.exe
 spintrcritical03.exe
 utf8proc01.exe
 spintrcritical01.exe
 spfatal26.exe
 spintrcritical09.exe
 spintrcritical04.exe
 spintrcritical05.exe
 psx13.exe
 sp37.exe
 sptls02.exe
 spintrcritical22.exe
 sptls01.exe
 spintrcritical02.exe
 spintrcritical16.exe
 heapwalk.exe
 spintrcritical08.exe
Timeouts:
*** Interactive
   termios.exe,  pppd.exe,  capture.exe,  top.exe, monitor.exe, fileio.exe
 *** Not Interactive:
spcpuset01.exe
crypt01.exe




powerpc/psim
===
Passed:   511
Failed: 2
Timeouts:   8
Invalid:0
-
Total:521

Failures:
 heapwalk.exe
 psx13.exe

Timeouts:
*** Interactive
   termios.exe,  pppd.exe,  capture.exe,  top.exe, monitor.exe, fileio.exe
 *** Not Interactive:
spcpuset01.exe
crypt01.exe

NOTE: spcpuset01 seems to run fine by hand

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [rtems commit] sync.c: Add asserts to document and check assumptions

2014-11-27 Thread Joel Sherrill

I am reverting this back to an appropriate comment and
(void) on the return values.

fsync_h on the IMFS is set to the default handler which
is rtems_filesystem_default_fsync_or_fdatasync(). It
is a one line method that returns EINVAL. I can either
throw away the _Assert's or make them more complicated.
That seems worse.

My plan is to go back to (void), update the comment, and
if this shows up again in ANY static analyser, we should
mark it as intentional and ignore.

--joel

On 11/27/2014 10:07 AM, Joel Sherril wrote:

Module:rtems
Branch:master
Commit:e22af784cd44cd407e268307ede01f6e1b621393
Changeset: 
http://git.rtems.org/rtems/commit/?id=e22af784cd44cd407e268307ede01f6e1b621393

Author:Joel Sherrill
Date:  Thu Nov 27 09:30:12 2014 -0600

sync.c: Add asserts to document and check assumptions

---

  cpukit/libcsupport/src/sync.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index 653a177..f27349c 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -29,6 +29,7 @@ int fdatasync(int);/* still not always prototyped */
  #include

  #include
+#include

  /* XXX check standards -- Linux version appears to be void */
  void _fwalk(struct _reent *, void *);
@@ -37,14 +38,19 @@ void _fwalk(struct _reent *, void *);
  static void sync_wrapper(FILE *f)
  {
int fn = fileno(f);
+  int rc;

/*
-   *  We are explicitly NOT checking the return values as it does not
-   *  matter if they succeed.  We are just making a best faith attempt
-   *  at both and trusting that we were passed a good FILE pointer.
+   *  We are explicitly NOT checking the return values in non-debug builds
+   *  as it does not matter if they succeed.  We are just making a best
+   *  faith attempt at both and trusting that we were passed a good
+   *  FILE pointer.
 */
-  fsync(fn);
-  fdatasync(fn);
+  rc = fsync(fn);
+  _Assert( rc == 0 );
+
+  rc = fdatasync(fn);
+  _Assert( rc == 0 );
  }

  /* iterate over all FILE *'s for this thread */

___
vc mailing list
v...@rtems.org
http://lists.rtems.org/mailman/listinfo/vc


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: crypt01 execution time

2014-11-27 Thread Chris Johns

On 27/11/2014 12:48 am, Joel Sherrill wrote:

On 11/26/2014 01:12 AM, Sebastian Huber wrote:

On 25/11/14 23:25, Joel Sherrill wrote:

How long is this test supposed to run?

It takes 4:42 using sis on my computer which is a 2.9 Ghz i7 .

SIS is a slow simulator.  On Qemu it runs much faster.


Is there anything to do? Split it?

Splitting it up doesn't reduce the overall test time.  The test cases in
this test are standard test cases.  I am not so fond of removing them,
but in case the test time is too long for you then you can drop the ones
with the many rounds.


Chris.. my old test scripts knew some tests ran
quickly and some ran long. The BSP settings could
adjust the timeout period based on the test name.


We need a BSP database in the tester and this can be part of it.


We shouldn't wait 5 minutes for every test to time
out when 95+% run in milliseconds.


The time out only happens if the test fails so lets fix all tests. :)



How can we account for this in rtems-tester?



I feel a BSP specific time out setting is only part of the answer. We 
have simulators running on hosts of various speeds plus we have tests 
that have different timing needs and this makes the problem a little 
more complex. There is also the ability to change a clock rate on a 
target and users do this for power and other reasons.


I am wondering about the tests telling us what the time out is plus 
adding tags that reset the time out in the tester. I also wonder if we 
create a test that runs first which "calibrates" the performance. The 
test prints a datum time and the tester takes the real time it runs for 
and scales the time out.


Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel