Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp975419iob; Fri, 13 May 2022 18:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM6ljnwLZoZuqIOtNY+nEqFQjKuMgLu8gRLmNiDFe9jWIsEW3c+drh3S7DoVNStBHRiRFq X-Received: by 2002:a05:600c:2e12:b0:395:b6ae:f551 with SMTP id o18-20020a05600c2e1200b00395b6aef551mr6853778wmf.36.1652491000179; Fri, 13 May 2022 18:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652491000; cv=none; d=google.com; s=arc-20160816; b=GmD0VboOmAnj4s0Cp+LfWATIO/VaKtEM05R3+mUMC441QJa3otrjqFvOD+LMkYiSA5 hopnFlCqLsk3jwT2LVOKe7uBYDfFkBqagmEJB9nz7biX1HOv2wjxZtctHJflJdMrZDmB wBhGph5lLR2l2KVEMC65A53GxBJqrUr5ZJ0h+M4j4lrQ2XYojQKF64AbDRBmh/HY0qYz A96osqjvcHQMieaOnd8Z4KMCW/H+YCVVQJtqYSEdWphA/vS6mqQIeqMxJj8CxuJQL+8X szcPEblc92mNGoG/TXkJI8/SiGP1ZWMX8O5NvNGdx+yYQShJFZj82ijpGXamYjCGzeAY 7sEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EVdWbIE56XbsAUR+25booxhNWEqZerSt05WfJuHrspg=; b=KIPlPujOJC/G3MY1WTn8sBxDzAOmzM3DrOi893UvS+UuX/zLBvVcODPboSR7V7KZ2K n9NhcDpkgWpSQS2tGBrPVC2cGU6kqEB1lpNUv92/ULnvLUAM285/psPN8opTgqNmB3U2 7i9sAsZQYnCo98cXa7Phydwv9zCQibz+GrWy6AFcdKGocxuCLyN7sP91z3dF9c2IiI4d kOC3VVU9b6c0UuJoC07spT8r2GctlLgKijJIfcgkrzx++hJk/Kqeyy4tMypSa8jmTxr7 d48SSEY2TbJOi2/0wCEiQyef4w1w2yy3GTpW0WUzdXAkmRpP3f7zn3MKD9BBWD82M6eM PW5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FXfx3lJ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 11-20020a056000154b00b0020c7e230c72si4367622wry.826.2022.05.13.18.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FXfx3lJ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B0823B1235; Fri, 13 May 2022 16:47:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378831AbiEMJDD (ORCPT + 99 others); Fri, 13 May 2022 05:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378744AbiEMJC5 (ORCPT ); Fri, 13 May 2022 05:02:57 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72BEA939EE; Fri, 13 May 2022 02:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652432576; x=1683968576; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/iND+4oDvVkD/6SGZOA2dZZ9Z7Of4oGc/qJILLKB+gA=; b=FXfx3lJ25MJqpjdWHTplC8jVRujINmMeLSbw4q582lylUIxRBOchFU1i Jfb9jYCLdeO+N91fQdiBZ7G7YbkkrOYIKY2okZVb7lBUIq/9Wu4K2HFzU Ihw8/BSLSlExZdiTy40gLqWdBAjh8KbG8tw7bxdh5eaHiXJQOylM9xp9Z gikvOE341wm3jWvp4tnI6k/QU2oLED4bUNT0lvpVEE7KgErptFJvnM6uV 8tVyJ4mlfp3RN6swobABWSIuWtJA/5/4jqvU1w12PVfmUWkEjgiV800JJ z0FQb8+/O3DCwfMr8tLf65MDxEVMELZoizwXDMrtXRbk6K2iV0akO7wcB g==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="330856465" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="330856465" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 02:02:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="595129559" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.36.190]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 02:02:52 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , Leo Yan , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 1/6] perf tools: Add machine to machines back pointer Date: Fri, 13 May 2022 12:02:32 +0300 Message-Id: <20220513090237.10444-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513090237.10444-1-adrian.hunter@intel.com> References: <20220513090237.10444-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 When dealing with guest machines, it can be necessary to get a reference to the host machine. Add a machines pointer to struct machine to make that possible. Signed-off-by: Adrian Hunter --- tools/perf/util/machine.c | 2 ++ tools/perf/util/machine.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 95391236f5f6..e96f6ea4fd82 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -299,6 +299,8 @@ struct machine *machines__add(struct machines *machines, pid_t pid, rb_link_node(&machine->rb_node, parent, p); rb_insert_color_cached(&machine->rb_node, &machines->guests, leftmost); + machine->machines = machines; + return machine; } diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 0023165422aa..0d113771e8c8 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -18,6 +18,7 @@ struct symbol; struct target; struct thread; union perf_event; +struct machines; /* Native host kernel uses -1 as pid index in machine */ #define HOST_KERNEL_ID (-1) @@ -59,6 +60,7 @@ struct machine { void *priv; u64 db_id; }; + struct machines *machines; bool trampolines_mapped; }; -- 2.25.1