Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3429347rdh; Mon, 27 Nov 2023 14:14:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUDwOlRj+9G77UxKtOeejLcGoasIrL9WigvHNg9abAS9+ykO8f15lN3kEQAnDgfEHVy1IN X-Received: by 2002:a17:90b:384a:b0:285:adbb:6ead with SMTP id nl10-20020a17090b384a00b00285adbb6eadmr10131083pjb.0.1701123240578; Mon, 27 Nov 2023 14:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701123240; cv=none; d=google.com; s=arc-20160816; b=cNSjK+lcWufjw8OCNdnJHQql8Jnik3n6AnJxPPBqqM4w0yHM0N2P98kML5h72bh9on 2oRraTqTTIc8GzDMLOlITuzsUdA4YH52ox5eUdq/PVHYOO7UtVWzgedqdRis0JFMHBva 0ocJoWZAbY46pMyhLVcXtKl/ZeD6DN+BzAPdg72QCA4YxOCac0R81PAlQ2KLFJU252F1 cixm/U3t/bYsDBmHiHmRlU2JV/LZY7+T9j2jqwvJwKd92M3Vq/Ki6GjfnWCzeYydNDqN x4DpFhrSjjQBfc0jEfQl3YQLpncfQ4EUDjFpPxmU0Dz0VY2yc1UCa9Ki/Pg0Xjaxgumc FUzg== 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=Xp8iIxo035oHbvCFG1UawGFv2rk11B4jTXVswVvjASk=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=wYniRRB3Bn+Ic1w5CJ5Z28CIs4dQr4XevHUzZrnr1xnP1ntFWCFCCyWkQyO7+KQV6U p5aEEjDiwJimNeF3oArResFHEjDyc5PzZr0O8al/gtDeSbphJ9hT1dfoH5EWPRNgoOYL /N/0obPmXH5XuWJomni3RYFv5wWWZ3MGQMu/p9B1WgRysuVdonupUxU6O8qMi7qGwzxf YDchm2wAQ71XczaGASmOPI7B/HsXtJ1dfPMnYuvYLEdwAvK1Gyx+RTh70FlYXM/L6dEt 2A0EyJPIA5g0fe1t9ssnbfkiy/ydKi/7CoyReupA2l1GgMI9+66byG8SsDEI6nyDYXeD ExaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="BUrE4/XM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id lx2-20020a17090b4b0200b00285bcb75b77si4071071pjb.75.2023.11.27.14.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 14:14:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="BUrE4/XM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 88119807502B; Mon, 27 Nov 2023 14:11:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234214AbjK0WLH (ORCPT + 99 others); Mon, 27 Nov 2023 17:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbjK0WKe (ORCPT ); Mon, 27 Nov 2023 17:10:34 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5281701 for ; Mon, 27 Nov 2023 14:10:11 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db3ef4c7094so5513143276.1 for ; Mon, 27 Nov 2023 14:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701123010; x=1701727810; 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=Xp8iIxo035oHbvCFG1UawGFv2rk11B4jTXVswVvjASk=; b=BUrE4/XMQNQ1Ra4CBGM1v3cF4C7O32Gl+n96nIN4DM6rc1W2CzhsGnHacDEPHyU5X6 15RKWKSch4tTWHHa1f5wq0xKJGfdI57w7vWHmc5lNizb2sjj5r5bsoAK3vsLfmpta9tM dAhJPfivtEt2QWVn6acsGOeZZ4KVxxvl9TYS/2xi9Plam4LTGEnEwKe1pmu6txI0iT6s ONpZ2Gl15Oms1QYGJ6TPTle+HG/2mwIZsrNpeUMROa4gLCKOk1ONyhQZU8iE05JZdNvG SM0NJbeqN3WvECRIthmYl9dO+aySHjRsPasf/EyqEnwD7i6LfKE9+E7UjkIVJ+pa0RTj 4IHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701123010; x=1701727810; 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=Xp8iIxo035oHbvCFG1UawGFv2rk11B4jTXVswVvjASk=; b=a/sEbeEdEnLwd2WDq2DydzndIHbCVPlLgIdb7cO5xCEh/oERilPYYkOmn9oEwUMT/x klSE6GNswri/2jzxb1UqJ1BA+RcJb1SbFc5CfgACcRdsBoDFNLVY1AdzEnWLcsI8THC/ WcwJK7FQcLVWSYmlMv1VkXgyPu1L7u2gsv9PSYo1k8teXv80VRbxqIPYr1CmC/I6iQM9 5G+o5EjUpMXR5Jv63JV55UBILLWl+zbNO8lgZgRh9zco/mxxA23BdQ+J6Y+s/atJtrQF bC1BtD/bAhLL1Fuo3zp09REQseIpVV7kmKiAgnoQ4GlU9wXI9tgtJCOyzz+fvHP4wa66 7E2w== X-Gm-Message-State: AOJu0YySy4An5rRKPzhnF01mkJmS582GcR71iHuZKx9ViciIhzViacqH XADo0O6XQ7WRxMnUUtQuxwHWalWlQOQa X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:829:6e77:9093:f39b]) (user=irogers job=sendgmr) by 2002:a25:3383:0:b0:da0:c6d7:8231 with SMTP id z125-20020a253383000000b00da0c6d78231mr445480ybz.0.1701123010280; Mon, 27 Nov 2023 14:10:10 -0800 (PST) Date: Mon, 27 Nov 2023 14:08:32 -0800 In-Reply-To: <20231127220902.1315692-1-irogers@google.com> Message-Id: <20231127220902.1315692-21-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 20/50] 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=-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 27 Nov 2023 14:11:28 -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. 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 3c967295c9a3..191e492539e5 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -454,7 +454,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 14e1a169433d..85bea2a6dca9 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -452,12 +452,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.rc1.413.gea7ed67945-goog