Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2160410ybl; Thu, 9 Jan 2020 07:54:53 -0800 (PST) X-Google-Smtp-Source: APXvYqz3f/8zuZlTU16QifQhU8LLAgeOFi7xo15Wd402Ybu/kqCedGPym+SzmV7/cVUe9VjvNcNC X-Received: by 2002:aca:6108:: with SMTP id v8mr3425039oib.96.1578585293075; Thu, 09 Jan 2020 07:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578585293; cv=none; d=google.com; s=arc-20160816; b=w3NCP6nCsX2b0ce1SC3aV6zq7N929gOlNOO3qLYvaDFDNw43bTe9h3UI5Jx+56FNTr dCZyqFhQoWcziMOzzcAEY/jQ+ehiK92XkCVMJFkkY2efkRRBdKO7y4aX71oZbnaobY5v FZm7r3n+tWaSfZBQHz5yXcM0LL5jwCx9EwYyrnNuzQB2i0jBFBBDE5HiG8RX/V3+OhTE M+Re6PXEm7J5kUY2ymeE0j98sC9clp3c3DuXVeHkTiPhJl/QW1QjSsnH5DPigQl88Tb/ LnujxKJeMZsMlHqCyeLFUec+qzzA5Kwwn4grN6tSmTfdi8uwxEIfJvAClMhskDseE7Hi XfSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=dE4ryLd3fwXYcbBtXTnMIpC4ft/UG9Rj8eEUk0vFsRo=; b=KHgasWupP7TioW4MLRKsl6RCw+Eo3F8+qPkD47EGc33APROqRPwt0BUxUp+WSj15fV ZWZ5bDW7e/5zF/hGjE7wSAiqCtF58fVLncFzxS1ywLcFJvZo8b3mmxGNkg3n+kP2GJcw 3W1fhdRZnYBV2s4hMr7+UnOXi6+WzlJS968NzBdWa1mzV4yMiHFTBwHVY8i2xLM/o69A fjubWYfROtK4EPDHCqOiISlD+X2ic/BCX6Eh9jopqQQLtOdLy+pSsQS1XZEBPJYElzG+ 5wMQtQUVeyZJXe2JFuG8fIO7qmsrIDZdMnSEGUjP4m9uQAg1ErYQtcgf0ssaMP4CNfgl /IAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PjAv93AN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si3638243ois.76.2020.01.09.07.54.40; Thu, 09 Jan 2020 07:54:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PjAv93AN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbgAINWn (ORCPT + 99 others); Thu, 9 Jan 2020 08:22:43 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33544 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727861AbgAINWn (ORCPT ); Thu, 9 Jan 2020 08:22:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578576161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dE4ryLd3fwXYcbBtXTnMIpC4ft/UG9Rj8eEUk0vFsRo=; b=PjAv93ANWoJDOVfjvmoH/47u7ugV687I3ofvvnrffgMjJv0h/yYQhGOWYZqK1mMZOoAHLE RvIM6JxBx6qn35iGdNDikIiCma2TbPcoA8VRxNl5qJ/8EnA9USe16mKbg8wOFIF0LfS6Ym n9iqhRUfoHBFCi/gXSGltmX/VJ+wso0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-0vvOMYTwOpKc-AJibRDE-g-1; Thu, 09 Jan 2020 08:22:38 -0500 X-MC-Unique: 0vvOMYTwOpKc-AJibRDE-g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB9DA10054E3; Thu, 9 Jan 2020 13:22:36 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA0AC1000322; Thu, 9 Jan 2020 13:22:34 +0000 (UTC) Date: Thu, 9 Jan 2020 14:22:32 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Michael Petlan , Andres Freund , linux-kernel@vger.kernel.org, Jiri Olsa , Andi Kleen , Alexander Shishkin , Namhyung Kim , Peter Zijlstra , stable@vger.kernel.org Subject: Re: [PATCH] perf c2c: Fix sorting. Message-ID: <20200109132232.GA82989@krava> References: <20200109043030.233746-1-andres@anarazel.de> <20200109131834.GA4404@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109131834.GA4404@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 10:18:34AM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Jan 09, 2020 at 10:58:43AM +0100, Michael Petlan escreveu: > > On Wed, 8 Jan 2020, Andres Freund wrote: > > > Commit 722ddfde366f ("perf tools: Fix time sorting") changed - > > > correctly so - hist_entry__sort to return int64. Unfortunately several > > > of the builtin-c2c.c comparison routines only happened to work due the > > > cast caused by the wrong return type. > > > > > > This causes meaningless ordering of both the cacheline list, and the > > > cacheline details page. E.g a simple > > > perf c2c record -a sleep 3 > > > perf c2c report > > > will result in cacheline table like > > > ================================================= > > > Shared Data Cache Line Table > > > ================================================= > > > # > > > # ----------- Cacheline ---------- Total Tot ----- LLC Load Hitm ----- ---- Store Reference ---- --- Load Dram ---- LLC Total ----- Core Load Hit ----- -- LLC Load Hit -- > > > # Index Address Node PA cnt records Hitm Total Lcl Rmt Total L1Hit L1Miss Lcl Rmt Ld Miss Loads FB L1 L2 Llc Rmt > > > # ..... .................. .... ...... ....... ....... ....... ....... ....... ....... ....... ....... ........ ........ ....... ....... ....... ....... ....... ........ ........ > > > # > > > 0 0x7f0d27ffba00 N/A 0 52 0.12% 13 6 7 12 12 0 0 7 14 40 4 16 0 0 0 > > > 1 0x7f0d27ff61c0 N/A 0 6353 14.04% 1475 801 674 779 779 0 0 718 1392 5574 1299 1967 0 115 0 > > > 2 0x7f0d26d3ec80 N/A 0 71 0.15% 16 4 12 13 13 0 0 12 24 58 1 20 0 9 0 > > > 3 0x7f0d26d3ec00 N/A 0 98 0.22% 23 17 6 19 19 0 0 6 12 79 0 40 0 10 0 > > > i.e. with the list not being ordered by Total Hitm. > > > > > > Fixes: 722ddfde366f ("perf tools: Fix time sorting") > > > Signed-off-by: Andres Freund > > > > Tested on top of Arnaldo's perf/core branch. After the patch, the rows > > are ordered by Tot Hitm. > > > > Tested-by: Michael Petlan > > Jiri, so you think we should use a different Fixes: cset? Or plain > remove it? I haven't checked it, just trying to figure out if you guys > came up with a conclusion so that I can review/apply. waiting for Andres's answer.. making sure I understand the issue ;-) jirka > > - Arnaldo > > > > Cc: Jiri Olsa > > > Cc: Andi Kleen > > > Cc: Arnaldo Carvalho de Melo > > > Cc: Alexander Shishkin > > > Cc: Michael Petlan > > > Cc: Namhyung Kim > > > Cc: Peter Zijlstra > > > Cc: stable@vger.kernel.org # v3.16+ > > > --- > > > tools/perf/builtin-c2c.c | 10 ++++++---- > > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > > > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c > > > index e69f44941aad..f2e9d2b1b913 100644 > > > --- a/tools/perf/builtin-c2c.c > > > +++ b/tools/perf/builtin-c2c.c > > > @@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, > > > { > > > struct c2c_hist_entry *c2c_left; > > > struct c2c_hist_entry *c2c_right; > > > - unsigned int tot_hitm_left; > > > - unsigned int tot_hitm_right; > > > + uint64_t tot_hitm_left; > > > + uint64_t tot_hitm_right; > > > > > > c2c_left = container_of(left, struct c2c_hist_entry, he); > > > c2c_right = container_of(right, struct c2c_hist_entry, he); > > > @@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \ > > > \ > > > c2c_left = container_of(left, struct c2c_hist_entry, he); \ > > > c2c_right = container_of(right, struct c2c_hist_entry, he); \ > > > - return c2c_left->stats.__f - c2c_right->stats.__f; \ > > > + return (uint64_t) c2c_left->stats.__f - \ > > > + (uint64_t) c2c_right->stats.__f; \ > > > } > > > > > > #define STAT_FN(__f) \ > > > @@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused, > > > c2c_left = container_of(left, struct c2c_hist_entry, he); > > > c2c_right = container_of(right, struct c2c_hist_entry, he); > > > > > > - return llc_miss(&c2c_left->stats) - llc_miss(&c2c_right->stats); > > > + return (uint64_t) llc_miss(&c2c_left->stats) - > > > + (uint64_t) llc_miss(&c2c_right->stats); > > > } > > > > > > static uint64_t total_records(struct c2c_stats *stats) > > > -- > > > 2.25.0.rc1 > > > > > >