All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 22:08 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-22 22:08 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 3227 bytes --]

running:
find / -name unistd.h | xargs /bin/grep __NR_perf_event_open

resulted in output of:

/usr/include/asm/unistd.h:#define __NR_perf_event_open          (__NR_SYSCALL_BASE+364)
/usr/include/asm-generic/unistd.h:#define __NR_perf_event_open 241
/usr/include/asm-generic/unistd.h:__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
/usr/src/linux-3.1.10-11-ARCH/include/asm-generic/unistd.h:#define __NR_perf_event_open 241
/usr/src/linux-3.1.10-11-ARCH/include/asm-generic/unistd.h:__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
/usr/src/linux-3.1.10-11-ARCH/arch/arm/include/asm/unistd.h:#define __NR_perf_event_open                (__NR_SYSCALL_BASE+364)


HTH

Rui



________________________________
 From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
To: Rui DaCosta <ruidc(a)yahoo.com> 
Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org" <powertop(a)lists.01.org> 
Sent: Tuesday, 22 May 2012, 23:23
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On (05/22/12 12:35), Rui DaCosta wrote:
> 
>    thanks, same result:
>    PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>    as well as support for trace points in the kernel:
> 
>    CONFIG_PERF_EVENTS=y
>    CONFIG_PERF_COUNTERS=y
>    CONFIG_TRACEPOINTS=y
>    CONFIG_TRACING=y
>
>

Hm...
Could you please tell the number of '__NR_perf_event_open' syscall in your
unistd.h?


    -ss


>    Regards,
>    Rui
> 
>    ──────────────────────────────────────────────────────────────────────────
> 
>    From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>    To: Rui DaCosta <ruidc(a)yahoo.com>
>    Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron
>    <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org"
>    <powertop(a)lists.01.org>
>    Sent: Monday, 21 May 2012, 0:17
>    Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>    On (05/20/12 12:32), Rui DaCosta wrote:
>    >
>    >    it was pointed out to me that  CONFIG_PERF_COUNTERS has been
>    superseded by
>    >    PERF_EVENTS since 2.6.32  - see bottom section of
>    >    [1]http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html
>    >    so is  CONFIG_PERF_COUNTERS really required?
>    >
> 
>    Could you please try the following patch?
> 
>    ---
> 
>    src/perf/perf.cpp |    3 +++
>    1 file changed, 3 insertions(+)
> 
>    diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp
>    index ce9ae6a..09ca390 100644
>    --- a/src/perf/perf.cpp
>    +++ b/src/perf/perf.cpp
>    @@ -48,6 +48,9 @@
>    #ifdef __alpha__
>    #include <asm-generic/unistd.h>
>    #endif
>    +#ifdef __arm__
>    +#include <asm-generic/unistd.h>
>    +#endif
> 
>    #include "perf.h"
>    #include "../lib.h"
> 
> References
> 
>    Visible links
>    1. http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 5590 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 21:58 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-22 21:58 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

nothing exists below /sys/kernel/debug
does the kernel need to be built with debug flags? or a switch flicked on somewhere?



________________________________
 From: Thomas Spura <thomas.spura(a)googlemail.com>
To: Rui DaCosta <ruidc(a)yahoo.com> 
Cc: powertop(a)lists.01.org 
Sent: Tuesday, 22 May 2012, 22:50
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On Sun, May 20, 2012 at 11:19 AM, Rui DaCosta <ruidc(a)yahoo.com> wrote:
>
> Sure and thanks,
> (v1.13 worked fine btw)
> Processor       : Feroceon 88FR131 rev 1 (v5l)
> BogoMIPS        : 1191.11
> Features        : swp half thumb fastmult edsp
> CPU implementer : 0x56
> CPU architecture: 5TE
> CPU variant     : 0x2
> CPU part        : 0x131
> CPU revision    : 1
>
> Hardware        : Marvell SheevaPlug Reference Board
> Revision        : 0000
> Serial          : 0000000000000000

Here perf is trying to open this file:
/sys/kernel/debug/tracing/events/power/cpu_frequency/id
with the old version it was:
/sys/kernel/debug/tracing/events/vfs/dirty_inode/id
(which doesn't exist here anymore)

Could you please look which files of those two exist on your arm device?

Greetings,
    Tom

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2297 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 21:23 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-22 21:23 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2047 bytes --]

On (05/22/12 12:35), Rui DaCosta wrote:
> 
>    thanks, same result:
>    PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>    as well as support for trace points in the kernel:
> 
>    CONFIG_PERF_EVENTS=y
>    CONFIG_PERF_COUNTERS=y
>    CONFIG_TRACEPOINTS=y
>    CONFIG_TRACING=y
>
>

Hm...
Could you please tell the number of '__NR_perf_event_open' syscall in your
unistd.h?


	-ss


>    Regards,
>    Rui
> 
>    ──────────────────────────────────────────────────────────────────────────
> 
>    From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>    To: Rui DaCosta <ruidc(a)yahoo.com>
>    Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron
>    <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org"
>    <powertop(a)lists.01.org>
>    Sent: Monday, 21 May 2012, 0:17
>    Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>    On (05/20/12 12:32), Rui DaCosta wrote:
>    >
>    >    it was pointed out to me that  CONFIG_PERF_COUNTERS has been
>    superseded by
>    >    PERF_EVENTS since 2.6.32  - see bottom section of
>    >    [1]http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html
>    >    so is  CONFIG_PERF_COUNTERS really required?
>    >
> 
>    Could you please try the following patch?
> 
>    ---
> 
>    src/perf/perf.cpp |    3 +++
>    1 file changed, 3 insertions(+)
> 
>    diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp
>    index ce9ae6a..09ca390 100644
>    --- a/src/perf/perf.cpp
>    +++ b/src/perf/perf.cpp
>    @@ -48,6 +48,9 @@
>    #ifdef __alpha__
>    #include <asm-generic/unistd.h>
>    #endif
>    +#ifdef __arm__
>    +#include <asm-generic/unistd.h>
>    +#endif
> 
>    #include "perf.h"
>    #include "../lib.h"
> 
> References
> 
>    Visible links
>    1. http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 20:50 Thomas Spura
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Spura @ 2012-05-22 20:50 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

On Sun, May 20, 2012 at 11:19 AM, Rui DaCosta <ruidc(a)yahoo.com> wrote:
>
> Sure and thanks,
> (v1.13 worked fine btw)
> Processor       : Feroceon 88FR131 rev 1 (v5l)
> BogoMIPS        : 1191.11
> Features        : swp half thumb fastmult edsp
> CPU implementer : 0x56
> CPU architecture: 5TE
> CPU variant     : 0x2
> CPU part        : 0x131
> CPU revision    : 1
>
> Hardware        : Marvell SheevaPlug Reference Board
> Revision        : 0000
> Serial          : 0000000000000000

Here perf is trying to open this file:
/sys/kernel/debug/tracing/events/power/cpu_frequency/id
with the old version it was:
/sys/kernel/debug/tracing/events/vfs/dirty_inode/id
(which doesn't exist here anymore)

Could you please look which files of those two exist on your arm device?

Greetings,
    Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 19:35 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-22 19:35 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

thanks, same result:


PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
as well as support for trace points in the kernel:

CONFIG_PERF_EVENTS=y 
CONFIG_PERF_COUNTERS=y
CONFIG_TRACEPOINTS=y
CONFIG_TRACING=y


Regards,

Rui



________________________________
 From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
To: Rui DaCosta <ruidc(a)yahoo.com> 
Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org" <powertop(a)lists.01.org> 
Sent: Monday, 21 May 2012, 0:17
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On (05/20/12 12:32), Rui DaCosta wrote:
> 
>    it was pointed out to me that  CONFIG_PERF_COUNTERS has been superseded by
>    PERF_EVENTS since 2.6.32  - see bottom section of
>    http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html
>    so is  CONFIG_PERF_COUNTERS really required?
> 

Could you please try the following patch?

---

src/perf/perf.cpp |    3 +++
1 file changed, 3 insertions(+)

diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp
index ce9ae6a..09ca390 100644
--- a/src/perf/perf.cpp
+++ b/src/perf/perf.cpp
@@ -48,6 +48,9 @@
#ifdef __alpha__
#include <asm-generic/unistd.h>
#endif
+#ifdef __arm__
+#include <asm-generic/unistd.h>
+#endif

#include "perf.h"
#include "../lib.h"

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2505 bytes --]

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-22 19:19 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-22 19:19 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 8752 bytes --]

I'd love to help, but development in low-level languages  is far from my "forte",  but I can try to submituser-level bugs and perform some testing, ( I'm merely a user of powertop and an enthusiast for low-power computing).


I understand ARM support in Linux is a mess, but nevertheless it is Linux's most successful platform (taking mobile devices into account), and there's lots of effort being put in to cleaning it up, though i can also understand a reluctance on Intel's part to commit much in that direction ;)


I don't know enough about the issues here to comment on *where* the bug is, but am happy to chase things upstream to get it fixed, if, after review, you think it is a bug there. 


>From my understanding, this Kirkwood platform is also a reasonably popular ARM device, particularly with the power-conscious users, and has been incorporated in many mass-market devices, so i'd think patching until things are fixed upstream would be in many people's interest - and particularly as this appears as a regression from powertop 1.13.


I could also perhaps, on arrangement, organize root access to this device for any devs wishing to test support - so long as I don't have to go too wild with kernel changes (I still rely upon this device as a home NAS).


But i look forward to your conclusion and respect your decision regardless.

... Great tool by the way - doing it's own massive bit to keep the world a greener place.

Kind Regards,
Rui

________________________________
 From: Chris Ferron <chris.e.ferron(a)linux.intel.com>
To: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com> 
Cc: Rui DaCosta <ruidc(a)yahoo.com>; Arjan van de Ven <arjan(a)linux.intel.com>; "powertop(a)lists.01.org" <powertop(a)lists.01.org> 
Sent: Tuesday, 22 May 2012, 1:09
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On 05/20/2012 02:57 PM, Sergey Senozhatsky wrote:
> On (05/20/12 04:01), Rui DaCosta wrote:
>>     Thanks,
>>     this has gotten past the issue. I now get:
>>     PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>>     as well as support for trace points in the kernel:
>>
>>     CONFIG_PERF_EVENTS=y
>>     CONFIG_PERF_COUNTERS=y
>>     CONFIG_TRACEPOINTS=y
>>     CONFIG_TRACING=y
>>
>>     all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see
>>     if i can get a kernel built with that option on.
>>
>>     Will this patch make it into trunk?
>>
> Well, it depends. The patch itself is quite innocent -- assuming default
> number of processors being 1 instead of -1 will not do any harm. Of course,
> such default value could be considered as debugging friendly, yet segfault
> is still no good.
>
> We'll see what project owners think about that.
*In GENERAL*
Well that is an interesting question. I personally will not be spending 
any time on arm.
That said, i am also not opposed to somewhat blindly accepting patches 
for ARM, especially from trusted and active members.
*As long as ARM work isn't effecting PowerTOP.*

Now if you find a bug, then that is a different story, as long as the 
bug is not purely ARM specific it will get attention.

*this instance*
I will pull this patch and take a good look at it, since it looks to me 
to be a bug as well. Thanks Sergey


-Chris



>
>     -ss
>
>>     Many thanks.
>>
>>     ──────────────────────────────────────────────────────────────────────────
>>
>>     From: Sergey Senozhatsky<sergey.senozhatsky(a)gmail.com>
>>     To: Rui DaCosta<ruidc(a)yahoo.com>
>>     Cc: Arjan van de Ven<arjan(a)linux.intel.com>; Chris Ferron
>>     <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org
>>     Sent: Sunday, 20 May 2012, 11:34
>>     Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>>     On (05/20/12 02:19), Rui DaCosta wrote:
>>     >  Sure and thanks,
>>     >  (v1.13 worked fine btw)
>>     >  Processor    : Feroceon 88FR131 rev 1 (v5l)
>>     >  BogoMIPS    : 1191.11
>>     >  Features    : swp half thumb fastmult edsp
>>     >  CPU implementer    : 0x56
>>     >  CPU architecture: 5TE
>>     >  CPU variant    : 0x2
>>     >  CPU part    : 0x131
>>     >  CPU revision    : 1
>>     >
>>     >  Hardware    : Marvell SheevaPlug Reference Board
>>     >  Revision    : 0000
>>     >  Serial        : 0000000000000000
>>     >
>>     >
>>
>>     Thanks,
>>
>>     Well, that's the problem. Current cpu info parser doesn't understand your
>>     cpuinfo format. It awaits for sane values on special places. For example,
>>     word
>>     "processor" should be followed by a number, not model name.
>>
>>         processor    : 2
>>         vendor_id    : GenuineIntel
>>         cpu family    : 6
>>         model        : 37
>>         bogomips    : 4522.66
>>
>>     while cpuinfo on your system is totally different.
>>
>>     the following is untested patch (I'm a bit skeptical) plus I don't have
>>     ARM device for testing.
>>
>>     ---
>>
>>     src/cpu/cpu.cpp |  26 ++++++++++++++------------
>>     1 file changed, 14 insertions(+), 12 deletions(-)
>>
>>     diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
>>     index 09d4a2d..143e18c 100644
>>     --- a/src/cpu/cpu.cpp
>>     +++ b/src/cpu/cpu.cpp
>>     @@ -225,7 +225,7 @@ void enumerate_cpus(void)
>>         ifstream file;
>>         char line[1024];
>>
>>     -    int number = -1;
>>     +    int number = 1;
>>         char vendor[128];
>>         int family = 0;
>>         int model = 0;
>>     @@ -236,7 +236,6 @@ void enumerate_cpus(void)
>>             return;
>>
>>         while (file) {
>>     -
>>             file.getline(line, sizeof(line));
>>             if (strncmp(line, "vendor_id\t",10) == 0) {
>>                 char *c;
>>     @@ -247,42 +246,45 @@ void enumerate_cpus(void)
>>                         c++;
>>                     strncpy(vendor,c, 127);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "processor\t",10) == 0) {
>>     +        } else if (strncmp(line, "processor\t",10) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     number = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "cpu family\t",11) == 0) {
>>     +        } else if (strncmp(line, "Processor\t",10) == 0) {
>>     +            char *c;
>>     +            c = strchr(line, ':');
>>     +            if (c) {
>>     +                c++;
>>     +                if (*c == ' ')
>>     +                    c++;
>>     +                strncpy(vendor, c, 127);
>>     +            }
>>     +        }  else if (strncmp(line, "cpu family\t",11) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     family = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "model\t",6) == 0) {
>>     +        } else if (strncmp(line, "model\t",6) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     model = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncasecmp(line, "bogomips\t", 9) == 0) {
>>     +        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
>>                 handle_one_cpu(number, vendor, family, model);
>>                 set_max_cpu(number);
>>             }
>>         }
>>
>>     -
>>         file.close();
>>
>>         perf_events = new perf_power_bundle();
>>     -
>>         if (!perf_events->add_event("power:cpu_idle")){
>>             perf_events->add_event("power:power_start");
>>             perf_events->add_event("power:power_end");

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 14099 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-21 23:09 Chris Ferron
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Ferron @ 2012-05-21 23:09 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 6253 bytes --]

On 05/20/2012 02:57 PM, Sergey Senozhatsky wrote:
> On (05/20/12 04:01), Rui DaCosta wrote:
>>     Thanks,
>>     this has gotten past the issue. I now get:
>>     PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>>     as well as support for trace points in the kernel:
>>
>>     CONFIG_PERF_EVENTS=y
>>     CONFIG_PERF_COUNTERS=y
>>     CONFIG_TRACEPOINTS=y
>>     CONFIG_TRACING=y
>>
>>     all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see
>>     if i can get a kernel built with that option on.
>>
>>     Will this patch make it into trunk?
>>
> Well, it depends. The patch itself is quite innocent -- assuming default
> number of processors being 1 instead of -1 will not do any harm. Of course,
> such default value could be considered as debugging friendly, yet segfault
> is still no good.
>
> We'll see what project owners think about that.
*In GENERAL*
Well that is an interesting question. I personally will not be spending 
any time on arm.
That said, i am also not opposed to somewhat blindly accepting patches 
for ARM, especially from trusted and active members.
*As long as ARM work isn't effecting PowerTOP.*

Now if you find a bug, then that is a different story, as long as the 
bug is not purely ARM specific it will get attention.

*this instance*
I will pull this patch and take a good look at it, since it looks to me 
to be a bug as well. Thanks Sergey


-Chris



>
> 	-ss
>
>>     Many thanks.
>>
>>     ──────────────────────────────────────────────────────────────────────────
>>
>>     From: Sergey Senozhatsky<sergey.senozhatsky(a)gmail.com>
>>     To: Rui DaCosta<ruidc(a)yahoo.com>
>>     Cc: Arjan van de Ven<arjan(a)linux.intel.com>; Chris Ferron
>>     <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org
>>     Sent: Sunday, 20 May 2012, 11:34
>>     Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>>     On (05/20/12 02:19), Rui DaCosta wrote:
>>     >  Sure and thanks,
>>     >  (v1.13 worked fine btw)
>>     >  Processor    : Feroceon 88FR131 rev 1 (v5l)
>>     >  BogoMIPS    : 1191.11
>>     >  Features    : swp half thumb fastmult edsp
>>     >  CPU implementer    : 0x56
>>     >  CPU architecture: 5TE
>>     >  CPU variant    : 0x2
>>     >  CPU part    : 0x131
>>     >  CPU revision    : 1
>>     >
>>     >  Hardware    : Marvell SheevaPlug Reference Board
>>     >  Revision    : 0000
>>     >  Serial        : 0000000000000000
>>     >
>>     >
>>
>>     Thanks,
>>
>>     Well, that's the problem. Current cpu info parser doesn't understand your
>>     cpuinfo format. It awaits for sane values on special places. For example,
>>     word
>>     "processor" should be followed by a number, not model name.
>>
>>         processor    : 2
>>         vendor_id    : GenuineIntel
>>         cpu family    : 6
>>         model        : 37
>>         bogomips    : 4522.66
>>
>>     while cpuinfo on your system is totally different.
>>
>>     the following is untested patch (I'm a bit skeptical) plus I don't have
>>     ARM device for testing.
>>
>>     ---
>>
>>     src/cpu/cpu.cpp |  26 ++++++++++++++------------
>>     1 file changed, 14 insertions(+), 12 deletions(-)
>>
>>     diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
>>     index 09d4a2d..143e18c 100644
>>     --- a/src/cpu/cpu.cpp
>>     +++ b/src/cpu/cpu.cpp
>>     @@ -225,7 +225,7 @@ void enumerate_cpus(void)
>>         ifstream file;
>>         char line[1024];
>>
>>     -    int number = -1;
>>     +    int number = 1;
>>         char vendor[128];
>>         int family = 0;
>>         int model = 0;
>>     @@ -236,7 +236,6 @@ void enumerate_cpus(void)
>>             return;
>>
>>         while (file) {
>>     -
>>             file.getline(line, sizeof(line));
>>             if (strncmp(line, "vendor_id\t",10) == 0) {
>>                 char *c;
>>     @@ -247,42 +246,45 @@ void enumerate_cpus(void)
>>                         c++;
>>                     strncpy(vendor,c, 127);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "processor\t",10) == 0) {
>>     +        } else if (strncmp(line, "processor\t",10) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     number = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "cpu family\t",11) == 0) {
>>     +        } else if (strncmp(line, "Processor\t",10) == 0) {
>>     +            char *c;
>>     +            c = strchr(line, ':');
>>     +            if (c) {
>>     +                c++;
>>     +                if (*c == ' ')
>>     +                    c++;
>>     +                strncpy(vendor, c, 127);
>>     +            }
>>     +        }  else if (strncmp(line, "cpu family\t",11) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     family = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncmp(line, "model\t",6) == 0) {
>>     +        } else if (strncmp(line, "model\t",6) == 0) {
>>                 char *c;
>>                 c = strchr(line, ':');
>>                 if (c) {
>>                     c++;
>>                     model = strtoull(c, NULL, 10);
>>                 }
>>     -        }
>>     -        if (strncasecmp(line, "bogomips\t", 9) == 0) {
>>     +        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
>>                 handle_one_cpu(number, vendor, family, model);
>>                 set_max_cpu(number);
>>             }
>>         }
>>
>>     -
>>         file.close();
>>
>>         perf_events = new perf_power_bundle();
>>     -
>>         if (!perf_events->add_event("power:cpu_idle")){
>>             perf_events->add_event("power:power_start");
>>             perf_events->add_event("power:power_end");


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20 22:17 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-20 22:17 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On (05/20/12 12:32), Rui DaCosta wrote:
> 
>    it was pointed out to me that  CONFIG_PERF_COUNTERS has been superseded by
>    PERF_EVENTS since 2.6.32  - see bottom section of
>    http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html
>    so is  CONFIG_PERF_COUNTERS really required?
> 

Could you please try the following patch?

---

 src/perf/perf.cpp |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp
index ce9ae6a..09ca390 100644
--- a/src/perf/perf.cpp
+++ b/src/perf/perf.cpp
@@ -48,6 +48,9 @@
 #ifdef __alpha__
 #include <asm-generic/unistd.h>
 #endif
+#ifdef __arm__
+#include <asm-generic/unistd.h>
+#endif
 
 #include "perf.h"
 #include "../lib.h"


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20 22:05 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-20 22:05 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 6513 bytes --]

On (05/20/12 12:32), Rui DaCosta wrote:
> 
>    it was pointed out to me that  CONFIG_PERF_COUNTERS has been superseded by
>    PERF_EVENTS since 2.6.32  - see bottom section of
>    http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html
>    so is  CONFIG_PERF_COUNTERS really required?
>

Does perf tool work for you?

	-ss

 
>    ──────────────────────────────────────────────────────────────────────────
> 
>    From: Rui DaCosta <ruidc(a)yahoo.com>
>    To: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>    Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron
>    <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org"
>    <powertop(a)lists.01.org>
>    Sent: Sunday, 20 May 2012, 13:01
>    Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>    Thanks,
>    this has gotten past the issue. I now get:
>    PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>    as well as support for trace points in the kernel:
> 
>    CONFIG_PERF_EVENTS=y
>    CONFIG_PERF_COUNTERS=y
>    CONFIG_TRACEPOINTS=y
>    CONFIG_TRACING=y
> 
>    all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see
>    if i can get a kernel built with that option on.
>    Will this patch make it into trunk?
>    Many thanks.
> 
>    ──────────────────────────────────────────────────────────────────────────
> 
>    From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>    To: Rui DaCosta <ruidc(a)yahoo.com>
>    Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron
>    <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org
>    Sent: Sunday, 20 May 2012, 11:34
>    Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>    On (05/20/12 02:19), Rui DaCosta wrote:
>    > Sure and thanks,
>    > (v1.13 worked fine btw)
>    > Processor    : Feroceon 88FR131 rev 1 (v5l)
>    > BogoMIPS    : 1191.11
>    > Features    : swp half thumb fastmult edsp
>    > CPU implementer    : 0x56
>    > CPU architecture: 5TE
>    > CPU variant    : 0x2
>    > CPU part    : 0x131
>    > CPU revision    : 1
>    >
>    > Hardware    : Marvell SheevaPlug Reference Board
>    > Revision    : 0000
>    > Serial        : 0000000000000000
>    >
>    >
> 
>    Thanks,
> 
>    Well, that's the problem. Current cpu info parser doesn't understand your
>    cpuinfo format. It awaits for sane values on special places. For example,
>    word
>    "processor" should be followed by a number, not model name.
> 
>        processor    : 2
>        vendor_id    : GenuineIntel
>        cpu family    : 6
>        model        : 37
>        bogomips    : 4522.66
> 
>    while cpuinfo on your system is totally different.
> 
>    the following is untested patch (I'm a bit skeptical) plus I don't have
>    ARM device for testing.
> 
>    ---
> 
>    src/cpu/cpu.cpp |  26 ++++++++++++++------------
>    1 file changed, 14 insertions(+), 12 deletions(-)
> 
>    diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
>    index 09d4a2d..143e18c 100644
>    --- a/src/cpu/cpu.cpp
>    +++ b/src/cpu/cpu.cpp
>    @@ -225,7 +225,7 @@ void enumerate_cpus(void)
>        ifstream file;
>        char line[1024];
> 
>    -    int number = -1;
>    +    int number = 1;
>        char vendor[128];
>        int family = 0;
>        int model = 0;
>    @@ -236,7 +236,6 @@ void enumerate_cpus(void)
>            return;
> 
>        while (file) {
>    -
>            file.getline(line, sizeof(line));
>            if (strncmp(line, "vendor_id\t",10) == 0) {
>                char *c;
>    @@ -247,42 +246,45 @@ void enumerate_cpus(void)
>                        c++;
>                    strncpy(vendor,c, 127);
>                }
>    -        }
>    -        if (strncmp(line, "processor\t",10) == 0) {
>    +        } else if (strncmp(line, "processor\t",10) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    number = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncmp(line, "cpu family\t",11) == 0) {
>    +        } else if (strncmp(line, "Processor\t",10) == 0) {
>    +            char *c;
>    +            c = strchr(line, ':');
>    +            if (c) {
>    +                c++;
>    +                if (*c == ' ')
>    +                    c++;
>    +                strncpy(vendor, c, 127);
>    +            }
>    +        }  else if (strncmp(line, "cpu family\t",11) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    family = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncmp(line, "model\t",6) == 0) {
>    +        } else if (strncmp(line, "model\t",6) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    model = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncasecmp(line, "bogomips\t", 9) == 0) {
>    +        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
>                handle_one_cpu(number, vendor, family, model);
>                set_max_cpu(number);
>            }
>        }
> 
>    -
>        file.close();
> 
>        perf_events = new perf_power_bundle();
>    -
>        if (!perf_events->add_event("power:cpu_idle")){
>            perf_events->add_event("power:power_start");
>            perf_events->add_event("power:power_end");

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20 21:57 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-20 21:57 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 5918 bytes --]

On (05/20/12 04:01), Rui DaCosta wrote:
>    Thanks,
>    this has gotten past the issue. I now get:
>    PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
>    as well as support for trace points in the kernel:
> 
>    CONFIG_PERF_EVENTS=y
>    CONFIG_PERF_COUNTERS=y
>    CONFIG_TRACEPOINTS=y
>    CONFIG_TRACING=y
> 
>    all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see
>    if i can get a kernel built with that option on.
>

>
>    Will this patch make it into trunk?
>

Well, it depends. The patch itself is quite innocent -- assuming default
number of processors being 1 instead of -1 will not do any harm. Of course,
such default value could be considered as debugging friendly, yet segfault
is still no good.

We'll see what project owners think about that.

	-ss

>    Many thanks.
> 
>    ──────────────────────────────────────────────────────────────────────────
> 
>    From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
>    To: Rui DaCosta <ruidc(a)yahoo.com>
>    Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron
>    <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org
>    Sent: Sunday, 20 May 2012, 11:34
>    Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
>    On (05/20/12 02:19), Rui DaCosta wrote:
>    > Sure and thanks,
>    > (v1.13 worked fine btw)
>    > Processor    : Feroceon 88FR131 rev 1 (v5l)
>    > BogoMIPS    : 1191.11
>    > Features    : swp half thumb fastmult edsp
>    > CPU implementer    : 0x56
>    > CPU architecture: 5TE
>    > CPU variant    : 0x2
>    > CPU part    : 0x131
>    > CPU revision    : 1
>    >
>    > Hardware    : Marvell SheevaPlug Reference Board
>    > Revision    : 0000
>    > Serial        : 0000000000000000
>    >
>    >
> 
>    Thanks,
> 
>    Well, that's the problem. Current cpu info parser doesn't understand your
>    cpuinfo format. It awaits for sane values on special places. For example,
>    word
>    "processor" should be followed by a number, not model name.
> 
>        processor    : 2
>        vendor_id    : GenuineIntel
>        cpu family    : 6
>        model        : 37
>        bogomips    : 4522.66
> 
>    while cpuinfo on your system is totally different.
> 
>    the following is untested patch (I'm a bit skeptical) plus I don't have
>    ARM device for testing.
> 
>    ---
> 
>    src/cpu/cpu.cpp |  26 ++++++++++++++------------
>    1 file changed, 14 insertions(+), 12 deletions(-)
> 
>    diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
>    index 09d4a2d..143e18c 100644
>    --- a/src/cpu/cpu.cpp
>    +++ b/src/cpu/cpu.cpp
>    @@ -225,7 +225,7 @@ void enumerate_cpus(void)
>        ifstream file;
>        char line[1024];
> 
>    -    int number = -1;
>    +    int number = 1;
>        char vendor[128];
>        int family = 0;
>        int model = 0;
>    @@ -236,7 +236,6 @@ void enumerate_cpus(void)
>            return;
> 
>        while (file) {
>    -
>            file.getline(line, sizeof(line));
>            if (strncmp(line, "vendor_id\t",10) == 0) {
>                char *c;
>    @@ -247,42 +246,45 @@ void enumerate_cpus(void)
>                        c++;
>                    strncpy(vendor,c, 127);
>                }
>    -        }
>    -        if (strncmp(line, "processor\t",10) == 0) {
>    +        } else if (strncmp(line, "processor\t",10) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    number = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncmp(line, "cpu family\t",11) == 0) {
>    +        } else if (strncmp(line, "Processor\t",10) == 0) {
>    +            char *c;
>    +            c = strchr(line, ':');
>    +            if (c) {
>    +                c++;
>    +                if (*c == ' ')
>    +                    c++;
>    +                strncpy(vendor, c, 127);
>    +            }
>    +        }  else if (strncmp(line, "cpu family\t",11) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    family = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncmp(line, "model\t",6) == 0) {
>    +        } else if (strncmp(line, "model\t",6) == 0) {
>                char *c;
>                c = strchr(line, ':');
>                if (c) {
>                    c++;
>                    model = strtoull(c, NULL, 10);
>                }
>    -        }
>    -        if (strncasecmp(line, "bogomips\t", 9) == 0) {
>    +        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
>                handle_one_cpu(number, vendor, family, model);
>                set_max_cpu(number);
>            }
>        }
> 
>    -
>        file.close();
> 
>        perf_events = new perf_power_bundle();
>    -
>        if (!perf_events->add_event("power:cpu_idle")){
>            perf_events->add_event("power:power_start");
>            perf_events->add_event("power:power_end");

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20 19:32 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-20 19:32 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 5368 bytes --]

it was pointed out to me that  CONFIG_PERF_COUNTERS has been superseded by PERF_EVENTS since 2.6.32  - see bottom section of http://cateee.net/lkddb/web-lkddb/PERF_COUNTERS.html

so is  CONFIG_PERF_COUNTERS really required?




________________________________
 From: Rui DaCosta <ruidc(a)yahoo.com>
To: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com> 
Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron <chris.e.ferron(a)linux.intel.com>; "powertop(a)lists.01.org" <powertop(a)lists.01.org> 
Sent: Sunday, 20 May 2012, 13:01
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 

Thanks,

this has gotten past the issue. I now get:


PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
as well as support for trace points in the kernel:

CONFIG_PERF_EVENTS=y 
CONFIG_PERF_COUNTERS=y
CONFIG_TRACEPOINTS=y
CONFIG_TRACING=y

all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see if i can get a kernel built with that option on.

Will this patch make it into trunk?

Many thanks.


________________________________
 From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
To: Rui DaCosta <ruidc(a)yahoo.com> 
Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org 
Sent: Sunday, 20 May 2012, 11:34
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On (05/20/12 02:19), Rui DaCosta wrote:
> Sure and thanks,
> (v1.13 worked fine btw)
> Processor    : Feroceon 88FR131 rev 1 (v5l)
> BogoMIPS    : 1191.11
> Features    : swp half thumb
 fastmult edsp 
> CPU implementer    : 0x56
> CPU architecture: 5TE
> CPU variant    : 0x2
> CPU part    : 0x131
> CPU revision    : 1
> 
> Hardware    : Marvell SheevaPlug Reference Board
> Revision    : 0000
> Serial        : 0000000000000000
> 
> 

Thanks,

Well, that's the problem. Current cpu info parser doesn't understand your
cpuinfo format. It awaits for sane values on special places. For example, word 
"processor" should be followed by a number, not model name.

    processor    : 2
    vendor_id    : GenuineIntel
    cpu family    : 6
    model        : 37
   
 bogomips    : 4522.66

while cpuinfo on your system is totally different.

the following is untested patch (I'm a bit skeptical) plus I don't have 
ARM device for testing.

---

src/cpu/cpu.cpp |   26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index 09d4a2d..143e18c 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -225,7 +225,7 @@ void enumerate_cpus(void)
    ifstream file;
    char line[1024];

-    int number = -1;
+    int number = 1;
    char vendor[128];
    int family = 0;
    int model = 0;
@@ -236,7 +236,6 @@ void enumerate_cpus(void)
        return;

    while (file) {
-
   
     file.getline(line, sizeof(line));
        if (strncmp(line, "vendor_id\t",10) == 0) {
            char *c;
@@ -247,42 +246,45 @@ void enumerate_cpus(void)
                    c++;
                strncpy(vendor,c, 127);
            }
-        }
-        if (strncmp(line, "processor\t",10) == 0) {
+        } else if (strncmp(line, "processor\t",10) == 0) {
            char *c;
            c = strchr(line, ':');
       
     if (c) {
                c++;
                number = strtoull(c, NULL, 10);
            }
-        }
-        if (strncmp(line, "cpu family\t",11) == 0) {
+        } else if (strncmp(line, "Processor\t",10) == 0) {
+            char *c;
+            c = strchr(line, ':');
+            if (c) {
+                c++;
+                if (*c == ' ')
+       
             c++;
+                strncpy(vendor, c, 127);
+            }
+        }  else if (strncmp(line, "cpu family\t",11) == 0) {
            char *c;
            c = strchr(line, ':');
            if (c) {
                c++;
                family = strtoull(c, NULL, 10);
            }
-        }
-        if (strncmp(line, "model\t",6) == 0) {
+   
     } else if (strncmp(line, "model\t",6) == 0) {
            char *c;
            c = strchr(line, ':');
            if (c) {
                c++;
                model = strtoull(c, NULL, 10);
            }
-        }
-        if (strncasecmp(line, "bogomips\t", 9) == 0) {
+        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
            handle_one_cpu(number, vendor, family, model);
           
 set_max_cpu(number);
        }
    }

-
    file.close();

    perf_events = new perf_power_bundle();
-
    if (!perf_events->add_event("power:cpu_idle")){
        perf_events->add_event("power:power_start");
        perf_events->add_event("power:power_end");

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 9581 bytes --]

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20 11:01 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-20 11:01 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 4731 bytes --]

Thanks,

this has gotten past the issue. I now get:


PowerTOP v2.0 needs the kernel to support the 'perf' subsystem
as well as support for trace points in the kernel:

CONFIG_PERF_EVENTS=y 
CONFIG_PERF_COUNTERS=y
CONFIG_TRACEPOINTS=y
CONFIG_TRACING=y

all these except CONFIG_PERF_COUNTERS are already set, so i'll need to see if i can get a kernel built with that option on.

Will this patch make it into trunk?

Many thanks.


________________________________
 From: Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>
To: Rui DaCosta <ruidc(a)yahoo.com> 
Cc: Arjan van de Ven <arjan(a)linux.intel.com>; Chris Ferron <chris.e.ferron(a)linux.intel.com>; powertop(a)lists.01.org 
Sent: Sunday, 20 May 2012, 11:34
Subject: Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
 
On (05/20/12 02:19), Rui DaCosta wrote:
> Sure and thanks,
> (v1.13 worked fine btw)
> Processor    : Feroceon 88FR131 rev 1 (v5l)
> BogoMIPS    : 1191.11
> Features    : swp half thumb fastmult edsp 
> CPU implementer    : 0x56
> CPU architecture: 5TE
> CPU variant    : 0x2
> CPU part    : 0x131
> CPU revision    : 1
> 
> Hardware    : Marvell SheevaPlug Reference Board
> Revision    : 0000
> Serial        : 0000000000000000
> 
> 

Thanks,

Well, that's the problem. Current cpu info parser doesn't understand your
cpuinfo format. It awaits for sane values on special places. For example, word 
"processor" should be followed by a number, not model name.

    processor    : 2
    vendor_id    : GenuineIntel
    cpu family    : 6
    model        : 37
    bogomips    : 4522.66

while cpuinfo on your system is totally different.

the following is untested patch (I'm a bit skeptical) plus I don't have 
ARM device for testing.

---

src/cpu/cpu.cpp |   26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index 09d4a2d..143e18c 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -225,7 +225,7 @@ void enumerate_cpus(void)
    ifstream file;
    char line[1024];

-    int number = -1;
+    int number = 1;
    char vendor[128];
    int family = 0;
    int model = 0;
@@ -236,7 +236,6 @@ void enumerate_cpus(void)
        return;

    while (file) {
-
        file.getline(line, sizeof(line));
        if (strncmp(line, "vendor_id\t",10) == 0) {
            char *c;
@@ -247,42 +246,45 @@ void enumerate_cpus(void)
                    c++;
                strncpy(vendor,c, 127);
            }
-        }
-        if (strncmp(line, "processor\t",10) == 0) {
+        } else if (strncmp(line, "processor\t",10) == 0) {
            char *c;
            c = strchr(line, ':');
            if (c) {
                c++;
                number = strtoull(c, NULL, 10);
            }
-        }
-        if (strncmp(line, "cpu family\t",11) == 0) {
+        } else if (strncmp(line, "Processor\t",10) == 0) {
+            char *c;
+            c = strchr(line, ':');
+            if (c) {
+                c++;
+                if (*c == ' ')
+                    c++;
+                strncpy(vendor, c, 127);
+            }
+        }  else if (strncmp(line, "cpu family\t",11) == 0) {
            char *c;
            c = strchr(line, ':');
            if (c) {
                c++;
                family = strtoull(c, NULL, 10);
            }
-        }
-        if (strncmp(line, "model\t",6) == 0) {
+        } else if (strncmp(line, "model\t",6) == 0) {
            char *c;
            c = strchr(line, ':');
            if (c) {
                c++;
                model = strtoull(c, NULL, 10);
            }
-        }
-        if (strncasecmp(line, "bogomips\t", 9) == 0) {
+        } else if (strncasecmp(line, "bogomips\t", 9) == 0) {
            handle_one_cpu(number, vendor, family, model);
            set_max_cpu(number);
        }
    }

-
    file.close();

    perf_events = new perf_power_bundle();
-
    if (!perf_events->add_event("power:cpu_idle")){
        perf_events->add_event("power:power_start");
        perf_events->add_event("power:power_end");

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 8183 bytes --]

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20  9:34 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-20  9:34 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2880 bytes --]

On (05/20/12 02:19), Rui DaCosta wrote:
> Sure and thanks,
> (v1.13 worked fine btw)
> Processor	: Feroceon 88FR131 rev 1 (v5l)
> BogoMIPS	: 1191.11
> Features	: swp half thumb fastmult edsp 
> CPU implementer	: 0x56
> CPU architecture: 5TE
> CPU variant	: 0x2
> CPU part	: 0x131
> CPU revision	: 1
> 
> Hardware	: Marvell SheevaPlug Reference Board
> Revision	: 0000
> Serial		: 0000000000000000
> 
> 

Thanks,

Well, that's the problem. Current cpu info parser doesn't understand your
cpuinfo format. It awaits for sane values on special places. For example, word 
"processor" should be followed by a number, not model name.

	processor	: 2
	vendor_id	: GenuineIntel
	cpu family	: 6
	model		: 37
	bogomips	: 4522.66

while cpuinfo on your system is totally different.

the following is untested patch (I'm a bit skeptical) plus I don't have 
ARM device for testing.

---

 src/cpu/cpu.cpp |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index 09d4a2d..143e18c 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -225,7 +225,7 @@ void enumerate_cpus(void)
 	ifstream file;
 	char line[1024];
 
-	int number = -1;
+	int number = 1;
 	char vendor[128];
 	int family = 0;
 	int model = 0;
@@ -236,7 +236,6 @@ void enumerate_cpus(void)
 		return;
 
 	while (file) {
-
 		file.getline(line, sizeof(line));
 		if (strncmp(line, "vendor_id\t",10) == 0) {
 			char *c;
@@ -247,42 +246,45 @@ void enumerate_cpus(void)
 					c++;
 				strncpy(vendor,c, 127);
 			}
-		}
-		if (strncmp(line, "processor\t",10) == 0) {
+		} else if (strncmp(line, "processor\t",10) == 0) {
 			char *c;
 			c = strchr(line, ':');
 			if (c) {
 				c++;
 				number = strtoull(c, NULL, 10);
 			}
-		}
-		if (strncmp(line, "cpu family\t",11) == 0) {
+		} else if (strncmp(line, "Processor\t",10) == 0) {
+			char *c;
+			c = strchr(line, ':');
+			if (c) {
+				c++;
+				if (*c == ' ')
+					c++;
+				strncpy(vendor, c, 127);
+			}
+		}  else if (strncmp(line, "cpu family\t",11) == 0) {
 			char *c;
 			c = strchr(line, ':');
 			if (c) {
 				c++;
 				family = strtoull(c, NULL, 10);
 			}
-		}
-		if (strncmp(line, "model\t",6) == 0) {
+		} else if (strncmp(line, "model\t",6) == 0) {
 			char *c;
 			c = strchr(line, ':');
 			if (c) {
 				c++;
 				model = strtoull(c, NULL, 10);
 			}
-		}
-		if (strncasecmp(line, "bogomips\t", 9) == 0) {
+		} else if (strncasecmp(line, "bogomips\t", 9) == 0) {
 			handle_one_cpu(number, vendor, family, model);
 			set_max_cpu(number);
 		}
 	}
 
-
 	file.close();
 
 	perf_events = new perf_power_bundle();
-
 	if (!perf_events->add_event("power:cpu_idle")){
 		perf_events->add_event("power:power_start");
 		perf_events->add_event("power:power_end");


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20  9:19 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-20  9:19 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]


Sure and thanks,
(v1.13 worked fine btw)
Processor	: Feroceon 88FR131 rev 1 (v5l)
BogoMIPS	: 1191.11
Features	: swp half thumb fastmult edsp 
CPU implementer	: 0x56
CPU architecture: 5TE
CPU variant	: 0x2
CPU part	: 0x131
CPU revision	: 1

Hardware	: Marvell SheevaPlug Reference Board
Revision	: 0000
Serial		: 0000000000000000


------------------------------
On Sun, May 20, 2012 11:05 AM CEST Sergey Senozhatsky wrote:

>On (05/20/12 01:41), Rui DaCosta wrote:
>>    I get the following segfault running 2.0 from unmodified source and
>>    default build options in Arch Linux ARM:
>>    Linux alarm 3.1.10-10-ARCH #1 PREEMPT Thu May 10 02:00:37 UTC 2012
>>    armv5tel GNU/Linux
>>    Cannot load from file /var/cache/powertop/saved_results.powertop
>>    Cannot load from file /var/cache/powertop/saved_parameters.powertop
>>    Segmentation fault
>>    trace is:
>>    #0 handle_one_cpu (model=0, family=0, vendor=0xbeffcf8c ",
>>    number=4294967295)
>
>weird and overflowed input.
>could you please provide your /proc/cpuinfo output?
>
>	-ss
>
>>    at cpu/cpu.cpp:210
>>    #1 enumerate_cpus () at cpu/cpu.cpp:276
>>    #2 0x000495d8 in main (argc=1, argv=0xbefffcc4) at main.cpp:382
>>    please let me know if there's anything else I can provide to assist.
>>    Regards,
>>    RuiDC
>
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20  9:05 Sergey Senozhatsky
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Senozhatsky @ 2012-05-20  9:05 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

On (05/20/12 01:41), Rui DaCosta wrote:
>    I get the following segfault running 2.0 from unmodified source and
>    default build options in Arch Linux ARM:
>    Linux alarm 3.1.10-10-ARCH #1 PREEMPT Thu May 10 02:00:37 UTC 2012
>    armv5tel GNU/Linux
>    Cannot load from file /var/cache/powertop/saved_results.powertop
>    Cannot load from file /var/cache/powertop/saved_parameters.powertop
>    Segmentation fault
>    trace is:
>    #0 handle_one_cpu (model=0, family=0, vendor=0xbeffcf8c "",
>    number=4294967295)

weird and overflowed input.
could you please provide your /proc/cpuinfo output?

	-ss

>    at cpu/cpu.cpp:210
>    #1 enumerate_cpus () at cpu/cpu.cpp:276
>    #2 0x000495d8 in main (argc=1, argv=0xbefffcc4) at main.cpp:382
>    please let me know if there's anything else I can provide to assist.
>    Regards,
>    RuiDC



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Powertop] segfault on Sheevaplug (ARM Kirkwood)
@ 2012-05-20  8:41 Rui DaCosta
  0 siblings, 0 replies; 16+ messages in thread
From: Rui DaCosta @ 2012-05-20  8:41 UTC (permalink / raw)
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

I get the following segfault running 2.0 from unmodified source and default build options in Arch Linux ARM:
Linux alarm 3.1.10-10-ARCH #1 PREEMPT Thu May 10 02:00:37 UTC 2012 armv5tel GNU/Linux


Cannot load from file /var/cache/powertop/saved_results.powertop
Cannot load from file /var/cache/powertop/saved_parameters.powertop
Segmentation fault


trace is:

#0  handle_one_cpu (model=0, family=0, vendor=0xbeffcf8c "", number=4294967295)
at cpu/cpu.cpp:210
#1  enumerate_cpus () at cpu/cpu.cpp:276
#2  0x000495d8 in main (argc=1, argv=0xbefffcc4) at main.cpp:382


please let me know if there's anything else I can provide to assist.

Regards,
RuiDC

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 980 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-05-22 22:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22 22:08 [Powertop] segfault on Sheevaplug (ARM Kirkwood) Rui DaCosta
  -- strict thread matches above, loose matches on Subject: below --
2012-05-22 21:58 Rui DaCosta
2012-05-22 21:23 Sergey Senozhatsky
2012-05-22 20:50 Thomas Spura
2012-05-22 19:35 Rui DaCosta
2012-05-22 19:19 Rui DaCosta
2012-05-21 23:09 Chris Ferron
2012-05-20 22:17 Sergey Senozhatsky
2012-05-20 22:05 Sergey Senozhatsky
2012-05-20 21:57 Sergey Senozhatsky
2012-05-20 19:32 Rui DaCosta
2012-05-20 11:01 Rui DaCosta
2012-05-20  9:34 Sergey Senozhatsky
2012-05-20  9:19 Rui DaCosta
2012-05-20  9:05 Sergey Senozhatsky
2012-05-20  8:41 Rui DaCosta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.