linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ftrace histogram sorting broken on BE architecures
@ 2019-12-11 12:33 Sven Schnelle
  2019-12-11 15:35 ` Steven Rostedt
  0 siblings, 1 reply; 16+ messages in thread
From: Sven Schnelle @ 2019-12-11 12:33 UTC (permalink / raw)
  To: linux-trace-devel

Hi List,

i was looking into a ftracetest failure on s390:

# ./ftracetest test.d/trigger/trigger-hist.tc
=== Ftrace unit tests ===
[1] event trigger - test histogram trigger	[FAIL]
[2] (instance)  event trigger - test histogram trigger	[FAIL]

from the -vvv log: ++ fail 'sort param on sched_process_fork did not work'

# cat events/sched/sched_process_fork/hist

# event histogram
#
# trigger info: hist:keys=parent_pid,child_pid:vals=hitcount:sort=child_pid:size=2048 [active]
#

{ parent_pid:       1406, child_pid:       1428 } hitcount:          1
{ parent_pid:       1406, child_pid:       1430 } hitcount:          1
{ parent_pid:       1406, child_pid:       1427 } hitcount:          1
{ parent_pid:       1406, child_pid:       1432 } hitcount:          1
{ parent_pid:       1406, child_pid:       1431 } hitcount:          1
{ parent_pid:       1406, child_pid:       1429 } hitcount:          1

So the test is right, the entries are not sorted. After digging into the
ftrace code i noticed that integer values always get extended to 64 bit
in event_hist_trigger(), but cmp_entries_key() from tracing_map.c uses the
type of the field (which is a pid_t, and therefore 4 bytes).

On Little Endian this doesn't hurt, but on BE s390 this makes the compare
function compare 4 zero bytes, which is the reason why sorting doesn't
work. As a test i forced the compare function used in cmp_entries_key() to
tracing_map_cmp_s64(), which made the ftrace tests pass.

I also tested this on 64 bit parisc with the same results, so the architecture
doesn't seem make a difference (besides LE vs. BE)

Any thoughts on how to fix this? I'm not sure whether i fully understand the
ftrace maps... ;-)

Best,
Sven

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

end of thread, other threads:[~2019-12-18 15:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 12:33 ftrace histogram sorting broken on BE architecures Sven Schnelle
2019-12-11 15:35 ` Steven Rostedt
2019-12-11 16:09   ` Steven Rostedt
2019-12-11 16:37     ` Tom Zanussi
2019-12-11 17:00       ` Steven Rostedt
2019-12-11 19:26         ` Tom Zanussi
2019-12-12 18:07           ` Steven Rostedt
2019-12-12 19:15             ` Tom Zanussi
2019-12-11 18:14     ` Sven Schnelle
2019-12-12 19:17     ` Tom Zanussi
2019-12-16 15:47       ` David Laight
2019-12-16 16:05         ` Steven Rostedt
2019-12-16 17:06           ` David Laight
2019-12-16 18:29             ` Steven Rostedt
2019-12-17 10:05               ` David Laight
2019-12-18 15:33                 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).