Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2186594rda; Tue, 24 Oct 2023 15:28:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnHliM3yjgV85eo1KKXC9xkM1rfoAn0cI7yn7ZYkd1fw/5DisCBQO5lEnyIKDdLxZ49WOq X-Received: by 2002:a05:6870:15cf:b0:1ea:8645:6352 with SMTP id k15-20020a05687015cf00b001ea86456352mr11629101oad.11.1698186536006; Tue, 24 Oct 2023 15:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698186535; cv=none; d=google.com; s=arc-20160816; b=uGQSIrfRgXZ2Cjzb/yMbMSAWJE+EPJCeoN0xChx+0VLqL2zC4HhfHg1m9EXcEXxCFj NjwJu1+ecVlo9OahEqRTvIZGZEvx9XIYeOVmY4bQ4c6q6PNkeGG6q/74jJRmZIzrtwfH MgylYrGn8EmlP+TFOAiS2bM9mR8/AF/cOyAEX3/2t3R/V4SReW/oKXE4nY5o5+AnYJmb J3Y+5MZzBb2cQE0yNCru0461I+WpkAxYS40qHhbq/mY/P0MFs0xe6h3Ilx1DQe5zbFNO sQLai6qVexscPFy9z2OmGDgN8nBjzISLufkn07AHfJOscn6oK/A5jWy1WcCLtdiBw+lt ub8Q== 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=Ndf4120/UMb6KGHcRZrmqdMAZ7pHFTlKKfpIyLscZJ4=; fh=NAro5oTsDEB2Or99ABwb774QJkwQSkr6EoLVqn/Yde0=; b=uhgNs790uW8dagySxhasOAqWcBx3qw1PV3Qc3hCTlB6oHhrEMYrgZK8phVeLckkTSs TXCj3344cXMwvzECDDDLebR6eXsr8dsfHRCySO3pHzTKYn6y24gvFmEbYvWMFglaPUzO Fymr6QHQzLdobLgr/cAPfGNMzjxS/DNoW6YlpWqR4cqcc/bB3Fp66fI97Br3uViPjUMd 3cDqOTrpH1CPKou0+xkJiiZnr+V+PkU31C9tLmyfVlvLxFR4+8iZq2eyZVrPOdJheimr Aa11o/7VKvsYubaipj40/+4KfWjq4iOsqSWdy3d57dxjvVcyiLTHV9OolpM2x7Celq06 WeAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CoJ0f3p4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id v70-20020a638949000000b005aa0e024d62si8806095pgd.102.2023.10.24.15.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 15:28:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CoJ0f3p4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id C35828021B1F; Tue, 24 Oct 2023 15:28:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344620AbjJXW2R (ORCPT + 99 others); Tue, 24 Oct 2023 18:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344585AbjJXW1u (ORCPT ); Tue, 24 Oct 2023 18:27:50 -0400 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 A83CB273D for ; Tue, 24 Oct 2023 15:25:29 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d99ec34829aso5777361276.1 for ; Tue, 24 Oct 2023 15:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698186327; x=1698791127; 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=Ndf4120/UMb6KGHcRZrmqdMAZ7pHFTlKKfpIyLscZJ4=; b=CoJ0f3p4aWl/uTgfDXZxl8+eaIvudN6Nao8BPWMSORZARBSZFCwvZPAr/gXvByaAO/ JeCAHIIa+cg1qiUoM8rRBcbkDo2s+MoeBBnsKz1YNjcD+JdtgMMJh/6HZk/U5MsAY6K0 RwGh1L+kd7rnxXribEcJrRiea2p86EHxXmI33TuRVO63zbTWxFDmoPnrJGIKiONJ6xk2 qyYVQHM/8JwBECj+cBnYt2shdoRZnNYMpAtqshG16eei8z7Fpu9mQbUnhGQujFFKX3D8 UX7J7E6W/ZOJXzeNqfsV90KEoSYlTsRd40ttVBKiSbdhY/I34EdtOl7HIWlBc+fZW/94 2wNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698186327; x=1698791127; 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=Ndf4120/UMb6KGHcRZrmqdMAZ7pHFTlKKfpIyLscZJ4=; b=CP/XVjvqBoCE/wAdbxS71yXWTMr1yVlBYNb8IjX8Oi9a9sH7+DBdwbC9baeE7dZbLE bCWMLJXj9CsIa7GDhhp06vb5OEwXxeFrdbtmyY4XuSYN6n4DInwUOkm01vczK0GsnU+q bXyHA2NcnJH5e0P0IxsE/2wSczER8evhClBxeHLvCj1sbFHCo68YqChjZm+1Y4IrvoTR vj/AcR91xrQk6Fkjd6HnZiWalyKtrvv02/a3MeJOrm2kQoGj+ao+dTWP6gGctIR6qDPj qMSXDzVXU/sLPCXAJNiPs0OVuEP/t2gDRcn6vWfSKUHk2Nx+T5DTcishJ4BufFaVckEw wd3Q== X-Gm-Message-State: AOJu0YzRRmGwd4b+VyyZxNa8ivkIIrdpVvQ8DRFA8/a6YSe6GfPLUHlx o4zHCKcv9o80HvHuSKg2Tp/LbMN5xnGC X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:93d2:18cc:4d63:45ba]) (user=irogers job=sendgmr) by 2002:a05:6902:1083:b0:d9a:c3b8:4274 with SMTP id v3-20020a056902108300b00d9ac3b84274mr348613ybu.7.1698186327431; Tue, 24 Oct 2023 15:25:27 -0700 (PDT) Date: Tue, 24 Oct 2023 15:23:36 -0700 In-Reply-To: <20231024222353.3024098-1-irogers@google.com> Message-Id: <20231024222353.3024098-34-irogers@google.com> Mime-Version: 1.0 References: <20231024222353.3024098-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Subject: [PATCH v3 33/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 , Leo Yan , Song Liu , Sandipan Das , James Clark , Anshuman Khandual , Miguel Ojeda , Liam Howlett , Yang Jihong , Athira Rajeev , Kajol Jain , K Prateek Nayak , Sean Christopherson , Yanteng Si , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Masami Hiramatsu , 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,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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 15:28:54 -0700 (PDT) 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 cab818af6787..07b158aa3e44 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.42.0.758.gaed0368e0e-goog