Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

From: Paolo Bonzini
Date: Fri Jan 30 2015 - 16:15:58 EST




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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/