Discussion:
What perf_event_paranoid can do?
陳韋任
2011-03-21 06:14:36 UTC
Permalink
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

--=20
Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Lin Ming
2011-03-21 08:35:11 UTC
Permalink
Post by 陳韋任
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
Post by 陳韋任
Any suggestion appreciated.
Regards,
chenwj
--
Wei-Ren Chen (=B3=AF=AD=B3=A5=F4)
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
Post by 陳韋任
More majordomo info at http://vger.kernel.org/majordomo-info.html
陳韋任
2011-03-21 09:19:52 UTC
Permalink
Thanks, Lin.

--=20
Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
陳韋任
2011-03-21 09:56:43 UTC
Permalink
Hi, Lin
It's used to control if some action is allowed or not for normal user=
=2E
=20
/*
* -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,=20
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

--=20
Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Lin Ming
2011-03-21 13:46:35 UTC
Permalink
Post by 陳韋任
Hi, Lin
It's used to control if some action is allowed or not for normal use=
r.
Post by 陳韋任
/*
* -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)?
In x86_setup_perfctr:

/*
* Branch tracing:
*/
if ((attr->config =3D=3D PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
(hwc->sample_period =3D=3D 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
Post by 陳韋任
Thanks!
Regards,
chenwj
--
Wei-Ren Chen (=B3=AF=AD=B3=A5=F4)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Lin Ming
2011-03-21 13:51:16 UTC
Permalink
Post by Lin Ming
Post by 陳韋任
Hi, Lin
It's used to control if some action is allowed or not for normal us=
er.
Post by Lin Ming
Post by 陳韋任
/*
* -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)?
/*
*/
if ((attr->config =3D=3D PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
(hwc->sample_period =3D=3D 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"
And also "cat /proc/cpuinfo"

Thanks,
Lin Ming
Post by Lin Ming
Lin Ming
Post by 陳韋任
Thanks!
Regards,
chenwj
--
Wei-Ren Chen (=B3=AF=AD=B3=A5=F4)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
陳韋任
2011-03-22 01:10:41 UTC
Permalink
Hi, Lin
Post by Lin Ming
Post by Lin Ming
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
--
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
陳韋任
2011-03-22 01:55:13 UTC
Permalink
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/perfmon2-***@lists.sourceforge.net/msg029=
27.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

--=20
Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Lin Ming
2011-03-22 03:09:52 UTC
Permalink
Post by 陳韋任
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.
2927.html
Post by 陳韋任
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
Post by 陳韋任
Regards,
chenwj
--
Wei-Ren Chen (=B3=AF=AD=B3=A5=F4)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Loading...