From 1552eeca128b9be7c544ee1ad4a9385dd68ead31 Mon Sep 17 00:00:00 2001 From: Aleix Roca Nonell Date: Fri, 9 Jun 2023 10:58:11 +0200 Subject: [PATCH] xeon08: Add perf --- xeon08/kernel/kernel.nix | 1 + xeon08/kernel/perf.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 xeon08/kernel/perf.nix diff --git a/xeon08/kernel/kernel.nix b/xeon08/kernel/kernel.nix index ae3b91d..45ecce6 100644 --- a/xeon08/kernel/kernel.nix +++ b/xeon08/kernel/kernel.nix @@ -48,6 +48,7 @@ let in { imports = [ ./lttng.nix + ./perf.nix ]; boot.kernelPackages = lib.mkForce kernel; } diff --git a/xeon08/kernel/perf.nix b/xeon08/kernel/perf.nix new file mode 100644 index 0000000..51340df --- /dev/null +++ b/xeon08/kernel/perf.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: + +{ + # add the perf tool + environment.systemPackages = with pkgs; [ + config.boot.kernelPackages.perf + ]; + + # allow non-root users to read tracing data from the kernel + boot.kernel.sysctl."kernel.perf_event_paranoid" = -2; + boot.kernel.sysctl."kernel.kptr_restrict" = 0; + + # specify additionl options to the tracefs directory to allow members of the + # tracing group to access tracefs. + fileSystems."/sys/kernel/tracing" = { + options = [ + "mode=755" + "gid=tracing" + ]; + }; +} +