Page MenuHomeFreeBSD

linuxkpi: Add eventfd_*()
Needs ReviewPublic

Authored by dumbbell on Sat, Jun 14, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 30, 11:47 PM
Unknown Object (File)
Sun, Jun 29, 8:52 PM
Unknown Object (File)
Tue, Jun 24, 5:31 PM
Unknown Object (File)
Wed, Jun 18, 5:05 PM
Unknown Object (File)
Wed, Jun 18, 3:26 AM
Unknown Object (File)
Mon, Jun 16, 9:38 PM
Unknown Object (File)
Mon, Jun 16, 9:37 PM
Unknown Object (File)
Mon, Jun 16, 8:33 PM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

Add <linux/eventfd.h> and expose the eventfd_*() API. This is used by DRM drivers for some time, but the code was commented out so far.

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

I will have to bump __FreeBSD_version to be able to use this API in DRM drivers.

wulf added inline comments.
sys/compat/linuxkpi/common/include/linux/eventfd.h
41

We do not expose LKPI API directly to userland. So no need in uapi/linux/eventfd.h

dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/eventfd.h
41

The goal is the same as D50851: it is to reproduce the same includes as Linux.

I frequently see a compilation failure because a source file relies on namespace pollution in Linux (it uses something but doesn’t include the associated header explicitly). As I don’t want to add a FreeBSD-specific include in DRM drivers, I search that mission inclued somewhere in linuxkpi.

This useless header for us is simply to avoid that work in the future.

bz added inline comments.
sys/compat/linuxkpi/common/include/linux/eventfd.h
41

Yes, I have a lot of #ifdef for #includes (and missing self-sufficiency of headers) in wireless drivers from the time before we had the dummy/includes and I would love to get rid of them as well. One man one for me is delay,h.

That said there is zero need to #include a dummy header inside linuxkpi/common. so I agree with @wulf here.

sys/compat/linuxkpi/common/include/linux/eventfd.h
41

If you would grep drm-kmod for <uapi/ string, you would find references on only 3 files: uapi/linux/kfd_ioctl.h, uapi/drm/i915_drm.h and uapi/linux/sched/types.h. So they can't produce any significant namespace pollution.
Generally in LKPI uapi/ file contents should be just merged in to corresponding non-uapi file.

@dumbbell FYI. Take a look at https://github.com/lutzbichler/drm-kmod/tree/pr/6.15. It seems that lutzbichler has advanced to drm-kmod v6.15

dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/eventfd.h
41

Even if linuxkpi doesn't need this extra header, Linux code might expect this to reproduce the same "graph".

It also makes it easier to compare sources from Linux and FreeBSD if we honor the same layout.

41

I prefer to have the exact same layout to make the porting effort less bumpy. This way, we know the provide the same API. We don't know how headers will be included in the future, so running a grep isn't helpful.

Of course, if you all prefer the opposite, I will change it. But I lost a fair amount of time solving these missing includes. I find it sad if we continue to introduce them.

@dumbbell FYI. Take a look at https://github.com/lutzbichler/drm-kmod/tree/pr/6.15. It seems that lutzbichler has advanced to drm-kmod v6.15

I stumbled upon this repository a few times, but I don't know this person and they don't seem to submit pull requests so far.

Address comments from @wulf and @bz: don’t introduce a <uapi/linux/eventfd.h> header.