Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1945758iob; Sun, 15 May 2022 03:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1IAaU1063N9YKBy3RDozRs2HoxLYewLQgpjJLMhbX0YyHifNNQ7b8WD0d7kYxfW0D2fSz X-Received: by 2002:adf:ebc7:0:b0:20c:d65d:3f19 with SMTP id v7-20020adfebc7000000b0020cd65d3f19mr10379419wrn.613.1652610749117; Sun, 15 May 2022 03:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652610749; cv=none; d=google.com; s=arc-20160816; b=Q/Tq7g5gkll8Jc/NwL4ow+e0PSa7xdOidvlKADkmr46v+h5ur2i3i5WiWEMAN0vIjy gMvZu6ZYSNECOaRzHV7OuMatuQCKq6WnWIXZ+euqFYXOmdlG2+p/dtxz13I74aKnzL+6 MIOFMEO0GU5x1V5jzoGhqESzMYsignEoUYWhaIdXzhCYMTHM95DkJWr4gj2iKsBbeg4U zyjzdtpnvtmnxKI7XjTy9lPJiRlt66l6fhRaiRC4d+t7D0U0ICVKLHLz3bsBG8l+mZWx 9NL8AjwHjWb7wlu0pa4vdeGcTY2LOORrL2T7NqC9GbDljgTe2X7U9GSTlMVB3tqAZkBd BqjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=yXHFXgvLl62fv3t0D8YY2SBzAQnYa/x+26txUxyCkbs=; b=ozKD9QSfqI5zrK6QhX+C+JGuNVKNOADAj/hU7Z5+bvVFYa5e3OmjxAr8HL2xQKdpql CUa3d9hddCapORoG0AnPwz2GGU2u2nTj+FwWi8jckzWwVC7ZW+GVvAwQODj2xHtuz6D/ qkkxz/9rWVcGabRl7ZswXf+I86sCmQp+CI9B3Set1Iynaj3DpSle/jjF+D9FdQVrmeVc EOQhfHxmEDgwkFzQE7bIhqGUJFCRecRmzOrEAS1L+6ozUoMHFrsFh2ZHhq1WFFa99KUJ yC+yL9uczZbsf1ukqMKNcQONtFWLre5COzugB5J/kZYPpqOhrajNl0iLgmGgBVOhDAYA CbOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fPYuatnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a05600c2cc900b003948b635e22si7827191wmc.53.2022.05.15.03.32.01; Sun, 15 May 2022 03:32:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fPYuatnl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234083AbiEOH1y (ORCPT + 99 others); Sun, 15 May 2022 03:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiEOH1w (ORCPT ); Sun, 15 May 2022 03:27:52 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E959AB874; Sun, 15 May 2022 00:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652599671; x=1684135671; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Smy0VW9Z/B0hw61N8jmj4g4kLpvB1teUObFaA9+9Bgw=; b=fPYuatnlvF1Nozp1hkrsg/XrTkjbnKkp7XYNN5RnxHjrk3HvvxSXxIT4 R1ehTedzYTfFK+fqk4J/Rkuo3D+MKjOma8ia2Iudti13fF2GAGgnXO6c4 7PAkyZXHY2SU4/qKDYLPQQ51EmUU8HcX+pNwTl9ddmx4No09OiWf/G/5K RLexhYmFqs9pixYpySJ6QukU+0fOO1STiYCpe8LMz5vcGwcykfMbK4OW4 oexMj/XgfKm2gKb4RYOsf7sWdb/EfqCewLsyNNFZ01W7QaPhE+rbW5Xtq 734WXDqwZRnFbUyoPZ4pvqyIP9qzgZOiXgEYh1YzvyuLDmyF9Op5CEdJq g==; X-IronPort-AV: E=McAfee;i="6400,9594,10347"; a="295864279" X-IronPort-AV: E=Sophos;i="5.91,227,1647327600"; d="scan'208";a="295864279" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2022 00:27:51 -0700 X-IronPort-AV: E=Sophos;i="5.91,227,1647327600"; d="scan'208";a="595975304" Received: from fiegl-mobl.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.51.28]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2022 00:27:48 -0700 Message-ID: <47690d71-6ebf-b85c-97f7-d37b20f3cd65@intel.com> Date: Sun, 15 May 2022 10:27:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.8.1 Subject: Re: [PATCH 6/6] perf intel-pt: Add guest_code support Content-Language: en-US To: Andi Kleen Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , Leo Yan , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org References: <20220513090237.10444-1-adrian.hunter@intel.com> <20220513090237.10444-7-adrian.hunter@intel.com> <875ym9h4mt.fsf@linux.intel.com> <871qwxgv1e.fsf@linux.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: <871qwxgv1e.fsf@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 13/05/22 21:13, Andi Kleen wrote: > Adrian Hunter writes: >>> >>> I'm still not fully sure how it exactly finds the code on the host, >>> how is the code transferred? >> >> I don't know. From a quick look at the code in >> tools/testing/selftests/kvm/lib/kvm_util.c it seems to be using >> KVM_SET_USER_MEMORY_REGION IOCTL. > > Okay so it assumes that the pages with code on the guest are still intact: that is > you cannot quit the traced program, or at least not do something that would > fill it with other data?. Is that correct? > > It sounds like with that restriction it's more useful for kernel traces. These patches are to support tracing of test programs that *are* the hypervisor, creating, populating, and destroying the VM. The VM is not running an OS. Like: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c guest_code() gets mapped into the VM at the same virtual address as the host, so the Intel PT decoder, which wants to walk the object code, can find the object code in the host program.