Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp558685rdb; Thu, 2 Nov 2023 11:05:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTJi7ol9o3ceWVi+MFfOFvZnbBfR8TWB/0oDXd20A7AHmEKYBgBH3RRx4+3exDorBtzPX4 X-Received: by 2002:a17:902:c946:b0:1cc:5589:7dba with SMTP id i6-20020a170902c94600b001cc55897dbamr12539328pla.43.1698948345936; Thu, 02 Nov 2023 11:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698948345; cv=none; d=google.com; s=arc-20160816; b=WkGmxp8BMLNk+bHmHBr0S5MMoIvGEt1DQEXfn+WuSlEIafHSgupIFiIqokPK9jJODk Vp5lqWWvvx2gNCzj99hpEfA72BUKXWDMjLhfIDGOs7oYPSqnF5fflGuMCeLySTPyLQ61 zaIL3mzPhnvXiDTuNf296AaQk2i4Q2ZkjPfCLhF20TMpquxYef8ezmt/i3K4OqRY4gT8 ZoCYuB/poCe1/2y3O6H1bbVI3WcVf6NZCKpMMmX4xWQErVsakkk4AtStST8eBPBGftNf 2nkKEQBY4zaEobCVsI31KwcpEksGu+Cw7KagAzw15pCgNWZWQ+KyC3dTDqfWBXDU63Sf FEHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=crhHdwgNdVgPwaFyhVa1Sf4kXmyuYN0V7L2Kpn4xK3g=; fh=z1KcSqUpYQ9oC4uLSeIkhAYTnJ2bvP0QbNW2xqV5NqA=; b=y7Rc/bKZwpfQrdoE3dml1/7rleGYb0veefr8CY6k2cPz+GdedHL38eB64QRT3SRtyf hiqHZ2KlmGu2DV8vna/JViFoxLMzx5+l64LXiJhdIvang5ehAbcH28PjjUATEs7E+VPK 3sQyJC6W+2liqQj/gNen99OlmBVVw6S3M8tkLPWRbsT4KmVjX4EwzKVyc8djKgRY/OKv VlpJvsEpDXnOsKdBy9gsi8+pueEsUQEMWqj2BA/xQXVTYcBaScCUN4K9QGV3VpUMYO3f qn0ylRG027C7C2gVzEd8+gM4iQYTYZqb6uWSbIQU2qgEXUtCqTAa6SI2yg9NfddpO6hA KqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wBuFwbCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id v20-20020a170902ca9400b001c9ad8ca211si71633pld.18.2023.11.02.11.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 11:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wBuFwbCw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0E5FF809CCB2; Thu, 2 Nov 2023 11:05:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234446AbjKBSEH (ORCPT + 99 others); Thu, 2 Nov 2023 14:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377159AbjKBSDf (ORCPT ); Thu, 2 Nov 2023 14:03:35 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263FA268F for ; Thu, 2 Nov 2023 10:59:47 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5a8d9dcdd2bso25330897b3.2 for ; Thu, 02 Nov 2023 10:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698947986; x=1699552786; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=crhHdwgNdVgPwaFyhVa1Sf4kXmyuYN0V7L2Kpn4xK3g=; b=wBuFwbCw31nqnnbwfHqB6+YQn5GCmd1sYTdTsOcicMMZBaSKVoJ1WtdOYghGbWN6GV sXMkJvuTP+b/Jta3Q/hno01sedd6eAX8mJHP2uuWfQn5TuYN5VT1YbF990J1gAPItmlu bGPwjkfMYzLrRdHD8ZODS6coOWQv1AIs4aP+0dTTUyDasy73+sPke7A+DNm46U0ZZoj8 So4bOd/fxYGXxURtTIegN6/ly1wRqsiDFLjoqM5qJ+wIKXdH7GipppNlHA+LAvW7Ynbb KRv7q47eEjO9SgRkpczxVKM7KI2Lvz1wRjmnBzdqjgGtpeQEQX0q+QMsYBF/VCIn6wQx SE+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698947986; x=1699552786; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=crhHdwgNdVgPwaFyhVa1Sf4kXmyuYN0V7L2Kpn4xK3g=; b=CjqnafhJGAHoBN65juTd2aOMhwqG0j+1wcTc8XW0+TJJMRNikwsF/AmA0b3KY+CFWr TCwVNri8Qd8HXBgiEAVjY9I6DXVJ8/VpvST1x7v+1k+1D0cgTSfQiy+7LNktvR9JrnCe ff5oKyu/LY9xAyqxrYj+gVwgsh69rw5/QnkBgqvLCKU53cgBYuQgjhecmY/w0suFulJZ CK/b84w07gexAzq3Tljjd5XEZB48rMNGndCyTIFHt/cMj411p5Awtd60p5U1lIdwyvjE 1iYvIMUKUTdFSaop1IObkWCNoUubW2LcTfC7aDJ/1qSU1KoyBeYyT+/7KBhhwzZIfzxR OdYg== X-Gm-Message-State: AOJu0YwxNSPBByCJ0KiQw7igvVU73eNG2nsK/f8Hz/lX/c8SFLesNQdQ Ju699ISlj0IF/W/gjCxFLHMez8AtgJU3 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:bb34:df9c:836c:afca]) (user=irogers job=sendgmr) by 2002:a0d:e204:0:b0:59b:ccba:1249 with SMTP id l4-20020a0de204000000b0059bccba1249mr6574ywe.10.1698947986093; Thu, 02 Nov 2023 10:59:46 -0700 (PDT) Date: Thu, 2 Nov 2023 10:57:30 -0700 In-Reply-To: <20231102175735.2272696-1-irogers@google.com> Message-Id: <20231102175735.2272696-49-irogers@google.com> Mime-Version: 1.0 References: <20231102175735.2272696-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog Subject: [PATCH v4 48/53] perf dsos: Remove __dsos__findnew_link_by_longname_id From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Kajol Jain , Athira Rajeev , Huacai Chen , Masami Hiramatsu , Vincent Whitchurch , "Steinar H. Gunderson" , Liam Howlett , Miguel Ojeda , Colin Ian King , Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong , Ming Wang , James Clark , K Prateek Nayak , Sean Christopherson , Leo Yan , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Li Dong , Sandipan Das , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 02 Nov 2023 11:05:15 -0700 (PDT) Function was only called in dsos.c with the dso parameter as NULL. Remove the function and specialize for the dso being NULL case removing other unused functions along the way. Signed-off-by: Ian Rogers --- tools/perf/util/dsos.c | 51 +++++++++--------------------------------- tools/perf/util/dsos.h | 6 ----- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/tools/perf/util/dsos.c b/tools/perf/util/dsos.c index 1495ab1cd7a0..e4110438841b 100644 --- a/tools/perf/util/dsos.c +++ b/tools/perf/util/dsos.c @@ -119,11 +119,6 @@ static int __dso__cmp_short_name(const char *short_name, struct dso_id *id, stru return rc ?: dso_id__cmp(id, &b->id); } -static int dso__cmp_short_name(struct dso *a, struct dso *b) -{ - return __dso__cmp_short_name(a->short_name, &a->id, b); -} - static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb) { const struct dso *a = *((const struct dso **)va); @@ -143,20 +138,21 @@ static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb) * Either one of the dso or name parameter must be non-NULL or the * function will not work. */ -struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, - struct dso *dso, - const char *name, - struct dso_id *id, - bool write_locked) +static struct dso *__dsos__find_by_longname_id(struct dsos *dsos, + const char *name, + struct dso_id *id, + bool write_locked) { int low = 0, high = dsos->cnt - 1; if (!dsos->sorted) { if (!write_locked) { + struct dso *dso; + up_read(&dsos->lock); down_write(&dsos->lock); - dso = __dsos__findnew_link_by_longname_id(dsos, dso, name, id, - /*write_locked=*/true); + dso = __dsos__find_by_longname_id(dsos, name, id, + /*write_locked=*/true); up_write(&dsos->lock); down_read(&dsos->lock); return dso; @@ -166,9 +162,6 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, dsos->sorted = true; } - if (!name) - name = dso->long_name; - /* * Find node with the matching name */ @@ -178,31 +171,13 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, int rc = __dso__cmp_long_name(name, id, this); if (rc == 0) { - /* - * In case the new DSO is a duplicate of an existing - * one, print a one-time warning & put the new entry - * at the end of the list of duplicates. - */ - if (!dso || (dso == this)) - return dso__get(this); /* Find matching dso */ - /* - * The core kernel DSOs may have duplicated long name. - * In this case, the short name should be different. - * Comparing the short names to differentiate the DSOs. - */ - rc = dso__cmp_short_name(dso, this); - if (rc == 0) { - pr_err("Duplicated dso name: %s\n", name); - return NULL; - } + return dso__get(this); /* Find matching dso */ } if (rc < 0) high = mid - 1; else low = mid + 1; } - if (dso) - __dsos__add(dsos, dso); return NULL; } @@ -240,12 +215,6 @@ int dsos__add(struct dsos *dsos, struct dso *dso) return ret; } -static struct dso *__dsos__findnew_by_longname_id(struct dsos *dsos, const char *name, - struct dso_id *id, bool write_locked) -{ - return __dsos__findnew_link_by_longname_id(dsos, NULL, name, id, write_locked); -} - struct dsos__find_id_cb_args { const char *name; struct dso_id *id; @@ -279,7 +248,7 @@ static struct dso *__dsos__find_id(struct dsos *dsos, const char *name, struct d __dsos__for_each_dso(dsos, dsos__find_id_cb, &args); return args.res; } - res = __dsos__findnew_by_longname_id(dsos, name, id, write_locked); + res = __dsos__find_by_longname_id(dsos, name, id, write_locked); return res; } diff --git a/tools/perf/util/dsos.h b/tools/perf/util/dsos.h index d1497b11d64c..6c13b65648bc 100644 --- a/tools/perf/util/dsos.h +++ b/tools/perf/util/dsos.h @@ -36,12 +36,6 @@ struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id bool dsos__read_build_ids(struct dsos *dsos, bool with_hits); -struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, - struct dso *dso, - const char *name, - struct dso_id *id, - bool write_locked); - size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm); size_t dsos__fprintf(struct dsos *dsos, FILE *fp); -- 2.42.0.869.gea05f2083d-goog