Re: [PATCH] kvm/mmu: small fix for reserved bits check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/12/2016 08:02, Liang Li wrote:
> Use '||' is more efficient than '|' at this point.

No, it's not, because the check is going to be always false in practice,
so the || is going to evaluate both branches anyway.  So, depending on
the compiler, either it's the same or it's worse (because a branch is
worse than an OR instruction).

If anything, as David said (and if the compiled code changes at all),
the "!= 0" is superfluous.

Paolo

> Signed-off-by: Liang Li <liang.z.li@xxxxxxxxx>
> ---
>  arch/x86/kvm/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index d9c7e98..16c0b00 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3315,7 +3315,7 @@ static gpa_t nonpaging_gva_to_gpa_nested(struct kvm_vcpu *vcpu, gva_t vaddr,
>  {
>  	int bit7 = (pte >> 7) & 1, low6 = pte & 0x3f;
>  
> -	return (pte & rsvd_check->rsvd_bits_mask[bit7][level-1]) |
> +	return (pte & rsvd_check->rsvd_bits_mask[bit7][level-1]) ||
>  		((rsvd_check->bad_mt_xwr & (1ull << low6)) != 0);
>  }

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux