Page MenuHomeFreeBSD

Rework the gzio API.
ClosedPublic

Authored by markj on Dec 26 2017, 3:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 23, 8:02 PM
Unknown Object (File)
Wed, Oct 23, 8:02 PM
Unknown Object (File)
Wed, Oct 23, 8:02 PM
Unknown Object (File)
Wed, Oct 23, 8:01 PM
Unknown Object (File)
Wed, Oct 23, 8:01 PM
Unknown Object (File)
Wed, Oct 23, 7:42 PM
Unknown Object (File)
Oct 5 2024, 6:59 PM
Unknown Object (File)
Oct 5 2024, 3:52 PM
Subscribers

Details

Summary

A long time ago I rewrote kern_gzio.c since it contained some really
questionable code, and I wanted to use it for kernel dumps (it had
existed solely for user process core dumps). It works ok, but now that
we're adding support for zstd dumps, it's become preferable to use a
wrapper API for different compression formats.

This change adds such an API in subr_compressor.c and reworks the user
and kernel core dump code to use it instead. I did it in a way that
minimizes the number of ifdefs needed, and I think kern_shutdown.c is
left neater than it was.

The change is still a bit of a WIP; suggestions for improvements,
especially related to naming, are welcome.

Test Plan

My hacky kernel dump test suite still passes.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14190
Build 14356: arc lint + arc unit

Event Timeline

markj added reviewers: allanjude, cem, def.
cem added inline comments.
sys/kern/kern_sig.c
3258

Seems like this change effectively disables compressed user cores by default.

sys/kern/subr_compressor.c
48–52

Can all of these be const?

56

const?

sys/sys/compressor.h
38

No need for ZSTD in this patch.

This revision is now accepted and ready to land.Jan 6 2018, 1:47 AM
markj marked 3 inline comments as done.Jan 8 2018, 4:56 PM
markj added inline comments.
sys/kern/kern_sig.c
3258

Indeed. It seemed a bit weird to make a kernel option automatically configure a feature by default, and I didn't want to deal with the precedence issue that comes up when we have multiple compression algorithms available. I don't plan to MFC this (at least, not without preserving the current behaviour), so I don't think it's a big deal to change the default behaviour.

  • Sprinkle const
  • Remove unintended reference to zstd
This revision now requires review to proceed.Jan 8 2018, 5:00 PM
  • Add a SPDX identifier to subr_compressor.c

LGTM, modulo disagreement about default-compress disable. Ok to commit — we can discuss later if and how default-compress would be implemented.

sys/kern/kern_sig.c
3258

I think some form of compression, as well as at least one compression algorithm feature, should be on by default. It's fine if disabling all compression features disables compression, but I think we should have relatively sane defaults.

Forcing everyone to add an rc.conf or loader.conf line for compressed cores is just another thing unnecessarily wrong out of the box.

This revision is now accepted and ready to land.Jan 8 2018, 8:00 PM
This revision was automatically updated to reflect the committed changes.