gramine icon indicating copy to clipboard operation
gramine copied to clipboard

[LibOS] Add support for timerfd system calls

Open kailun-qin opened this issue 2 years ago • 1 comments

Description of the changes

This commit adds support for system calls that create and operate on a timer that delivers timer expiration notifications via a file descriptor, specifically: timerfd_create(), timerfd_settime() and timerfd_gettime(). The timerfd object is associated with a dummy eventfd created on the host to trigger notifications (e.g., in epoll). The object is created inside Gramine, with all it operations resolved entirely inside Gramine.

The emulation is currently implemented at the level of a single process. However, it may sometimes work for multi-process applications, e.g., if the child process inherits the timerfd object but doesn't use it; to support these cases, we introduce the sys.experimental__allow_timerfd_fork manifest option.

LibOS regression tests are also added.

How to test this PR?

CI + newly added regression tests. ~TODO: test it on some real workloads.~ Also tested w/ stress-ng --timerfd.


This change is Reviewable

kailun-qin avatar Jan 26 '24 08:01 kailun-qin

libos/src/sys/libos_timerfd.c line 233 at r2 (raw file):

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

This is the only comment that I have now; all others were resolved.

So, this isn't fixed yet, right? Let's wait with this PR and fix this problem first.

mkow avatar Aug 12 '24 16:08 mkow