Skip to content

Commit

Permalink
sysdump: ignore some files in /sys/kernel/tracing to avoid hang
Browse files Browse the repository at this point in the history
Identified the following files in /sys/kernel/tracing which cause hang:

* /sys/kernel/tracing/trace_pipe
* /sys/kernel/tracing/per_cpu/cpu[0-9]+/trace_pipe
* /sys/kernel/tracing/per_cpu/cpu[0-9]+/trace_pipe_raw
* /sys/kernel/tracing/per_cpu/cpu[0-9]+/snapshot_raw

Instead of ignoring the files explicitly like this:

  if ($file =~ "/sys/kernel/tracing/per_cpu/cpu[0-9]+/trace_pipe*") {
  if ($file =~ "/sys/kernel/tracing/trace_pipe") {

and to make sysdump more robust for future blocking files,
it seemed more obvious to ignore all files which contain '*_pipe*'.

Also moved print $file to the beginning of the block
to make it easier to debug, in case other files cause blocking.

Closes: grml#3
  • Loading branch information
jkirk committed Feb 12, 2021
1 parent aba8e13 commit 852bc3b
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions sysdump
Expand Up @@ -62,17 +62,30 @@ sub dump_value($$)
my $level = shift;
my $file = shift;

if (!open (FILE, "<$file")) {
print STDERR "can't open $file: '$!'\n";
return 0;
}

print $file;

if ($file =~ "/sys/kernel/debug/.*") {
print("ignoring file $file\n");
print(": ignoring file\n");
return 0;
}
if ($file =~ "/sys/kernel/security/apparmor/revision") {
print("ignoring file $file\n");

if ($file =~ ".*_pipe.*") {
print(": ignoring file\n");
return 0;
}

if (!open (FILE, "<$file")) {
print STDERR "can't open $file: '$!'\n";
if ($file =~ "/sys/kernel/tracing/per_cpu/cpu[0-9]+/snapshot_raw") {
print(": ignoring file\n");
return 0;
}

if ($file =~ "/sys/kernel/security/apparmor/revision") {
print(": ignoring file\n");
return 0;
}

Expand All @@ -85,7 +98,7 @@ sub dump_value($$)
close FILE;

#print " "x$level;
print $file, " = '", $value, "'\n";
print " = '", $value, "'\n";
}

sub dump_entry($$)
Expand Down

0 comments on commit 852bc3b

Please sign in to comment.