gramine
gramine copied to clipboard
Unsupported system call timer_create
Description of the feature
I was trying to enable TDEngine(a time serious database) to Gramine libOS. It crashed while initializing the taosd. From the Gramine log, a system call "timer_create" is not supported. Is there any workaround for the timer_create? Will Gramine support this system call in future time?
[P1:T17:taosd] warning: Unsupported system call timer_create
[P1:T17:taosd] debug: memory fault at 0x00000004 (IP = 0x28700b814787)
[P1:T17:taosd] debug: killed by signal 11
Why Gramine should implement it?
To support more applications
Indeed, TDEngine seems to require timer_create() syscall and may fail arbitrarily if the syscall is not implemented: https://github.com/taosdata/TDengine/blob/d290daa197b08564c7b1b587b3cde8cda96e70c1/source/os/src/osTimer.c#L111-L113
(The code quality is... dubious. The author knows that timer_create() may return an error, but simply ignores this fact.)
Is there any workaround for the timer_create? Will Gramine support this system call in future time?
There is no workaround from Gramine side. Ideally, TDEngine app would check that timer_create() is unsupported and would fall back to some other mechanism/syscall.
Gramine may support this syscall in the future, but we didn't prioritize adding support for this... So no promises.
Do you know any syscall that can replace the timer_create? Maybe we can push on TDEngine side.
@qijiax Gramine currently supports only classic alarm/timer syscalls:
These syscalls are far less powerful than timer_create() unfortunately. But if TDEngine doesn't require anything complicated from timers, then these two syscalls may be enough to implement the functionality.
If you want to dive deep into the supported timer syscalls in Gramine, check this file: https://github.com/gramineproject/gramine/blob/5c312f95d464a3ac69cce129e270838808f1ee31/libos/src/sys/libos_alarm.c
Would be interested in implementing it based on a similar approach to settimer. Or is someone else already working on this?
Thanks! I don't know anyone planning to work on it, but let's ping @dimakuv and @kailun-qin so they can check their teams.
My team has no ongoing effort around this currently. It's great to have @BraunPhilipp working on it! I'll let @dimakuv double check on the plan/priority.
I'm not aware of anyone working on timer_create(), at least from the Intel side.
If possible, you may also want to take a look at timerfd_create() syscall -- maybe it will be fairly trivial to implement it as well?
@BraunPhilipp If you haven't seen it yet, I recently created a comprehensive technical document on Gramine implemented and unimplemented features. It is still a pending PR, but you can read the current version here: https://github.com/gramineproject/gramine/blob/dimakuv/add-gramine-features-doc/Documentation/devel/features.md
Thanks that sounds great! Will start working on it tomorrow.
Based on my current understanding adding timer support will require timer_create, timer_settime and timer_delete to be implemented.
@dimakuv @mkow moved further discussion here https://github.com/gramineproject/gramine/discussions/1242
@BraunPhilipp Replied there.