[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-03-06 Thread git repository hosting
Module: xenomai-3
Branch: wip/dovetail
Commit: f6f82cb5a7ae024cb874f72b0167bad748c74d27
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f6f82cb5a7ae024cb874f72b0167bad748c74d27

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |3 +-
 testsuite/smokey/cpu-affinity/Makefile.am|9 +
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  252 ++
 4 files changed, 264 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f450673..d71aa38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -909,6 +909,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 174b393..51292f1 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
fpu-stress  \
iddp\
leaks   \
@@ -32,7 +33,7 @@ COBALT_SUBDIRS =  \
 MERCURY_SUBDIRS =
 
 DIST_SUBDIRS = $(COBALT_SUBDIRS) $(MERCURY_SUBDIRS)
-   
+
 if XENO_COBALT
 wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS = $(COBALT_SUBDIRS)
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..2674f76
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,252 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+   int kfd;
+   int nrt_cpu;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   smokey_trace(" user thread starts on CPU%d, ok", cpu);
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   smokey_trace(" user thread moved to CPU%d, good", ncpu);
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static int load_test_module(void)
+{
+   int fd, status;
+   
+   status = system("modprobe -q xeno_rtdmtest");
+   if (status < 0 || WEXITSTATUS(status))
+   return -ENOSYS;
+
+   /* Open the RTDM actor device. */
+   fd = open("/dev/rtdm/rtdmx", O_RDWR);
+   if (fd < 0)
+   return -errno;
+
+   return fd;
+}
+
+static void unload_test_module(int fd)
+{
+   close(fd);
+   system("rmmod xeno_rtdmtest");
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context *context = arg;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int ret;
+
+   smokey_trace(".. control thread binding to non-RT CPU%d",
+context->nrt_cpu);
+
+   __STD(sem_init(&context->done, 0, 0));
+
+   

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-09-22 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 1bca8574f7f01fc4b6d9ad0b9d8dd92548d63232
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1bca8574f7f01fc4b6d9ad0b9d8dd92548d63232

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 527d4a6..c062226 100644
--- a/configure.ac
+++ b/configure.ac
@@ -909,6 +909,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-10-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f63ddf3266a1f1a28194c33d1728b39b81491471
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f63ddf3266a1f1a28194c33d1728b39b81491471

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 527d4a6..c062226 100644
--- a/configure.ac
+++ b/configure.ac
@@ -909,6 +909,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-11-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2bf140afb6a0cd409aed86a1d40ca4c0cbfcbacc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2bf140afb6a0cd409aed86a1d40ca4c0cbfcbacc

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4bf37b1..e1f060a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -910,6 +910,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2f6868082032821842649398c5c564341b6b239c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2f6868082032821842649398c5c564341b6b239c

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4bf37b1..e1f060a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -910,6 +910,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-11-28 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 58ec0b8e9911df15f88768b5e79d6f7b0ce54220
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=58ec0b8e9911df15f88768b5e79d6f7b0ce54220

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4d9aee6..f8a11fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -916,6 +916,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-12-09 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 7ebcfb584352aae058f435ef6049a194c713f55c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7ebcfb584352aae058f435ef6049a194c713f55c

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4d9aee6..f8a11fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -916,6 +916,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-01-26 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ec88d006b71e949cc46d9d85c81a0cc754ba3ca8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ec88d006b71e949cc46d9d85c81a0cc754ba3ca8

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 1a738a5..c6506b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -920,6 +920,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-02-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 38388242f86c7dc196e5411f6ac85d1074cd759a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=38388242f86c7dc196e5411f6ac85d1074cd759a

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 1a738a5..c6506b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -920,6 +920,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

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

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4df837f..9cfb7f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -920,6 +920,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-03-13 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 602c2eb85d2c1d803d9d4ae525a4966fd07ee68f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=602c2eb85d2c1d803d9d4ae525a4966fd07ee68f

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index f42538c..5418e11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -923,6 +923,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-03-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a3920c64caafd70c6bf65eb1a0a5940a2847898f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a3920c64caafd70c6bf65eb1a0a5940a2847898f

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 4b6cd3c..1c94559 100644
--- a/configure.ac
+++ b/configure.ac
@@ -923,6 +923,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-04-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b6ddecce4fdac8f0ff6b016e1fd499eb1cd6a9e3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b6ddecce4fdac8f0ff6b016e1fd499eb1cd6a9e3

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-05-13 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2b28613fc6405854d2c2f20dc97b3559289eb78d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2b28613fc6405854d2c2f20dc97b3559289eb78d

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

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

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

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

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

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

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-06-03 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6a6824a1c23b84e9ec7a9f64bf8a5ff8faf3ae3e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6a6824a1c23b84e9ec7a9f64bf8a5ff8faf3ae3e

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2017-07-27 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 0521016513cbbb62e4f0226fba5ef8f6de8e7a6d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0521016513cbbb62e4f0226fba5ef8f6de8e7a6d

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 457d026..9eeb34d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -926,6 +926,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-26 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: e8aae307254751a0db90ce6ddc5aa38858720b82
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e8aae307254751a0db90ce6ddc5aa38858720b82

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/cpu-affinity/Makefile.am|9 ++
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  158 ++
 4 files changed, 169 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7aaedc2..578327e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -902,6 +902,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index e9a0fd2..5ade58b 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..e91c1b1
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,158 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0;
+   struct test_context *p = arg;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   smokey_trace(".. child thread on CPU%d", cpu);
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set))
+   status = -EINVAL;
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context context;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int cpu, ret;
+
+   cpu = *(int *)arg;
+   smokey_trace(".. binding to non-RT CPU%d", cpu);
+
+   context.status = 0;
+   __STD(sem_init(&context.done, 0, 0));
+
+   /*
+* Make the child thread inherit a CPU affinity outside of the
+* valid RT set from us. Cobalt should migrate the spawned
+* thread to a CPU from the RT set automatically.
+*/
+   CPU_ZERO(&set);
+   CPU_SET(cpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   context.status = ret;
+   goto out;
+   }
+
+   pthread_attr_init(&thattr);
+   param.sched_priority = 1;
+   pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED);
+   pthread_attr_setschedpolicy(&thattr, SCHED_FIFO);
+   pthread_attr_setschedparam(&thattr, ¶m);
+   pthread_attr_setinheritsched(&thattr, PTHREAD_EXPLICIT_SCHED);
+
+   if (!__T(ret, pthread_create(&tid, &thattr, test_thread, &context))) {
+   context.status = ret;
+   goto out;
+   }
+
+   __STD(clock_gettime(CLOCK_REALTIME, &now));
+   timespec_adds(&ts, &now, 1); /* 100ms from now */
+   
+   if (!__Terrno(ret, __STD(sem_timedwait(&context.done, &ts
+   context.status = ret;
+out:
+   __STD(sem_destroy(&context.done));
+   
+   return (void *)(long)context.status;
+}
+
+static int run_cpu_affinity(struct smokey_test *t,
+   int argc, char *c

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-27 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: ec0776f69aa3d3f4fadf3e31dc43b9c8779400da
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ec0776f69aa3d3f4fadf3e31dc43b9c8779400da

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/cpu-affinity/Makefile.am|9 ++
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  180 ++
 4 files changed, 191 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7aaedc2..578327e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -902,6 +902,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index e9a0fd2..5ade58b 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..edb285e
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,180 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   smokey_trace(".. child thread starts on CPU%d", cpu);
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   smokey_trace(".. child moving to CPU%d", ncpu);
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context context;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int cpu, ret;
+
+   cpu = *(int *)arg;
+   smokey_trace(".. parent binding to non-RT CPU%d", cpu);
+
+   context.status = 0;
+   __STD(sem_init(&context.done, 0, 0));
+
+   /*
+* Make the child thread inherit a CPU affinity outside of the
+* valid RT set from us. Cobalt should migrate the spawned
+* thread to a CPU from the RT set automatically.
+*/
+   CPU_ZERO(&set);
+   CPU_SET(cpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   context.status = ret;
+   goto out;
+   }
+
+   pthread_attr_init(&thattr);
+   param.sched_priority = 1;
+   pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED);
+   pthread_attr_setschedpolicy(&thattr, SCHED_FIFO);
+   pthread_attr_setschedparam(&thattr, ¶m);
+   pthread_attr_setinheritsched(&thattr, PTHREAD_EXPLICIT_SCHED);
+
+   if (!__T(ret, pthread_create

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-27 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 78eae5786c1f31c5f8f6c1e0dc93b41f4ad35dce
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=78eae5786c1f31c5f8f6c1e0dc93b41f4ad35dce

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/cpu-affinity/Makefile.am|9 +
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  246 ++
 4 files changed, 257 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7aaedc2..578327e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -902,6 +902,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index e9a0fd2..5ade58b 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..fe5865f
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,246 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+   int kfd;
+   int nrt_cpu;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   smokey_trace(" user thread starts on CPU%d, ok", cpu);
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   smokey_trace(" user thread moved to CPU%d, good", ncpu);
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static int load_test_module(void)
+{
+   int fd, status;
+   
+   status = system("modprobe -q xeno_rtdmtest");
+   if (status < 0 || WEXITSTATUS(status))
+   return -ENOSYS;
+
+   /* Open the RTDM actor device. */
+   fd = open("/dev/rtdm/rtdmx", O_RDWR);
+   if (fd < 0)
+   return -errno;
+
+   return fd;
+}
+
+static void unload_test_module(int fd)
+{
+   close(fd);
+   system("rmmod xeno_rtdmtest");
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context *context = arg;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int ret;
+
+   smokey_trace(".. control thread binding to non-RT CPU%d",
+context->nrt_cpu);
+
+   __STD(sem_init(&context->done, 0, 0));
+
+   /*
+* Make the child thread inherit a CPU affinity outside of the
+* valid RT set from us. Cobalt should migrate the spawned
+* threads (kernel and user) to a CPU from the RT set
+* automatically.
+

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-27 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 3973d289e7ea7b0f31054b25a74d5c68617bfd58
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3973d289e7ea7b0f31054b25a74d5c68617bfd58

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/cpu-affinity/Makefile.am|9 +
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  252 ++
 4 files changed, 263 insertions(+)

diff --git a/configure.ac b/configure.ac
index 20fa0ec..8bbeeef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -900,6 +900,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index e9a0fd2..5ade58b 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..2674f76
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,252 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+   int kfd;
+   int nrt_cpu;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   smokey_trace(" user thread starts on CPU%d, ok", cpu);
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   smokey_trace(" user thread moved to CPU%d, good", ncpu);
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static int load_test_module(void)
+{
+   int fd, status;
+   
+   status = system("modprobe -q xeno_rtdmtest");
+   if (status < 0 || WEXITSTATUS(status))
+   return -ENOSYS;
+
+   /* Open the RTDM actor device. */
+   fd = open("/dev/rtdm/rtdmx", O_RDWR);
+   if (fd < 0)
+   return -errno;
+
+   return fd;
+}
+
+static void unload_test_module(int fd)
+{
+   close(fd);
+   system("rmmod xeno_rtdmtest");
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context *context = arg;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int ret;
+
+   smokey_trace(".. control thread binding to non-RT CPU%d",
+context->nrt_cpu);
+
+   __STD(sem_init(&context->done, 0, 0));
+
+   /*
+* Make the child thread inherit a CPU affinity outside of the
+* valid RT set from us. Cobalt should migrate the spawned
+* threads (kernel and user) to a CPU from the RT set
+* automatic

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-27 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f6f82cb5a7ae024cb874f72b0167bad748c74d27
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f6f82cb5a7ae024cb874f72b0167bad748c74d27

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |3 +-
 testsuite/smokey/cpu-affinity/Makefile.am|9 +
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  252 ++
 4 files changed, 264 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f450673..d71aa38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -909,6 +909,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 174b393..51292f1 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
fpu-stress  \
iddp\
leaks   \
@@ -32,7 +33,7 @@ COBALT_SUBDIRS =  \
 MERCURY_SUBDIRS =
 
 DIST_SUBDIRS = $(COBALT_SUBDIRS) $(MERCURY_SUBDIRS)
-   
+
 if XENO_COBALT
 wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS = $(COBALT_SUBDIRS)
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..2674f76
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,252 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+   int kfd;
+   int nrt_cpu;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   smokey_trace(" user thread starts on CPU%d, ok", cpu);
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   smokey_trace(" user thread moved to CPU%d, good", ncpu);
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static int load_test_module(void)
+{
+   int fd, status;
+   
+   status = system("modprobe -q xeno_rtdmtest");
+   if (status < 0 || WEXITSTATUS(status))
+   return -ENOSYS;
+
+   /* Open the RTDM actor device. */
+   fd = open("/dev/rtdm/rtdmx", O_RDWR);
+   if (fd < 0)
+   return -errno;
+
+   return fd;
+}
+
+static void unload_test_module(int fd)
+{
+   close(fd);
+   system("rmmod xeno_rtdmtest");
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context *context = arg;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int ret;
+
+   smokey_trace(".. control thread binding to non-RT CPU%d",
+context->nrt_cpu);
+
+   __STD(sem_init(&context->done, 0, 0));
+
+   /*
+

[Xenomai-git] Philippe Gerum : testsuite/smokey: add test checking Cobalt' s cpu affinity control

2016-02-27 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 3973d289e7ea7b0f31054b25a74d5c68617bfd58
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3973d289e7ea7b0f31054b25a74d5c68617bfd58

Author: Philippe Gerum 
Date:   Fri Feb 26 11:44:16 2016 +0100

testsuite/smokey: add test checking Cobalt's cpu affinity control

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/cpu-affinity/Makefile.am|9 +
 testsuite/smokey/cpu-affinity/cpu-affinity.c |  252 ++
 4 files changed, 263 insertions(+)

diff --git a/configure.ac b/configure.ac
index 20fa0ec..8bbeeef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -900,6 +900,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/net_packet_dgram/Makefile \
testsuite/smokey/net_packet_raw/Makefile \
testsuite/smokey/net_common/Makefile \
+   testsuite/smokey/cpu-affinity/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index e9a0fd2..5ade58b 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -8,6 +8,7 @@ smokey_SOURCES = main.c
 COBALT_SUBDIRS =   \
arith   \
bufp\
+   cpu-affinity\
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/cpu-affinity/Makefile.am 
b/testsuite/smokey/cpu-affinity/Makefile.am
new file mode 100644
index 000..0d2e4e6
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/Makefile.am
@@ -0,0 +1,9 @@
+
+noinst_LIBRARIES = libcpu-affinity.a
+
+libcpu_affinity_a_SOURCES = cpu-affinity.c
+
+libcpu_affinity_a_CPPFLAGS =   \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir) \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/cpu-affinity/cpu-affinity.c 
b/testsuite/smokey/cpu-affinity/cpu-affinity.c
new file mode 100644
index 000..2674f76
--- /dev/null
+++ b/testsuite/smokey/cpu-affinity/cpu-affinity.c
@@ -0,0 +1,252 @@
+/*
+ * Test CPU affinity control mechanisms.
+ *
+ * Copyright (C) Philippe Gerum 
+ *
+ * Released under the terms of GPLv2.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(cpu_affinity,
+  SMOKEY_NOARGS,
+  "Check CPU affinity control."
+);
+
+static cpu_set_t cpu_realtime_set, cpu_online_set;
+
+struct test_context {
+   sem_t done;
+   int status;
+   int kfd;
+   int nrt_cpu;
+};
+
+static void *test_thread(void *arg)
+{
+   int cpu, cpu_in_rt_set, status = 0, ncpu, ret;
+   struct test_context *p = arg;
+   cpu_set_t set;
+
+   cpu = get_current_cpu();
+   if (!__Fassert(cpu < 0)) {
+   status = cpu;
+   goto out;
+   }
+
+   /*
+* When emerging, we should be running on a member of the
+* real-time CPU set.
+*/
+   cpu_in_rt_set = CPU_ISSET(cpu, &cpu_realtime_set);
+   if (!__Tassert(cpu_in_rt_set)) {
+   status = -EINVAL;
+   goto out;
+   }
+
+   smokey_trace(" user thread starts on CPU%d, ok", cpu);
+
+   for (ncpu = 0; ncpu < CPU_SETSIZE; ncpu++) {
+   if (ncpu == cpu || !CPU_ISSET(ncpu, &cpu_realtime_set))
+   continue;
+   CPU_ZERO(&set);
+   CPU_SET(ncpu, &set);
+   if (!__Terrno(ret, sched_setaffinity(0, sizeof(set), &set))) {
+   status = ret;
+   goto out;
+   }
+   smokey_trace(" user thread moved to CPU%d, good", ncpu);
+   }
+out:
+   p->status = status;
+   __STD(sem_post(&p->done));
+   
+   return NULL;
+}
+
+static int load_test_module(void)
+{
+   int fd, status;
+   
+   status = system("modprobe -q xeno_rtdmtest");
+   if (status < 0 || WEXITSTATUS(status))
+   return -ENOSYS;
+
+   /* Open the RTDM actor device. */
+   fd = open("/dev/rtdm/rtdmx", O_RDWR);
+   if (fd < 0)
+   return -errno;
+
+   return fd;
+}
+
+static void unload_test_module(int fd)
+{
+   close(fd);
+   system("rmmod xeno_rtdmtest");
+}
+
+static void *__run_cpu_affinity(void *arg)
+{
+   struct test_context *context = arg;
+   struct sched_param param;
+   struct timespec ts, now;
+   pthread_attr_t thattr;
+   cpu_set_t set;
+   pthread_t tid;
+   int ret;
+
+   smokey_trace(".. control thread binding to non-RT CPU%d",
+context->nrt_cpu);
+
+   __STD(sem_init(&context->done, 0, 0));
+
+   /*
+* Make the child thread inherit a CPU affinity outside of the
+* valid RT set from us. Cobalt should migrate the spawned
+* threads (kernel and user) to a CPU from the RT set
+* automatic