[Xenomai] rt_taks_bind() returns -EAGAIN for existing task

Giulio Moro g.moro at qmul.ac.uk
Sat Jun 10 21:34:22 CEST 2017


Hi,
Xenomai 3.0.5 here on kernel 4.4.68-ti-xenomai-r106 on a AM3358 (BeagleBone Black).

If I create a task with `rt_task_create()`, I can then successfully bind to it using its descriptive name from within the same process that started it, e.g.:

rt_task_create(&task, task_name, 0, 40, T_JOINABLE);
rt_task_bind(&task, task_name, TM_NONBLOCK); //this returns 0: success

But, if while this program is running (and I can see the task's stats in /proc/xenomai/sched/stat ), I start another program which tries to rt_task_bind() to the same task, the latter's call fails with `Resource temporarily unavailable(-11).`

Note that I run both programs with --enable-shared and I tried both with --skin=native and --skin=alchemy.

Here is an example of my code: https://github.com/giuliomoro/xenomai-mode-switch-detector

This program checks if a task with a given name exists. If it does exist, it returns the number of modes switches in that task. If it does not exist, then it creates and runs the task.

I run the program once, wait for it to display "Run" (so I know the created task is active), then while I leave that running, I run another instance of the program in another terminal. I would expect the second one to successfully bind to the first one, but that is not the case (i.e.: this second instance also creates another task with the same name). I can see both running tasks in /proc/xenomai/sched/stat
In both programs, the first call to rt_task_bind() fails with "Resource temporarily unavailable(-11)."

A side note: it seems that calling `rt_task_bind()` causes a switch to secondary mode, as I see the MSW counter increasing for every call to it.

Thanks,
Giulio

Configuration dumps follow:

Output of the --dump-config:

./mode_switches_detector --dump-config
based on Xenomai/cobalt v3.0.5 -- #48b2e57e2 (2017-05-30 09:03:41 +0200)
CONFIG_MMU=1
CONFIG_SMP=1
CONFIG_XENO_BUILD_ARGS=" '--disable-dependency-tracking' '--with-core=cobalt' '--enable-pshared' '--host=arm-linux-gnueabihf' '--build=arm' 'CFLAGS=-no-pie -fno-pie -march=armv7-a -mfpu=vfp3' 'LDFLAGS=-no-pie -fno-pie -march=armv7-a -mfpu=vfp3' '--enable-smp' 'build_alias=arm' 'host_alias=arm-linux-gnueabihf'"
CONFIG_XENO_BUILD_STRING="arm-unknown-none"
CONFIG_XENO_COBALT=1
CONFIG_XENO_COMPILER="gcc version 6.3.0 20170516 (Debian 6.3.0-18) "
CONFIG_XENO_DEFAULT_PERIOD=1000000
CONFIG_XENO_FORTIFY=1
CONFIG_XENO_HOST_STRING="arm-unknown-linux-gnueabihf"
CONFIG_XENO_LORES_CLOCK_DISABLED=1
CONFIG_XENO_PREFIX="/usr/xenomai"
CONFIG_XENO_PSHARED=1
CONFIG_XENO_RAW_CLOCK_ENABLED=1
CONFIG_XENO_REVISION_LEVEL=5
CONFIG_XENO_SANITY=1
CONFIG_XENO_TLSF=1
CONFIG_XENO_TLS_MODEL="initial-exec"
CONFIG_XENO_UAPI_LEVEL=14
CONFIG_XENO_VERSION_MAJOR=3
CONFIG_XENO_VERSION_MINOR=0
CONFIG_XENO_VERSION_NAME="Sisyphus's Boulder"
CONFIG_XENO_VERSION_STRING="3.0.5"
---
CONFIG_XENO_ASYNC_CANCEL is OFF
CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED is OFF
CONFIG_XENO_DEBUG is OFF
CONFIG_XENO_DEBUG_FULL is OFF
CONFIG_XENO_LIBS_DLOPEN is OFF
CONFIG_XENO_MERCURY is OFF
CONFIG_XENO_REGISTRY is OFF
CONFIG_XENO_REGISTRY_ROOT is OFF
CONFIG_XENO_VALGRIND_API is OFF
CONFIG_XENO_WORKAROUND_CONDVAR_PI is OFF
CONFIG_XENO_X86_VSYSCALL is OFF
---
PTHREAD_STACK_DEFAULT=65536
AUTOMATIC_BOOTSTRAP=1


Dump of Kernel flags:

$ grep XENO_ /boot/config-4.4.68-ti-xenomai-r106
# CONFIG_XENO_OPT_SCHED_CLASSES is not set
CONFIG_XENO_OPT_STATS=y
# CONFIG_XENO_OPT_SHIRQ is not set
CONFIG_XENO_OPT_RR_QUANTUM=1000
CONFIG_XENO_OPT_AUTOTUNE=y
# CONFIG_XENO_OPT_SCALABLE_SCHED is not set
CONFIG_XENO_OPT_TIMER_LIST=y
# CONFIG_XENO_OPT_TIMER_RBTREE is not set
CONFIG_XENO_OPT_HOSTRT=y
CONFIG_XENO_OPT_PIPE=y
CONFIG_XENO_OPT_MAP=y
CONFIG_XENO_OPT_VFILE=y
CONFIG_XENO_OPT_PIPE_NRDEV=32
CONFIG_XENO_OPT_REGISTRY_NRSLOTS=512
CONFIG_XENO_OPT_SYS_HEAPSZ=512
CONFIG_XENO_OPT_PRIVATE_HEAPSZ=64
CONFIG_XENO_OPT_SHARED_HEAPSZ=64
CONFIG_XENO_OPT_NRTIMERS=128
CONFIG_XENO_OPT_TIMING_SCHEDLAT=0
CONFIG_XENO_OPT_TIMING_KSCHEDLAT=0
CONFIG_XENO_OPT_TIMING_IRQLAT=0
# CONFIG_XENO_OPT_DEBUG is not set
CONFIG_XENO_OPT_RTDM_COMPAT_DEVNODE=y
CONFIG_XENO_DRIVERS_AUTOTUNE=y
CONFIG_XENO_DRIVERS_16550A=m
# CONFIG_XENO_DRIVERS_16550A_PIO is not set
# CONFIG_XENO_DRIVERS_16550A_MMIO is not set
CONFIG_XENO_DRIVERS_16550A_ANY=y
CONFIG_XENO_DRIVERS_TIMERBENCH=y
CONFIG_XENO_DRIVERS_SWITCHTEST=y
# CONFIG_XENO_DRIVERS_RTDMTEST is not set
# CONFIG_XENO_DRIVERS_CAN is not set
# CONFIG_XENO_DRIVERS_NET is not set
# CONFIG_XENO_DRIVERS_ANALOGY is not set
CONFIG_XENO_DRIVERS_RTIPC=y
CONFIG_XENO_DRIVERS_RTIPC_XDDP=y
CONFIG_XENO_DRIVERS_RTIPC_IDDP=y
CONFIG_XENO_OPT_IDDP_NRPORT=32
CONFIG_XENO_DRIVERS_RTIPC_BUFP=y
CONFIG_XENO_OPT_BUFP_NRPORT=32
CONFIG_XENO_DRIVERS_UDD=m
CONFIG_XENO_DRIVERS_GPIO=m
# CONFIG_XENO_DRIVERS_GPIO_DEBUG is not set
CONFIG_XENO_ARCH_UNLOCKED_SWITCH=y
CONFIG_XENO_ARCH_WANT_TIP=y
CONFIG_XENO_ARCH_FPU=y
# CONFIG_XENO_ARCH_SYS3264 is not set
CONFIG_XENO_ARCH_OUTOFLINE_XNLOCK=y
CONFIG_XENO_VERSION_MAJOR=3
CONFIG_XENO_VERSION_MINOR=0
CONFIG_XENO_REVISION_LEVEL=5
CONFIG_XENO_VERSION_STRING="3.0.5"
CONFIG_XENO_VERSION_NAME="Sisyphus's Boulder"


More information about the Xenomai mailing list