Page MenuHomeFreeBSD

LinuxKPI: Add work-in-pgroess PAGE_IS_LKPI_PAGE
Needs ReviewPublic

Authored by bz on Oct 29 2025, 4:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 19, 4:19 PM
Unknown Object (File)
Wed, Mar 18, 3:40 AM
Unknown Object (File)
Sun, Mar 15, 4:39 AM
Unknown Object (File)
Sat, Mar 14, 7:43 AM
Unknown Object (File)
Sat, Mar 14, 7:42 AM
Unknown Object (File)
Sat, Mar 14, 7:42 AM
Unknown Object (File)
Fri, Mar 13, 8:10 PM
Unknown Object (File)
Fri, Mar 13, 7:50 PM

Details

Reviewers
olce
emaste
Summary

PAGE_IS_LKPI_PAGE is not yet defined and thus a Linux "page" is still
a native FreeBSD vm_page.

With this defined 'struct page' becomes a collection-struct for Linux
code which handles its members itself. We keep the native FreeBSD page
as first argument.

Further work is needed to finish the implementation.

The pre-processor check allows us to test the new implementation (once
done; including drm-kmod which also worked around this problem in a
place before) before finally flipping the default.

In addition to drm-kmod also mt76 (page-pools) will benefit from this.

Test Plan

I litterally rebased this from sitting in the car on the road
and resolved two conflicts; this may or may not be the latest
revision of the work but at least is updated. I'll go and have
a look from inside or next week.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 71291
Build 68174: arc lint + arc unit

Event Timeline

bz requested review of this revision.Oct 29 2025, 4:08 PM

There's a few XXX cases in there still etc. mm.h and highmem.h got conflict resolution from the street. If I got it right a kernel w/o drm-kmod at least would compile which was all the bits I needed for the moment; will need this + page_ppols working for mt76 and drm-kmod still compiling and working despite having vm_age_t embedded somewhere which probably should not be native code but LinuxKPI code which then can handle any of that.

sys/compat/linuxkpi/common/src/linux_page.c
876

This is the logic (with or without optimization) that needs to work for all three cases.

931

This is/was debugging for me to see how big vm_page_array_size is.

sys/compat/linuxkpi/common/include/linux/page.h
51

Here's the one line that needs changing to compile this in or out.

bz planned changes to this revision.Dec 23 2025, 11:29 PM

I'll try to update this the next days based on further local changes.

Update.

I would highly advise to not try to run this on a desktop yet (unless
just to see how much it works in a throw-away BE).

I do run it and keep compile-time testing drm-kmod master with it
for wifi and I know there are issues.

bz added subscribers: jrm, dumbbell.
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_page.c
90

I would disable this KASSERT and the below as I know they fire.

sys/dev/iser/iser_initiator.c
299

Is there anyone to talk to about this driver?

The drm-kmod part is here; I hope it still applies cleanly otherwise I have a branch https://github.com/freebsd/drm-kmod/pull/398

In D53440#1275937, @bz wrote:

The drm-kmod part is here; I hope it still applies cleanly otherwise I have a branch https://github.com/freebsd/drm-kmod/pull/398

I just merged your pull request to drm-kmod.