From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map Date: Fri, 30 Jan 2015 22:15:45 +0100 Message-ID: <54CBF481.3020201@redhat.com> References: <1422568135-28402-1-git-send-email-rkrcmar@redhat.com> <1422568135-28402-9-git-send-email-rkrcmar@redhat.com> <54CB4C5C.6090706@redhat.com> <20150130151442.GC27414@potion.redhat.com> <54CBA1F9.6070206@redhat.com> <20150130165747.GD27414@potion.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nadav Amit , Gleb Natapov To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: In-Reply-To: <20150130165747.GD27414@potion.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 30/01/2015 17:57, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > As optimizations go, we could drop the "&" on cid as "cid < 16" is > checked later, so mode=3D4 practically does nothing ... Not the best = for > future bugs, but still pretty safe -- only x2APIC can set a value tha= t > would require the "&" and it can't have valid XAPIC mode, so u32 stil= l > protects us enough. >=20 > *cid =3D ldr >> mode; > *lid =3D ldr & ((1 << mode) - 1); >=20 > Which is probably faster a solution where we don't shuffle switch cas= es > to jump to x2APIC first. A comparison is at the very bottom [2]. >=20 > Would that be ok in v2? Yes, this is okay. Thanks for looking at it! Paolo