9795 Commits

Author SHA1 Message Date
Nick Terrell
728e73ebb4 [legacy] Remove FORCE_MEMORY_ACCESS and only use memcpy
Delete unaligned memory access code from the legacy codebase by removing all the
non-memcpy functions. We don't care about speed at all for this codebase, only
simplicity.
2022-12-14 17:54:35 -08:00
Nick Terrell
f31b83ff34 [decompress] Fix nullptr addition & improve fuzzer
Fix an instance of `NULL + 0` in `ZSTD_decompressStream()`. Also, improve our
`stream_decompress` fuzzer to pass `NULL` in/out buffers to
`ZSTD_decompressStream()`, and fix 2 issues that were immediately surfaced.

Fixes #3351
2022-12-14 17:54:22 -08:00
Nick Terrell
15f32ad74c [fileio] Separate parameter adaption from display update rate
Split the logic for parameter adaption from the logic to update the display rate.
This decouples the two updates, so changes to display updates don't affect
parameter adaption.

Also add a test case that checks that parameter adaption actually happens.

This fixes Issue #3353, where --adapt is broken when --no-progress is passed.
2022-12-14 17:08:21 -08:00
Alex Xu (Hello71)
a78c91ae59 Use proper unaligned access attributes
Instead of using packed attribute hack, just use aligned attribute. It
improves code generation on armv6 and armv7, and slightly improves code
generation on aarch64. GCC generates identical code to regular aligned
access on ARMv6 for all versions between 4.5 and trunk, except GCC 5
which is buggy and generates the same (bad) code as packed access:
https://gcc.godbolt.org/z/hq37rz7sb
2022-12-14 16:00:37 -08:00
Nick Terrell
fbff7827fa Refactor progress bar & summary line logic
* Centralize the logic about whether to print the progress bar or not in
  the `*_PROGRESS()` macros.
* Centralize the logc about whether to print the summary line or not in
  `FIO_shouldDisplayFileSummary()` and
  `FIO_shouldDisplayMultipleFileSummary()`.
* Make `--progress` work for non-zstd (de)compressors.
* Clean up several edge cases in compression and decompression progress
  printing along the way. E.g. wrong log level, or missing summary line.

One thing I don't like about stdout mode, which sets the display level
to 1, is that warnings aren't displayed. After this PR, we could change
stdout mode from lowering the display level, to defaulting to implied
`--no-progress`. But, I think that deserves a separate PR.
2022-12-14 15:44:09 -08:00
Nick Terrell
e58a39f84e Allow tests to fake stdin/stdout/stderr is a console
We've been unable to effectively test cases where stdin/stdout/stderr
are consoles, because in our test cases they generally aren't. Allow the
command line flags `--fake-std{in,out,err}-is-console` to tell the CLI
to pretend that std{in,out,err} is a console.
2022-12-14 15:44:09 -08:00
Rosen Penev
031de3c69c meson: make backtrace dependency on execinfo
musl libc for example has no such header.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-12-14 15:39:51 -08:00
daniellerozenblit
72845ebad2
Merge pull request #3346 from daniellerozenblit/seekable-format-empty-string
Seekable format empty string
2022-12-14 14:28:32 -05:00
Elliot Gorokhovsky
588073c920
Merge pull request #3349 from embg/frame_header_fields
Reserve two fields in ZSTD_frameHeader
2022-12-14 10:58:35 -05:00
Elliot Gorokhovsky
c43da3d605 Fix C90 compat 2022-12-13 18:01:32 -08:00
Elliot Gorokhovsky
e1e82f74f1 Reserve two fields in ZSTD_frameHeader 2022-12-13 17:45:05 -08:00
Nick Terrell
e767d5c7c1 [contrib][linux-kernel] Fix stack detection for newer gcc
Newer gcc versions were getting smart and omitting the `memset()`.
Get around this issue by outlining the `memset()` into a different
function. This test is still hacky, but it works...
2022-12-13 15:56:53 -08:00
daniellerozenblit
b0bcbbfe16
Merge pull request #3345 from daniellerozenblit/fix-1GiB-file-bug
Fix Window Resizing Edge Case
2022-12-13 17:56:38 -05:00
Yann Collet
0c88a7b969
Merge pull request #3347 from facebook/fix_m68k_ci
Fix m68k CI tests on Github Actions
2022-12-13 14:05:37 -08:00
Danielle Rozenblit
9b9ad5af3f use .ignore for stderr output in window-resize test case 2022-12-13 13:52:54 -08:00
Danielle Rozenblit
32bb667138 added test to cli-tests 2022-12-13 12:45:41 -08:00
Yann Collet
d081d98ae7 Fix m68k CI tests on Github Actions
seems there is a bug in the qemu version shipped with Ubuntu 22.04
2022-12-13 12:36:53 -08:00
Danielle Rozenblit
69ec75f0d5 fix window resizing edge case 2022-12-13 08:35:20 -08:00
Danielle Rozenblit
aece0f258a free memory in test case 2022-12-13 08:15:16 -08:00
daniellerozenblit
6ad71a3f0b
Merge pull request #10 from yhoogstrate/seekable_header_skip
seekable_format no header when compressing empty string to stream
2022-12-12 17:58:58 -05:00
FRex
dc39409a03 Print checksum value for single frame files in cli with -v -l options 2022-12-12 10:53:57 -08:00
Yann Collet
c91a84221b
Merge pull request #3337 from facebook/dependabot/github_actions/microsoft/setup-msbuild-1.1.3
Bump microsoft/setup-msbuild from 1.0.2 to 1.1.3
2022-12-11 23:59:25 -08:00
Yann Collet
2b212fd924
Merge pull request #3339 from facebook/dependabot/github_actions/skx/github-action-publish-binaries-release-2.0
Bump skx/github-action-publish-binaries from release-1.3 to 2.0
2022-12-11 23:59:07 -08:00
dependabot[bot]
88647489d4
Bump skx/github-action-publish-binaries from release-1.3 to 2.0
Bumps [skx/github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) from release-1.3 to 2.0. This release includes the previously tagged commit.
- [Release notes](https://github.com/skx/github-action-publish-binaries/releases)
- [Commits](https://github.com/skx/github-action-publish-binaries/compare/release-1.3...release-2.0)

---
updated-dependencies:
- dependency-name: skx/github-action-publish-binaries
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 18:39:55 +00:00
dependabot[bot]
91c7547fb5
Bump microsoft/setup-msbuild from 1.0.2 to 1.1.3
Bumps [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) from 1.0.2 to 1.1.3.
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Changelog](https://github.com/microsoft/setup-msbuild/blob/master/building-release.md)
- [Commits](https://github.com/microsoft/setup-msbuild/compare/v1.0.2...v1.1.3)

---
updated-dependencies:
- dependency-name: microsoft/setup-msbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 18:39:49 +00:00
Yann Collet
585deb807b
Merge pull request #3284 from DimitriPapadopoulos/actions
Automatically update GitHub Actions in the future
2022-12-08 10:39:21 -08:00
Yann Collet
80cf73fd66
Merge pull request #3320 from cwoffenden/msvc-arm64-size_t
Fix for MSVC C4267 warning on ARM64 (which becomes error C2220 with /WX)
2022-12-04 18:55:30 -08:00
Elliot Gorokhovsky
a89e6b6812
Merge pull request #3331 from embg/issue3330
Fix gcc-7 and gcc-8 CI breakages
2022-12-02 18:34:37 -05:00
Elliot Gorokhovsky
3f0b912a80 Fix gcc-7 and gcc-8 CI breakages 2022-12-02 16:35:17 -05:00
Yann Collet
e873335ffe
Merge pull request #3327 from eli-schwartz/meson-version-simplify
meson: get version up front
2022-12-01 06:46:23 -08:00
Eli Schwartz
6c3ed93c27
meson: get version up front
Run the scraper command to establish the project version immediately,
rather than wait for the build to be configured. This simplifies the
code and ensures that project introspection works correctly.
2022-11-30 21:36:24 -05:00
Yann Collet
4d82a4d3f2 minor : reorder --help
more logical context grouping
2022-11-22 07:23:45 -08:00
Yann Collet
ecd7601c36 minor: proper pledgedSrcSize trace 2022-11-22 06:00:45 -08:00
Elliot Gorokhovsky
2a356737d8
Merge pull request #3321 from embg/ldmCparamFix
Complete migration of ZSTD_c_enableLongDistanceMatching to ZSTD_paramSwitch_e framework
2022-11-21 17:37:59 -05:00
Elliot Gorokhovsky
bb3c01c853 Migrate other test usages of boolean LDM flag to paramSwitch enum 2022-11-21 16:20:38 -05:00
Elliot Gorokhovsky
3720910d06 Fix fuzzer failure 2022-11-21 16:09:04 -05:00
Elliot Gorokhovsky
c8d870fe52 Improve LDM cparam validation logic 2022-11-21 15:39:18 -05:00
Carl Woffenden
0547c3d3f8 Random edit to re-run the CI
I don't believe the (x64) Mac failure is related to error since it would take the SSE path.
2022-11-19 19:04:08 +01:00
Carl Woffenden
0168914490 Fix for MSVC C4267 error 2022-11-18 11:31:17 +01:00
Elliot Gorokhovsky
b1182fe242
Merge pull request #3300 from yiyuaner/dev
Fix the wrong check for buffer overrun in UTIL_mergeFileNamesTable
2022-11-02 15:28:02 -04:00
Felix Handte
bd4581c311
Merge pull request #3309 from joycebrum/dev
Fix action error by upgrading Scorecard GHA to 2.0.6
2022-11-01 17:53:37 -04:00
Joyce Brum
a8f8dc8c5c
fix: upgrade scorecard action to 2.0.6
Signed-off-by: Joyce Brum <joycebrum@google.com>
2022-11-01 14:55:31 -03:00
Elliot Gorokhovsky
bb23f7b99b
Merge pull request #3304 from GermanAizek/dev
Rewrite check *bufStart condition
2022-11-01 12:45:42 -04:00
appleman4321
5334339421 Rewrite checking condition bufStart pointer NULL 2022-11-01 02:31:09 +03:00
yiyuaner
361d86998a Fix the wrong check for buffer overrun in UTIL_mergeFileNamesTable 2022-10-24 20:37:15 +08:00
Nick Terrell
43de2aa17d [contrib][linux] Disable ASM in the kernel
Disable ASM in the kernel for now. It requires a few changes & setup to
get working. Instead of doing it in a zstd version update, I'd prefer to
package that change as a single patch, and propose it separately from
the version update. This makes the version update easier, and reduces
some risk.
2022-10-21 17:14:31 -07:00
Nick Terrell
330558ad52 [contrib][linux] Add zstd_common module
The zstd_common module was added upstream in commit
637a642f5c.

But the kernel specific code was inlined into the library. This commit
switches it to use the out of line method that we use for the other
modules.
2022-10-21 17:14:31 -07:00
Nick Terrell
dcc7228de9
[lazy] Use switch instead of indirect function calls. (#3295)
Use a switch statement to select the search function instead of an
indirect function call. This results in a sizable performance win.

This PR is a modification of the approach taken in PR #2828.
When I measured performance for that commit, it was neutral.
However, I now see a performance regression on gcc, but still
neutral on clang. I'm measuring on the same platform, but with
newer compilers. The new approach beats both the current dev
branch and the baseline before PR #2828 was merged.

This PR is necessary for Issue #3275, to update zstd in the kernel.
Without this PR there is a large regression in greedy - btlazy2
compression speed. With this PR it is about neutral.

gcc version: 12.2.0
clang version: 14.0.6
dataset: silesia.tar

| Compiler | Level | Dev Speed (MB/s) | PR Speed (MB/s) | Delta  |
|----------|-------|------------------|-----------------|--------|
| gcc      |     5 |            102.6 |           113.7 | +10.8% |
| gcc      |     7 |             66.6 |            74.8 | +12.3% |
| gcc      |     9 |             51.5 |            58.9 | +14.3% |
| gcc      |    13 |             14.3 |            14.3 |  +0.0% |
| clang    |     5 |            108.1 |           114.8 |  +6.2% |
| clang    |     7 |             68.5 |            72.3 |  +5.5% |
| clang    |     9 |             53.2 |            56.2 |  +5.6% |
| clang    |    13 |             14.3 |            14.7 |  +2.8% |

The binary size stays just about the same for clang and gcc, measured
using the `size` command:

| Compiler | Branch | Text    | Data | BSS | Total   |
|----------|--------|---------|------|-----|---------|
| gcc      | dev    | 1127950 | 3312 | 280 | 1131542 |
| gcc      | PR     | 1123422 | 2512 | 280 | 1126214 |
| clang    | dev    | 1046254 | 3256 | 216 | 1049726 |
| clang    | PR     | 1048198 | 2296 | 216 | 1050710 |
2022-10-21 17:14:02 -07:00
Miguel Ojeda
5c1cdba7dd
[contrib][linux-kernel] Generate SPDX license identifiers (#3294)
Add a `--spdx` option to the freestanding script to prefix
files with a line like (for `.c` files):

    // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

or (for `.h` and `.S` files):

    /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */

Given the style of the line to be used depends on the extension,
a simple `sed` insert command would not work.

It also skips the file if an existing SPDX line is there,
as well as raising an error if an unexpected SPDX line appears
anywhere else in the file, as well as for unexpected
file extensions.

I double-checked that all currently generated files appear
to be license as expected with:

    grep -LRF 'This source code is licensed under both the BSD-style license (found in the'  linux/lib/zstd
    grep -LRF 'LICENSE file in the root directory of this source tree) and the GPLv2 (found' linux/lib/zstd

but somebody knowledgable on the licensing of the project should
double-check this is the intended case.

Fixes: https://github.com/facebook/zstd/issues/3293
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-10-18 16:35:44 -07:00
Felix Handte
99d239de32
Merge pull request #3290 from felixhandte/ddict-dict-id-from-ddict
Make ZSTD_getDictID_fromDDict() Read DictID from DDict
2022-10-18 13:33:32 -04:00