New issue
Advanced search Search tips

Issue 777004 link

Starred by 1 user

Issue metadata

Status: Verified
Owner: ----
Closed: Oct 26
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug-Regression



Sign in to add a comment

perf: samples not mapped to the kernel or the kernel modules

Project Member Reported by gmx@chromium.org, Oct 20 2017

Issue description

Chrome Version: 64
Chrome OS Version: 10042.0.0
Chrome OS Platform: multiple

perf is broken on CrOS 10042+, on multiple boards and kernel versions.
For detection context, see b/68045463.

I confirmed the issue on a lars board with kernel 3.18.

1) I installed image R64-10042.0.0.
While playing youtube in Chrome, I ran
$ perf record -a -e cycles -c 1000003 sleep 3
$ perf report -s dso
Warning:
Kernel address maps (/proc/{kallsyms,modules}) were restricted.

Check /proc/sys/kernel/kptr_restrict before running 'perf record'.

As no suitable kallsyms nor vmlinux was found, kernel samples
can't be resolved.

Samples in kernel modules can't be resolved as well.

# To display the perf.data header info, please use --header/--header-only
# options.
#
#
# Total Lost Samples: 0
#
# Samples: 1K of event 'cycles'
# Event count (approx.): 1239003717
#
# Overhead  Shared Object
# ........  ......................
#
    45.52%  [unknown]
    42.13%  chrome
     3.55%  libpthread-2.23.so
     2.10%  libc-2.23.so
     1.29%  i965_dri.so
     1.13%  perf-9261.map
     0.97%  i965_drv_video.so
     0.81%  libstdc++.so.6.0.20
     0.65%  [vdso]
     0.48%  cras
     0.40%  libEGL.so.1.0.0
     0.24%  libdrm_intel.so.1.0.0
     0.16%  libbase-core-395517.so
     0.16%  libcras.so.0.0.0
     0.08%  ld-2.23.so
     0.08%  libm-2.23.so
     0.08%  perf-4443.map
     0.08%  perf-4908.map
     0.08%  perf-5747.map

45.5% of samples associated with an unknown module.

2) I installed image R64-10041.0.0.
While playing youtube in Chrome, I ran
$ perf record -a -e cycles -c 1000003 sleep 3
$ perf report -s dso
# To display the perf.data header info, please use --header/--header-only
# options.
#
#
# Total Lost Samples: 0
#
# Samples: 1K of event 'cycles'
# Event count (approx.): 1805005415
#
# Overhead  Shared Object
# ........  .....................
#
    59.61%  chrome
    29.42%  [kernel.kallsyms]
     2.71%  libpthread-2.23.so
     1.88%  perf-3649.map
     1.77%  i965_dri.so
     1.50%  libc-2.23.so
     0.78%  i965_drv_video.so
     0.66%  libstdc++.so.6.0.20
     0.44%  perf-3921.map
     0.33%  libdrm_intel.so.1.0.0
     0.17%  [vdso]
     0.11%  libart.so
     0.11%  libm-2.23.so
     0.11%  libva.so.1.4000.0
     0.06%  libEGL.so.1.0.0
     0.06%  libGLESv2.so.2.0.0
     0.06%  libasound.so.2.0.0
     0.06%  libglapi.so.0.0.0
     0.06%  perf-3501.map
     0.06%  perf-3712.map
     0.06%  perf-4022.map

29.4% of the samples are mapped to the kernel. No unknown module.

Running perf report -D on the perf data files collected at (1) and (2) shows that for image 10042.0.0 there are no MMAP events for the kernel or any kernel modules.

For case (1), see also the warning: "Kernel address maps (/proc/{kallsyms,modules}) were restricted." printed when running perf report, so this seems to be related.

It looks like something has changed in 10042 that denies perf access to /proc/kallsyms and /proc/modules.


What is the impact to the user, and is there a workaround? If so, what is it?

This breaks go/cwp. We also just started releasing kernels compiled with AutoFDO profiles generated from CWP data. Not being able to collect perf data for the kernel will break that pipeline in a few weeks.

I am attaching the output of 'perf report -D | grep MMAP' for the two perf data files collected at (1) and (2).

 
report_D_MMAP_10041.txt
1.0 MB View Download
report_D_MMAP_10042.txt
917 KB View Download

Comment 1 by gmx@chromium.org, Oct 20 2017

I think the change is that /proc/sys/kernel/kptr_restrict in 10042+ is set to 2.
In an older version is set to 1.

Based on https://lwn.net/Articles/420403/, a value of 2 restricts access to kernel pointers via the /proc interface to any user.
A value of 1 allowed access for privileged users.

If I run "cat /proc/kallsyms" with the 10042.0.0 image, I get 0 addresses for all kernel symbols.

The question is, what determined this change?

Comment 2 by gmx@chromium.org, Oct 20 2017

Cc: cmtm@google.com
The change was introduced in https://chrome-internal-review.googlesource.com/c/chromeos/cheets-scripts/+/481553

+cmtm@
Christopher, kptr_restrict needs to be set to 2? Can we set it to 1 instead?

Comment 3 by vapier@chromium.org, Oct 21 2017

sysctl settings should really be done on a common/global basis and not in ARC++ specific init
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 23 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chromeos/cheets-scripts/+/7d7646da2e42d3824ba29f225336711570ebc92c

commit 7d7646da2e42d3824ba29f225336711570ebc92c
Author: Gabriel Marin <gmx@chromium.org>
Date: Mon Oct 23 22:22:22 2017

Comment 5 by gmx@chromium.org, Oct 24 2017

I changed the kptr_restrict setting in arc_setup from 2 to 1, to unblock our pipeline, which landed in 10062.0.0.

I agree with Mike's comment that this setting shouldn't be done in a component init at all, but I don't know who needs to tackle that one. Do you want to open a separate issue for it?
Project Member

Comment 6 by bugdroid1@chromium.org, Oct 24 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chromeos/overlays/project-cheets-private/+/fca8e3fcc501855b98bad309558e99683ce6b177

commit fca8e3fcc501855b98bad309558e99683ce6b177
Author: Luis Hector Chavez <lhchavez@google.com>
Date: Tue Oct 24 22:30:13 2017

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 24 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chromeos/overlays/project-cheets-private/+/5bc81bb9fdafb5d9436b40570a019447fd13395d

commit 5bc81bb9fdafb5d9436b40570a019447fd13395d
Author: Luis Hector Chavez <lhchavez@google.com>
Date: Tue Oct 24 22:30:12 2017

Project Member

Comment 8 by bugdroid1@chromium.org, Oct 25 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/chromeos/cheets-scripts/+/351d46580f16f0dee4d7cccec5c7b322dfffad7a

commit 351d46580f16f0dee4d7cccec5c7b322dfffad7a
Author: Mike Frysinger <vapier@chromium.org>
Date: Wed Oct 25 17:24:09 2017

Project Member

Comment 9 by sheriffbot@chromium.org, Oct 26

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Verified (was: Archived)

Sign in to add a comment