[Powertop] Segmentation fault occurs with --calibrate
Lekensteyn <lekensteyn at gmail.com> Thu, 17 May 2012 17:48:13 +0200
| Newsgroups | dev.linux.lists.powertop |
|---|---|
| Message-ID | <3231880.1xuGnurXlG@penguin> |
Hi,
With the new Powertop 2.0, `powertop --calibrate` segfaults. Debugging output
is attached:
> Starting program: /tmp/powertop-2.0/src/powertop --calibrate
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Starting PowerTOP power estimate calibration
> Calibrating idle
>
> Program received signal SIGSEGV, Segmentation fault.
> perf_bundle::start (this=0x0) at perf/perf_bundle.cpp:180
> 180 for (i = 0; i < events.size(); i++) {
> (gdb) bt
> #0 perf_bundle::start (this=0x0) at perf/perf_bundle.cpp:180
> #1 0x000000000040f9b0 in start_cpu_measurement () at cpu/cpu.cpp:297
> #2 0x0000000000442655 in one_measurement (seconds=15) at main.cpp:182
> #3 0x000000000043f4c2 in idle_calibration () at calibrate/calibrate.cpp:423
> #4 calibrate () at calibrate/calibrate.cpp:466
> #5 0x000000000040665f in main (argc=2, argv=0x7fffffffe718) at main.cpp:325
> (gdb) up
> #1 0x000000000040f9b0 in start_cpu_measurement () at cpu/cpu.cpp:297
> 297 perf_events->start()
> (gdb) print perf_events
> $5 = (perf_bundle *) 0x0
The order of processing seems flawed. Immediately during argument processing,
calibrate() is called. But start_cpu_measurement requires some initialization
which is done by enumerate_cpus() in the main() function after arguments
processing. You know your code better, so I'll gratefully wait for your
patches.
Thanks,
Peter