From: Radim =?utf-8?Q?Krcm=C3=A1r?= Subject: Re: [PATCH] KVM: x86: Add lowest-priority support for vt-d posted-interrupts Date: Wed, 25 Nov 2015 15:12:39 +0100 Message-ID: <20151125141238.GC13925@potion.brq.redhat.com> References: <1447037208-75615-1-git-send-email-feng.wu@intel.com> <20151116190314.GA12245@potion.brq.redhat.com> <20151124143154.GB13925@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-11-25 03:21+0000, Wu, Feng: > From: Radim Kr=C4=8Dm=C3=A1=C5=99 [mailto:rkrcmar@redhat.com] >> The hash function just interprets a subset of vector's bits as a num= ber >> and uses that as a starting offset in a search for an enabled APIC >> within the destination set? >>=20 >> For example: >> The x2APIC destination is 0x00000055 (=3D first four even APICs in c= luster >> 0), the vector is 0b11100000, and bits 10:8 of IntControl are 000. >>=20 >> 000 means that bits 7:4 of vector are selected, thus the vector hash= is >> 0b1110 =3D 14, so the round-robin effectively does 14 % 4 (because w= e only >> have 4 destinations) and delivers to the 3rd possible APIC (=3D ID 6= )? >=20 > In my current implementation, I don't select a subset of vector's bit= s as > the number, instead, I use the whole vector number. For software emul= ation > p. o. v, do we really need to select a subset of the vector's bits as= the base > number? What is your opinion? Thanks a lot! I think it's ok to pick any algorithm we like. It's unlikely that software would recognize and take advantage of the hardware algorithm without adding a special treatment for KVM. (I'd vote for the simple pick-first-APIC lowest priority algorithm ... I don't see much point in complicating lowest priority when it doesn't deliver to lowest priority CPU anyway.) I mainly wanted to know what real hardware really does, because there i= s a lot of alternatives that still fit into the Xeon documentation.