Seg fault on system with large page size
by Ronen Shitrit
Hi,
I'm trying to run powertop on an ARM system which is using page size
of 64k and I get segmentation fault.
The seg fault is a result of failure in mmap of 8M (128 pages), It
seems there are many mmap like this going on...
Below is a small patch that reduce the amount of mmaped memory based
on the system page size.
Subject: [PATCH] Limit number of mmaped pages
Reduce number of pages mmaped, to prevent segmentation fault,
when system uses page size bigger than 4k.
Signed-off-by: Ronen Shitrit <rshitrit(a)annapurnalabs.com>
---
src/perf/perf.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp
index b1103a7..b4d026f 100644
--- a/src/perf/perf.cpp
+++ b/src/perf/perf.cpp
@@ -207,7 +207,7 @@ perf_event::perf_event(void)
allocate_pevent();
name = NULL;
perf_fd = -1;
- bufsize = 128;
+ bufsize = 128 * 4096 / getpagesize();
perf_mmap = NULL;
cpu = 0;
trace_type = 0;
--
1.9.1
--
Ronen Shitrit
7 years, 7 months
Powertop crashes with 'powertop --auto-tune'
by Harvey
Hope I am right here:
On Archlinux 64bit as well as 32bit systems powertop 2.7 crashes
reproducible like this when called with the parameter --auto-tune:
Steps to reproduce: Just try:
[root@teefax ~]# powertop --auto-tune
Loaded 0 prior measurements
Cannot load from file /var/cache/powertop/saved_parameters.powertop
RAPL device for cpu 0
RAPL device for cpu 0
RAPL device for cpu 0
Devfreq not enabled
Cannot load from file /var/cache/powertop/saved_parameters.powertop
unknown op '{'
Leaving PowerTOP
*** Error in `powertop': double free or corruption (!prev): 0x0975bc20 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x6b5c9)[0xb74685c9]
/usr/lib/libc.so.6(+0x71217)[0xb746e217]
/usr/lib/libc.so.6(+0x719ed)[0xb746e9ed]
/usr/lib/libc.so.6(closedir+0x23)[0xb74aafd3]
powertop[0x806fb31]
powertop[0x805758a]
powertop[0x804d36e]
/usr/lib/libc.so.6(__libc_start_main+0xde)[0xb7414e5e]
powertop[0x804e39d]
======= Memory map: ========
08048000-080bb000 r-xp 00000000 08:13 129320 /usr/bin/powertop
080bb000-080bc000 r--p 00072000 08:13 129320 /usr/bin/powertop
080bc000-080bd000 rw-p 00073000 08:13 129320 /usr/bin/powertop
080bd000-080bf000 rw-p 00000000 00:00 0
09529000-09ae7000 rw-p 00000000 00:00 0 [heap]
b73e1000-b73e4000 rw-p 00000000 00:00 0
b73e4000-b73f8000 r-xp 00000000 08:13 149123 /usr/lib/libresolv-2.20.so
b73f8000-b73f9000 ---p 00014000 08:13 149123 /usr/lib/libresolv-2.20.so
b73f9000-b73fa000 r--p 00014000 08:13 149123 /usr/lib/libresolv-2.20.so
b73fa000-b73fb000 rw-p 00015000 08:13 149123 /usr/lib/libresolv-2.20.so
b73fb000-b73fd000 rw-p 00000000 00:00 0
b73fd000-b75ae000 r-xp 00000000 08:13 149166 /usr/lib/libc-2.20.so
b75ae000-b75b1000 r--p 001b0000 08:13 149166 /usr/lib/libc-2.20.so
b75b1000-b75b3000 rw-p 001b3000 08:13 149166 /usr/lib/libc-2.20.so
b75b3000-b75b5000 rw-p 00000000 00:00 0
b75b5000-b75d1000 r-xp 00000000 08:13 159577 /usr/lib/libgcc_s.so.1
b75d1000-b75d2000 rw-p 0001b000 08:13 159577 /usr/lib/libgcc_s.so.1
b75d2000-b761d000 r-xp 00000000 08:13 149165 /usr/lib/libm-2.20.so
b761d000-b761e000 r--p 0004a000 08:13 149165 /usr/lib/libm-2.20.so
b761e000-b761f000 rw-p 0004b000 08:13 149165 /usr/lib/libm-2.20.so
b761f000-b7708000 r-xp 00000000 08:13 159583 /usr/lib/libstdc++.so.6.0.20
b7708000-b770c000 r--p 000e9000 08:13 159583 /usr/lib/libstdc++.so.6.0.20
b770c000-b770d000 rw-p 000ed000 08:13 159583 /usr/lib/libstdc++.so.6.0.20
b770d000-b7715000 rw-p 00000000 00:00 0
b7715000-b772d000 r-xp 00000000 08:13 149130 /usr/lib/libpthread-2.20.so
b772d000-b772e000 r--p 00017000 08:13 149130 /usr/lib/libpthread-2.20.so
b772e000-b772f000 rw-p 00018000 08:13 149130 /usr/lib/libpthread-2.20.so
b772f000-b7731000 rw-p 00000000 00:00 0
b7731000-b773d000 r-xp 00000000 08:13 137914 /usr/lib/libpci.so.3.3.0
b773d000-b773e000 r--p 0000b000 08:13 137914 /usr/lib/libpci.so.3.3.0
b773e000-b773f000 rw-p 0000c000 08:13 137914 /usr/lib/libpci.so.3.3.0
b773f000-b77a1000 r-xp 00000000 08:13 132783 /usr/lib/libncursesw.so.5.9
b77a1000-b77a3000 r--p 00062000 08:13 132783 /usr/lib/libncursesw.so.5.9
b77a3000-b77a4000 rw-p 00064000 08:13 132783 /usr/lib/libncursesw.so.5.9
b77a4000-b77c2000 r-xp 00000000 08:13 149793 /usr/lib/libnl-3.so.200.20.0
b77c2000-b77c3000 r--p 0001d000 08:13 149793 /usr/lib/libnl-3.so.200.20.0
b77c3000-b77c4000 rw-p 0001e000 08:13 149793 /usr/lib/libnl-3.so.200.20.0
b77c4000-b77c9000 r-xp 00000000 08:13 149794
/usr/lib/libnl-genl-3.so.200.20.0
b77c9000-b77ca000 r--p 00004000 08:13 149794
/usr/lib/libnl-genl-3.so.200.20.0
b77ca000-b77cb000 rw-p 00005000 08:13 149794
/usr/lib/libnl-genl-3.so.200.20.0
b77d6000-b77d8000 rw-p 00000000 00:00 0
b77d8000-b77da000 r--p 00000000 00:00 0 [vvar]
b77da000-b77db000 r-xp 00000000 00:00 0 [vdso]
b77db000-b77fc000 r-xp 00000000 08:13 149126 /usr/lib/ld-2.20.so
b77fc000-b77fd000 rw-p 00000000 00:00 0
b77fd000-b77fe000 r--p 00021000 08:13 149126 /usr/lib/ld-2.20.so
b77fe000-b77ff000 rw-p 00022000 08:13 149126 /usr/lib/ld-2.20.so
bfe80000-bfea1000 rw-p 00000000 00:00 0 [stack]
Aborted (core dumped)
See also Arch Bug report here:
https://bugs.archlinux.org/task/43150
They pointed me to this mailing list. Hope I am right here.
Harvey
--
I am root. If you see me laughing, you'd better have a backup!
7 years, 7 months
Re: [Powertop] [Announcement] Updated Users Guide Released
by Chris Samuel
Hiya,
On Tue, 16 Dec 2014 04:56:42 PM Pandruvada, Srinivas wrote:
> Check your kernel command line. It may be disabling there
> "intel_pstate=disable".
Thanks for the idea, but it doesn't look like it..
$ cat /proc/cmdline
BOOT_IMAGE=/(a)/boot/vmlinuz-3.13.0-43-generic root=UUID=3b13f4db-6ba3-47c9-aa78-2b52ae5c4807 ro rootflags=subvol=@ quiet splash nomdmonddf nomdmonisw nomdmonddf nomdmonisw vt.handoff=7
I don't see any mention of pstate in dmesg. :-(
All the best,
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
7 years, 8 months
[PATCH] powertop: fix erroneous C state detection on ARM
by Lorenzo Pieralisi
When the kernel is configured with CONFIG_CPU_IDLE_MULTIPLE_DRIVERS,
the cpuidle directory contains a "driver" subdirectory that confuses
the current code parsing the C states on ARM platforms, ending up
with a C state entry corresponding to the actual driver name instead
of a proper C state entry.
This patch fixes the code by stopping the parsing if the files that
characterise the C states (ie usage) are not found in the respective:
/sys/devices/system/cpu/cpuX/cpuidle
subdirectory containing C states information.
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi(a)arm.com>
Tested-by: Kevin Hilman <khilman(a)linaro.org>
---
src/cpu/cpu_linux.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu_linux.cpp b/src/cpu/cpu_linux.cpp
index e1ff165..78fd2d3 100644
--- a/src/cpu/cpu_linux.cpp
+++ b/src/cpu/cpu_linux.cpp
@@ -83,7 +83,8 @@ void cpu_linux::parse_cstates_start(void)
if (file) {
file >> usage;
file.close();
- }
+ } else
+ continue;
sprintf(filename + len, "/%s/time", entry->d_name);
@@ -172,7 +173,8 @@ void cpu_linux::parse_cstates_end(void)
if (file) {
file >> usage;
file.close();
- }
+ } else
+ continue;
sprintf(filename + len, "/%s/time", entry->d_name);
--
2.1.2
7 years, 8 months