Lustre Upstreaming to Linux Kernel: Difference between revisions

From Lustre Wiki
Jump to navigation Jump to search
(Add patch sending info)
m (→‎Pending Work: mention rhashtable in libcfs has)
 
(49 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Getting started ==
The Lustre upstreaming effort is currently being managed as part of the <code>master</code> Lustre development branch, and submitted patches should follow the normal Lustre patch submission process, which includes fixing issues reported by checkpatch.pl, so that the code follows the upstream kernel style guidelines.  Once all issues in the Lustre code that are known to be blocking upstream submission have been addressed, then the filesystem will be resubmitted to the upstream kernel.


The upstream Lustre client code is currently hosted in the staging area of the linux kernel tree. All current efforts for the upstream client are done with the git staging repo and that work then goes into Linus's tree during the merge window shortly after a Linux kernel release is cut. The git staging tree has several branches but the one of interest for contributing is the staging-testing branch. Any patches created against the other branches will likely not even apply correctly so please ensure  you are working and testing with the staging-testing branch. Before we can start developing patches we need to obtain the source repo, build and install the Lustre enabled kernel with the proper utilities. The steps to getting started are listed below. In my example I named by git repo top directory lustre-upstream but you can name it whatever you want.
== Pending Work ==


cd your-work-directory<br>
Significant work has gone into improving the Lustre codebase since the Lustre client was removed from staging. Below are listed some of the major areas of ongoing work. This list is not comprehensive. The first ticket <code>LU-12511</code> links to a lot of work that has been completed historically. This table will be updated periodically as new requirements emerge and as work becomes completed.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git lustre-upstream<br>
cd lustre-upstream<br>
git checkout -b staging-testing origin/staging-testing<br>


=== Kernel configuration ===
{| class="wikitable sortable"


With the lustre client source tree available the next step will be configuring your kernel to enable Lustre. The easiest way to configure a kernel is to run make menuconfig. If this fails it most likely is due to the missing libncurses library that is required. Running the make menuconfig will present you the top level menu. The section for Lustre is located in the Device Drivers section:
|-
! Task !! Status !! Notes !! Jira !! Patch(es)
|-


< > Volume Management Device Driver<br>
|-
[*] Networking support  ---><br>
| Prepare Lustre for Adoption in the Linux kernel || Incomplete || This is the main Jira ticket - which links to other subtasks || [https://jira.whamcloud.com/browse/LU-12511 LU-12511] || Various
Device Drivers  ---><br>
|-
Firmware Drivers  ---><br>


Once in the Device Drivers menu you want to enable the Staging driver menu as shown here:
|-
| IPv6 Support || Mostly Complete || Initial support in 2.16, finalized support in 2.17 || [https://jira.whamcloud.com/browse/LU-18417 LU-18417] || Various
|-


Virtio drivers  ---><br>
|-
Microsoft Hyper-V guest support  ----<br>
| Enforce Linux kernel coding style || Mostly Complete || The majority of checkpatch.pl warnings have been addressed || [https://jira.whamcloud.com/browse/LU-6142 LU-6142] || Various
[*] Staging drivers  ---><br>
|-
[ ] X86 Platform Specific Device Drivers  ---><br>


Enable the staging driver allows you to display the options of that menu. Scroll down to the Staging drivers option and hit enter to go to the Staging menu.
|-
In the menu you will see:
| Convert to kernel-doc comments || Incomplete || work underway || [https://jira.whamcloud.com/browse/LU-9633 LU-9633] || Various
|-


< >  GCT GDM724x LTE support><br>
|-
< >  TTY over Firewire<br>
| Unify Lustre kernel modules || Incomplete || Reduce the total number of Lustre kernel modules || [https://jira.whamcloud.com/browse/LU-17862 LU-17862] || [https://review.whamcloud.com/c/fs/lustre-release/+/55153 55153]
< >  Lustre networking subsystem (LNet)<br>
|-
< >  Digi Neo and Classic PCI Products<br>


You want to select Lustre networking subsystem which will in turn enable several other options.
|-
| Split userspace, compat, and kernel code || Incomplete || Split the core filesystem from the compatibility code needed to support older kernels || [https://jira.whamcloud.com/browse/LU-18687 LU-18687] || Various
|-


< >  GCT GDM724x LTE support<br>
|-
< >  TTY over Firewire<br>
| Replace libcfs hashing code with rhashtable || Incomplete || Most of the users on the client have been removed; the majority of the work is server-side || [https://jira.whamcloud.com/browse/LU-8130 LU-8130] || Various
<M>  Lustre networking subsystem (LNet)<br>
|-
 (1048576) Lustre lnet max transfer payload (default 1MB)
<M>    Lustre networking self testing<br>
<M>    LNET infiniband support<br>
<M>    Lustre file system client support<br>
(8192)    Lustre obd max ioctl buffer bytes (default 8KB)<br>   
[ ]       Enable Lustre DEBUG checks<br>
<M>      Lustre virtual block device<br>
< >  Digi Neo and Classic PCI Products<br>
< >  Xilinx FPGA firmware download module<br>


These default values will be enough to get you on your way to building a lustre client. Help sections are provided for all the entries to help you understand your options.
|-
Once you have made your selections then the normal build process of make bzImage and make modules on x86 machines will produce the lustre client modules. For
| Adapt Lustre Infiniband driver to latest APIs || Deferred || The initial submission of Lustre to Linux will be TCP/IP only || [https://jira.whamcloud.com/browse/LU-8874 LU-8874] || Various
other platforms or if you want to create debian or rpm packages please consult freely available documentation about kernel building on the web. Also feel free to ask
|-
for help on the lustre-devel mailing list. Once your kernel is ready just install it as you normally would a new kernel and reboot.


=== Building the Lustre utilities ===
|-
| Remove ProcFS users || Incomplete || Most of the users on the client have been removed; the majority of the work is server-side || [https://jira.whamcloud.com/browse/LU-8066 LU-8066] || Various
|-


To use the lustre upstream client properly you will need to install the lustre utilities rpm or debian packages. First you will need to download the latest Lustre OpenSFS/Intel repository.
|-
Like the upstream repo checkout you can name it something different than lustre-intel-branch in this example.
| Remove custom interval-tree || Complete || - || [https://jira.whamcloud.com/browse/LU-11085 LU-11085] || Various
|-


cd my-work-space<br>
|-
git clone git://git.hpdd.intel.com/fs/lustre-release lustre-intel-branch<br>
| Transition completely to folios || Incomplete || A lot of callbacks have been implemented; still have dependency on mm/folio-compat.c; large folio support is in-flight || [https://jira.whamcloud.com/browse/LU-17916 LU-17916] || Various
cd lustre-intel-branch<br>
|-
sh ./autogen.sh<br>
./configure --disable-server<br>
make rpm  - make debs<br>


Once it completes you will have the debian based packages stored in the debs directory or the rpms in the top level source directory. In either case you only need the utilities package.
|-
In the rpm case it is the lustre-'version'*.rpm and the debian package of interest is lustre-utils_*.deb. Besides the utility package the other package that could be of interest is the
| ->writepage could likely be deprecated || Incomplete || Mostly a factor of ensure Lustre still behaves - [https://lwn.net/Articles/893512/ context] || [https://jira.whamcloud.com/browse/LU-18675 LU-18675] || [https://review.whamcloud.com/c/fs/lustre-release/+/57894 57894]
lustre-tests-* package which contains an test suite used to validate Lustre to avoid potential regressions observed in the past. If you are interested in full fledge testing then I recommend
|-
reading the [[TestingLustreCode | How to test Lustre Code]] section.


Once all your packages are installed you will need to setup a lustre file system. An excellent link to get the newcomer going is https://wiki.hpdd.intel.com/display/PUB/Create+and+Mount+a+Lustre+Filesystem.
|}
As always if you have questions feel free to ask on the lustre-devel mailing and people will gladly help you.


== git setup for patch submitting ==
== Proposed Transition to an Upstream-first Development Model ==


Now that you are familiar with Lustre setup and would like to contribute the next step is too configure .gitconfig to send patches to Greg and the staging tree. I will show my .gitconfig I use for
==== Background ====
pushing patches upstream.


[sendemail]<br>
Currently, the Lustre kernel modules are maintained as an out-of-tree driver. This driver supports a variety of vendor kernels (primarily on RHEL and Ubuntu). Code is developed first for these vendors kernels. It is later updated to support newer kernel as they are release. The core filesystem code and the compatibility code are intermixed.
        to = Greg Kroah-Hartman <[email protected]><br>
        to = [email protected].org<br>
        to = Andreas Dilger <andreas.dilger@intel.com><br>
        to = Oleg Drokin <[email protected]><br>
        cc = Linux Kernel Mailing List <linux-kernel@vger.kernel.org><br>
        cc = Lustre Development List <[email protected].org><br>
[diff]<br>
        renames = true<br>


Basically the .gitconfig is set to email patches to the correct people. I also a [diff] field to handle renaming of files for when it does happen. Most users will most like never use that functionality.
For upstreaming to work, the normal development flow has to generate patches to mainline Linux. However, we must still support the older distribution kernels that most people use to run Lustre. To achieve this - we must invert the development model. Code must be developed first for the upstream kernel. Afterwards, this code will be supported on older kernels via a compatibility layer maintained by the Lustre development community. These next sections provide a high-level overview and defines a clear roadmap with tangible milestones on our path to upstream. This transition will occur in stages and will proceed in parallel with normal development - without interrupting normal feature work.
After you merge your patches the easiest way to prepare to send them by:


git format-patch -"# of patches" --cover-letter -o patch-directory/<br>
The timelines provided are approximate.
Edit your cover letter<br>
git send-email patch-directory/<br>


This one approach but people that are much better at git know of ways to do the above more efficiently.
==== Tenets ====
 
There are several important considerations we must account for when undertaking this work (in order of importance):
 
* '''Mainline Linux is the source of truth''' - Every Lustre release must be derived from a mainline Linux release. Code change to Lustre should target mainline Linux first - and later be backported as needed. We should not block upstream improvements to facilitate backporting.
 
* '''Do not complicate the process of contributing to Lustre''' - Lustre has an active developer community and a large amount of pre-existing test infrastructure. Our existing processes have worked well. We should maintain the beneficial aspects of our existing workflows while transitioning to an upstream-first model.
 
* '''Integrate with the wider filesystem community''' - We should strive to share Lustre's improvements and advancements with the wider filesystem community. We should regularly collaborate with others in the community to facilitate kernel-wide improvements.
 
==== [I] Separate the kernel code, compatibility code, and userspace code ====
 
ETA: June 2025
 
The Lustre tree should be reorganized to have a clear separation of concerns:
 
<pre>
fs/lustre/
net/lnet/
net/lnet/libcfs/
lustre_compat/
tests/
utils/
</pre>
 
The functional components of <code>libcfs/</code> would stay in that directory and the compatibility components would live in <code>lustre_compat/</code>. Centralizing the compatibility code makes it easier to maintain and update and allows us to start removing the compatibility code from the modules themselves. <code>lustre_compat/</code> will be compiled into <code>libcfs.ko</code>. The functional components of <code>libcfs/</code> will be compiled into <code>lnet.ko</code>.
 
The compatibility code will mirror the upstream kernel-tree. After an upstream kernel is released, we will update the compatibility layer as-needed to support that release on older kernels.
 
==== [II] Get fs/ and net/ to compile on a mainline kernel ====
 
ETA: November 2025
 
Once the compatibility code is isolated, we must get <code>fs/</code> and <code>net/</code> to compile on a mainline kernel - without any configuration or <code>lustre_compat/</code> layer.
 
This would enforced by adding build validation to each patch submitted to Gerrit. The kernel version would be pinned in the <code>contrib/lbuild/</code> scripts and we'd periodically update it and fix any new build failures.
 
Once this is achieved, we'll have a native mainline Linux client/server that can be run on older distributions via a compatibility layer.
 
==== [III] Move fs/ and net/ to a separate kernel tree ====
 
ETA: November 2026 (This would immediately precede submission for inclusion)
 
Transition to maintaining <code>fs/</code> and <code>net/</code> as a series on patches on top of a mainline kernel release. At this point, we'll generating patches to mainline Linux while retaining the ability to support older distro kernels via <code>lustre_compat/</code>. Similar to the previous step, we periodically rebase our Lustre patch series - fixing <code>lustre_compat/</code> as needed.
 
This is the only step that requires a significant change the Lustre development workflow - patches would have to be split and sent to two different repositories. This step will be delayed until we have some confidence that Lustre has a path to be accepted to mainline.
 
==== [IV] Submit the patch series for inclusion ====
 
ETA: November 2026
 
Once we are comfortable with the above process, we can submit the initial patches to add Lustre support to the kernel. Our normal development flow will generate a batch of patches to be submitted during each merge window. After the merge window, we can focus on testing and making sure that our backport to older distro kernels is still functional.
 
 
 
 
 
== FAQ ==
 
; Who will actually run the Lustre code in mainline Linux?
: Everyone. Releases for older distros will be a combination of the upstream Lustre combined with <code>lustre_compat/</code> and whatever stuff the kernel won't allow.
 
; What will a Lustre release look like?
: We can generate a tarball by combining an upstream Lustre release from mainline along with <code>lustre_compat/</code> and the userspace stuff. Vendors and third-parties can base their versions of Lustre on those tarballs. Every time a new kernel releases - a new Lustre release tarball will be created. LTS releases can center around the LTS kernel releases.
 
; How will we validate that fs/ and net/ build on mainline?
: It would probably be easiest to create a minimalist mainline kernel build in Jenkins. This would allow us to reuse most of the existing <code>lbuild</code> scripting. The build would be non-enforced at first. Testing would remain on distribution kernels, since most people use those.
 
; Does anyone else have a similar model? Does this even work?
: AMD GPU seems to have a similar approach, at least. We should talk to other developers working in a model similar to this.
 
<br>
 
 
 
== Past Talks and Coverage ==
 
This section covers previous talks and coverage about the Lustre upstreaming process.
 
==== Lustre Administrators and Developers (LAD) ====
 
[https://www.youtube.com/watch?v=Sjbpq73SoIE LAD 2022: Native Linux client Status - James Simmons]
 
[https://www.youtube.com/watch?v=g8xOy7HTo3w LAD 2020: Linux Lustre Client State - James Simmons]
 
==== Lustre User Group (LUG) ====
 
[https://www.youtube.com/watch?v=jPTGlazji3A&t=1s LUG 2024: Native Linux client Status - James Simmons]
 
[https://vimeo.com/339571280 LUG 2019: Lustre - A view from the outside - Neil Brown]
 
==== Linux Weekly News (LWN) ====
 
[https://lwn.net/Articles/756565/ Will staging lose its Lustre?]
 
== Mailing List Archives ==
 
This is a collection of mailing list threads of interest - any useful discussion related to upstreaming Lustre.
 
[https://lore.kernel.org/linux-fsdevel/[email protected]/T/#t LSF/MM 2025]
 
[https://lwn.net/ml/linux-fsdevel/20180601091133.GA27521@kroah.com/ Lustre removed from staging]

Latest revision as of 09:48, 21 March 2025

The Lustre upstreaming effort is currently being managed as part of the master Lustre development branch, and submitted patches should follow the normal Lustre patch submission process, which includes fixing issues reported by checkpatch.pl, so that the code follows the upstream kernel style guidelines. Once all issues in the Lustre code that are known to be blocking upstream submission have been addressed, then the filesystem will be resubmitted to the upstream kernel.

Pending Work

Significant work has gone into improving the Lustre codebase since the Lustre client was removed from staging. Below are listed some of the major areas of ongoing work. This list is not comprehensive. The first ticket LU-12511 links to a lot of work that has been completed historically. This table will be updated periodically as new requirements emerge and as work becomes completed.

Task Status Notes Jira Patch(es)
Prepare Lustre for Adoption in the Linux kernel Incomplete This is the main Jira ticket - which links to other subtasks LU-12511 Various
IPv6 Support Mostly Complete Initial support in 2.16, finalized support in 2.17 LU-18417 Various
Enforce Linux kernel coding style Mostly Complete The majority of checkpatch.pl warnings have been addressed LU-6142 Various
Convert to kernel-doc comments Incomplete work underway LU-9633 Various
Unify Lustre kernel modules Incomplete Reduce the total number of Lustre kernel modules LU-17862 55153
Split userspace, compat, and kernel code Incomplete Split the core filesystem from the compatibility code needed to support older kernels LU-18687 Various
Replace libcfs hashing code with rhashtable Incomplete Most of the users on the client have been removed; the majority of the work is server-side LU-8130 Various
Adapt Lustre Infiniband driver to latest APIs Deferred The initial submission of Lustre to Linux will be TCP/IP only LU-8874 Various
Remove ProcFS users Incomplete Most of the users on the client have been removed; the majority of the work is server-side LU-8066 Various
Remove custom interval-tree Complete - LU-11085 Various
Transition completely to folios Incomplete A lot of callbacks have been implemented; still have dependency on mm/folio-compat.c; large folio support is in-flight LU-17916 Various
->writepage could likely be deprecated Incomplete Mostly a factor of ensure Lustre still behaves - context LU-18675 57894

Proposed Transition to an Upstream-first Development Model

Background

Currently, the Lustre kernel modules are maintained as an out-of-tree driver. This driver supports a variety of vendor kernels (primarily on RHEL and Ubuntu). Code is developed first for these vendors kernels. It is later updated to support newer kernel as they are release. The core filesystem code and the compatibility code are intermixed.

For upstreaming to work, the normal development flow has to generate patches to mainline Linux. However, we must still support the older distribution kernels that most people use to run Lustre. To achieve this - we must invert the development model. Code must be developed first for the upstream kernel. Afterwards, this code will be supported on older kernels via a compatibility layer maintained by the Lustre development community. These next sections provide a high-level overview and defines a clear roadmap with tangible milestones on our path to upstream. This transition will occur in stages and will proceed in parallel with normal development - without interrupting normal feature work.

The timelines provided are approximate.

Tenets

There are several important considerations we must account for when undertaking this work (in order of importance):

  • Mainline Linux is the source of truth - Every Lustre release must be derived from a mainline Linux release. Code change to Lustre should target mainline Linux first - and later be backported as needed. We should not block upstream improvements to facilitate backporting.
  • Do not complicate the process of contributing to Lustre - Lustre has an active developer community and a large amount of pre-existing test infrastructure. Our existing processes have worked well. We should maintain the beneficial aspects of our existing workflows while transitioning to an upstream-first model.
  • Integrate with the wider filesystem community - We should strive to share Lustre's improvements and advancements with the wider filesystem community. We should regularly collaborate with others in the community to facilitate kernel-wide improvements.

[I] Separate the kernel code, compatibility code, and userspace code

ETA: June 2025

The Lustre tree should be reorganized to have a clear separation of concerns:

fs/lustre/
net/lnet/
net/lnet/libcfs/
lustre_compat/
tests/
utils/

The functional components of libcfs/ would stay in that directory and the compatibility components would live in lustre_compat/. Centralizing the compatibility code makes it easier to maintain and update and allows us to start removing the compatibility code from the modules themselves. lustre_compat/ will be compiled into libcfs.ko. The functional components of libcfs/ will be compiled into lnet.ko.

The compatibility code will mirror the upstream kernel-tree. After an upstream kernel is released, we will update the compatibility layer as-needed to support that release on older kernels.

[II] Get fs/ and net/ to compile on a mainline kernel

ETA: November 2025

Once the compatibility code is isolated, we must get fs/ and net/ to compile on a mainline kernel - without any configuration or lustre_compat/ layer.

This would enforced by adding build validation to each patch submitted to Gerrit. The kernel version would be pinned in the contrib/lbuild/ scripts and we'd periodically update it and fix any new build failures.

Once this is achieved, we'll have a native mainline Linux client/server that can be run on older distributions via a compatibility layer.

[III] Move fs/ and net/ to a separate kernel tree

ETA: November 2026 (This would immediately precede submission for inclusion)

Transition to maintaining fs/ and net/ as a series on patches on top of a mainline kernel release. At this point, we'll generating patches to mainline Linux while retaining the ability to support older distro kernels via lustre_compat/. Similar to the previous step, we periodically rebase our Lustre patch series - fixing lustre_compat/ as needed.

This is the only step that requires a significant change the Lustre development workflow - patches would have to be split and sent to two different repositories. This step will be delayed until we have some confidence that Lustre has a path to be accepted to mainline.

[IV] Submit the patch series for inclusion

ETA: November 2026

Once we are comfortable with the above process, we can submit the initial patches to add Lustre support to the kernel. Our normal development flow will generate a batch of patches to be submitted during each merge window. After the merge window, we can focus on testing and making sure that our backport to older distro kernels is still functional.



FAQ

Who will actually run the Lustre code in mainline Linux?
Everyone. Releases for older distros will be a combination of the upstream Lustre combined with lustre_compat/ and whatever stuff the kernel won't allow.
What will a Lustre release look like?
We can generate a tarball by combining an upstream Lustre release from mainline along with lustre_compat/ and the userspace stuff. Vendors and third-parties can base their versions of Lustre on those tarballs. Every time a new kernel releases - a new Lustre release tarball will be created. LTS releases can center around the LTS kernel releases.
How will we validate that fs/ and net/ build on mainline?
It would probably be easiest to create a minimalist mainline kernel build in Jenkins. This would allow us to reuse most of the existing lbuild scripting. The build would be non-enforced at first. Testing would remain on distribution kernels, since most people use those.
Does anyone else have a similar model? Does this even work?
AMD GPU seems to have a similar approach, at least. We should talk to other developers working in a model similar to this.



Past Talks and Coverage

This section covers previous talks and coverage about the Lustre upstreaming process.

Lustre Administrators and Developers (LAD)

LAD 2022: Native Linux client Status - James Simmons

LAD 2020: Linux Lustre Client State - James Simmons

Lustre User Group (LUG)

LUG 2024: Native Linux client Status - James Simmons

LUG 2019: Lustre - A view from the outside - Neil Brown

Linux Weekly News (LWN)

Will staging lose its Lustre?

Mailing List Archives

This is a collection of mailing list threads of interest - any useful discussion related to upstreaming Lustre.

LSF/MM 2025

Lustre removed from staging