From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4216DC19F2A for ; Thu, 11 Aug 2022 17:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236760AbiHKRW0 (ORCPT ); Thu, 11 Aug 2022 13:22:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236251AbiHKRWD (ORCPT ); Thu, 11 Aug 2022 13:22:03 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C00C055B6; Thu, 11 Aug 2022 10:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660238384; x=1691774384; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=HaM7ltJcP71ySGrHR3YRze6Z8RdSBuajt+u9PP2+jLA=; b=Xq30Rb827YiRX21OcKvJtI7NwvBXnAvs1kCunr2Mvx8V2q6O3nYlUdZA D88ulFfFlD3spXr/fDzft4otEs3bz8XIT1vlvfWyr5ZcXgomDB6nMpJVd HhcsiqCJC0j49aIf2WwZ/aAD6czMcVzDz3JEOuushj/1r0cRXNDeQ3jew SwXbRhLcW+skWzozgKwXo49/+/dMFRww2SRtLBy/0wI19gH9kA2yk3fBN IhD9mKqOluP9ctoeuXJZ5YNmWNFkLXrEkISKwNnXKEV2l5M91BNvadSUl +Z4Dy3alI7+hlz29OPH0++zETd4vPoNMl2YKR9YGUEqK0q9JNVHJUP3e+ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10436"; a="292206221" X-IronPort-AV: E=Sophos;i="5.93,230,1654585200"; d="scan'208";a="292206221" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2022 10:19:44 -0700 X-IronPort-AV: E=Sophos;i="5.93,230,1654585200"; d="scan'208";a="665467167" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.35.150]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2022 10:19:41 -0700 Message-ID: Date: Thu, 11 Aug 2022 20:19:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH 24/35] perf inject: Add support for injecting guest sideband events Content-Language: en-US To: Ian Rogers Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20220711093218.10967-1-adrian.hunter@intel.com> <20220711093218.10967-25-adrian.hunter@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/07/22 04:06, Ian Rogers wrote: > On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter wrote: >> >> Inject events from a perf.data file recorded in a virtual machine into >> a perf.data file recorded on the host at the same time. >> >> Only side band events (e.g. mmap, comm, fork, exit etc) and build IDs are >> injected. Additionally, the guest kcore_dir is copied as kcore_dir__ >> appended to the machine PID. >> >> This is non-trivial because: >> o It is not possible to process 2 sessions simultaneously so instead >> events are first written to a temporary file. >> o To avoid conflict, guest sample IDs are replaced with new unused sample >> IDs. >> o Guest event's CPU is changed to be the host CPU because it is more >> useful for reporting and analysis. >> o Sample ID is mapped to machine PID which is recorded with VCPU in the >> id index. This is important to allow guest events to be related to the >> guest machine and VCPU. >> o Timestamps must be converted. >> o Events are inserted to obey finished-round ordering. >> >> The anticipated use-case is: >> - start recording sideband events in a guest machine >> - start recording an AUX area trace on the host which can trace also the >> guest (e.g. Intel PT) >> - run test case on the guest >> - stop recording on the host >> - stop recording on the guest >> - copy the guest perf.data file to the host >> - inject the guest perf.data file sideband events into the host perf.data >> file using perf inject >> - the resulting perf.data file can now be used >> >> Subsequent patches provide Intel PT support for this. >> >> Signed-off-by: Adrian Hunter >> --- >> tools/perf/Documentation/perf-inject.txt | 17 + >> tools/perf/builtin-inject.c | 1043 +++++++++++++++++++++- >> 2 files changed, 1059 insertions(+), 1 deletion(-) >> >> diff --git a/tools/perf/Documentation/perf-inject.txt b/tools/perf/Documentation/perf-inject.txt >> index 0570a1ccd344..646aa31586ed 100644 >> --- a/tools/perf/Documentation/perf-inject.txt >> +++ b/tools/perf/Documentation/perf-inject.txt >> @@ -85,6 +85,23 @@ include::itrace.txt[] >> without updating it. Currently this option is supported only by >> Intel PT, refer linkperf:perf-intel-pt[1] >> >> +--guest-data=,[,