From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B554C7EE29 for ; Fri, 9 Jun 2023 19:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bsfwnuzOzfiEVyhpD2bcu8781ZX7FV0RdfxZnWUYTDk=; b=LuRcsL7vfw7S6A jSiQrHwZV+D21JKWv8WKk8yuURGN5SaItrOKIs1hchDmsj4gUh7SjTcHgko/bpfX0C/UQyScXGoj2 cIFIUYKZTi2n8DLZKwwxq10vDXBqjtmW/v3/tyJRIHl5ZA4Ckzx4vRI/Nc2gwNbzjcpkHen/TDzls QudURNQw2FCshNk2XHjlhQp/0diDBZDq3Hko/TthdvVfQk7aitVCc4FGHBzhitJXwbogm0HWuRaKu 8TsG2ZMf7y5+OEmodZplbyoFVC18bGMeEdBQYzhajxhvOaJRSJ1omI5lHP2M8TcUTX9VodAW4jlkv 6npq2VJqeZ5UO89kq7zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7i5l-00E2tv-2z; Fri, 09 Jun 2023 19:48:13 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7i5l-00E2tV-02 for linux-arm-kernel@bombadil.infradead.org; Fri, 09 Jun 2023 19:48:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oj175d+449m+6zFr0Y5fAgs5ybritiwRXRykDH2Q6nQ=; b=KIcHHwnCi9l+jGMSsFzV2lqwuu CY70iS8gAe0JGtI4FcUQTZHH5mp9GbWpHy7PKRB++/xsjq2SkolUsqkB/6yLh9djUN8YQKkt93il0 X5Q3alrqiDYqPk9kUhwfvYPQrexCSpFKhLJZJGKNx3duaW6UpQGpMj1Gu7vPLe+ed/DnvkATP3HIH 04Eyt1AWvtRTZoaks81H2hE+hiScDozr1q7i5CiKbB7GA4bKJoyi2S3Z5R25DA7PpokY5kBhVj512 P/tm8AahsmTiNamil3eoZmmvn/szLydn2uUv680K4/dpYu0nQ9usfHFHT8NKyXvoTRD5Y5zTr3HDK WyxgXEsg==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q7i5i-007HqD-1V; Fri, 09 Jun 2023 19:48:11 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BAEE940692; Fri, 9 Jun 2023 16:48:04 -0300 (-03) Date: Fri, 9 Jun 2023 16:48:04 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Suzuki K Poulose , "Naveen N. Rao" , Kan Liang , German Gomez , Ali Saidi , Jing Zhang , Athira Rajeev , Miguel Ojeda , ye xingchen , Liam Howlett , Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong , K Prateek Nayak , Changbin Du , Ravi Bangoria , Sean Christopherson , Andi Kleen , "Steinar H. Gunderson" , Yuan Can , Brian Robbins , liuwenyu , Ivan Babrou , Fangrui Song , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, coresight@lists.linaro.org Subject: Re: [PATCH v2 06/26] perf addr_location: Add init/exit/copy functions Message-ID: References: <20230608232823.4027869-1-irogers@google.com> <20230608232823.4027869-7-irogers@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230608232823.4027869-7-irogers@google.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Thu, Jun 08, 2023 at 04:28:03PM -0700, Ian Rogers escreveu: > +++ b/tools/perf/builtin-kmem.c > @@ -399,7 +399,9 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample) > struct addr_location al; > struct machine *machine = &kmem_session->machines.host; > struct callchain_cursor_node *node; > + u64 result; > > + addr_location__init(&al); > if (alloc_func_list == NULL) { > if (build_alloc_func_list() < 0) > goto out; > @@ -427,16 +429,19 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample) > else > addr = node->ip; > > - return addr; > + result = addr; > + goto out; > } else > pr_debug3("skipping alloc function: %s\n", caller->name); > > callchain_cursor_advance(&callchain_cursor); > } > > -out: > pr_debug2("unknown callsite: %"PRIx64 "\n", sample->ip); > - return sample->ip; > + result = sample->ip; > +out: > + addr_location__exit(&al); > + return result; > } I needed this to make sure result is set to something, mostly keeping the previous logic as build_alloc_func_list() already does debugging/error prints about what went wrong if it takes the 'goto out'. - Arnaldo diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index a11f280d20bd3d12..96a6611e4e53f448 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -399,7 +399,7 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample) struct addr_location al; struct machine *machine = &kmem_session->machines.host; struct callchain_cursor_node *node; - u64 result; + u64 result = sample->ip; addr_location__init(&al); if (alloc_func_list == NULL) { @@ -438,7 +438,6 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample) } pr_debug2("unknown callsite: %"PRIx64 "\n", sample->ip); - result = sample->ip; out: addr_location__exit(&al); return result; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel