Skip to contentSkip to conversation

perf lzma: Quieten lzma warning

PATCH In review Andi Kleen 2 participants 3 messages Oct 4, 2022 – Nov 16, 2022 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf lzma: Quieten lzma warning

On my Fedora system which is missing some modules I always get a long flood of

lzma: fopen failed on /usr/lib/modules/5.3.9-300.fc31.x86_64/kernel/sound/pci/hda/snd-hda-codec.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.16.7-200.fc35.x86_64/kernel/sound/pci/hda/snd-hda-intel.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.1.11-200.fc29.x86_64/kernel/drivers/vhost/vhost_net.ko.xz: 'No such file or directory'

for each use of "perf list".

Disable the message.

Also I'm not sure why it's looking at the modules of each kernel, not just the running one, but that's a different problem.

---
 tools/perf/util/lzma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/lzma.c +1 -4
index 51424cdc3b68..ef0520c82245 100644
@@ -44,11 +44,8 @@ int lzma_decompress_to_file(const char *input, int output_fd)
 	FILE *infile;
 
 	infile = fopen(input, "rb");
-	if (!infile) {
-		pr_err("lzma: fopen failed on %s: '%s'\n",
-		       input, strerror(errno));
+	if (!infile)
 		return -1;
-	}
 
 	ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);
 	if (ret != LZMA_OK) {
Signature · 1 line
2.37.2
#1 lore raw

Em Tue, Oct 04, 2022 at 12:06:15PM -0700, Andi Kleen escreveu:

Quoted 7 lines

On my Fedora system which is missing some modules I always get a long flood of

lzma: fopen failed on /usr/lib/modules/5.3.9-300.fc31.x86_64/kernel/sound/pci/hda/snd-hda-codec.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.16.7-200.fc35.x86_64/kernel/sound/pci/hda/snd-hda-intel.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.1.11-200.fc29.x86_64/kernel/drivers/vhost/vhost_net.ko.xz: 'No such file or directory'

Quoted 6 lines

for each use of "perf list".

Disable the message.

Also I'm not sure why it's looking at the modules of each kernel, not just the running one, but that's a different problem.

Yeah, I see this from time to time, would be interesting to find the root cause for looking at te modules for each kernel :-\

I'll try to take a look if Jiri doesn't have any idea about this.

- Arnaldo

Quoted 24 lines
---
 tools/perf/util/lzma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/lzma.c +1 -4
index 51424cdc3b68..ef0520c82245 100644
@@ -44,11 +44,8 @@ int lzma_decompress_to_file(const char *input, int output_fd)
 	FILE *infile;
 
 	infile = fopen(input, "rb");
-	if (!infile) {
-		pr_err("lzma: fopen failed on %s: '%s'\n",
-		       input, strerror(errno));
+	if (!infile)
 		return -1;
-	}
 
 	ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);
 	if (ret != LZMA_OK) {
Signature · 1 line
2.37.2
Signature · 1 line
- Arnaldo
#2 lore raw
In reply to Andi Kleen

Em Tue, Oct 04, 2022 at 12:06:15PM -0700, Andi Kleen escreveu:

Quoted 7 lines

On my Fedora system which is missing some modules I always get a long flood of

lzma: fopen failed on /usr/lib/modules/5.3.9-300.fc31.x86_64/kernel/sound/pci/hda/snd-hda-codec.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.16.7-200.fc35.x86_64/kernel/sound/pci/hda/snd-hda-intel.ko.xz: 'No such file or directory'
lzma: fopen failed on /usr/lib/modules/5.1.11-200.fc29.x86_64/kernel/drivers/vhost/vhost_net.ko.xz: 'No such file or directory'

Quoted 6 lines

for each use of "perf list".

Disable the message.

Also I'm not sure why it's looking at the modules of each kernel, not just the running one, but that's a different problem.

So using:

[root@five ~]# perf probe -x ~/bin/perf -L lzma_decompress_to_file | head -20 <lzma_decompress_to_file@/var/home/acme/git/perf/tools/perf/util/lzma.c:0>

      0  int lzma_decompress_to_file(const char *input, int output_fd)
         {
      2  	lzma_action action = LZMA_RUN;
         	lzma_stream strm   = LZMA_STREAM_INIT;
      4  	lzma_ret ret;
         	int err = -1;
         
         	u8 buf_in[BUFSIZE];
         	u8 buf_out[BUFSIZE];
         	FILE *infile;
         
         	infile = fopen(input, "rb");
     12  	if (!infile) {
     13  		pr_err("lzma: fopen failed on %s: '%s'\n",
         		       input, strerror(errno));
     15  		return -1;
         	}
         
     18  	ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);

[root@five ~]#

And:

[root@five ~]# perf probe -x ~/bin/perf lzma_decompress_to_file
Added new event:
probe_perf:lzma_decompress_to_file (on lzma_decompress_to_file in /var/home/acme/bin/perf)

You can now use it in all perf tools, such as:

perf record -e probe_perf:lzma_decompress_to_file -aR sleep 1

[root@five ~]#
[root@five ~]# perf record -e probe_perf:lzma_decompress_to_file/max-stack=16/ perf list syscalls:sys_enter_open* [ perf record: Woken up 1 times to write data ]

[ perf record: Captured and wrote 0.119 MB perf.data (625 samples) ]

[root@five ~]#
[root@five ~]#
[root@five ~]# perf report --stdio
# To display the perf.data header info, please use --header/--header-only options. #
#
# Total Lost Samples: 0
#
# Samples: 625 of event 'probe_perf:lzma_decompress_to_file'
# Event count (approx.): 625
#
# Children Self Trace output

# ........  ........  ............
#
   100.00%   100.00%  (5c53b0)
            |
            ---__libc_start_call_main
               main
               run_builtin
               cmd_list
               print_sdt_events
               build_id_cache__list_all
               filename__read_build_id
               lzma_decompress_to_file

#
# (Tip: Limit to show entries above 5% only: perf report --percent-limit 5) #
[root@five ~]#

Seems like it is trying to find SDT events in everything that is in ~/.debug :-\ I'll try to continue this later, sidetracked now.

- Arnaldo

Quoted 24 lines
---
 tools/perf/util/lzma.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/lzma.c +1 -4
index 51424cdc3b68..ef0520c82245 100644
@@ -44,11 +44,8 @@ int lzma_decompress_to_file(const char *input, int output_fd)
 	FILE *infile;
 
 	infile = fopen(input, "rb");
-	if (!infile) {
-		pr_err("lzma: fopen failed on %s: '%s'\n",
-		       input, strerror(errno));
+	if (!infile)
 		return -1;
-	}
 
 	ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);
 	if (ret != LZMA_OK) {
Signature · 1 line
2.37.2
Signature · 1 line
- Arnaldo