From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760147AbbA3VPz (ORCPT ); Fri, 30 Jan 2015 16:15:55 -0500 Received: from mail-we0-f171.google.com ([74.125.82.171]:63136 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751419AbbA3VPy (ORCPT ); Fri, 30 Jan 2015 16:15:54 -0500 Message-ID: <54CBF481.3020201@redhat.com> Date: Fri, 30 Jan 2015 22:15:45 +0100 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= CC: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nadav Amit , Gleb Natapov Subject: Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map 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> In-Reply-To: <20150130165747.GD27414@potion.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/01/2015 17:57, Radim Krčmář wrote: > As optimizations go, we could drop the "&" on cid as "cid < 16" is > checked later, so mode=4 practically does nothing ... Not the best for > future bugs, but still pretty safe -- only x2APIC can set a value that > would require the "&" and it can't have valid XAPIC mode, so u32 still > protects us enough. > > *cid = ldr >> mode; > *lid = ldr & ((1 << mode) - 1); > > Which is probably faster a solution where we don't shuffle switch cases > to jump to x2APIC first. A comparison is at the very bottom [2]. > > Would that be ok in v2? Yes, this is okay. Thanks for looking at it! Paolo