From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbbEROkM (ORCPT ); Mon, 18 May 2015 10:40:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54842 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752339AbbEROkJ (ORCPT ); Mon, 18 May 2015 10:40:09 -0400 Date: Mon, 18 May 2015 16:39:53 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Paul Mackerras , David Ahern , Ingo Molnar , Jan Stancek , Frederic Weisbecker Subject: Re: [PATCH] perf tools: Fix "Command" sort_entry's cmp and collapse function Message-ID: <20150518143953.GC528@krava.redhat.com> References: <1431705268-12788-1-git-send-email-jolsa@kernel.org> <20150518013850.GA21663@sejong> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150518013850.GA21663@sejong> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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