mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Shapovalov <intelfx@intelfx.name>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Arnaldo Carvalho de Melo <acme@kernel.org>,
	 Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	 Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	 Adrian Hunter <adrian.hunter@intel.com>,
	 James Clark <james.clark@linaro.org>,
	Nick Terrell <terrelln@fb.com>,  David Sterba <dsterba@suse.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Ivan Shapovalov <intelfx@intelfx.name>
Subject: [PATCH 4/4] perf: support zstd-compressed kernel modules
Date: Wed, 14 Oct 2026 20:34:10 +0300	[thread overview]
Message-ID: <20261014-perf-zstd-v1-4-9652727886fa@intelfx.name> (raw)
In-Reply-To: <20261014-perf-zstd-v1-0-9652727886fa@intelfx.name>

Support handling loading zstd-compressed DSOs in perf (in addition to
existing support for gzip/xz formats). This allows loading of e.g.
zstd-compressed kernel modules, as shipped by various distros
including Arch.

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
---
 tools/perf/Makefile.config | 2 +-
 tools/perf/util/dso.c      | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 4d5993da9f945..dfdda22becc39 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -982,7 +982,7 @@ ifndef NO_LIBZSTD
     EXTLIBS += -lzstd
     $(call detected,CONFIG_ZSTD)
   else
-    $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR)
+    $(warning No libzstd found, disables zstd kernel module decompression and trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR)
     NO_LIBZSTD := 1
   endif
 endif
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 42bfe30a3b518..0e8886172e239 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -277,6 +277,9 @@ static const struct {
 #endif
 #ifdef HAVE_LZMA_SUPPORT
 	{ "xz", lzma_decompress_to_file, lzma_is_compressed },
+#endif
+#ifdef HAVE_ZSTD_SUPPORT
+	{ "zst", zstd_decompress_to_fd, zstd_is_compressed },
 #endif
 	{ NULL, NULL, NULL },
 };
@@ -460,7 +463,7 @@ int __kmod_path__parse(struct kmod_path *m, const char *path,
 
 	m->comp = is_supported_compression(ext + 1);
 	if (m->comp > COMP_ID__NONE)
-		ext -= 3;
+		ext -= strlen(compressions[m->comp].fmt);
 
 	/* Check .ko extension only if there's enough name left. */
 	if (ext > name)

-- 
2.55.0.8.g37e2a0019f


  parent reply	other threads:[~2026-10-14 17:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 17:34 [PATCH 0/4] " Ivan Shapovalov
2026-10-14 17:34 ` [PATCH 1/4] perf: zstd: zstd_decompress_stream -> zstd_decompress_buffer Ivan Shapovalov
2026-10-14 17:34 ` [PATCH 2/4] perf: zstd: factor out zstd_init_{c,d}stream() Ivan Shapovalov
2026-10-14 17:34 ` [PATCH 3/4] perf: zstd: add streaming decompression and format probe functions Ivan Shapovalov
2026-10-14 17:34 ` Ivan Shapovalov [this message]
2026-10-27  2:58   ` [PATCH 4/4] perf: support zstd-compressed kernel modules kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261014-perf-zstd-v1-4-9652727886fa@intelfx.name \
    --to=intelfx@intelfx.name \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dsterba@suse.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®