From: "Radim Krčmář" <rkrcmar@redhat.com>
To: "Wu, Feng" <feng.wu@intel.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86: Add lowest-priority support for vt-d posted-interrupts
Date: Wed, 9 Dec 2015 15:53:47 +0100 [thread overview]
Message-ID: <20151209145343.GB2672@potion.brq.redhat.com> (raw)
In-Reply-To: <E959C4978C3B6342920538CF579893F00AEC87EB@SHSMSX104.ccr.corp.intel.com>
2015-12-09 08:19+0000, Wu, Feng:
>> -----Original Message-----
>> From: Radim Krčmář [mailto:rkrcmar@redhat.com]
>> Sent: Tuesday, November 17, 2015 3:03 AM
>> To: Wu, Feng <feng.wu@intel.com>
>> Cc: pbonzini@redhat.com; kvm@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] KVM: x86: Add lowest-priority support for vt-d posted-
>> interrupts
>>
>> 2015-11-09 10:46+0800, Feng Wu:
>> > +struct kvm_vcpu *kvm_intr_vector_hashing_dest(struct kvm *kvm,
>> > + struct kvm_lapic_irq *irq)
>> > +
>> > +{
>> > + unsigned long dest_vcpu_bitmap[BITS_TO_LONGS(KVM_MAX_VCPUS)];
>> > + unsigned int dest_vcpus = 0;
>> > + struct kvm_vcpu *vcpu;
>> > + unsigned int i, mod, idx = 0;
>> > +
>> > + vcpu = kvm_intr_vector_hashing_dest_fast(kvm, irq);
>> > + if (vcpu)
>> > + return vcpu;
>>
>> I think the rest of this function shouldn't be implemented:
>> - Shorthands are only for IPIs and hence don't need to be handled,
>> - Lowest priority physical broadcast is not supported,
>> - Lowest priority cluster logical broadcast is not supported,
>> - No point in optimizing mixed xAPIC and x2APIC mode,
>
> I read your comments again, and don't quite understand why we
> don't need PI optimization for mixed xAPIC and x2APIC mode.
There shouldn't be a non-hobbyist operating system that uses mixed mode,
so the optimization would practically be dead code as all other cases
are handled by kvm_intr_vector_hashing_dest_fast().
I think that having extra code would bring problems in the future -- we
need to take care of it when refactoring KVM's APIC and we should also
write a unit-test for this otherwise dead path. I don't think that the
benefit for guests would ever balance those efforts.
(Physical xAPIC+x2APIC mode is still somewhat reasonable and xAPIC CPUs
start with LDR=0, which means that operating system doesn't need to
utilize mixed mode, as defined by KVM, when switching to x2APIC.)
> BTW, can we have mixed flat and cluster mode?
Yes, KVM recognizes that mixed mode, but luckily, there are severe
limitations.
Notes below SDM section 10.6.2.2:
All processors that have their APIC software enabled (using the
spurious vector enable/disable bit) must have their DFRs (Destination
Format Registers) programmed identically.
I hope there isn't a human that would use it in good faith.
(Only NMI/SMI/INIT/SIPI are delivered in software disabled mode and if
the system uses cluster xAPIC, OS should set DFR before LDR, which
doesn't trigger mixed mode either.)
next prev parent reply other threads:[~2015-12-09 14:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 2:46 [PATCH] KVM: x86: Add lowest-priority support for vt-d posted-interrupts Feng Wu
2015-11-16 6:18 ` Wu, Feng
2015-11-16 19:03 ` Radim Krčmář
2015-11-17 9:41 ` Paolo Bonzini
2015-11-24 1:26 ` Wu, Feng
2015-11-24 14:35 ` Radim Krcmár
2015-11-24 14:38 ` Paolo Bonzini
2015-11-25 1:58 ` Wu, Feng
2015-11-25 11:32 ` Paolo Bonzini
2015-11-24 1:26 ` Wu, Feng
2015-11-24 14:31 ` Radim Krčmář
2015-11-24 14:44 ` Radim Krčmář
2015-11-25 3:21 ` Wu, Feng
2015-11-25 14:12 ` Radim Krcmár
2015-11-25 14:38 ` Paolo Bonzini
2015-11-25 15:43 ` Radim Krčmář
2015-11-26 6:24 ` Wu, Feng
2015-11-26 14:03 ` Radim Krcmár
2015-12-09 8:19 ` Wu, Feng
2015-12-09 14:53 ` Radim Krčmář [this message]
2015-12-10 1:52 ` Wu, Feng
2015-12-11 14:37 ` Radim Krcmár
2015-12-15 1:52 ` Wu, Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151209145343.GB2672@potion.brq.redhat.com \
--to=rkrcmar@redhat.com \
--cc=feng.wu@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox