Page MenuHomeFreeBSD

Add support for zstd to subr_compressor.c.
ClosedPublic

Authored by markj on Dec 26 2017, 3:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 4:44 PM
Unknown Object (File)
Wed, Dec 4, 6:33 PM
Unknown Object (File)
Thu, Nov 28, 3:01 AM
Unknown Object (File)
Wed, Nov 27, 8:23 AM
Unknown Object (File)
Nov 23 2024, 12:05 AM
Unknown Object (File)
Nov 22 2024, 8:44 PM
Unknown Object (File)
Nov 22 2024, 8:44 PM
Unknown Object (File)
Nov 22 2024, 8:44 PM
Subscribers
None

Details

Summary

This is effectively a copy of kern_zstdio.c from D13101. The only
difference is that we always use a static context.

Test Plan

Kernel and user core dumping works. I will integrate the zstd
feature into my kernel dump test suite and verify that it plays
nicely with other kernel dump parameters (mini vs. full, dump
device sector size, etc.)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14186
Build 14352: arc lint + arc unit

Event Timeline

markj added reviewers: allanjude, cem, def.
  • Need to define COMPRESSOR_ZSTD

We're missing savecore support, manual page additions, as well as inclusion in GENERIC, right?

In D13633#289147, @cem wrote:

We're missing savecore support, manual page additions, as well as inclusion in GENERIC, right?

Yes, this is only the kernel code changes from your original patch. Sorry for not specifying that.

Yes, this is only the kernel code changes from your original patch. Sorry for not specifying that.

Ok. I like the approach, but don't think it makes sense to commit without the other pieces in place as well.

In D13633#289164, @cem wrote:

Yes, this is only the kernel code changes from your original patch. Sorry for not specifying that.

Ok. I like the approach, but don't think it makes sense to commit without the other pieces in place as well.

If by "other pieces" you mean D13632, I am going to commit them momentarily. :)

If by "other pieces" you mean D13632, I am going to commit them momentarily. :)

No, I meant the corresponding userspace and documentation changes. Though yes, this patch doesn't make sense without D13632 either :-).

In D13633#289172, @cem wrote:

If by "other pieces" you mean D13632, I am going to commit them momentarily. :)

No, I meant the corresponding userspace and documentation changes. Though yes, this patch doesn't make sense without D13632 either :-).

D'oh, of course. Feel free to commandeer the review and upload the other bits, or update your original review with this diff.

sys/kern/subr_compressor.c
252

This necessitates using ZSTD_C (or otherwise hijacking the includes path) because zstd.h tries to include userland headers.

sys/kern/subr_compressor.c
252

Hmmm. Doing that also hijacks malloc.

sys/kern/subr_compressor.c
252

Ugly: it can be blocked with #define ZSTD_KFREEBSD_H.

sys/kern/subr_compressor.c
252

Yeah. That compiles.

What do you think of adding GZIO and ZSTDIO to GENERIC on AMD64? Other platforms (aarch64)?

sys/kern/subr_compressor.c
252

That would be ok with me, I would just do it as a separate commit. amd64 and arm64 seems like a reasonable starting point. How much bigger does the kernel binary get with those options configured?

As for enabling compressed user or kernel dumps by default, I'm not sure. It's probably the right configuration for a lot of systems. Note that compressing core dumps can consume a ton of CPU time; as a followup to this change we should look at adding a periodic sched_yield() or so somewhere in the write path. IMO this is especially important seeing as there's no way to abort a user core dump. I'd probably ask on -arch for opinions on compressing by default. One compromise might be to add installer support for configuring compressed dumps.

Ping — were you going to carry this forward?

In D13633#295769, @cem wrote:

Ping — were you going to carry this forward?

I assumed you were going to. If not I can pick it up this week.

I assumed you were going to. If not I can pick it up this week.

I'm having difficulty finding time to work on it, so I'd very much appreciate it if you picked it up. Thanks!

Accepting so that I can close this.

This revision is now accepted and ready to land.Feb 14 2018, 7:38 PM