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 833F2C43334 for ; Wed, 20 Jul 2022 01:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238164AbiGTBGm (ORCPT ); Tue, 19 Jul 2022 21:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbiGTBGl (ORCPT ); Tue, 19 Jul 2022 21:06:41 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0816148C94 for ; Tue, 19 Jul 2022 18:06:38 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id z12so24007879wrq.7 for ; Tue, 19 Jul 2022 18:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V1NMyozbYwh5KEsPJ8ZlH7KeX37FK7/6uteBlF3ALhk=; b=AunOv5X5zQ4ZJby2fLOaMCmqSr/9UL4VWMZpnP21ghGRYjW3niaiz+ot2xdu/nTLf9 ccBQgQz6JbjefYGakuh3kyO+QiGVzSysJLjMmc+Gj8D7tUMCTwlhH7DBzsAT6u0WqvHM cqZCRX4lhx67oa7l3I0N7e2/dUlCuB+OzUMO241G6dILPHQbwy/TlEpmf87HqIsDuhOi a0vHzIEN9OK93hAt2BHJMzUnpTUdwuOybyphasUSf7K5bpeajNA9jnBDxNXH4F8gjLOl TR6WBsiOLpN+k/rVvSn6r+vbZ12Is/PYf5g9Zh7FX7k84hY2e4b6gI+oaj/dfbga14Dv 7oDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V1NMyozbYwh5KEsPJ8ZlH7KeX37FK7/6uteBlF3ALhk=; b=qWuHuzotNxyuNanHFpGf2f0Xco0VfWokHNuvluwFhfr8L1K9r91U8q27bZTzVUS+Bc j1WHFNIITTMhVk+p9URVCYMOY3uWQQfd8tqKYFaMSCc6mvhlmC71hJHYkMV5FPe+TaUd EZ2SHHIK6apA3jar7ieA+ipMg1ZnBPIWIDJ3IsSop/ulcj0G3T4v6BGQETkC90LSo5LZ oNvv0HBZybK+1oEB0uYwdVUC/LW3AYGhyIYImbFAJUSORjAvjWO4VnsDpX4HM+elFRja /YWEdcOvF9eQp2gW0NZyM4ZWWkkDhxPC+Za3O9/U776qLvppTMINLtywbEGWTrBEBb+t +Fug== X-Gm-Message-State: AJIora/KxB3td2wxJa5iUhGewlqr2SjT7qFysePIe+b6ku860xMLZAsQ vjJvfo++nZgOoICfHfDl+H7c1oumvx68Y8gcJcfUVA== X-Google-Smtp-Source: AGRyM1vsQBECniTKFhV1Ox/M4+yMyzOpyGPFl3d5fbt2v9sPTf5Tz34TWl00YjkA7lCp6/za6EtZ0gtuUGE3lCa2af8= X-Received: by 2002:a5d:6a4c:0:b0:21e:46d4:6eec with SMTP id t12-20020a5d6a4c000000b0021e46d46eecmr1676512wrw.375.1658279196071; Tue, 19 Jul 2022 18:06:36 -0700 (PDT) MIME-Version: 1.0 References: <20220711093218.10967-1-adrian.hunter@intel.com> <20220711093218.10967-25-adrian.hunter@intel.com> In-Reply-To: <20220711093218.10967-25-adrian.hunter@intel.com> From: Ian Rogers Date: Tue, 19 Jul 2022 18:06:23 -0700 Message-ID: Subject: Re: [PATCH 24/35] perf inject: Add support for injecting guest sideband events To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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=,[,