Re: tools/perf: "perf record" restricted to root in latest kernel?

From: Miles Bader
Date: Wed Jan 06 2010 - 21:50:17 EST


Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxx> writes:
>> Next I updated to the latest linus tree (c5974b835a), and recompiled perf.
>> It still seems to work, and has obviously had a lot of features added, but
>> now it only wants to let me run "perf record" if I'm root.
>
> Don't recall noticing such problem, here it works just fine:
>
> [acme@doppio linux-2.6-tip]$ mkdir tmp
> [acme@doppio linux-2.6-tip]$ cd tmp
> [acme@doppio tmp]$ time perf record find ~/git/ > /dev/null
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.053 MB perf.data (~2312 samples) ]

Weird... if I try your recipe, I get:

$ cd /usr/local/tmp
$ ls
gstlfilt.zip q2.jpg q3.jpg
$ time perf record find /usr/local/src/git/ > /dev/null
Fatal: Permission error - are you root?

real 0m0.032s
user 0m0.004s
sys 0m0.012s

> [acme@doppio linux-2.6-tip]$ uname -r
> 2.6.33-rc3-tip+

Perhaps the newer version of perf works better with newer kernels, or
with some specific option enabled? [Since it's a fairly new tool, I
suppose it may not work well unless the perf version and the kernel
version are in sync.]

I'm using a standard debian kernel:

$ uname -r
2.6.32-trunk-amd64

$ grep PERF_ /boot/config-2.6.32-trunk-amd64
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_EVENTS=y
# CONFIG_PERF_COUNTERS is not set
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set

I notice that the system call which results in an error for me changed
between the two versions of perf -- from "sys_perf_counter_open" to
"sys_perf_event_open" -- though I don't understand the difference.

Thanks,

-Miles

--
Youth, n. The Period of Possibility, when Archimedes finds a fulcrum,
Cassandra has a following and seven cities compete for the honor of endowing a
living Homer.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/