Page MenuHomeFreeBSD

LinuxKPI: Add tgid to task_struct under sched.h
ClosedPublic

Authored by siri_racha.ca on Jul 14 2026, 5:27 PM.
Referenced Files
F171490467: D58228.id185990.diff
Fri, Sep 11, 10:47 AM
F171390082: D58228.diff
Thu, Sep 10, 9:11 PM
Unknown Object (File)
Thu, Sep 10, 3:26 AM
Unknown Object (File)
Wed, Sep 9, 6:54 PM
Unknown Object (File)
Wed, Sep 9, 11:57 AM
Unknown Object (File)
Wed, Sep 9, 11:57 AM
Unknown Object (File)
Tue, Sep 8, 10:23 AM
Unknown Object (File)
Tue, Sep 8, 10:08 AM

Details

Summary

The amdkfd driver requires the tgid to be apart of the task_struct.
This patch introduces the tgid member to task_struct.

Sponsored By: The FreeBSD Foundation

Test Plan

Ran a test build, and builds with no issues.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

What's the KBI impact of this? Does it need a __FreeBSD_version bump then? Would it make sense to add it to the end?

In D58228#1349195, @bz wrote:

What's the KBI impact of this? Does it need a __FreeBSD_version bump then? Would it make sense to add it to the end?

It does break KBI... I did not consider that. I've made a revision to gaurd via __FreeBSD_version, though it bumps from 19->21 since someone bumped to 20 last night.

siri_racha.ca edited the summary of this revision. (Show Details)
siri_racha.ca edited the test plan for this revision. (Show Details)

Fixed formatting, incremented to correct value, fixed description, added test plan.

@bz If you have some time, can you let me know if there are any additional changes I should make?

bz requested changes to this revision.Fri, Sep 4, 5:23 PM
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/sched.h
80

This is not right. The structure field should always be unconditional.

This revision now requires changes to proceed.Fri, Sep 4, 5:23 PM
sys/compat/linuxkpi/common/include/linux/sched.h
80

Hmmm ok, to make sure I understand why so I don't make this mistake again can you confirm this;
This change would break KABI becauses it changes the layout of the struct.
In this case, because the FreeBSD kernel header files are always compiled against the kernel source tree they belong to, it would always evaluate to True, making this useless.
But we should still bump the __FreeBSD_version so that external code knows that there was a KPI change.

On a related note, it got bumped to 1600023 on CURRENT, so I need to fix this again.

bz added inline comments.
sys/compat/linuxkpi/common/include/linux/sched.h
80

Right. Also in addition to all this it gets complicated when you start MFCing.
Bumping __FreeBSD_version will make the external kmod packages (the ones from the special repo) being rebuilt.
For as long as the header is not used in further code that's fine. We (I) still do not have a full understanding of that.

Given we do bump __FreeBSD_version I am not sure how much we win in this particular case by adding the field to the end.
You just do the final bump before the commit; there's no need for extra review for that.
You may also want to add an UPDATING entry saying that LinuxKPI modules must be recompiled (there should be examples from dumbbell or me there).

Lastly after the commit please document the __FreeBSD_version bump in the docs as indicated in the comment in param.h right above it.

This revision is now accepted and ready to land.Sun, Sep 6, 4:21 PM

Hi,
sorry, I somehow assumed you have a commit bit. This is not the case, right? So @dumbbell , @emaste, or I need to commit your changes?

This revision was automatically updated to reflect the committed changes.