[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200527162318.GD24461@linux.intel.com>
Date: Wed, 27 May 2020 09:23:18 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzbot+904752567107eefb728c@...kaller.appspotmail.com
Subject: Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation
On Wed, May 27, 2020 at 06:15:27PM +0200, Paolo Bonzini wrote:
> On 27/05/20 12:03, Vitaly Kuznetsov wrote:
> >>
> >> vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
> >> + vcpu->arch.tdp_level = kvm_x86_ops.get_tdp_level(vcpu);
> >>
> >> vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;
> > Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> >
> > Looking at kvm_update_cpuid() I was thinking if it would make sense to
> > duplicate the "/* Note, maxphyaddr must be updated before tdp_level. */"
> > comment here (it seems to be a vmx-only thing btw), drop it from
> > kvm_update_cpuid() or move cpuid_query_maxphyaddr() to get_tdp_level()
> > but didn't come to a conclusive answer.
>
> Yeah, it makes sense to at least add the comment here too.
Hmm, one option would be to make .get_tdp_level() pure function by passing
in vcpu->arch.maxphyaddr. That should make the comment redundant. I don't
love bleeding VMX's implementation into the prototype, but that ship has
kinda already sailed.
Side topic, cpuid_query_maxphyaddr() should be unexported, the RTIT usage can
and should use vcpu->arch.maxphyaddr. I'll send a patch for that.
Powered by blists - more mailing lists