Page MenuHomeFreeBSD

eventfd: Add eventfd_signal()
Needs ReviewPublic

Authored by dumbbell on Jun 14 2025, 5:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 7, 9:39 AM
Unknown Object (File)
Wed, Dec 3, 9:25 PM
Unknown Object (File)
Nov 10 2025, 10:57 PM
Unknown Object (File)
Nov 6 2025, 8:37 PM
Unknown Object (File)
Nov 5 2025, 12:14 AM
Unknown Object (File)
Nov 3 2025, 3:15 PM
Unknown Object (File)
Oct 27 2025, 3:33 PM
Unknown Object (File)
Oct 25 2025, 2:46 AM

Details

Reviewers
markj
Group Reviewers
linuxkpi
Summary

The eventfd_signal() function is the equivalent to a write to an eventfd file descriptor: it bumps the internal counter and wakes up processes waiting for it.

eventfd_signal() is meant to be used by kernel drivers. DRM drivers will call it through linuxkpi.

This is a requirement to the following patch to drm-kmod:
https://github.com/freebsd/drm-kmod/pull/358

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj added a subscriber: markj.
markj added inline comments.
sys/kern/sys_eventfd.c
161

What's the purpose of having the mask parameter? Do you plan to extend this in the future?

170

It would be better to share this code with eventfd_write(), but it is not critical.

This revision is now accepted and ready to land.Sun, Nov 30, 4:42 PM

Refresh patch after abandonning D50848.

This revision now requires review to proceed.Sat, Dec 13, 9:41 PM
christos added inline comments.
sys/kern/sys_eventfd.c
161

Same question as Mark. D50853 does not use it.

emaste added inline comments.
sys/kern/sys_eventfd.c
161

It matches Linux's eventfd_signal_mask but it does seem we could just omit it if not being used in FreeBSD.

sys/kern/sys_eventfd.c
161

This isn't the linuxkpi, so we shouldn't be duplicating the interface when it doesn't match our implementation.

sys/kern/sys_eventfd.c
161

Arguably it should just be eventfd_signal as well?

dumbbell added inline comments.
sys/kern/sys_eventfd.c
161

I will rename it to eventfd_signal() and get rid of eventfd_signal_mask() (which DRM doesn't use for now).

170

I will move this code to a dedicated function.

sys/kern/sys_eventfd.c
161

I will also change from using casts to #define eventfd_ctx eventfd because Linux code expects eventfd_signal() to take a struct eventfd_ctx * (the wrapper around eventfd_signal_mask() held the cast previously).