perf timechart broken
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"
I reverted the latest changes and things seem to break between d854861c4292a4e675a5d3bfd862c5f7421c81e8 and69aad6f1ee69546dea8535ab8f3da9f445d57328 (linux-2.6-x86 tree ids)
Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37). I submitted a patch to stable@ but it did not get accepted, becaust it's not mainline yet.
I concentrated on my latest patches instead of making sure the tiny fix gets into 2.6.37 first.
Ingo: It's a bit late for 2.6.37, if there is any chance to still get it in, the patch below is against linus master... otherwise I'll submit it for stable 36+37 asap.
Anyway to test above regression this mail is about, first apply below patch otherwise you get a segfault if idle (power_start/end) events got logged.
Thanks,
Thomas
---
perf timechart: Fix segfault on cpu idle (power_start/end) events
power_end event does not have type and other attributes and thus does not match struct power_event.
Another struct could be created, but data.cpu is fine for fixing the segfault and will work as long as C-states got initiated on the same CPU the idle state takes place which is the case for all recent HW.
The power_start/end events get deprecated anyway, thus this is an easy, riskless and sufficient solution for the segfault problem.
--- tools/perf/builtin-timechart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-timechart.c +1 -1
@@ -502,7 +502,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)c_state_start (pe->cpu_id, data.time, pe->value);if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (pe->cpu_id, data.time); +c_state_end (data.cpu, data.time);if (strcmp (event_str,"power:power_frequency" ) ==0 )p_state_change (pe->cpu_id, data.time, pe->value);
(Cc:-ed Arjan and Frederic too.)
Quoted 67 lines · Thomas Renninger
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"I reverted the latest changes and things seem to break between
d854861c4292a4e675a5d3bfd862c5f7421c81e8and69aad6f1ee69546dea8535ab8f3da9f445d57328(linux-2.6-x86 tree ids)Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37). I submitted a patch to stable@ but it did not get accepted, becaust it's not mainline yet.
I concentrated on my latest patches instead of making sure the tiny fix gets into 2.6.37 first.Ingo: It's a bit late for 2.6.37, if there is any chance to still get it in, the patch below is against linus master... otherwise I'll submit it for stable 36+37 asap.
Anyway to test above regression this mail is about, first apply below patch otherwise you get a segfault if idle (power_start/end) events got logged.
Thanks,
Thomas
---
perf timechart: Fix segfault on cpu idle (power_start/end) events
power_endevent does not have type and other attributes and thus does not match structpower_event.
Another struct could be created, but data.cpu is fine for fixing the segfault and will work as long as C-states got initiated on the same CPU the idle state takes place which is the case for all recent HW.The power_start/end events get deprecated anyway, thus this is an easy, riskless and sufficient solution for the segfault problem.
--- tools/perf/builtin-timechart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/builtin-timechart.c +1
-1@@ -502,7 +502,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)c_state_start (pe->cpu_id, data.time, pe->value);if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (pe->cpu_id, data.time); +c_state_end (data.cpu, data.time);if (strcmp (event_str,"power:power_frequency" ) ==0 )p_state_change (pe->cpu_id, data.time, pe->value);
Signature · 3 lines
Thanks, Ingo
Quoted 9 lines · Thomas Renninger
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"
Quoted 8 lines
I reverted the latest changes and things seem to break between
d854861c4292a4e675a5d3bfd862c5f7421c81e8and69aad6f1ee69546dea8535ab8f3da9f445d57328(linux-2.6-x86 tree ids)Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37).
You mean .36 perf tools faults on .37 kernel? or the opposite? Is it because power_idle events weren't present on old tools?
Do you have a pointer to those patches?
Quoted 8 lines
I submitted a patch to stable@ but it did not get accepted, becaust it's not mainline yet.
I concentrated on my latest patches instead of making sure the tiny fix gets into 2.6.37 first.Ingo: It's a bit late for 2.6.37, if there is any chance to still get it in, the patch below is against linus master... otherwise I'll submit it for stable 36+37 asap.
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
Quoted 34 lines
Anyway to test above regression this mail is about, first apply below patch otherwise you get a segfault if idle (power_start/end) events got logged.
Thanks,
Thomas
---
perf timechart: Fix segfault on cpu idle (power_start/end) events
power_endevent does not have type and other attributes and thus does not match structpower_event.
Another struct could be created, but data.cpu is fine for fixing the segfault and will work as long as C-states got initiated on the same CPU the idle state takes place which is the case for all recent HW.The power_start/end events get deprecated anyway, thus this is an easy, riskless and sufficient solution for the segfault problem.
--- tools/perf/builtin-timechart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/builtin-timechart.c +0
-0
tools/perf/builtin-timechart.c static int process_sample_event(event_t *event, struct perf_session *session) · line 505
Quoted 5 lines
tools/perf/builtin-timechart.c +1
-1@@ -502,7 +502,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)c_state_start (pe->cpu_id, data.time, pe->value);if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (pe->cpu_id, data.time); +c_state_end (data.cpu, data.time);
On which tree is this based of?
What I have by looking at tip/master is:
else if (strcmp(event_str, "power:power_end") == 0) c_state_end(sample->cpu, sample->time);
Quoted 7 lines
tools/perf/builtin-timechart.c +0
-1if (strcmp (event_str,"power:power_frequency" ) ==0 )p_state_change (pe->cpu_id, data.time, pe->value); --To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 15 lines · Thomas Renninger
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"I reverted the latest changes and things seem to break between
d854861c4292a4e675a5d3bfd862c5f7421c81e8and69aad6f1ee69546dea8535ab8f3da9f445d57328(linux-2.6-x86 tree ids)
Quoted 6 lines
Quoted 2 lines
Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37).
You mean .36 perf tools faults on .37 kernel? or the opposite? Is it because
power_idleevents weren't present on old tools? Do you have a pointer to those patches?
perf timechart
will segfault if perf.data has power_{start,end} events included on 2.6.36 and 2.6.37 kernels.
Quoted 5 lines
Quoted 5 lines
I submitted a patch to stable@ but it did not get accepted, becaust it's not mainline yet.
I concentrated on my latest patches instead of making sure the tiny fix gets into 2.6.37 first.
Quoted 7 lines
Quoted 3 lines
Ingo: It's a bit late for 2.6.37, if there is any chance to still get it in, the patch below is against linus master... otherwise I'll submit it for stable 36+37 asap.
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
I'll submit it to stable@ (it wasn't taken because the patch which included the fix wasn't mainline yet and I forgot to submit it for 2.6.37-rcX).
I can take care of that, but it would be great if someone could look at the issue that perf timechart shows:
"no trace data in the file"
in x86/tip which seems introduced by one of Arnaldo's latest commits. Reverting some of his latest patches, solved it for me.
Quoted 35 lines
Quoted 35 lines
Anyway to test above regression this mail is about, first apply below patch otherwise you get a segfault if idle (power_start/end) events got logged.
Thanks,
Thomas
---
perf timechart: Fix segfault on cpu idle (power_start/end) events
power_endevent does not have type and other attributes and thus does not match structpower_event.
Another struct could be created, but data.cpu is fine for fixing the segfault and will work as long as C-states got initiated on the same CPU the idle state takes place which is the case for all recent HW.The power_start/end events get deprecated anyway, thus this is an easy, riskless and sufficient solution for the segfault problem.
--- tools/perf/builtin-timechart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/builtin-timechart.c +0
-0@@ -502,7 +502,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)c_state_start (pe->cpu_id, data.time, pe->value);
Quoted 5 lines
tools/perf/builtin-timechart.c static int process_sample_event(event_t *event, struct perf_session *session) · line 505
Quoted 3 lines
tools/perf/builtin-timechart.c +1
-1if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (pe->cpu_id, data.time); +c_state_end (data.cpu, data.time);On which tree is this based of?
Linus master (2.6.37-rc8).
Quoted 1 line
What I have by looking at tip/master is:
Yes, this commit includes the patch (should have been a seperate one...):20c457b8587bee4644d998331d9e13be82e05b4c
perf timechart: Adjust perf timechart to the new power events
Thomas
Quoted 12 lines
else if (strcmp(event_str, "power:power_end") == 0) c_state_end(sample->cpu, sample->time);Quoted 7 lines
tools/perf/builtin-timechart.c +0
-1if (strcmp (event_str,"power:power_frequency" ) ==0 )p_state_change (pe->cpu_id, data.time, pe->value); --To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Em Tue, Jan 11, 2011 at 09:55:36AM +0100, Thomas Renninger escreveu:
Quoted 12 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 3 lines
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
I'll submit it to stable@ (it wasn't taken because the patch which included the fix wasn't mainline yet and I forgot to submit it for 2.6.37-rcX).
I can take care of that, but it would be great if someone could look at the issue that perf timechart shows: "no trace data in the file" in x86/tip which seems introduced by one of Arnaldo's latest commits. Reverting some of his latest patches, solved it for me.
Looking at it now.
- Arnaldo
Em Tue, Jan 11, 2011 at 09:49:51AM -0200, Arnaldo Carvalho de Melo escreveu:
Quoted 9 lines
Em Tue, Jan 11, 2011 at 09:55:36AM +0100, Thomas Renninger escreveu:
Quoted 7 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 3 lines
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
I'll submit it to stable@ (it wasn't taken because the patch which included the fix wasn't mainline yet and I forgot to submit it for 2.6.37-rcX).
Quoted 6 lines
Quoted 4 lines
I can take care of that, but it would be great if someone could look at the issue that perf timechart shows: "no trace data in the file" in x86/tip which seems introduced by one of Arnaldo's latest commits. Reverting some of his latest patches, solved it for me.
Looking at it now.
Can you try with this patch applied? We need a better way of specifying ordering of __exit and __init routines :-\
- Arnaldo
commit 7116fe5e13ff978676d96bcea79ec1b8f87b2f9d
Author: Arnaldo Carvalho de Melo <[email protected]> Date: Tue Jan 11 12:42:00 2011 -0200
perf evsel: Fix order of event list deletion
We need to defer calling perf_evsel_list__delete() till after atexit registered routines, because we need to traverse the events being recorded at that time at least on 'perf record'.
This fixes the problem reported by Thomas Renninger where cmd_record called by cmd_timechart would not write the tracing data to the perf.data file header because the evsel_list at atexit (control+C on 'perf timechart record') time would be empty, being already deleted by run_builtin(), and thus 'perf timechart' when trying to process such perf.data file would die with:
"no trace data in the file"
Problem introduced in 70d544d.
LKML-Reference: <new-submission>
tools/perf/builtin-record.c +1 -0
@@ -480,6 +480,7 @@ static void atexit_header(void)process_buildids ();perf_header__write (&session->header, output, true);perf_session__delete (session); +perf_evsel_list__delete ();symbol__exit (); } }
tools/perf/builtin-stat.c +1 -0
@@ -743,6 +743,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) out_free_fd:list_for_each_entry (pos, &evsel_list, node)perf_evsel__free_stat_priv (pos); +perf_evsel_list__delete (); out:thread_map__delete (threads); threads =NULL ;
tools/perf/builtin-top.c +1 -0
@@ -1490,6 +1490,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) out_free_fd:list_for_each_entry (pos, &evsel_list, node)perf_evsel__free_mmap (pos); +perf_evsel_list__delete ();return status; }
tools/perf/perf.c +0 -2
@@ -286,8 +286,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) status = p->fn (argc, argv, prefix);exit_browser (status); -perf_evsel_list__delete (); -if (status)return status &0xff ;
Quoted 20 lines · Thomas Renninger
Quoted 19 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 17 lines · Thomas Renninger
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"I reverted the latest changes and things seem to break between
d854861c4292a4e675a5d3bfd862c5f7421c81e8and69aad6f1ee69546dea8535ab8f3da9f445d57328(linux-2.6-x86 tree ids)Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37).
Quoted 6 lines
Quoted 3 lines
You mean .36 perf tools faults on .37 kernel? or the opposite? Is it because
power_idleevents weren't present on old tools? Do you have a pointer to those patches?perf timechart
will segfault if perf.data has power_{start,end} events included on 2.6.36 and 2.6.37 kernels.
Is this the same segfault you are seeing?
http://www.mail-archive.com/[email protected]/msg00057.html
David
Quoted 90 lines
Quoted 6 lines
Quoted 6 lines
I submitted a patch to stable@ but it did not get accepted, becaust it's not mainline yet.
I concentrated on my latest patches instead of making sure the tiny fix gets into 2.6.37 first.Quoted 7 lines
Quoted 3 lines
Ingo: It's a bit late for 2.6.37, if there is any chance to still get it in, the patch below is against linus master... otherwise I'll submit it for stable 36+37 asap.
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
I'll submit it to stable@ (it wasn't taken because the patch which included the fix wasn't mainline yet and I forgot to submit it for 2.6.37-rcX).
I can take care of that, but it would be great if someone could look at the issue that perf timechart shows:
"no trace data in the file"
in x86/tip which seems introduced by one of Arnaldo's latest commits. Reverting some of his latest patches, solved it for me.Quoted 35 lines
Quoted 35 lines
Anyway to test above regression this mail is about, first apply below patch otherwise you get a segfault if idle (power_start/end) events got logged.
Thanks,
Thomas
---
perf timechart: Fix segfault on cpu idle (power_start/end) events
power_endevent does not have type and other attributes and thus does not match structpower_event.
Another struct could be created, but data.cpu is fine for fixing the segfault and will work as long as C-states got initiated on the same CPU the idle state takes place which is the case for all recent HW.The power_start/end events get deprecated anyway, thus this is an easy, riskless and sufficient solution for the segfault problem.
--- tools/perf/builtin-timechart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/perf/builtin-timechart.c +0
-0@@ -502,7 +502,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)c_state_start (pe->cpu_id, data.time, pe->value);Quoted 5 lines
tools/perf/builtin-timechart.c static int process_sample_event(event_t *event, struct perf_session *session) · line 505
Quoted 3 lines
tools/perf/builtin-timechart.c +1
-1if (strcmp (event_str,"power:power_end" ) ==0 ) -c_state_end (pe->cpu_id, data.time); +c_state_end (data.cpu, data.time);On which tree is this based of?
Linus master (2.6.37-rc8).
Quoted 1 line
What I have by looking at tip/master is:
Yes, this commit includes the patch (should have been a seperate one...):
20c457b8587bee4644d998331d9e13be82e05b4c
perf timechart: Adjust perf timechart to the new power eventsThomas
Quoted 12 lines
else if (strcmp(event_str, "power:power_end") == 0) c_state_end(sample->cpu, sample->time);Quoted 7 lines
tools/perf/builtin-timechart.c +0
-1if (strcmp (event_str,"power:power_frequency" ) ==0 )p_state_change (pe->cpu_id, data.time, pe->value); --To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · On Tuesday 11 January 2011 15:51:34 Arnaldo Carvalho de Melo wrote:
Em Tue, Jan 11, 2011 at 09:49:51AM -0200, Arnaldo Carvalho de Melo escreveu:
Quoted 14 lines
Em Tue, Jan 11, 2011 at 09:55:36AM +0100, Thomas Renninger escreveu:
Quoted 12 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 3 lines
It's too late for .37, but it's fine, we just need to add a "Cc: [email protected]" tag in the patch for it to be backported.
I'll submit it to stable@ (it wasn't taken because the patch which included the fix wasn't mainline yet and I forgot to submit it for 2.6.37-rcX).
I can take care of that, but it would be great if someone could look at the issue that perf timechart shows: "no trace data in the file" in x86/tip which seems introduced by one of Arnaldo's latest commits. Reverting some of his latest patches, solved it for me.
Quoted 4 lines
Quoted 1 line
Looking at it now.
Can you try with this patch applied? We need a better way of specifying ordering of
__exitand__initroutines :-\
I tested on x86/tip and it is fixed.
I explicitly reverted your fix and run into it again.
Thanks!
Thomas
Quoted 25 lines · On Tuesday 11 January 2011 19:56:22 David Ahern wrote:
Quoted 23 lines · Thomas Renninger
Quoted 22 lines · On Tuesday 11 January 2011 02:36:28 Frederic Weisbecker wrote:
Quoted 9 lines · Thomas Renninger
Hi,
Latest x86 tip has another perf timechart issue introduce by latest commits.
./perf timechart
gives me:
"no trace data in the file"Quoted 8 lines
I reverted the latest changes and things seem to break between
d854861c4292a4e675a5d3bfd862c5f7421c81e8and69aad6f1ee69546dea8535ab8f3da9f445d57328(linux-2.6-x86 tree ids)Be aware that ./perf timechart is currently broken and segfaults on idle events (in 2.6.36 and 2.6.37).
You mean .36 perf tools faults on .37 kernel? or the opposite? Is it because
power_idleevents weren't present on old tools? Do you have a pointer to those patches?
Quoted 7 lines
Quoted 3 lines
perf timechart
will segfault if perf.data has power_{start,end} events included on 2.6.36 and 2.6.37 kernels.Is this the same segfault you are seeing?
[email protected]/msg00057.html
Looks slightly different, the segfault should happen in:process_sample_event
But looks very much related, possibly it has not been made/make with DEBUG=1
and -O6 was added and the backtrace is not 100% correct?
I still did not have time to send it out, will do so on Mo.
Thomas
Quoted 7 lines · Thomas Renninger
Quoted 1 line
[email protected]/msg00057.html
Looks slightly different, the segfault should happen in:process_sample_event
But looks very much related, possibly it has not been made/make with DEBUG=1
and -O6 was added and the backtrace is not 100% correct?
perf was built with DEBUG=1; that's how I got the pretty backtrace versus having the arguments optimized out. The cpu=6291457 is the garbage causing the segfault (there are only 2 cores in the system). 6291457 = 0x600001. Perhaps a mask is missing?
David
Quoted 4 lines
I still did not have time to send it out, will do so on Mo.
Thomas
Em Fri, Jan 14, 2011 at 05:49:36PM +0100, Thomas Renninger escreveu:
Quoted 10 lines · On Tuesday 11 January 2011 15:51:34 Arnaldo Carvalho de Melo wrote:
Quoted 5 lines
Em Tue, Jan 11, 2011 at 09:49:51AM -0200, Arnaldo Carvalho de Melo escreveu:
Quoted 1 line
Looking at it now.
Can you try with this patch applied? We need a better way of specifying ordering of
__exitand__initroutines :-\I tested on x86/tip and it is fixed.
I explicitly reverted your fix and run into it again.Thanks!
Thanks a lot for reporting and retesting,
- Arnaldo
Quoted 10 lines · On Friday 14 January 2011 18:09:05 David Ahern wrote:
Quoted 7 lines · Thomas Renninger
Quoted 1 line
[email protected]/msg00057.html
Looks slightly different, the segfault should happen in:process_sample_event
But looks very much related, possibly it has not been made/make with DEBUG=1
and -O6 was added and the backtrace is not 100% correct?
Quoted 3 lines
perf was built with DEBUG=1; that's how I got the pretty backtrace versus having the arguments optimized out. The cpu=6291457 is the garbage causing the segfault
Then it's the same issue.
Quoted 2 lines
(there are only 2 cores in the system).
6291457 =0x600001. Perhaps a mask is missing?
No, the power_start and power_end event have different kernel structures, but in builtin-timechart.c the same struct is used. cpu is at the end.
Therefore pe->cpu_id (in power_end case) accesses uninitialized data.
But using the cpu data from the event itself (data.cpu, the cpu on which the event got emited) for fixing this is fine.
It's the way it was done before the bug got introduced.
As said, this won't work if the kernel code triggering the C-state is executed on a different CPU than the CPU which is affected by the C-state change. But such HW does not yet exist on X86 afaik and the power_start event dies out anyway.
I resubmitted the fix for 2.6.3{6,7} stable kernels and added you to CC.
Thomas