Re: [PATCH] perf tools: Fix "Command" sort_entry's cmp and collapse function

From: Jiri Olsa
Date: Mon May 18 2015 - 10:40:17 EST


On Mon, May 18, 2015 at 10:38:50AM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> CC-ing Frederic as he wrote the comm change.
>
> On Fri, May 15, 2015 at 05:54:28PM +0200, Jiri Olsa wrote:
> > Currently the se_cmp and se_collapse use pointer comparison,
> > which is ok for for testing equality of strings. It's not ok
> > as comparing function for rbtree insertion, because it gives
> > different results based on current pointer values.
> >
> > We saw test 32 (hists cumulation test) failing based on different
> > environment setup. Having all sort functions straightened fix the
> > test for us.
>
> Can you elaborate it?
>
> AFAIK comm string is shared among threads so pointer comparison and
> 'strcmp == 0' should have same result..

well pointers (A, B) substraction will get either negative (A < B) or
possitive number (A > B). Now if your environment happens to have those
pointers switched you'll get different result for same strings.

Following python script forced the 'perf test 32' to switch those pointers
and screwed the Command sorting.. it's not very reliable on upstream for
some reason.. but very reproducible on RHEL7

---
#!/bin/python

import os

env={}

env['PATH'] = "/tmp:"*500

os.execve("./perf", ["perf", "test", "32", "-v"], env)
---

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/