Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1362325rdb; Wed, 6 Dec 2023 17:19:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0wsMGvJh+/0pVn5yiMEZCfl4QGytMKnoRDOWZrJG8cA0g9lMKsAjNeGXxujcDN1uL0roz X-Received: by 2002:a17:902:c713:b0:1d0:ab2e:8e8e with SMTP id p19-20020a170902c71300b001d0ab2e8e8emr1629102plp.82.1701911959087; Wed, 06 Dec 2023 17:19:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701911959; cv=none; d=google.com; s=arc-20160816; b=ZtuIzn4BgiAX6LRssWc9mEqNijmouOKPFzx9u2uxfuH3evdJI1+FY6QaqvtZdJWQjN +lOvd9efFxx3AzT7utcQ4G/VTItxvtZAhcIlX4QZdkp8AO2lwDqpYIkDSnVz+CNaRSdL fb1UHK8NrxAEH+TMtbAFduLkdECFk+dpdVqsQHKlP6VUjF+//AtoHuKbb7aSzv8aB8rr tMKFUzd3cm0i2zpPP17A+rT7Cs4psH6zRppZcbZE9LT4kuILFNWzCeYeD1dLOfVyylK1 XnIEcNCfGsCpVOZbEAxyWnLmCMncYaUMZlYLQA65OUDOTWCxtBeYt3jhIWFxZK8eMtxd Xb9w== 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=Fa0yzbvjGhr4NhEJ4udLP0p51ZFXxXnD3jAPwBOmSuU=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=DLRP4ihwz1iYJsXSkL8q98cuPMVx7YoQYICJBT/CUR+09pJ0Nsaf+2YOEgHDdGc3h9 pXvY6O2eF13qGFkgcZjpk0/qF8bxE493Sydr0JoZexuF0LAqYfdkj6Tv1pkG6JfvNGYs 5Bu/0rdbEBe586b0FJd/aFv6TB5oPTY67syJqdUuAKKr3M4xOejlgaxYgYolHQ88OzjR sHFaYm6YEMko6PH1pMMijMh6LMtAXBVQUuKdPA4/6flHnu2Jso+YlT0FkVgBC96dorK5 eRkHcLWmfDc69NK3KfvRsrFm0+0KHf+9W4KMsepeTTiLn2IHK0omoSI9VZyXxth0nfw9 svYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=MsxW6DNP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z8-20020a170903018800b001d08f1a5c70si154843plg.405.2023.12.06.17.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 17:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=MsxW6DNP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id EC51380D8F42; Wed, 6 Dec 2023 17:19:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442968AbjLGBTF (ORCPT + 99 others); Wed, 6 Dec 2023 20:19:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442976AbjLGBSh (ORCPT ); Wed, 6 Dec 2023 20:18:37 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 141E71BF4 for ; Wed, 6 Dec 2023 17:18:10 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5caf61210e3so2076327b3.0 for ; Wed, 06 Dec 2023 17:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701911889; x=1702516689; 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=Fa0yzbvjGhr4NhEJ4udLP0p51ZFXxXnD3jAPwBOmSuU=; b=MsxW6DNPjcm5lXhgrPs/F1kqrwe0yhpO3eU89Vd4QfVJDe7pnuSHMcJjSvNzpjn9fo ht3jV4NZ1hl9iqeyggKHTlN6v2jRjIKoMfgjNl1eSdPlkkDNiz+T5n856tr0wMSr4lzY /kLKEWH4Z7weuLpkCtBH1gKJchp4PI6OYP4uU9dnUfOxHOEQfXFOUgk2qp36YODGYL4N 3BxCHIKIJh7jQ1qkr9gAbm/mUDzM7Et0yshdYsH4F2lQrXyOB1LucdtQAwoV6FR5D2je IvL07YVtdJHhJcMUOdr6PolnBW6fVBB+YCkA1XkNYoJY6E2eAXr2h4O7ZwnB+gLKCsP3 Tykg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701911889; x=1702516689; 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=Fa0yzbvjGhr4NhEJ4udLP0p51ZFXxXnD3jAPwBOmSuU=; b=pZufeebayaNPJ1PSvokXOv9w3FicQMcKr1RdOUQKGtjnVyCQB2yNONbKVjpibD2+iL 9vx4lL+WBg5mf8eWnYISVMs5uFB6x2j0Rl91SHOKKsXlOSXY5xHj7ewx18LYTxfL0EmC 1eUtasvChWvxnqxTVNHjhScsSBdAaDvw/xmrqWzTKjqzsgV/sHsAjillQ344MrqQ1otn dQZZIVPLlLgJoIQhKtEvaYryTSJawcisUbL0NfbPYzfKIcmsf+nFsKPHX0W0sI99+wl4 z7N+FMyTjugxRyYvw0RVW0rPJeWFUSXaYWxkCHBbdidUBdak2ABF/WLVJi8RaKBULwPC S4qg== X-Gm-Message-State: AOJu0YzmsjTTQ6hWP4jz2FsCrUl6CAwum4hV6pdZ9vQRurlhcySHYkXe rGv9jFgRxI5NcU7qw+KbjoKo2Xg2zn+V X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:35bf:293e:7696:34e9]) (user=irogers job=sendgmr) by 2002:a05:690c:250b:b0:5d3:9222:a83e with SMTP id dt11-20020a05690c250b00b005d39222a83emr31358ywb.10.1701911888965; Wed, 06 Dec 2023 17:18:08 -0800 (PST) Date: Wed, 6 Dec 2023 17:16:52 -0800 In-Reply-To: <20231207011722.1220634-1-irogers@google.com> Message-Id: <20231207011722.1220634-19-irogers@google.com> Mime-Version: 1.0 References: <20231207011722.1220634-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v6 18/47] perf maps: Rename clone to copy from 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=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 17:19:18 -0800 (PST) Rename maps__clone to maps__copy_from to be more intention revealing of its behavior. Pass the underlying maps rather than the thread. Acked-by: Namhyung Kim Signed-off-by: Ian Rogers --- tools/perf/util/machine.c | 2 +- tools/perf/util/maps.c | 6 +----- tools/perf/util/maps.h | 3 +-- tools/perf/util/thread.c | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index ca855fc435ac..38bf7108821d 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -453,7 +453,7 @@ static struct thread *findnew_guest_code(struct machine *machine, * Guest code can be found in hypervisor process at the same address * so copy host maps. */ - err = maps__clone(thread, thread__maps(host_thread)); + err = maps__copy_from(thread__maps(thread), thread__maps(host_thread)); thread__put(host_thread); if (err) goto out_err; diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index f305a4834cf0..986daa1b0497 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -453,12 +453,8 @@ int maps__fixup_overlap_and_insert(struct maps *maps, struct map *new) return err; } -/* - * XXX This should not really _copy_ te maps, but refcount them. - */ -int maps__clone(struct thread *thread, struct maps *parent) +int maps__copy_from(struct maps *maps, struct maps *parent) { - struct maps *maps = thread__maps(thread); int err; struct map_rb_node *rb_node; diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h index 62e94d443c02..e4a49d6ff5cf 100644 --- a/tools/perf/util/maps.h +++ b/tools/perf/util/maps.h @@ -14,7 +14,6 @@ struct ref_reloc_sym; struct machine; struct map; struct maps; -struct thread; struct map_rb_node { struct rb_node rb_node; @@ -61,7 +60,7 @@ struct kmap { struct maps *maps__new(struct machine *machine); bool maps__empty(struct maps *maps); -int maps__clone(struct thread *thread, struct maps *parent); +int maps__copy_from(struct maps *maps, struct maps *parent); struct maps *maps__get(struct maps *maps); void maps__put(struct maps *maps); diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 3d47b5c5528b..89c47a5098e2 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -390,7 +390,7 @@ static int thread__clone_maps(struct thread *thread, struct thread *parent, bool return 0; } /* But this one is new process, copy maps. */ - return do_maps_clone ? maps__clone(thread, thread__maps(parent)) : 0; + return do_maps_clone ? maps__copy_from(thread__maps(thread), thread__maps(parent)) : 0; } int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bool do_maps_clone) -- 2.43.0.rc2.451.g8631bc7472-goog