From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Shishkin Subject: Re: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu Date: Wed, 31 Oct 2018 13:38:39 +0200 Message-ID: <87r2g65osg.fsf@ashishki-desk.ger.corp.intel.com> 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> <87y3af65fi.fsf@ashishki-desk.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain Cc: tglx@linutronix.de, 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 To: Paolo Bonzini , Luwei Kang , kvm@vger.kernel.org, x86@kernel.org Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Paolo Bonzini writes: > On 30/10/2018 12:26, Alexander Shishkin wrote: >> There is a control in the perf event attribute that enables tracing the >> guest. If this control is enabled, the kvm needs to stay away from any >> PT related MSRs. > > This cannot happen once the guest has been told it can trace itself. So, they need to be made mutually exclusive. > There is no standard way to tell the guest that the host overrode its > choice to use PT. However, the host will get a PGD/PGE packet around > vmentry and vmexit, so there _will_ be an indication that the guest > owned the MSRs for that period of time. Not if they are not tracing the kernel. > If PT context switching is enabled with the module parameter, we could > also reject creation of events with the attribute set. However that > won't help if the event is created before KVM is even loaded. In that case, modprobe kvm should fail. Regards, -- Alex