Recent Linux kernels have bugs with the perf_event subsystem which can be triggered by PAPI. These bugs can lead to kernel panics and system crashes. The bugs have been fixed upstream but the fixes are only gradually getting into vendor kernels. If your code causes a crash, you should upgrade to a kernel with the fixes applied.

Bug 1 involves "inherit" support. perf_event inherit support was only added to PAPI as of the recent 4.1.3 release. This bug causes a memory leak in the kernel that will eventually out-of-memory your machine with unfreeable memory. It is triggered by using the perf_event substrate to measure at least two events with the "inherit" option set, then running a multithreaded workload.

The fix for this will be in the forthcoming 2.6.39 Linux kernel, and the patch has been included in the relevant stable series trees (2.6.38.2, etc.). The changeset for the fix is: 38b435b16c36b0d863efcf3f07b34a6fac9873fd

Bug 2 involves multiplexing support (PAPI will only use kernel multiplexing on kernels 2.6.33 and newer). If you use multiplexing on multithreaded workloads you can eventually see a kernel panic.

The fix for this will be in the forthcoming 2.6.39 Linux kernel, and the patch has been included in the relevant stable trees (2.6.38.4, etc.). The changeset for the fix is:ab711fe08297de1485fff0a366e6db8828cafd6a