diff options
-rw-r--r-- | tools/perf/Documentation/perf-lock.txt | 8 | ||||
-rw-r--r-- | tools/perf/builtin-lock.c | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt index 2d9aecf63042..c17b3e318169 100644 --- a/tools/perf/Documentation/perf-lock.txt +++ b/tools/perf/Documentation/perf-lock.txt @@ -224,8 +224,12 @@ CONTENTION OPTIONS only with -b/--use-bpf. The 'time' is specified in nsec but it can have a unit suffix. Available - units are "ms" and "us". Note that it will busy-wait after it gets the - lock. Please use it at your own risk. + units are "ms", "us" and "ns". Currently it accepts up to 10ms of delays + for safety reasons. + + Note that it will busy-wait after it gets the lock. Delaying locks can + have significant consequences including potential kernel crashes. Please + use it at your own risk. SEE ALSO diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 41f6f3d2b779..3b3ade7a39ca 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -2537,6 +2537,11 @@ static bool add_lock_delay(char *spec) return false; } + if (duration > 10 * 1000 * 1000) { + pr_err("lock delay is too long: %s (> 10ms)\n", spec); + return false; + } + tmp = realloc(delays, (nr_delays + 1) * sizeof(*delays)); if (tmp == NULL) { pr_err("Memory allocation failure\n"); |