Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3430593rdh; Mon, 27 Nov 2023 14:16:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IG24Cr80Y0+5AuZjV01HDvr3YwqoVBu4ZQV92R2yc8SSNIvB6L5yBu82sGBG7Tm+pkHPinu X-Received: by 2002:a05:6a21:2c83:b0:18a:d4c5:2842 with SMTP id ua3-20020a056a212c8300b0018ad4c52842mr9630138pzb.33.1701123370611; Mon, 27 Nov 2023 14:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701123370; cv=none; d=google.com; s=arc-20160816; b=x0izrQFGhwduORYCeXaWMSPjNhhUXksM/2TO/vetILucKlMMzyEW/XkBXCb+wwWQ8X oPdnLQZTbXnqagE/sh85zLhfs16zr9ArExVNhfg4ILGPPI/1ajDtj2HcP4po8WqjkYs9 yKP6+A91QK23ZO1Ky175xdWHB0W+9RKOzqFoLE9l4zHs9vwdeEVZFxBn4ZZEPC2FUK9l wUf9dKceflpE6BoOrzlhIZkw+MF7ebDupDVVMXYKiv8DW8x73iNmU3FQ9Niei4hLatiB uxe7rQRQ+M/N/dcCY2UoXY9adhBRc28a/uKAx9560Wx7kRi6706zdTcaaNFcNpPzTffA nGlQ== 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=4wSAh26bOFuK46pelhW7xt46dEdfvdkTq4iPcKBortg=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=dyd7TzDv3xkJnVXuVRO0lUEcbY3n1gFjRDZ17B7XQ60CMbCo0swT65mVfjFtO1xQO4 lfWwaD+6r0naHsNOdL2FHBswbGy5RaUjOP2h8fTGqNB4U/ln2uGozcsPe8F5dSWA2sUX GfHVHzOfRvFl/YweBw2qmWvFqizr4XAMwWpMGURIYDF29+tvzQ7t1Df+PFc8zNzu4R10 LEH3AbNXIVr24QlGCR/lEcbP++wDBAqVkRyKUyfYaTdLiVlSFs5eUnA6pPvtqH268r/H cEh0tAxKeKzg1AnATkRIAeSL3HW/QxEiwAQfLbCWITbk155yHdkRNqyE3C1tp+hei544 W73A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XYwqrCHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id a2-20020a63e842000000b005b90e67f438si11080053pgk.106.2023.11.27.14.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 14:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XYwqrCHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 02FC4809C10B; Mon, 27 Nov 2023 14:15:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233657AbjK0WO6 (ORCPT + 99 others); Mon, 27 Nov 2023 17:14:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbjK0WOG (ORCPT ); Mon, 27 Nov 2023 17:14:06 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989DA3855 for ; Mon, 27 Nov 2023 14:11:07 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-db410931c23so5795641276.2 for ; Mon, 27 Nov 2023 14:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701123066; x=1701727866; 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=4wSAh26bOFuK46pelhW7xt46dEdfvdkTq4iPcKBortg=; b=XYwqrCHAG2/ZWR0C0ArOxJizZDgnoPPzK5OBeBVN5yRcDmBJDhpcSeko/r7eNDpnGJ iC+u/19NHoXzFqc+l/uOCjXca8vWnQl8w8DOwWX0EMd5ji54oCjUtA6visSx8MzImp25 Jm66cILhQIGC/A7l+ZSrdQI1CrYoWAGI7zCIjAcsoOg+UAjtE+Ybpj5S13+J8WgQdrzh o7mPTPsdg9+aTKYI6AqJdtyElcQumv5a/6mYEqt55Nm0nV8KnhyNhECGpQL1Gtx5rqSu WBAYOr/kDVwfH9H20ZkyEPbDsZZIfh1Q+mmaH/Qyne32dLp10Z8D1ncsV4Kxs6dRWlUS Pv0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701123066; x=1701727866; 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=4wSAh26bOFuK46pelhW7xt46dEdfvdkTq4iPcKBortg=; b=QAJFiWovympDdKjMeYPK0Q8xNxA4eg7bR/Wb2G4D8jNjyp+/UDwCNhQlZuAw7qUuvk UifrK3mVD8Y0vH17FcmuZ7aRoKkCuW0CxP8W6g6o4Gvm7RBecp5xKsKBGrHUV9KB2C+G TA3t1DC93EuFQqXAc2FpoJb6iuEuVFOq4RbG7By7PhWMES0NAC0RRxJK0h6IA3XzoCul ohjdwxKeBa9J0k9z/qvDAP+kwK23Em02Mj9LpeMxiPWQT0Uat9lKcua13TY7ddBokN9D 5OGHzVrS4pU5CKTHWxPudZeV04p93fgssYLSlWNvIzj++F1gGo0qvPWzlKQbtyHrGiaJ Vbpw== X-Gm-Message-State: AOJu0YwcgIBGSLBvNh/BJKKcvppVtHNNP8dxZT4PRyhuv6+62sug6mKM yok6K+sva3YSrlWkUKuPWkBNVQA3A5d4 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:829:6e77:9093:f39b]) (user=irogers job=sendgmr) by 2002:a25:ab8e:0:b0:db4:5db7:9519 with SMTP id v14-20020a25ab8e000000b00db45db79519mr391813ybi.3.1701123066435; Mon, 27 Nov 2023 14:11:06 -0800 (PST) Date: Mon, 27 Nov 2023 14:08:57 -0800 In-Reply-To: <20231127220902.1315692-1-irogers@google.com> Message-Id: <20231127220902.1315692-46-irogers@google.com> Mime-Version: 1.0 References: <20231127220902.1315692-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v5 45/50] 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, Guilherme Amadio 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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 14:15:21 -0800 (PST) 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.43.0.rc1.413.gea7ed67945-goog