From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2] kvm: nVMX: CPUID.01H:EDX.APIC[bit 9] should mirror IA32_APIC_BASE[11] Date: Thu, 10 Nov 2016 18:18:45 +0100 Message-ID: References: <1478711076-1426-1-git-send-email-jmattson@google.com> <54f8e0e1-d903-0630-50dc-8dcefe8ce599@redhat.com> <10ecf889-148b-b40e-08db-ad93c17aa3c2@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org To: Jim Mattson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36646 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935047AbcKJRSu (ORCPT ); Thu, 10 Nov 2016 12:18:50 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 10/11/2016 18:16, Jim Mattson wrote: > What if I were to adopt your previous suggestion: > >> The three new lines should be inside "if (apic)", because you are not calling kvm_update_cpuid at all in kvm_lapic_set_base's "if (!apic)" case. > > That would preserve the existing behavior for the QEMU userspace irqchip. > > I do have a kvm-unit-test for the in-kernel APIC. Send it, we can test it with QEMU userspace irqchip. Always send unit tests if you have them. :) Paolo > On Wed, Nov 9, 2016 at 9:43 AM, Paolo Bonzini > wrote: > > > > On 09/11/2016 18:41, Jim Mattson wrote: > > Agreed, but as you can probably tell, I don't use QEMU, so I will > > leave that to someone who does. > > If you can find a colleague or minion to do it, fine, otherwise I'll > drop the patch. The benefit is small and the corner cases large. > > Paolo > > > On Wed, Nov 9, 2016 at 9:37 AM, Paolo Bonzini > wrote: > >> > >> > >> On 09/11/2016 18:28, Jim Mattson wrote: > >>> Better would be to call kvm_update_cpuid regardless, I think. > >> > >> Sure. A kvm-unit-tests patch would be even better so that we can > ensure > >> it works with QEMU userspace irqchip. :) > >> > >> Paolo > >> > >>> On Wed, Nov 9, 2016 at 9:14 AM, Paolo Bonzini > > wrote: > >>>> > >>>> > >>>> On 09/11/2016 18:04, Jim Mattson wrote: > >>>>> > >>>>> + best->edx &= ~F(APIC); > >>>>> + if (vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE) > >>>>> + best->edx |= F(APIC); > >>>>> + > >>>>> if (apic) { > >>>>> if (best->ecx & F(TSC_DEADLINE_TIMER)) > >>>>> apic->lapic_timer.timer_mode_mask = 3 << 17; > >>>> > >>>> The three new lines should be inside "if (apic)", because you > are not > >>>> calling kvm_update_cpuid at all in kvm_lapic_set_base's "if > (!apic)" case. > >>>> > >>>> Thanks, > >>>> > >>>> Paolo > >