From: Radim =?utf-8?Q?Krcm=C3=A1r?= Subject: Re: [PATCH] KVM: x86: Add lowest-priority support for vt-d posted-interrupts Date: Fri, 11 Dec 2015 15:37:51 +0100 Message-ID: <20151211143751.GA28788@potion.brq.redhat.com> References: <1447037208-75615-1-git-send-email-feng.wu@intel.com> <20151116190314.GA12245@potion.brq.redhat.com> <20151209145343.GB2672@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "pbonzini@redhat.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: "Wu, Feng" Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2015-12-10 01:52+0000, Wu, Feng: >> From: Radim Kr=C4=8Dm=C3=A1=C5=99 [mailto:rkrcmar@redhat.com] >> (Physical xAPIC+x2APIC mode is still somewhat reasonable and xAPIC C= PUs >> start with LDR=3D0, which means that operating system doesn't need = to >> utilize mixed mode, as defined by KVM, when switching to x2APIC.) >=20 > I think you mean Physical xAPIC+Physical x2APIC mode, right? For phys= ical > mode, we don't use LDR in any case, do we? So in physical mode, we on= ly > use the APIC ID, that is why they can be mixed, is my understanding c= orrect? Yes. (Technically, physical and logical addressing is always active in APIC, but xAPIC must have nonzero LDR to accept logical interrupts[1].) If all xAPIC LDRs are zero, KVM doesn't enter a "mixed mode" even if some are xAPIC and some x2APIC [2]. 1: Real LAPICs probably do not accept broadcasts on APICs where LDR=3D0= , KVM LAPICs do, but lowest priority broadcast is not allowed anyway, so PI doesn't care. 2: KVM allows OS-writeable APIC ID, which complicates things and real hardware probably doesn't allow it because of that ... we'd be saner with RO APIC ID, but it's not that bad. (And no major OS does it :]= ) >> the system uses cluster xAPIC, OS should set DFR before LDR, which >> doesn't trigger mixed mode either.) >=20 > Just curious, if the APIC is software disabled and it is in xAPIC mod= e. OS sets > different value for DFR for different APICs, then when OS sets LDR, K= VM can > trigger mixed flat and cluster mode, right? Exactly. APICs with zeroed LDR are ignored, so KVM will use the slow-path for delivery (=3D trigger mixed mode) at the moment the first APIC with different DFR is configured.