Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Sean Christopherson
On Fri, Jul 10, 2020 at 12:11:54AM +0200, Paolo Bonzini wrote: > On 09/07/20 23:50, Peter Xu wrote: > >> Sean: Objection your honor. > >> Paolo: Overruled, you're wrong. > >> Sean: Phooey. > >> > >> My point is that even though I still object to this series, Paolo has final > >> say. > > > > I coul

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Paolo Bonzini
On 09/07/20 23:50, Peter Xu wrote: >> Sean: Objection your honor. >> Paolo: Overruled, you're wrong. >> Sean: Phooey. >> >> My point is that even though I still object to this series, Paolo has final >> say. > > I could be wrong, but I feel like Paolo was really respecting your input, as > always.

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Peter Xu
On Thu, Jul 09, 2020 at 02:26:52PM -0700, Sean Christopherson wrote: > On Thu, Jul 09, 2020 at 05:09:19PM -0400, Peter Xu wrote: > > Again, using host_initiated or not should be a different issue? Frankly > > speaking, I don't know whether it's an issue or not, but it's different from > > what thi

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Sean Christopherson
On Thu, Jul 09, 2020 at 05:09:19PM -0400, Peter Xu wrote: > Again, using host_initiated or not should be a different issue? Frankly > speaking, I don't know whether it's an issue or not, but it's different from > what this series wants to do, because it'll be the same before/after this > series. A

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Peter Xu
On Thu, Jul 09, 2020 at 12:24:40PM -0700, Sean Christopherson wrote: > On Thu, Jul 09, 2020 at 02:22:20PM -0400, Peter Xu wrote: > > On Tue, Jun 30, 2020 at 08:47:26AM -0700, Sean Christopherson wrote: > > > On Sat, Jun 27, 2020 at 04:24:34PM +0200, Paolo Bonzini wrote: > > > > On 26/06/20 20:18, S

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Sean Christopherson
On Thu, Jul 09, 2020 at 02:22:20PM -0400, Peter Xu wrote: > On Tue, Jun 30, 2020 at 08:47:26AM -0700, Sean Christopherson wrote: > > On Sat, Jun 27, 2020 at 04:24:34PM +0200, Paolo Bonzini wrote: > > > On 26/06/20 20:18, Sean Christopherson wrote: > > > >> Btw, would it be more staightforward to ch

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Peter Xu
On Thu, Jul 09, 2020 at 08:24:03PM +0200, Paolo Bonzini wrote: > On 09/07/20 20:22, Peter Xu wrote: > >>> So I think Peter's patch is fine, but (possibly on top as a third patch) > >>> __must_check should be added to MSR getters and setters. Also one > >>> possibility is to return -EINVAL for inva

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Paolo Bonzini
On 09/07/20 20:22, Peter Xu wrote: >>> So I think Peter's patch is fine, but (possibly on top as a third patch) >>> __must_check should be added to MSR getters and setters. Also one >>> possibility is to return -EINVAL for invalid MSRs. > Yeah I can add another patch for that. Also if to repost,

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-07-09 Thread Peter Xu
On Tue, Jun 30, 2020 at 08:47:26AM -0700, Sean Christopherson wrote: > On Sat, Jun 27, 2020 at 04:24:34PM +0200, Paolo Bonzini wrote: > > On 26/06/20 20:18, Sean Christopherson wrote: > > >> Btw, would it be more staightforward to check > > >> "vcpu->arch.arch_capabilities & > > >> ARCH_CAP_TSX_CT

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-30 Thread Sean Christopherson
On Sat, Jun 27, 2020 at 04:24:34PM +0200, Paolo Bonzini wrote: > On 26/06/20 20:18, Sean Christopherson wrote: > >> Btw, would it be more staightforward to check > >> "vcpu->arch.arch_capabilities & > >> ARCH_CAP_TSX_CTRL_MSR" rather than "*ebx | (F(RTM) | F(HLE))" even if we > >> want > >> to ha

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-27 Thread Paolo Bonzini
On 26/06/20 20:18, Sean Christopherson wrote: >> Btw, would it be more staightforward to check "vcpu->arch.arch_capabilities & >> ARCH_CAP_TSX_CTRL_MSR" rather than "*ebx | (F(RTM) | F(HLE))" even if we want >> to have such a fix? > Not really, That ends up duplicating the check in vmx_get_msr().

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Peter Xu
On Fri, Jun 26, 2020 at 11:18:20AM -0700, Sean Christopherson wrote: > On Fri, Jun 26, 2020 at 02:07:32PM -0400, Peter Xu wrote: > > On Thu, Jun 25, 2020 at 09:25:40AM -0700, Sean Christopherson wrote: > > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > > > index 5eb618dbf211..64322446

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Sean Christopherson
On Fri, Jun 26, 2020 at 02:07:32PM -0400, Peter Xu wrote: > On Thu, Jun 25, 2020 at 09:25:40AM -0700, Sean Christopherson wrote: > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > > index 5eb618dbf211..64322446e590 100644 > > --- a/arch/x86/kvm/cpuid.c > > +++ b/arch/x86/kvm/cpuid.c > >

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Peter Xu
On Thu, Jun 25, 2020 at 09:25:40AM -0700, Sean Christopherson wrote: > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 5eb618dbf211..64322446e590 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -1013,9 +1013,9 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax,

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Sean Christopherson
On Fri, Jun 26, 2020 at 01:37:50PM -0400, Peter Xu wrote: > On Fri, Jun 26, 2020 at 08:56:57AM -0700, Sean Christopherson wrote: > > Not really? It's solving a problem that doesn't exist in the current code > > base (assuming TSC_CTRL is fixed), and IMO solving it in an ugly fashion. > > > > I wo

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Peter Xu
On Fri, Jun 26, 2020 at 08:56:57AM -0700, Sean Christopherson wrote: > Not really? It's solving a problem that doesn't exist in the current code > base (assuming TSC_CTRL is fixed), and IMO solving it in an ugly fashion. > > I would much prefer that, _if_ we want to support blind KVM-internal MSR

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-26 Thread Sean Christopherson
On Thu, Jun 25, 2020 at 08:44:16PM +0200, Paolo Bonzini wrote: > On 25/06/20 18:25, Sean Christopherson wrote: > > I get the "what" of the change, and even the "why" to some extent, but I > > dislike the idea of supporting/encouraging blind reads/writes to MSRs. > > Blind writes are just asking for

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-25 Thread Paolo Bonzini
On 25/06/20 18:25, Sean Christopherson wrote: > I get the "what" of the change, and even the "why" to some extent, but I > dislike the idea of supporting/encouraging blind reads/writes to MSRs. > Blind writes are just asking for problems, and suppressing warnings on reads > is almost guaranteed to

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-25 Thread Sean Christopherson
On Thu, Jun 25, 2020 at 09:25:40AM -0700, Sean Christopherson wrote: > On Thu, Jun 25, 2020 at 10:09:13AM +0200, Paolo Bonzini wrote: > > On 25/06/20 08:15, Sean Christopherson wrote: > > > IMO, kvm_cpuid() is simply buggy. If KVM attempts to access a > > > non-existent > > > MSR then it darn wel

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-25 Thread Sean Christopherson
On Thu, Jun 25, 2020 at 10:09:13AM +0200, Paolo Bonzini wrote: > On 25/06/20 08:15, Sean Christopherson wrote: > > IMO, kvm_cpuid() is simply buggy. If KVM attempts to access a non-existent > > MSR then it darn well should warn. > > > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > >

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-25 Thread Paolo Bonzini
On 25/06/20 08:15, Sean Christopherson wrote: > IMO, kvm_cpuid() is simply buggy. If KVM attempts to access a non-existent > MSR then it darn well should warn. > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 8a294f9747aa..7ef7283011d6 100644 > --- a/arch/x86/kvm/cpuid.c > +++

Re: [PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-24 Thread Sean Christopherson
On Mon, Jun 22, 2020 at 06:04:41PM -0400, Peter Xu wrote: > MSR accesses can be one of: > > (1) KVM internal access, > (2) userspace access (e.g., via KVM_SET_MSRS ioctl), > (3) guest access. > > The ignore_msrs was previously handled by kvm_get_msr_common() and > kvm_set_msr_common(), whic

[PATCH 1/2] KVM: X86: Move ignore_msrs handling upper the stack

2020-06-22 Thread Peter Xu
MSR accesses can be one of: (1) KVM internal access, (2) userspace access (e.g., via KVM_SET_MSRS ioctl), (3) guest access. The ignore_msrs was previously handled by kvm_get_msr_common() and kvm_set_msr_common(), which is the bottom of the msr access stack. It's working in most cases, howe