From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu Date: Mon, 29 Oct 2018 18:48:15 +0100 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Alexander Shishkin , Luwei Kang , kvm@vger.kernel.org, x86@kernel.org Return-path: In-Reply-To: <87a7n37iuf.fsf@ashishki-desk.ger.corp.intel.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 24/10/2018 12:13, Alexander Shishkin wrote: > Luwei Kang writes: > >> +static void pt_guest_enter(struct vcpu_vmx *vmx) >> +{ >> + if (pt_mode == PT_MODE_SYSTEM) >> + return; >> + >> + /* Save host state before VM entry */ >> + rdmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); >> + >> + /* >> + * Set guest state of MSR_IA32_RTIT_CTL MSR (PT will be disabled >> + * on VM entry when it has been disabled in guest before). >> + */ >> + vmcs_write64(GUEST_IA32_RTIT_CTL, vmx->pt_desc.guest.ctl); >> + >> + if (vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) { >> + wrmsrl(MSR_IA32_RTIT_CTL, 0); >> + pt_save_msr(&vmx->pt_desc.host, vmx->pt_desc.addr_range); >> + pt_load_msr(&vmx->pt_desc.guest, vmx->pt_desc.addr_range); >> + } >> +} > > From my side this is still a NAK, because [1]. > > [1] https://marc.info/?l=kvm&m=153847567226248&w=2 Then you should have replied to https://marc.info/?l=kvm&m=153865386015249&w=2 instead of having Luwei do the work for nothing. Quoting from there: >> One shouldn't have to enable or disable anything in KVM to stop it from >> breaking one's existing workflow. That makes no sense. > > If you "have to enable or disable anything" it means you have to > override the default. But the default in this patches is "no change > compared to before the patches", leaving tracing of both host and guest > entirely to the host, so I don't understand your remark. What workflow > is broken? > >> There already are controls in perf that enable/disable guest tracing. > > You are confusing "tracing guest from the host" and "the guest can trace > itself". This patchset is adding support for the latter, and that > affects directly whether the tracing CPUID leaf can be added to the > guest. Therefore it's not perf that can decide whether to turn it on; > KVM must know it when /dev/kvm is opened, which is why it is a module > parameter. I'd be happier if we found an agreement, but without discussion that just won't happen. Also, is there an existing interface to write a record into a tracing buffer? Paolo