Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Punt zfs_dbgmsg into zcommon #13206

Closed
wants to merge 2 commits into from

Conversation

rincebrain
Copy link
Contributor

@rincebrain rincebrain commented Mar 12, 2022

(WIP because I just want to see if the CI screams anywhere about this...)

e: Oh, I didn't mark it as draft on creation. Oops.

Motivation and Context

It's much more useful to be able to call zfs_dbgmsg from anything
that depends on zcommon - zzstd, icp...

(Using it from icp means that people can't link libicp on its own, which is unfortunate, but since the only consumer in our tree that did that is the checksum tests in the test suite, I think it's an acceptable tradeoff...if anybody really minds this, I imagine you could implement weak symbols for the dbgmsg family in libicp that stub it out and get overridden if you have libzpool instead.)

(I tried punting it into SPL, but that would involve reimplementing a whole bunch in userland because you no longer get libzpool/kernel.c if you're in libspl...oh well, if someone really wants to call it from SPL, they can do it.)

Description

git mv module/os/linux/{zfs,zcommon}/zfs_debug.c and then cleanup of fallout.

(FreeBSD never had a problem with this, since it shoves everything into one module anyway...)

How Has This Been Tested?

This branch? It built.

The branch I pulled these changes out of, I've been running tests on and using this for a couple weeks.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

It's much more useful to be able to call zfs_dbgmsg from anything
that depends on zcommon.

Signed-off-by: Rich Ercolani <[email protected]>
This will blow up if anyone tries calling zfs_dbgmsg from the relevant
codepaths, since it assumes you're always going to have libzpool bits
available.

Signed-off-by: Rich Ercolani <[email protected]>
@nabijaczleweli
Copy link
Contributor

nabijaczleweli commented Mar 13, 2022

Now that you mention it – is there a Good Reason we couldn't just shove everything into zfs.ko for Linux, too, nowadays?

@rincebrain
Copy link
Contributor Author

Other than if Linux has an upper limit on single module size (I'm not aware of one) or the fact that the LICENSE field on the module would become "It's Complicated...", I'm not aware of any reason we couldn't.

@adamdmoss
Copy link
Contributor

It's much more useful to be able to call zfs_dbgmsg from anything
that depends on zcommon - zzstd, icp...

Yes please! I spent too long trying to figure out why this doesn't work from zzstd and ended up doing my own stupid printk() wrapper 😬

@behlendorf
Copy link
Contributor

Pulling everything we can together in to a single zfs.ko would be nice. Merging the icp, znvpair, zavl, zcommon, zunicode, and zfs modules would be straight forward. Keeping zzstd, zlua, and spl modules split off might still be desirable sole to keep the license information clear.

@rincebrain
Copy link
Contributor Author

Wouldn't merging zfs.ko into zcommon leave a cyclic dependency between zzstd and zfs?

The rest could probably get flattened, but I think you're stuck with at least some parts of zfs.ko being separate from zcommon unless you want to flatten the whole enchilada.

@behlendorf
Copy link
Contributor

Good point, I was only really commenting on it from the stand point that the licenses are identical. Seems like we'd have to pull in zzstd and zlua as well. This would be fine, and it's already what we do on the FreeBSD side.

@rincebrain rincebrain marked this pull request as ready for review March 19, 2022 10:23
@rincebrain rincebrain mentioned this pull request Mar 24, 2022
13 tasks
@nabijaczleweli
Copy link
Contributor

So, I've spent the last 4 hours making a unified 94-megabyte zfs.ko (well, okay, 4M stripped), and it'd be perfect if:

  • all of CPU hotplugging weren't GPL-only
  • dequeue_signal() weren't GPL-only
  • __alloc_percpu()/free_percpu() weren't GPL-only
  • schedule_hrtimeout_range() weren't GPL-only

As it stands, these are all laundered via the SPL, so if you don't want to lie, it's impossible to merge it into the image. And at that point there's no point.

@rincebrain
Copy link
Contributor Author

Oh no, I'm somehow not surprised that A) it's infeasible because of GPL-only laundering symbols (though I thought the Linux kernel started enforcing some sins-of-the-father dependency tracking on those to stop that) and B) you got to doing the experiment before me.

That said, I don't think I agree that it has no value to flatten some but not all of the modules together when there's no external consumers of them or inherent value in keeping them apart.

@behlendorf
Copy link
Contributor

That said, I don't think I agree that it has no value to flatten some but not all of the modules together when there's no external consumers of them or inherent value in keeping them apart.

This is my feeling as well. Early on I thought there might be some value in keeping the modules split up but in practice that never panned out. We do have one external consumer, Lustre, however it mostly used the zfs.ko symbols so I doubt merging the kmods would cause it any serious problems.

We've also gone out of our way to avoid using GPL symbols in the SPL module, even though it is GPL licensed. So I don't think it's fair to characterize its usage as laundering. It's purpose was never to make that possible, but to simply implement the Solaris interfaces we needed.

@behlendorf
Copy link
Contributor

behlendorf commented Apr 15, 2022

Closing. The plan is this will be addressed by #13224 #13274 .

@behlendorf behlendorf closed this Apr 15, 2022
@rincebrain
Copy link
Contributor Author

Did you mean #13274?

I mentioned my rationale for wanting to still see this land separately, but that's fine, I'll just keep cherrypicking it into my 2.0 and 2.1 branches.

@behlendorf
Copy link
Contributor

I do, thanks for catching that.

Right, I can see the appeal. My feeling is cherrypicking this as needed is probably for the best, this strikes me as too significant a change to backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants