Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5952546imd; Wed, 31 Oct 2018 04:47:38 -0700 (PDT) X-Google-Smtp-Source: AJdET5evoV0Q8RpUwQcL+4Msh02+txLoeHLyytfcJpbHpjvcaf6mEfy+1vplDXStweBa2erIWUAx X-Received: by 2002:a17:902:904a:: with SMTP id w10-v6mr2942723plz.225.1540986458508; Wed, 31 Oct 2018 04:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540986458; cv=none; d=google.com; s=arc-20160816; b=DI3/Fq1fpjj3gQjqxBA2Nf0Ss/nQcqvqdEcZT2g3aaFb6II2ueWzHdFUcWCpLMHejL W84anBt8F5WTgr3m6PhLL0aB4jj4eoHQiCB9jLRzRVVZx2CGsPeIU4WQFtBQ6+5VQFbG ZAlpBzUXuGXvloYEzCM613gU6msNot74g1QQEeEbBx/QqpQj2UeV5zpqrtmfFcMiWDyl uiBa5yrwe3tqZFqK7cZ5uLFjsuYJRgoefjC4hVaEZuCNM6L3eB/tS7UaGSQ0Ol8TL8g7 fNdkPebi/Jk9u+CLuHtQlemkx15oY7qj2xQqwbhGw68yETzrJA15VLGmiVI4TZJ5/b6P euIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=jvwloUeiGDP1UFIOJrcL/C27GfDwDnZ3ajHmU/QiXJI=; b=XcGgTPRQtI9f3gO8hQGW4k7DjApKzU8mdro7ija7I/SbCRcKmj0TOffv3Eljk2weGc MZ7J/45Yd/RazEYR0yxaOLAu67E8qqzwrHuoLm6MxnBRKAgx6ttutE9XoF1H5yOlr7vw cZBsXhSzlu8Eeg2xyrHL+/BYCjBd9Nemh7eD3bmTNdFrk6alfxsGCr47UEb5ftJIHJPn h6m0PzycAIzqyOOtQX6ZWZKbqRMptax4StGLuKfPIfmgGCj8+p9byp4AIPo2665vru8t zT7Hzavm0gvg3lwIaWW4uYUSRGe/3S94NRsgbZWNFNFKmBPn7EtQLExo0y6dWoOylSUh sWIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e39-v6si19426233plg.366.2018.10.31.04.47.23; Wed, 31 Oct 2018 04:47:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728819AbeJaUoN (ORCPT + 99 others); Wed, 31 Oct 2018 16:44:13 -0400 Received: from mga07.intel.com ([134.134.136.100]:13000 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbeJaUoM (ORCPT ); Wed, 31 Oct 2018 16:44:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2018 04:46:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,447,1534834800"; d="scan'208";a="104086037" Received: from um.fi.intel.com (HELO localhost) ([10.237.72.212]) by fmsmga001.fm.intel.com with ESMTP; 31 Oct 2018 04:46:24 -0700 From: Alexander Shishkin To: Paolo Bonzini , Thomas Gleixner Cc: Luwei Kang , kvm@vger.kernel.org, x86@kernel.org, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, rkrcmar@redhat.com, joro@8bytes.org, songliubraving@fb.com, peterz@infradead.org, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, thomas.lendacky@amd.com, konrad.wilk@oracle.com, mattst88@gmail.com, Janakarajan.Natarajan@amd.com, dwmw@amazon.co.uk, jpoimboe@redhat.com, marcorr@google.com, ubizjak@gmail.com, sean.j.christopherson@intel.com, jmattson@google.com, linux-kernel@vger.kernel.org, Chao Peng Subject: Re: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu In-Reply-To: References: <1540368316-12998-1-git-send-email-luwei.kang@intel.com> <1540368316-12998-9-git-send-email-luwei.kang@intel.com> <87a7n37iuf.fsf@ashishki-desk.ger.corp.intel.com> Date: Wed, 31 Oct 2018 13:46:24 +0200 Message-ID: <87o9ba5ofj.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paolo Bonzini writes: > On 30/10/2018 11:00, Thomas Gleixner wrote: >> So at least we need a way for perf on the host to programmatically detect, >> that 'guest traces itself' is enabled, so it can inject that information >> into the host data and post processing can tell that. W/o something like >> that it's going to be a FAQ. > > In guest-tracing mode there will be already a TIP.PGD and TIP.PGE packet > respectively before vmentry and after vmexit, caused by the RTIT_CTL > WRMSRs in pt_guest_enter and pt_guest_exit. The target IP of the > packets will come from kvm-intel.ko. Most people aren't tracing the kernel, so they'd just get a PGD with no address and a PGE after the kvm is done without any indication of what happened in between. > In system mode instead you get a Paging Information Packet on > vmentry/vmexit, with bit 0 set in the third byte. You won't get it if > guest-side tracing is on (because tracing has been disabled by > pt_guest_enter and won't be re-enabled until pt_guest_exit). I don't > think it's correct to "fake" the PIP in guest-tracing mode, because > TIP.PGD should be followed immediately by TIP.PGE. Indeed, we should most definitely not fake PIP. Perf has RECORD_AUX, which already has PARTIAL flag that was introduced specifically because of kvm. Regards, -- Alex