[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Optimized clocksource with AMD AVIC enabled for Windows guest

From: Kechen Lu
Subject: RE: Optimized clocksource with AMD AVIC enabled for Windows guest
Date: Thu, 4 Feb 2021 02:05:44 +0000

Hi Vitaly and Paolo,

Thanks so much for quick reply. This makes sense to me. From my understanding, 
basically this can be two part of it to resolve it. 

First, we make sure to set and expose 0x40000004.EAX Bit9 to windows guest, 
like in kvm_vcpu_ioctl_get_hv_cpuid(), having this recommendation bit :

Second, although the above could tell guest to deprecate AutoEOI, older Windows 
OSes would not acknowledge this (I checked the Hyper-v TLFS, from spec v3.0 
(i.e. Windows Server 2012), it starts having bit9 defined in 0x40000004.EAX), 
we may want to dynamically toggle off APICv/AVIC if we found the SynIC SINT 
vector has AutoEOI, under synic_update_vector(). E.g. like:
if (synic_has_vector_auto_eoi(synic, vector)) {
        kvm_request_apicv_update(vcpu->kvm, false, APICV_INHIBIT_REASON_HYPERV);
        __set_bit(vector, synic->auto_eoi_bitmap);
} else {
        kvm_request_apicv_update(vcpu->kvm, true, APICV_INHIBIT_REASON_HYPERV);
        __clear_bit(vector, synic->auto_eoi_bitmap);

Curious about what current plan/status of upstream is for this. If that's 
doable and not current pending patch covering this, I can make a quick draft 
patch tested and sent out for reviewing. 

Best Regards,

>-----Original Message-----
>From: Vitaly Kuznetsov <vkuznets@redhat.com>
>Sent: Wednesday, February 3, 2021 1:16 AM
>To: Paolo Bonzini <pbonzini@redhat.com>; Kechen Lu <kechenl@nvidia.com>
>Cc: suravee.suthikulpanit@amd.com; Somdutta Roy <somduttar@nvidia.com>;
>kvm@vger.kernel.org; qemu-discuss@nongnu.org
>Subject: Re: Optimized clocksource with AMD AVIC enabled for Windows guest
>External email: Use caution opening links or attachments
>Paolo Bonzini <pbonzini@redhat.com> writes:
>> On 03/02/21 07:40, Kechen Lu wrote:
>>> From the above observations, trying to see if there's a way for
>>> enabling AVIC while also having the most optimized clock source for
>>> windows guest.
>> You would have to change KVM, so that AVIC is only disabled if
>> Auto-EOI interrupts are used.
>(I vaguely recall having this was discussed already but apparently no changes
>were made since)
>Hyper-V TLFS defines the following bit:
>CPUID 0x40000004.EAX
>Bit 9: Recommend deprecating AutoEOI.
>But this is merely a recommendation and older Windows versions may not know
>about the bit and still use it. We need to make sure the bit is set/exposed to
>Windows guests but we also must track AutoEOI usage and inhibit AVIC when

reply via email to

[Prev in Thread] Current Thread [Next in Thread]