From mboxrd@z Thu Jan 1 00:00:00 1970 From: Milian Wolff Subject: Re: [PATCH v6 1/6] perf report: properly handle branch count in match_chain Date: Fri, 20 Oct 2017 12:21:35 +0200 Message-ID: <4075632.NPQJP4Tzi9@agathebauer> References: <20171018185350.14893-1-milian.wolff@kdab.com> <20171019135519.GC5109@tassilo.jf.intel.com> <20171019150108.GA24104@danjae.aot.lge.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: Received: from mail.kdab.com ([176.9.126.58]:37546 "EHLO mail.kdab.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbdJTKVk (ORCPT ); Fri, 20 Oct 2017 06:21:40 -0400 In-Reply-To: <20171019150108.GA24104@danjae.aot.lge.com> Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: Namhyung Kim Cc: Andi Kleen , acme@kernel.org, jolsa@kernel.org, Linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , David Ahern , Peter Zijlstra , Yao Jin , Ravi Bangoria , kernel-team@lge.com On Donnerstag, 19. Oktober 2017 17:01:08 CEST Namhyung Kim wrote: > Hi Andi, > > On Thu, Oct 19, 2017 at 06:55:19AM -0700, Andi Kleen wrote: > > On Thu, Oct 19, 2017 at 12:59:14PM +0200, Milian Wolff wrote: > > > On Donnerstag, 19. Oktober 2017 00:41:04 CEST Andi Kleen wrote: > > > > Milian Wolff writes: > > > > > +static enum match_result match_address_dso(struct dso *left_dso, > > > > > u64 > > > > > left_ip, + struct dso *right_dso, u64 right_ip) > > > > > +{ > > > > > + if (left_dso == right_dso && left_ip == right_ip) > > > > > + return MATCH_EQ; > > > > > + else if (left_ip < right_ip) > > > > > + return MATCH_LT; > > > > > + else > > > > > + return MATCH_GT; > > > > > +} > > > > > > > > So why does only the first case check the dso? Does it not matter > > > > for the others? > > > > > > > > Either should be checked by none or by all. > > > > > > I don't see why it should be checked. It is only required to prevent two > > > addresses to be considered equal while they are not. So only the one > > > check is required, otherwise we return either LT or GT. > > > > When the comparison is always in the same process (which I think > > is not the case) just checking the addresses is sufficient. If they are > > not then you always need to check the DSO and only compare inside the > > same DSO. > > As far as I know, the node->ip is a relative address (inside a DSO). > So it should compare the dso as well even in the same process. Sorry guys, I seem to be slow at understanding your review comments. match_address_dso should impose a sort order on two relative addresses. The order should ensure that relative addresses in a different DSO are not considered equal. But if the DSOs are different, it doesn't matter whether we return LT or GT - or? Put differently, how would you write this function to take care of the DSO in the other two branches? I.e. what to return if the DSOs are different - a MATCH_ERROR? Bye -- Milian Wolff | milian.wolff@kdab.com | Senior Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts