Cobalt Preemption of kernel update_fast_timekeeper can cause deadlocks

Jan Kiszka jan.kiszka at siemens.com
Thu Dec 20 11:45:25 CET 2018


On 19.12.18 19:26, Auel, Kendall via Xenomai wrote:
> Jan,
> 
> I'm very much in favor of providing a way to prevent Xenomai modules from using features which can result in deadlock, if there is a clean way to detect such a situation.
> 
> We used gettimeofday in one of our modules and it mostly worked great. But once in a great while the system would deadlock. Most calls to gettimeofday are benign and appear to work normally, which is why it is especially problematic. It would have saved some debug cycles if there was a kernel log message to warn us of our danger.
> 
> Or perhaps we could collect a blacklist of references which will produce warnings when linking a Xenomai module. All of these things are 'nice to have' but certainly not urgent matters.

We do have the infrastructure and a small use case for such RT traps already: If 
you use --mode-check on xeno-config, any usage of malloc and free from RT 
contexts will be detected and reported. These calls are evil as well because 
they tend no not trigger a syscall in the fast path and only fail on contention 
or empty-pool situations of the userspace allocator.

We could extend that mechanism for gettimeofday & Co. checks, but we need to 
limit that to non-posix applications: with posix, you are already redirected to 
the RT-safe implementations of those functions.

Patches welcome.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list