Skip to contentSkip to conversation

What perf_event_paranoid can do?

DISCUSSION 陳韋任 2 participants 9 messages Mar 21, 2011 – Mar 22, 2011

lore
Share & tools
lore

陳韋任

author
#0 lore raw

Hi, folks

I don't know what "perf_event_paranoid" is for. Sometimes
perf told me tweaking perf_event_paranoid. For example,

$ perf stat -e branches:pp ls
No permission to collect stats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid.

I cannot find any document talks about what perf_event_paranoid
is and what we can do on it.

Any suggestion appreciated.

Regards,
chenwj

Signature · 4 lines
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
#1 lore raw
Quoted 11 lines · 陳韋任

Hi, folks

I don't know what "perf_event_paranoid" is for. Sometimes
perf told me tweaking perf_event_paranoid. For example,

$ perf stat -e branches:pp ls
No permission to collect stats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid.

I cannot find any document talks about what perf_event_paranoid
is and what we can do on it.

It's used to control if some action is allowed or not for normal user. See comments at kernel/perf_event.c:

/*
* perf event paranoia level:
* -1 - not paranoid at all

 *   0 - disallow raw tracepoint access for unpriv
 *   1 - disallow cpu events for unpriv
 *   2 - disallow kernel profiling for unpriv

*/

Lin Ming

Quoted 16 lines

Any suggestion appreciated.

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw

Thanks, Lin.

Signature · 4 lines
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
author
#3 lore raw
In reply to Lin Ming

Hi, Lin

Quoted 10 lines

It's used to control if some action is allowed or not for normal user. See comments at kernel/perf_event.c:

/*
* perf event paranoia level:
* -1 - not paranoid at all

 *   0 - disallow raw tracepoint access for unpriv
 *   1 - disallow cpu events for unpriv
 *   2 - disallow kernel profiling for unpriv

*/

I assume -1 give normal user the most high level privilege,
but it doesn't work. I have tried -1 through 2, but none of them works. Any suggestion? Or maybe the event "branches" does not support PBES modifier (pp)?

Thanks!

Regards,
chenwj

Signature · 4 lines
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
#4 lore raw

2011/3/21 陳韋任 <[email protected]>:

Quoted 13 lines

Hi, Lin

Quoted 10 lines

It's used to control if some action is allowed or not for normal user. See comments at kernel/perf_event.c:

/*
* perf event paranoia level:
* -1 - not paranoid at all

 *   0 - disallow raw tracepoint access for unpriv
 *   1 - disallow cpu events for unpriv
 *   2 - disallow kernel profiling for unpriv

*/

Quoted 4 lines

I assume -1 give normal user the most high level privilege,
but it doesn't work. I have tried -1 through 2, but none of them works. Any suggestion? Or maybe the event "branches" does not support PBES modifier (pp)?

In x86_setup_perfctr:

        /*
         * Branch tracing:
         */
        if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
            (hwc->sample_period == 1)) {
                /* BTS is not supported by this architecture. */
                if (!x86_pmu.bts_active)
                        return -EOPNOTSUPP;

                /* BTS is currently only allowed for user-mode. */
                if (!attr->exclude_kernel)
                        return -EOPNOTSUPP;
        }

Does your CPU support PEBS? Please attach below output.

dmesg |grep "Performance Events"

Lin Ming

Quoted 12 lines

Thanks!

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667

#5 lore raw

2011/3/21 Lin Ming <[email protected]>:

Quoted 35 lines

2011/3/21 陳韋任 <[email protected]>:

Quoted 13 lines

Hi, Lin

Quoted 10 lines

It's used to control if some action is allowed or not for normal user. See comments at kernel/perf_event.c:

/*
* perf event paranoia level:
* -1 - not paranoid at all

 *   0 - disallow raw tracepoint access for unpriv
 *   1 - disallow cpu events for unpriv
 *   2 - disallow kernel profiling for unpriv

*/

Quoted 4 lines

I assume -1 give normal user the most high level privilege,
but it doesn't work. I have tried -1 through 2, but none of them works. Any suggestion? Or maybe the event "branches" does not support PBES modifier (pp)?

In x86_setup_perfctr:

       /*
        * Branch tracing:
        */
       if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
           (hwc->sample_period == 1)) {
               /* BTS is not supported by this architecture. */
               if (!x86_pmu.bts_active)
                       return -EOPNOTSUPP;

               /* BTS is currently only allowed for user-mode. */
               if (!attr->exclude_kernel)
                       return -EOPNOTSUPP;
       }
Quoted 3 lines

Does your CPU support PEBS? Please attach below output.

dmesg |grep "Performance Events"

And also "cat /proc/cpuinfo"

Thanks,
Lin Ming

Quoted 16 lines

Lin Ming

Quoted 12 lines

Thanks!

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667

author
#6 lore raw

Hi, Lin

Quoted 5 lines
Quoted 3 lines

Does your CPU support PEBS? Please attach below output.

dmesg |grep "Performance Events"

And also "cat /proc/cpuinfo"

The attachment are output of dmesg and cpuinfo. Thanks.

Regards,
chenwj

Signature · 4 lines
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

Performance Events: PEBS fmt0+, Core2 events, Intel PMU driver.

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4657.13
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.99
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.99
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 1
cpu cores : 4
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.00
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.96
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 2
cpu cores : 4
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.99
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4509.06
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
stepping : 6
cpu MHz : 2327.585
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips : 4656.99
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:

author
#7 lore raw

Hi, Lin

As the discussion on the mailing list (see below) said,
He suspected the older perf may over-interpret the error code, thus gave me poor error message.

http://www.mail-archive.com/[email protected]/msg02927.html

Is it possible to build a newer perf by a "normal" user
himself? Or the newer perf needs a kernel update to work correctly?

Regards,
chenwj

Signature · 4 lines
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
#8 lore raw
Quoted 11 lines · 陳韋任

Hi, Lin

As the discussion on the mailing list (see below) said,
He suspected the older perf may over-interpret the error code, thus gave me poor error message.

http://www.mail-archive.com/[email protected]/msg02927.html

Is it possible to build a newer perf by a "normal" user
himself? Or the newer perf needs a kernel update to work correctly?

Yes, you can build perf tool by a non-root normal user.

$ cd linux-2.6/tools/perf
$ make
$ ./perf stat -e branches:pp ls

The code changes frequently, you'd better also build a new kernel, for example 2.6.38.
So I can analyze where from problem is with the same kernel version.

Lin Ming

Quoted 10 lines

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667