Page MenuHomeFreeBSD

LinuxKPI: remove timer KPI from Linux version before 4.15
ClosedPublic

Authored by bz on Tue, Sep 15, 1:33 AM.
Tags
None
Referenced Files
F172566155: D59688.id186744.diff
Sat, Sep 19, 7:46 AM
F172501651: D59688.id186799.diff
Fri, Sep 18, 9:42 PM
Unknown Object (File)
Fri, Sep 18, 7:26 PM
Unknown Object (File)
Fri, Sep 18, 4:33 PM
Unknown Object (File)
Fri, Sep 18, 11:43 AM
Unknown Object (File)
Thu, Sep 17, 2:45 PM
Unknown Object (File)
Thu, Sep 17, 9:32 AM
Unknown Object (File)
Thu, Sep 17, 9:01 AM

Details

Summary

Mark some of the old setup/init functions under a LINUXKPI_VERSION
check for now but given I removed the "data" field from the structure
they would no longer work anyway. We should entirely remove them
later when sure no one outside of base and drm-kmod uses them anymore.

MFC after: 3 days

Test Plan

compile tested after fixing main, with drm-kmod master

Diff Detail

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

Event Timeline

bz requested review of this revision.Tue, Sep 15, 1:33 AM

Ok, this was faster than I expected on the dependencies.

Question: Should I just rip out the pre-4.15 code or should I make it so that backward compatibility can be preserved and we leave it under #if defined ...?

I do not think it's worth doing an exp run for this though if @ashafer can maybe check against NVIDIA graphics to see if (the oldest supported version) still uses any of this or if anyone points out the oldest supported version to me I can go and do a quick build as well. I am still going through all drm-kmod branches currently just to be sure though they should have been covered by the Linux tree-wide replacements.

Should I just rip out the pre-4.15 code

I think so yes. Assuming an exp-run is not necessary or comes back clean it's only 3rd party code not in the ports tree that would be affected (e.g. proprietary code) and the updates a maintainer would need to adapt to the new interface are trivial to apply.

jhb added inline comments.
sys/compat/linuxkpi/common/include/linux/timer.h
62

I would just go ahead and remove them entirely. I think it's better to get a compile-time error than to have them silently fail at runtime.

bz edited the test plan for this revision. (Show Details)

Remove pre 4.15 KPI entirely.

This revision is now accepted and ready to land.Wed, Sep 16, 8:40 PM

Just FYI github drm-kmod on main/amd64/GENERIC:

5.4-lts         no longer compiles on main over error: redefinition of .., etc.
5.10-lts        no longer compiles -- atomic type mismatch /bitops.h:313:35: error: passing 'long *' to parameter of type 'u_long *' (aka 'unsigned long *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
5.15-lts        no longer compiles -- i915_drv.c:134:49: error: incompatible pointer to integer conversion passing 'int *' to parameter of type 'int'; remove & [-Wint-conversion]   &rid vs. rid  ;; easy fix if we wanted!
6.1-lts         compiles 
6.6-lts         compiles
6.12-lts        compiles
master          compiles at 512101d90d

I'll try to check NVIDIA next.

bz marked an inline comment as done.Wed, Sep 16, 9:48 PM
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/timer.h
62

I probably could have still made them work at runtime but they are gone now.

bz marked an inline comment as done.Thu, Sep 17, 9:04 PM

I manually checked the oldest NVIDIA I believe in ports:

% pwd
/..ports.git/graphics/nvidia-drm-515-kmod/work
% ls -l
total 8
drwxr-xr-x  11 bz staff 512 Aug 26 06:20 NVIDIA-FreeBSD-x86_64-595.99.02
drwxr-xr-x  14 bz staff 512 Sep  9 19:24 drm-kmod-drm_v5.15.160_8
% grep -r setup_timer *
% grep -r __setup_timer *    # redundant
% grep -r init_timer *
NVIDIA-FreeBSD-x86_64-595.99.02/src/nvidia-modeset/nvidia-modeset-freebsd.c:nvkms_init_timer(struct nvkms_timer_t *timer, nvkms_timer_proc_t *proc,
NVIDIA-FreeBSD-x86_64-595.99.02/src/nvidia-modeset/nvidia-modeset-freebsd.c:     * run in parallel with this, it could race against nvkms_init_timer()
NVIDIA-FreeBSD-x86_64-595.99.02/src/nvidia-modeset/nvidia-modeset-freebsd.c:        nvkms_init_timer(timer, proc, dataPtr, dataU32, NV_FALSE, usec);
NVIDIA-FreeBSD-x86_64-595.99.02/src/nvidia-modeset/nvidia-modeset-freebsd.c:        nvkms_init_timer(timer, proc, ref_ptr, dataU32, NV_TRUE, usec);
drm-kmod-drm_v5.15.160_8/drivers/gpu/drm/i915/display/intel_bios.h:     u32 master_init_timer;
drm-kmod-drm_v5.15.160_8/drivers/gpu/drm/i915/display/intel_dsi_vbt.c:  intel_dsi->init_count = mipi_config->master_init_timer;

Seems we are good. Otherwise I'll deal with the fallout.

The change can be easily detected at compile time with #ifndef init_timer so no need to bump anything for it. (I should add that to the commit message).