DLPX-88183 Generate BTF data for ZFS kernel module during git-zfs-make #740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
Our Linux kernels have BTF data that allow us to use BTF info to resolve types and use
kfunc
(similar tofbt
from DTrace) types of probes for all symbols+data fromvmlinux
and other modules from the kernel repo. Unfortunately this is not the case for our ZFS module which is an external out-of-tree module.This is one of the two patches that I've created for enabling the generation of BTF data. In this patch I make sure to create a symlink for our Delphix VMs so whenever we compile ZFS on them (generally through
zfs-make
) we also generate BTF info for it which is later installed withzfs-load
.This means that once this patch gets merged and someone compiles ZFS on a brand-new VM the new module will have BTF info (see Future Steps for having BTF info at first boot).
Testing
ab-pre-push: http://selfservice.jenkins.delphix.com/job/appliance-build-orchestrator-pre-push/7171/
(and with the help of Prakash: http://selfservice.jenkins.delphix.com/job/delphix-build-and-snapshots/job/ami-snapshots/5115/flowGraphTable/)
Stock VM:
Using an internal-dev VM cloned from the group created by the above ab-pre-push link, I verified that the symlink was created:
Then I ran
zfs-make
withdevelop
on that VM and ensured that the BTF info was generated during compilation:I ensured that the BTF info was installed after
zfs-load
and were placed in the appropriate runtime directory under/sys
:Then I verified that we can now use
kfunc
functions and their arguments:Future Steps
I'll soon be opening another patch in
linux-pkg
that will make sure that our first compilation of ZFS (in the bootstrap VM through linux-pkg - e.g. not the Delphix VM) generated a module with BTF info. That patch will help us having BTF info for ZFS in customer VMs too.Alternative designs
The ideal design for this whole process would be to somehow install that symlink when we install the the
linux-headers-*
package. Unfortunately thevmlinux
file that we need that has the debug info is part of the mainlinux-image-*-dbgsym
package which basically installs the whole kernel (not just the headers) which is harder to do in our bootstrap VM which can compile multiple versions and flavors of the linux kernel in a single run. It would also create an awkward dependency between the two packages. For these two reasons I decided to go with the above two patch approach for the appliance-build and linux-pkg.