[Xenomai-git] Philippe Gerum : cobalt/heap: rebase on HEAPMEM algorithm

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 10606d3ab266b3ffd077cc06db3c96d620d70612
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=10606d3ab266b3ffd077cc06db3c96d620d70612

Author: Philippe Gerum 
Date:   Sun May 13 19:00:50 2018 +0200

cobalt/heap: rebase on HEAPMEM algorithm

Address the issue mentioned in [1] regarding the core (xnheap)
allocator, using a variant of the McKusick scheme significantly
improving the performance figures.

As a by-product of this overhaul, the core allocator can now manage
heaps up to (4GB - PAGE_SIZE).

The performance report log obtained by testing on imx6qp
is as follows:

== memcheck started
 seq_heap_size=2048k
 random_alloc_rounds=1024
 pattern_heap_size=128k
 pattern_check_rounds=128

[SEQUENTIAL ALLOC->FREE, ^2 BLOCK SIZES] ON 'xnheap'

HEAPSZ  test heap size
BLOCKSZ tested block size
NRBLKS  number of blocks allocatable in heap
AVG-A   average time to allocate block (us)
AVG-F   average time to free block (us)
MAX-A   max time to allocate block (us)
MAX-F   max time to free block (us)
FLAGS   +shuffle: randomized free
+realloc: measure after initial alloc/free pass (hot heap)

sorted by: max alloc time
  HEAPSZ  BLOCKSZ   NRBLKS  AVG-A  AVG-F  MAX-A  MAX-F   FLAGS
   1024k   3232768  0  0  8  6
   1024k   3232768  0  0  7  2   +shuffle +realloc
   1024k   1665536  0  0  7  2   +realloc
   1024k   1665536  0  0  6  7   +shuffle +realloc
  ... (364 results following) ...

sorted by: max free time
  HEAPSZ  BLOCKSZ   NRBLKS  AVG-A  AVG-F  MAX-A  MAX-F   FLAGS
   1024k  128 8192  0  1  2  8
   1024k   1665536  0  0  6  7   +shuffle +realloc
   1024k   3232768  0  0  8  6
512k   3216384  0  0  5  6   +realloc
  ... (364 results following) ...

overall:
  worst alloc time: 8 (us)
  worst free time: 8 (us)
  average of max. alloc times: 1 (us)
  average of max. free times: 2 (us)
  average alloc time: 1 (us)
  average free time: 1 (us)

[SEQUENTIAL ALLOC->FREE, RANDOM BLOCK SIZES] ON 'xnheap'

HEAPSZ  test heap size
BLOCKSZ tested block size
NRBLKS  number of blocks allocatable in heap
AVG-A   average time to allocate block (us)
AVG-F   average time to free block (us)
MAX-A   max time to allocate block (us)
MAX-F   max time to free block (us)
FLAGS   +shuffle: randomized free
+realloc: measure after initial alloc/free pass (hot heap)

sorted by: max alloc time
  HEAPSZ  BLOCKSZ   NRBLKS  AVG-A  AVG-F  MAX-A  MAX-F   FLAGS
512k   17k  28  1  1  8  2   +shuffle
512k   45k  11  1  1  7  2
   1024k   2432768  0  0  7  6   +shuffle
128k  820  128  1  1  6  2   +shuffle
  ... (32764 results following) ...

sorted by: max free time
  HEAPSZ  BLOCKSZ   NRBLKS  AVG-A  AVG-F  MAX-A  MAX-F   FLAGS
   1024k3k 292  1  1  1  8   +shuffle
256k  174 1024  1  1  1  6   +shuffle
   1024k   2432768  0  0  7  6   +shuffle
 32k   12k   2  2  3  1  5
  ... (32764 results following) ...

overall:
  worst alloc time: 8 (us)
  worst free time: 8 (us)
  average of max. alloc times: 1 (us)
  average of max. free times: 1 (us)
  average alloc time: 1 (us)
  average free time: 1 (us)

[1] http://www.xenomai.org/pipermail/xenomai/2018-April/038883.html

---

 include/cobalt/kernel/heap.h |  168 
 kernel/cobalt/Kconfig|7 +
 kernel/cobalt/heap.c |  978 +-
 3 files changed, 663 insertions(+), 490 deletions(-)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index d89f25d..8a1c6f6 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -20,6 +20,7 @@
 #define _COBALT_KERNEL_HEAP_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -28,66 +29,66 @@
 /**
  * @addtogroup cobalt_core_heap
  * @{
- *
- * @par Implementation constraints
- *
- * - Minimum page size is 2 ** XNHEAP_MINLOG2 (must be large enough to
- * hold a pointer).
- *
- * - Maximum page size is 2 ** XNHEAP_MAXLOG2.
- *
- * - Requested block size is rounded up to XNHEAP_MINLOG2.
- *
- * - Requested block size larger than 2 times the XNHEAP_PAGESZ is
- * rounded up to the next page boundary and obtained from the free
- * page list. So we need a bucket for each power of two between
- * XNHEAP_MINLOG2 and XNHEAP_MAXLOG2 inclusive, plus one to honor
- * requests ranging from the maximum page size to twice this size.
  */
-#define XNHEAP_PAGESZPAGE_SIZE
-#define XNHEAP_MINLOG23
-#define XNHEAP_MAXLOG222   /* Holds pagemap.bcount blocks */
-#define XNHEAP_MINALLOCSZ (1 << XNHEAP_MINLOG2)
-#define XNHEAP_MINALIGNSZ (1 << 4) /* i.e. 16 bytes */
-#define XNHEAP_NBUCKETS   (X

[Xenomai-git] Philippe Gerum : powerpc64: drop architecture support

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: eb314853e93b81da595b79061dabb7d2c55351fe
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=eb314853e93b81da595b79061dabb7d2c55351fe

Author: Philippe Gerum 
Date:   Mon May 21 12:42:46 2018 +0200

powerpc64: drop architecture support

The powerpc64 architecture does not seem to have any active Xenomai
user, at least none who may be concerned enough to be willing to help
in maintaining this Xenomai port.

---

 configure.ac   |2 +-
 doc/asciidoc/README.INSTALL.adoc   |   18 ++-
 doc/asciidoc/TROUBLESHOOTING.COBALT.adoc   |   10 --
 .../arch/powerpc/include/asm/xenomai/calibration.h |4 ---
 .../arch/powerpc/include/asm/xenomai/machine.h |5 ---
 .../arch/powerpc/include/asm/xenomai/uapi/arith.h  |   32 
 lib/cobalt/arch/powerpc/include/asm/xenomai/tsc.h  |7 -
 7 files changed, 3 insertions(+), 75 deletions(-)

diff --git a/configure.ac b/configure.ac
index a6b1200..e2a2d47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ case "$build_for" in
target_cpu_arch=x86
CONFIG_XENO_DEFAULT_PERIOD=10
;;
- ppc-*|powerpc-*|powerpc64-*|ppc64-*)
+ ppc-*|powerpc-*)
use_tls=yes
target_cpu_arch=powerpc
CONFIG_XENO_DEFAULT_PERIOD=10
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index 4fe6867..cbd2adc 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -248,8 +248,8 @@ have to install the proper cross-compilation toolchain for 
the target
 system first.
 
 [[cobalt-core-powerpc]]
-Building a _Cobalt/powerpc_ kernel (32/64bit)
-^
+Building a _Cobalt/powerpc_ kernel
+^^
 
 A typical cross-compilation setup, in order to build Xenomai for a
 ppc-6xx architecture running a 3.10.32 kernel. We use the DENX ELDK
@@ -758,20 +758,6 @@ $ $xenomai_root/configure --host=powerpc-linux 
--with-core=cobalt \
 $ make DESTDIR=$staging_dir install
 --
 
-Building the PPC64 libraries
-
-
-Same process than for a 32bit PowerPC target, using a crosstool-built
-toolchain for ppc64/SMP.
-
---
-$ cd $build_root
-$ $xenomai_root/configure --host=powerpc64-unknown-linux-gnu \
-  --with-core=cobalt --enable-smp
-$ make DESTDIR=$staging_dir install
---
-
-
 Building the ARM libraries
 ~~
 
diff --git a/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc 
b/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
index db5673a..778e74f 100644
--- a/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
+++ b/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
@@ -125,16 +125,6 @@ article] from the Knowledge Base.
 
 See <>.
 
- system init failed, code -22
-
-On the ppc64 platform, check whether +CONFIG_PPC_64K_PAGES+ is defined
-in your kernel configuration. If so, then you likely need to raise all
-Xenomai parameters defining the size of internal heaps, such as
-+CONFIG_XENO_OPT_SYS_HEAPSZ+, +CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ+ and
-+CONFIG_XENO_OPT_SEM_HEAPSZ+, so that (size / 64k) > 2. The default
-values for these parameters are currently based on the assumption that
-PAGE_SIZE = 4k.
-
  Local APIC absent or disabled!
 
 The Xenomai 2.x _nucleus_ issues this warning if the kernel
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
index 07dee5f..9f06c3f 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
@@ -94,12 +94,8 @@ static inline void xnarch_get_latencies(struct 
xnclock_gravity *p)
 
 #ifndef __sched_latency
 /* Platform is unknown: pick a default value. */
-#ifdef CONFIG_PPC64
-#define __sched_latency 1000
-#else
 #define __sched_latency 4000
 #endif
-#endif
p->user = xnclock_ns_to_ticks(&nkclock, __sched_latency);
p->kernel = xnclock_ns_to_ticks(&nkclock, 
CONFIG_XENO_OPT_TIMING_KSCHEDLAT);
p->irq = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_IRQLAT);
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
index 6737ddc..0e41fd6 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
@@ -29,13 +29,8 @@
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
-#ifdef CONFIG_PPC64
-   __asm__ ("cntlzd %0, %1" : "=r" (ul) : "r" (ul & (-ul)));
-   return 63 - ul;
-#else
__asm__ ("cntlzw %0, %1":"=r"(ul):"r"(ul & (-ul)));
return 31 - ul;
-#endif

[Xenomai-git] Philippe Gerum : lib/smokey: enable test filtering with --list[=expr]

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d404b2c060ddc3300856c4491b36e5fe083410a9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d404b2c060ddc3300856c4491b36e5fe083410a9

Author: Philippe Gerum 
Date:   Sat May 19 12:01:49 2018 +0200

lib/smokey: enable test filtering with --list[=expr]

---

 lib/smokey/init.c |   91 +++--
 1 file changed, 47 insertions(+), 44 deletions(-)

diff --git a/lib/smokey/init.c b/lib/smokey/init.c
index 9df9a55..e1a133e 100644
--- a/lib/smokey/init.c
+++ b/lib/smokey/init.c
@@ -143,11 +143,13 @@
  * Any program linked against the Smokey API implicitly recognizes the
  * following options:
  *
- * - --list dumps the list of tests implemented in the program to
- *   stdout. The information given includes the description strings
- *   provided in the plugin declarators (smokey_test_plugin()).  The
- *   position and symbolic name of each test is also issued, which may
- *   be used in id specifications with the --run option (see below).
+ * - --list[=] dumps the list of tests implemented in the
+ *   program to stdout. This list may be restricted to the tests
+ *   matching the optional regular expression (see --run). The
+ *   information given includes the description strings provided in
+ *   the plugin declarators (smokey_test_plugin()).  The position and
+ *   symbolic name of each test is also issued, which may be used in
+ *   id specifications with the --run option (see below).
  *
  * @note Test positions may vary depending on changes to the host
  * program like adding or removing other tests, the symbolic name
@@ -297,7 +299,7 @@ static const struct option smokey_options[] = {
{
 #define list_opt   2
.name = "list",
-   .has_arg = no_argument,
+   .has_arg = optional_argument,
.flag = &do_list,
.val = 1,
},
@@ -319,13 +321,13 @@ static const struct option smokey_options[] = {
 static void smokey_help(void)
 {
 fprintf(stderr, "--keep-going  don't stop upon test 
error\n");
-   fprintf(stderr, "--list list all tests\n");
+   fprintf(stderr, "--list[=]] list [matching] 
tests\n");
fprintf(stderr, "--run[=]]  run [portion of] the 
test list\n");
fprintf(stderr, "--exclude=]exclude test(s) from 
the run list\n");
fprintf(stderr, "--vm   hint about running in a 
virtual environment\n");
 }
 
-static void pick_test_range(int start, int end)
+static void pick_test_range(struct pvlistobj *dst, int start, int end)
 {
struct smokey_test *t, *tmp;
 
@@ -336,7 +338,7 @@ static void pick_test_range(int start, int end)
if (t->__reserved.id >= start &&
t->__reserved.id <= end) {
pvlist_remove(&t->__reserved.next);
-   pvlist_append(&t->__reserved.next, 
&smokey_test_list);
+   pvlist_append(&t->__reserved.next, dst);
}
}
} else {
@@ -344,13 +346,13 @@ static void pick_test_range(int start, int end)
if (t->__reserved.id >= end &&
t->__reserved.id <= start) {
pvlist_remove(&t->__reserved.next);
-   pvlist_append(&t->__reserved.next, 
&smokey_test_list);
+   pvlist_append(&t->__reserved.next, dst);
}
}
} 
 }
 
-static void drop_test_range(int start, int end)
+static void drop_test_range(struct pvlistobj *dst, int start, int end)
 {
struct smokey_test *t, *tmp;
 
@@ -363,7 +365,7 @@ static void drop_test_range(int start, int end)
if (t->__reserved.id >= start &&
t->__reserved.id <= end) {
pvlist_remove(&t->__reserved.next);
-   pvlist_append(&t->__reserved.next, &exclude_list);
+   pvlist_append(&t->__reserved.next, dst);
}
}
 }
@@ -376,8 +378,8 @@ static int resolve_id(const char *s)
return atoi(s);
 
/*
-* CAUTION: as we transfer items from register_list to
-* smokey_test_list, we may end up with an empty source list,
+* CAUTION: as we transfer items from register_list to a
+* destination list, we may end up with an empty source list,
 * which is a perfectly valid situation. Unlike having an
 * empty registration list at startup, which would mean that
 * no test is available from the current program.
@@ -392,7 +394,7 @@ static int resolve_id(const char *s)
return -1;
 }
 
-static int do_glob_match(const char *s, struct pvlistobj *list)
+static int glob_match(struct pvlistobj *dst, const char *s)
 {
struct smokey_t

[Xenomai-git] Philippe Gerum : blackfin: drop architecture support

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: c58fe890afd12b9833837ac1cd1190435352d95e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c58fe890afd12b9833837ac1cd1190435352d95e

Author: Philippe Gerum 
Date:   Mon May 21 12:42:46 2018 +0200

blackfin: drop architecture support

The blackfin architecture is not supported by the mainline kernel
anymore since 4.17, and no concerned user showed up, willing to help
in maintaining this Xenomai port.

---

 configure.ac   |8 --
 doc/asciidoc/README.INSTALL.adoc   |   43 
 doc/asciidoc/TROUBLESHOOTING.COBALT.adoc   |2 +-
 kernel/cobalt/arch/blackfin/Kconfig|8 --
 kernel/cobalt/arch/blackfin/Makefile   |5 -
 kernel/cobalt/arch/blackfin/README |3 -
 .../blackfin/include/asm/xenomai/calibration.h |   56 --
 .../arch/blackfin/include/asm/xenomai/features.h   |   27 -
 .../arch/blackfin/include/asm/xenomai/fptest.h |   44 
 .../arch/blackfin/include/asm/xenomai/machine.h|   36 ---
 .../arch/blackfin/include/asm/xenomai/syscall.h|   70 
 .../arch/blackfin/include/asm/xenomai/syscall32.h  |   24 -
 .../arch/blackfin/include/asm/xenomai/thread.h |   69 
 .../arch/blackfin/include/asm/xenomai/uapi/arith.h |   43 
 .../blackfin/include/asm/xenomai/uapi/features.h   |   40 ---
 .../blackfin/include/asm/xenomai/uapi/fptest.h |   31 --
 .../blackfin/include/asm/xenomai/uapi/syscall.h|   29 -
 .../arch/blackfin/include/asm/xenomai/wrappers.h   |   27 -
 kernel/cobalt/arch/blackfin/machine.c  |   90 
 kernel/cobalt/arch/blackfin/mayday.c   |  112 
 kernel/cobalt/arch/blackfin/switch.S   |   98 -
 kernel/cobalt/arch/blackfin/syscall.c  |   41 ---
 kernel/cobalt/arch/blackfin/thread.c   |  106 --
 lib/cobalt/arch/Makefile.am|2 +-
 lib/cobalt/arch/blackfin/Makefile.am   |   13 ---
 lib/cobalt/arch/blackfin/features.c|   24 -
 lib/cobalt/arch/blackfin/include/Makefile.am   |2 -
 lib/cobalt/arch/blackfin/include/asm/Makefile.am   |2 -
 .../arch/blackfin/include/asm/xenomai/Makefile.am  |5 -
 .../arch/blackfin/include/asm/xenomai/features.h   |   30 --
 .../arch/blackfin/include/asm/xenomai/syscall.h|   58 --
 lib/cobalt/arch/blackfin/include/asm/xenomai/tsc.h |   44 
 scripts/prepare-kernel.sh  |3 -
 33 files changed, 2 insertions(+), 1193 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6c94301..a6b1200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,10 +131,6 @@ case "$build_for" in
target_cpu_arch=powerpc
CONFIG_XENO_DEFAULT_PERIOD=10
;;
- bfin-*|bfinnommu-*|blackfin-*)
-   target_cpu_arch=blackfin
-   CONFIG_XENO_DEFAULT_PERIOD=10
-   ;;
  arm*-*)
target_cpu_arch=arm
CONFIG_XENO_DEFAULT_PERIOD=100
@@ -928,10 +924,6 @@ AC_CONFIG_FILES([ \
lib/cobalt/arch/powerpc/include/Makefile \
lib/cobalt/arch/powerpc/include/asm/Makefile \
lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile \
-   lib/cobalt/arch/blackfin/Makefile \
-   lib/cobalt/arch/blackfin/include/Makefile \
-   lib/cobalt/arch/blackfin/include/asm/Makefile \
-   lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile \
lib/cobalt/arch/x86/Makefile \
lib/cobalt/arch/x86/include/Makefile \
lib/cobalt/arch/x86/include/asm/Makefile \
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index d32d710..4fe6867 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -119,7 +119,6 @@ In order to cross-compile the Linux kernel, pass an ARCH and
 CROSS_COMPILE variable on make command line. See sections
 <>,
 <>,
-<>,
 <>,
 for examples.
 
@@ -268,27 +267,6 @@ $ make ARCH=powerpc CROSS_COMPILE=powerpc-linux- uImage 
modules
 --
 ...manually install the kernel image and modules to the proper location
 
-[[cobalt-core-blackfin]]
-Building a _Cobalt/blackfin_ kernel
-^^^
-
-The Blackfin is a MMU-less, DSP-type architecture running uClinux.
-
---
-$ cd $linux_tree
-$ $xenomai_root/scripts/prepare-kernel.sh --arch=blackfin \
-  --ipipe=ipipe-core-X.Y.Z-x86-NN.patch
-$ make ARCH=blackfin CROSS_COMPILE=bfin-uclinux- xconfig/gconfig/menuconfig
---
-...select the kernel and Xenomai options, then compile with:
---
-$ make

[Xenomai-git] Philippe Gerum : scripts/prepare-kernel.sh: drop left overs from obsolete ports

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 57ddbcebd82455c98650fda876e45958d4c1c05a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=57ddbcebd82455c98650fda876e45958d4c1c05a

Author: Philippe Gerum 
Date:   Mon May 21 12:54:59 2018 +0200

scripts/prepare-kernel.sh: drop left overs from obsolete ports

---

 scripts/prepare-kernel.sh |6 --
 1 file changed, 6 deletions(-)

diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index 5e6e3b1..123b7b4 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -275,18 +275,12 @@ while : ; do
powerpc*|ppc*)
   linux_arch=powerpc
   ;;
-   nios2)
-  linux_arch=nios2
-  ;;
arm)
   linux_arch=arm
   ;;
arm64)
   linux_arch=arm64
   ;;
-   sh|sh4)
-  linux_arch=sh
-  ;;
*)
   echo "$me: unsupported architecture: $linux_arch" >&2
   linux_arch=


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/testing: add core heap test module

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e4a38086b2fbe4d4696046d27228d38e4a8987d4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e4a38086b2fbe4d4696046d27228d38e4a8987d4

Author: Philippe Gerum 
Date:   Sun May 13 19:00:50 2018 +0200

drivers/testing: add core heap test module

---

 include/rtdm/uapi/testing.h|   41 ++-
 kernel/drivers/testing/Kconfig |6 +
 kernel/drivers/testing/Makefile|3 +
 kernel/drivers/testing/heapcheck.c |  515 
 4 files changed, 564 insertions(+), 1 deletion(-)

diff --git a/include/rtdm/uapi/testing.h b/include/rtdm/uapi/testing.h
index 06b8f1e..f8207b8 100644
--- a/include/rtdm/uapi/testing.h
+++ b/include/rtdm/uapi/testing.h
@@ -87,6 +87,37 @@ struct rttst_swtest_error {
 #define RTTST_RTDM_MAGIC_PRIMARY   0xfefbfefb
 #define RTTST_RTDM_MAGIC_SECONDARY 0xa5b9a5b9
 
+#define RTTST_HEAPCHECK_ZEROOVRD   1
+#define RTTST_HEAPCHECK_SHUFFLE2
+#define RTTST_HEAPCHECK_PATTERN4
+#define RTTST_HEAPCHECK_HOT8
+
+struct rttst_heap_parms {
+   __u64 heap_size;
+   __u64 block_size;
+   int flags;
+   int nrstats;
+};
+
+struct rttst_heap_stats {
+   __u64 heap_size;
+   __u64 user_size;
+   __u64 block_size;
+   __s64 alloc_avg_ns;
+   __s64 alloc_max_ns;
+   __s64 free_avg_ns;
+   __s64 free_max_ns;
+   __u64 maximum_free;
+   __u64 largest_free;
+   int nrblocks;
+   int flags;
+};
+
+struct rttst_heap_stathdr {
+   int nrstats;
+   struct rttst_heap_stats *buf;
+};
+
 #define RTIOC_TYPE_TESTING RTDM_CLASS_TESTING
 
 /*!
@@ -100,6 +131,8 @@ struct rttst_swtest_error {
 #define RTDM_SUBCLASS_SWITCHTEST   2
 /** subclase name: "rtdm" */
 #define RTDM_SUBCLASS_RTDMTEST 3
+/** subclase name: "heapcheck" */
+#define RTDM_SUBCLASS_HEAPCHECK4
 /** @} */
 
 /*!
@@ -153,7 +186,13 @@ struct rttst_swtest_error {
   
 #define RTTST_RTIOC_RTDM_PING_SECONDARY \
_IOR(RTIOC_TYPE_TESTING, 0x43, __u32)
-  
+
+#define RTTST_RTIOC_HEAP_CHECK \
+   _IOR(RTIOC_TYPE_TESTING, 0x44, struct rttst_heap_parms)
+
+#define RTTST_RTIOC_HEAP_STAT_COLLECT \
+   _IOR(RTIOC_TYPE_TESTING, 0x45, int)
+
 /** @} */
 
 #endif /* !_RTDM_UAPI_TESTING_H */
diff --git a/kernel/drivers/testing/Kconfig b/kernel/drivers/testing/Kconfig
index bb44abb..88c043c 100644
--- a/kernel/drivers/testing/Kconfig
+++ b/kernel/drivers/testing/Kconfig
@@ -14,6 +14,12 @@ config XENO_DRIVERS_SWITCHTEST
Kernel-based driver for unit testing context switches and
FPU switches.
 
+config XENO_DRIVERS_HEAPCHECK
+   tristate "Memory allocator test driver"
+   default y
+   help
+   Kernel-based driver for testing Cobalt's memory allocator.
+
 config XENO_DRIVERS_RTDMTEST
depends on m
tristate "RTDM unit tests driver"
diff --git a/kernel/drivers/testing/Makefile b/kernel/drivers/testing/Makefile
index 367a22e..09b0763 100644
--- a/kernel/drivers/testing/Makefile
+++ b/kernel/drivers/testing/Makefile
@@ -2,9 +2,12 @@
 obj-$(CONFIG_XENO_DRIVERS_TIMERBENCH) += xeno_timerbench.o
 obj-$(CONFIG_XENO_DRIVERS_SWITCHTEST) += xeno_switchtest.o
 obj-$(CONFIG_XENO_DRIVERS_RTDMTEST)   += xeno_rtdmtest.o
+obj-$(CONFIG_XENO_DRIVERS_HEAPCHECK)   += xeno_heapcheck.o
 
 xeno_timerbench-y := timerbench.o
 
 xeno_switchtest-y := switchtest.o
 
 xeno_rtdmtest-y := rtdmtest.o
+
+xeno_heapcheck-y := heapcheck.o
diff --git a/kernel/drivers/testing/heapcheck.c 
b/kernel/drivers/testing/heapcheck.c
new file mode 100644
index 000..bed5a05
--- /dev/null
+++ b/kernel/drivers/testing/heapcheck.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (C) 2018 Philippe Gerum .
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define complain(__fmt, __args...) \
+   printk(XENO_WARNING "heap check: " __fmt "\n", ##__args)
+
+static struct xnheap test_heap = {
+   .name = "test_heap"
+};
+
+enum pattern {
+   alphabet_series,
+   digit_series,
+   binary_series,
+};
+
+struct chunk {
+   void *ptr;
+   enum pattern pattern;
+};
+
+struct runstats {
+   struct rttst_heap_stats stats;
+   struct runstats *next;
+};
+
+static struct runstats *st

[Xenomai-git] Philippe Gerum : testsuite/smokey: add core heap test

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 3f72815c31c2e2179964dc622794109eaa492816
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3f72815c31c2e2179964dc622794109eaa492816

Author: Philippe Gerum 
Date:   Sat May 19 11:18:53 2018 +0200

testsuite/smokey: add core heap test

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/memcheck/memcheck.c |  247 +-
 testsuite/smokey/memcheck/memcheck.h |   22 ++-
 testsuite/smokey/memory-coreheap/Makefile.am |9 +
 testsuite/smokey/memory-coreheap/coreheap.c  |  108 +++
 6 files changed, 265 insertions(+), 123 deletions(-)

diff --git a/configure.ac b/configure.ac
index b670206..6c94301 100644
--- a/configure.ac
+++ b/configure.ac
@@ -971,6 +971,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
testsuite/smokey/memcheck/Makefile \
+   testsuite/smokey/memory-coreheap/Makefile \
testsuite/smokey/memory-heapmem/Makefile \
testsuite/smokey/memory-tlsf/Makefile \
testsuite/smokey/memory-pshared/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index d7a71fe..601331e 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -16,6 +16,7 @@ COBALT_SUBDIRS =  \
fpu-stress  \
iddp\
leaks   \
+   memory-coreheap \
memory-heapmem  \
memory-tlsf \
memcheck\
diff --git a/testsuite/smokey/memcheck/memcheck.c 
b/testsuite/smokey/memcheck/memcheck.c
index 7f97218..b10b30f 100644
--- a/testsuite/smokey/memcheck/memcheck.c
+++ b/testsuite/smokey/memcheck/memcheck.c
@@ -24,27 +24,45 @@ struct chunk {
enum pattern pattern;
 };
 
-struct runstats {
-   size_t heap_size;
-   size_t user_size;
-   size_t block_size;
-   int nrblocks;
-   long alloc_avg_ns;
-   long alloc_max_ns;
-   long free_avg_ns;
-   long free_max_ns;
-   int flags;
-   double overhead;
-   double fragmentation;
-   struct runstats *next;
-};
-
-static struct runstats *statistics;
+static struct memcheck_stat *statistics;
 
 static int nrstats;
 
 static int max_results = 4;
 
+#ifdef CONFIG_XENO_COBALT
+
+#include 
+
+static inline void breathe(int loops)
+{
+   struct timespec idle = {
+   .tv_sec = 0,
+   .tv_nsec = 30,
+   };
+
+   /*
+* There is not rt throttling over Cobalt, so we may need to
+* keep the host kernel breathing by napping during the test
+* sequences.
+*/
+   if ((loops % 1000) == 0)
+   __RT(clock_nanosleep(CLOCK_MONOTONIC, 0, &idle, NULL));
+}
+
+static inline void harden(void)
+{
+   cobalt_thread_harden();
+}
+
+#else
+
+static inline void breathe(int loops) { }
+
+static inline void harden(void) { }
+
+#endif
+
 static inline long diff_ts(struct timespec *left, struct timespec *right)
 {
return (long long)(left->tv_sec - right->tv_sec) * ONE_BILLION
@@ -69,6 +87,7 @@ static void random_shuffle(void *vbase, size_t nmemb, const 
size_t size)
double u;
 
for(j = nmemb; j > 0; j--) {
+   breathe(j);
u = (double)random() / RAND_MAX;
k = (unsigned int)(j * u) + 1;
if (j == k)
@@ -88,37 +107,39 @@ static void random_shuffle(void *vbase, size_t nmemb, 
const size_t size)
 
 static int sort_by_heap_size(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->heap_size, ls->heap_size);
 }
 
 static int sort_by_alloc_time(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->alloc_max_ns, ls->alloc_max_ns);
 }
 
 static int sort_by_free_time(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->free_max_ns, ls->free_max_ns);
 }
 
 static int sort_by_frag(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
-   return compare_values(rs->fragmentation, ls->fragmentation);
+   return compare_values(rs->maximum_free - rs->largest_free,
+ ls->maximum_free - ls->largest_free);
 }
 
 static int sort_by_overhead(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
-   return compare_values(rs->overhead, ls->overhead);
+   return compare_values(rs->heap_size - rs->user_size,
+ ls->heap_size - ls->user_size);
 }
 
 static inline const char

[Xenomai-git] Philippe Gerum : cobalt/heap: add accessor to usage counter

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 44915d39ed46190570038457edaa7f4fa043872d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=44915d39ed46190570038457edaa7f4fa043872d

Author: Philippe Gerum 
Date:   Sat May 19 15:04:06 2018 +0200

cobalt/heap: add accessor to usage counter

---

 include/cobalt/kernel/heap.h |6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index 8a1c6f6..09c982f 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -108,6 +108,12 @@ size_t xnheap_get_size(const struct xnheap *heap)
 }
 
 static inline
+size_t xnheap_get_used(const struct xnheap *heap)
+{
+   return heap->used_size;
+}
+
+static inline
 size_t xnheap_get_free(const struct xnheap *heap)
 {
return heap->usable_size - heap->used_size;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : powerpc64: drop architecture support

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 3d5f73472d668b8eb442d6026aaa2c3397859ff1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3d5f73472d668b8eb442d6026aaa2c3397859ff1

Author: Philippe Gerum 
Date:   Mon May 21 12:42:46 2018 +0200

powerpc64: drop architecture support

The powerpc64 architecture does not seem to have any active Xenomai
user, at least none who may be concerned enough to be willing to help
in maintaining this Xenomai port.

---

 configure.ac   |2 +-
 doc/asciidoc/README.INSTALL.adoc   |   18 ++-
 doc/asciidoc/TROUBLESHOOTING.COBALT.adoc   |   10 --
 .../arch/powerpc/include/asm/xenomai/calibration.h |4 ---
 .../arch/powerpc/include/asm/xenomai/machine.h |5 ---
 .../arch/powerpc/include/asm/xenomai/uapi/arith.h  |   32 
 lib/cobalt/arch/powerpc/include/asm/xenomai/tsc.h  |7 -
 7 files changed, 3 insertions(+), 75 deletions(-)

diff --git a/configure.ac b/configure.ac
index a6b1200..e2a2d47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ case "$build_for" in
target_cpu_arch=x86
CONFIG_XENO_DEFAULT_PERIOD=10
;;
- ppc-*|powerpc-*|powerpc64-*|ppc64-*)
+ ppc-*|powerpc-*)
use_tls=yes
target_cpu_arch=powerpc
CONFIG_XENO_DEFAULT_PERIOD=10
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index 4fe6867..cbd2adc 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -248,8 +248,8 @@ have to install the proper cross-compilation toolchain for 
the target
 system first.
 
 [[cobalt-core-powerpc]]
-Building a _Cobalt/powerpc_ kernel (32/64bit)
-^
+Building a _Cobalt/powerpc_ kernel
+^^
 
 A typical cross-compilation setup, in order to build Xenomai for a
 ppc-6xx architecture running a 3.10.32 kernel. We use the DENX ELDK
@@ -758,20 +758,6 @@ $ $xenomai_root/configure --host=powerpc-linux 
--with-core=cobalt \
 $ make DESTDIR=$staging_dir install
 --
 
-Building the PPC64 libraries
-
-
-Same process than for a 32bit PowerPC target, using a crosstool-built
-toolchain for ppc64/SMP.
-
---
-$ cd $build_root
-$ $xenomai_root/configure --host=powerpc64-unknown-linux-gnu \
-  --with-core=cobalt --enable-smp
-$ make DESTDIR=$staging_dir install
---
-
-
 Building the ARM libraries
 ~~
 
diff --git a/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc 
b/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
index db5673a..778e74f 100644
--- a/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
+++ b/doc/asciidoc/TROUBLESHOOTING.COBALT.adoc
@@ -125,16 +125,6 @@ article] from the Knowledge Base.
 
 See <>.
 
- system init failed, code -22
-
-On the ppc64 platform, check whether +CONFIG_PPC_64K_PAGES+ is defined
-in your kernel configuration. If so, then you likely need to raise all
-Xenomai parameters defining the size of internal heaps, such as
-+CONFIG_XENO_OPT_SYS_HEAPSZ+, +CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ+ and
-+CONFIG_XENO_OPT_SEM_HEAPSZ+, so that (size / 64k) > 2. The default
-values for these parameters are currently based on the assumption that
-PAGE_SIZE = 4k.
-
  Local APIC absent or disabled!
 
 The Xenomai 2.x _nucleus_ issues this warning if the kernel
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
index 07dee5f..9f06c3f 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/calibration.h
@@ -94,12 +94,8 @@ static inline void xnarch_get_latencies(struct 
xnclock_gravity *p)
 
 #ifndef __sched_latency
 /* Platform is unknown: pick a default value. */
-#ifdef CONFIG_PPC64
-#define __sched_latency 1000
-#else
 #define __sched_latency 4000
 #endif
-#endif
p->user = xnclock_ns_to_ticks(&nkclock, __sched_latency);
p->kernel = xnclock_ns_to_ticks(&nkclock, 
CONFIG_XENO_OPT_TIMING_KSCHEDLAT);
p->irq = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_IRQLAT);
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
index 6737ddc..0e41fd6 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/machine.h
@@ -29,13 +29,8 @@
 
 static inline __attribute_const__ unsigned long ffnz(unsigned long ul)
 {
-#ifdef CONFIG_PPC64
-   __asm__ ("cntlzd %0, %1" : "=r" (ul) : "r" (ul & (-ul)));
-   return 63 - ul;
-#else
__asm__ ("cntlzw %0, %1":"=r"(ul):"r"(ul & (-ul)));
return 31 - ul;
-#endif

[Xenomai-git] Philippe Gerum : blackfin: drop architecture support

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 58e1e65b7f4008692118633dad6ded988d4c2066
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=58e1e65b7f4008692118633dad6ded988d4c2066

Author: Philippe Gerum 
Date:   Mon May 21 12:42:46 2018 +0200

blackfin: drop architecture support

The blackfin architecture is not supported by the mainline kernel
anymore since 4.17, and no concerned user showed up, willing to help
in maintaining this Xenomai port.

---

 configure.ac   |8 --
 doc/asciidoc/README.INSTALL.adoc   |   43 
 doc/asciidoc/TROUBLESHOOTING.COBALT.adoc   |2 +-
 kernel/cobalt/arch/blackfin/Kconfig|8 --
 kernel/cobalt/arch/blackfin/Makefile   |5 -
 kernel/cobalt/arch/blackfin/README |3 -
 .../blackfin/include/asm/xenomai/calibration.h |   56 --
 .../arch/blackfin/include/asm/xenomai/features.h   |   27 -
 .../arch/blackfin/include/asm/xenomai/fptest.h |   44 
 .../arch/blackfin/include/asm/xenomai/machine.h|   36 ---
 .../arch/blackfin/include/asm/xenomai/syscall.h|   70 
 .../arch/blackfin/include/asm/xenomai/syscall32.h  |   24 -
 .../arch/blackfin/include/asm/xenomai/thread.h |   69 
 .../arch/blackfin/include/asm/xenomai/uapi/arith.h |   43 
 .../blackfin/include/asm/xenomai/uapi/features.h   |   40 ---
 .../blackfin/include/asm/xenomai/uapi/fptest.h |   31 --
 .../blackfin/include/asm/xenomai/uapi/syscall.h|   29 -
 .../arch/blackfin/include/asm/xenomai/wrappers.h   |   27 -
 kernel/cobalt/arch/blackfin/machine.c  |   90 
 kernel/cobalt/arch/blackfin/mayday.c   |  112 
 kernel/cobalt/arch/blackfin/switch.S   |   98 -
 kernel/cobalt/arch/blackfin/syscall.c  |   41 ---
 kernel/cobalt/arch/blackfin/thread.c   |  106 --
 lib/cobalt/arch/Makefile.am|2 +-
 lib/cobalt/arch/blackfin/Makefile.am   |   13 ---
 lib/cobalt/arch/blackfin/features.c|   24 -
 lib/cobalt/arch/blackfin/include/Makefile.am   |2 -
 lib/cobalt/arch/blackfin/include/asm/Makefile.am   |2 -
 .../arch/blackfin/include/asm/xenomai/Makefile.am  |5 -
 .../arch/blackfin/include/asm/xenomai/features.h   |   30 --
 .../arch/blackfin/include/asm/xenomai/syscall.h|   58 --
 lib/cobalt/arch/blackfin/include/asm/xenomai/tsc.h |   44 
 scripts/prepare-kernel.sh  |3 -
 33 files changed, 2 insertions(+), 1193 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6c94301..a6b1200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,10 +131,6 @@ case "$build_for" in
target_cpu_arch=powerpc
CONFIG_XENO_DEFAULT_PERIOD=10
;;
- bfin-*|bfinnommu-*|blackfin-*)
-   target_cpu_arch=blackfin
-   CONFIG_XENO_DEFAULT_PERIOD=10
-   ;;
  arm*-*)
target_cpu_arch=arm
CONFIG_XENO_DEFAULT_PERIOD=100
@@ -928,10 +924,6 @@ AC_CONFIG_FILES([ \
lib/cobalt/arch/powerpc/include/Makefile \
lib/cobalt/arch/powerpc/include/asm/Makefile \
lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile \
-   lib/cobalt/arch/blackfin/Makefile \
-   lib/cobalt/arch/blackfin/include/Makefile \
-   lib/cobalt/arch/blackfin/include/asm/Makefile \
-   lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile \
lib/cobalt/arch/x86/Makefile \
lib/cobalt/arch/x86/include/Makefile \
lib/cobalt/arch/x86/include/asm/Makefile \
diff --git a/doc/asciidoc/README.INSTALL.adoc b/doc/asciidoc/README.INSTALL.adoc
index d32d710..4fe6867 100644
--- a/doc/asciidoc/README.INSTALL.adoc
+++ b/doc/asciidoc/README.INSTALL.adoc
@@ -119,7 +119,6 @@ In order to cross-compile the Linux kernel, pass an ARCH and
 CROSS_COMPILE variable on make command line. See sections
 <>,
 <>,
-<>,
 <>,
 for examples.
 
@@ -268,27 +267,6 @@ $ make ARCH=powerpc CROSS_COMPILE=powerpc-linux- uImage 
modules
 --
 ...manually install the kernel image and modules to the proper location
 
-[[cobalt-core-blackfin]]
-Building a _Cobalt/blackfin_ kernel
-^^^
-
-The Blackfin is a MMU-less, DSP-type architecture running uClinux.
-
---
-$ cd $linux_tree
-$ $xenomai_root/scripts/prepare-kernel.sh --arch=blackfin \
-  --ipipe=ipipe-core-X.Y.Z-x86-NN.patch
-$ make ARCH=blackfin CROSS_COMPILE=bfin-uclinux- xconfig/gconfig/menuconfig
---
-...select the kernel and Xenomai options, then compile with:
---
-$ make

[Xenomai-git] Philippe Gerum : testsuite/smokey: add core heap test

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 20387bcddf5e4413e41770ce4043e632b33d0905
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=20387bcddf5e4413e41770ce4043e632b33d0905

Author: Philippe Gerum 
Date:   Sat May 19 11:18:53 2018 +0200

testsuite/smokey: add core heap test

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/memcheck/memcheck.c |  250 +-
 testsuite/smokey/memcheck/memcheck.h |   22 ++-
 testsuite/smokey/memory-coreheap/Makefile.am |9 +
 testsuite/smokey/memory-coreheap/coreheap.c  |  108 +++
 6 files changed, 267 insertions(+), 124 deletions(-)

diff --git a/configure.ac b/configure.ac
index b670206..6c94301 100644
--- a/configure.ac
+++ b/configure.ac
@@ -971,6 +971,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
testsuite/smokey/memcheck/Makefile \
+   testsuite/smokey/memory-coreheap/Makefile \
testsuite/smokey/memory-heapmem/Makefile \
testsuite/smokey/memory-tlsf/Makefile \
testsuite/smokey/memory-pshared/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index d7a71fe..601331e 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -16,6 +16,7 @@ COBALT_SUBDIRS =  \
fpu-stress  \
iddp\
leaks   \
+   memory-coreheap \
memory-heapmem  \
memory-tlsf \
memcheck\
diff --git a/testsuite/smokey/memcheck/memcheck.c 
b/testsuite/smokey/memcheck/memcheck.c
index 7f97218..a33700f 100644
--- a/testsuite/smokey/memcheck/memcheck.c
+++ b/testsuite/smokey/memcheck/memcheck.c
@@ -24,27 +24,45 @@ struct chunk {
enum pattern pattern;
 };
 
-struct runstats {
-   size_t heap_size;
-   size_t user_size;
-   size_t block_size;
-   int nrblocks;
-   long alloc_avg_ns;
-   long alloc_max_ns;
-   long free_avg_ns;
-   long free_max_ns;
-   int flags;
-   double overhead;
-   double fragmentation;
-   struct runstats *next;
-};
-
-static struct runstats *statistics;
+static struct memcheck_stat *statistics;
 
 static int nrstats;
 
 static int max_results = 4;
 
+#ifdef CONFIG_XENO_COBALT
+
+#include 
+
+static inline void breathe(int loops)
+{
+   struct timespec idle = {
+   .tv_sec = 0,
+   .tv_nsec = 30,
+   };
+
+   /*
+* There is not rt throttling over Cobalt, so we may need to
+* keep the host kernel breathing by napping during the test
+* sequences.
+*/
+   if ((loops % 1000) == 0)
+   __RT(clock_nanosleep(CLOCK_MONOTONIC, 0, &idle, NULL));
+}
+
+static inline void harden(void)
+{
+   cobalt_thread_harden();
+}
+
+#else
+
+static inline void breathe(int loops) { }
+
+static inline void harden(void) { }
+
+#endif
+
 static inline long diff_ts(struct timespec *left, struct timespec *right)
 {
return (long long)(left->tv_sec - right->tv_sec) * ONE_BILLION
@@ -69,6 +87,7 @@ static void random_shuffle(void *vbase, size_t nmemb, const 
size_t size)
double u;
 
for(j = nmemb; j > 0; j--) {
+   breathe(j);
u = (double)random() / RAND_MAX;
k = (unsigned int)(j * u) + 1;
if (j == k)
@@ -88,37 +107,39 @@ static void random_shuffle(void *vbase, size_t nmemb, 
const size_t size)
 
 static int sort_by_heap_size(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->heap_size, ls->heap_size);
 }
 
 static int sort_by_alloc_time(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->alloc_max_ns, ls->alloc_max_ns);
 }
 
 static int sort_by_free_time(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
return compare_values(rs->free_max_ns, ls->free_max_ns);
 }
 
 static int sort_by_frag(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
-   return compare_values(rs->fragmentation, ls->fragmentation);
+   return compare_values(rs->maximum_free - rs->largest_free,
+ ls->maximum_free - ls->largest_free);
 }
 
 static int sort_by_overhead(const void *l, const void *r)
 {
-   const struct runstats *ls = l, *rs = r;
+   const struct memcheck_stat *ls = l, *rs = r;
 
-   return compare_values(rs->overhead, ls->overhead);
+   return compare_values(rs->heap_size - rs->user_size,
+ ls->heap_size - ls->user_size);
 }
 
 static inline const char

[Xenomai-git] Philippe Gerum : scripts/prepare-kernel.sh: drop left overs from obsolete ports

2018-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ffb68112e2342a62a1f70916a35a3d68e875b12c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ffb68112e2342a62a1f70916a35a3d68e875b12c

Author: Philippe Gerum 
Date:   Mon May 21 12:54:59 2018 +0200

scripts/prepare-kernel.sh: drop left overs from obsolete ports

---

 scripts/prepare-kernel.sh |6 --
 1 file changed, 6 deletions(-)

diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index 5e6e3b1..123b7b4 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -275,18 +275,12 @@ while : ; do
powerpc*|ppc*)
   linux_arch=powerpc
   ;;
-   nios2)
-  linux_arch=nios2
-  ;;
arm)
   linux_arch=arm
   ;;
arm64)
   linux_arch=arm64
   ;;
-   sh|sh4)
-  linux_arch=sh
-  ;;
*)
   echo "$me: unsupported architecture: $linux_arch" >&2
   linux_arch=


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git