All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: linux-trace-devel@vger.kernel.org
Subject: ftrace histogram sorting broken on BE architecures
Date: Wed, 11 Dec 2019 13:33:16 +0100	[thread overview]
Message-ID: <20191211123316.GD12147@stackframe.org> (raw)

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

             reply	other threads:[~2019-12-11 13:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 12:33 Sven Schnelle [this message]
2019-12-11 15:35 ` ftrace histogram sorting broken on BE architecures 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191211123316.GD12147@stackframe.org \
    --to=svens@stackframe.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.