From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933448AbcIENgg (ORCPT ); Mon, 5 Sep 2016 09:36:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932905AbcIENg1 (ORCPT ); Mon, 5 Sep 2016 09:36:27 -0400 Subject: Re: [PATCH] KVM: nVMX: expose INS/OUTS information support To: Yury Norov , Jan Dakinevich References: <1473013395-12214-1-git-send-email-jan.dakinevich@gmail.com> <20160905091913.GA22817@yury-N73SV> Cc: kvm@vger.kernel.org, rkrcmar@redhat.com, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: Date: Mon, 5 Sep 2016 15:27:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160905091913.GA22817@yury-N73SV> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Sep 2016 13:27:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09/2016 11:19, Yury Norov wrote: >> > >> > +static inline bool cpu_has_vmx_basic_inout(void) > inline is useless. See Documentation/CodingStyle, Chapter 15 No, it's not. See Documentation/CodingStyle, Chapter 15: "While the use of inlines can be appropriate (for example as a means of replacing macros, see Chapter 12), it very often is not". >> > +{ >> > + return (((u64)vmcs_config.basic_cap << 32) & VMX_BASIC_INOUT); > You can shift VMX_BASIC_INOUT (at compile time) and avoid the shifting of > vmcs_config.basic_cap at runtime. Not really since VMX_BASIC_INOUT comes from the processor manual. It's ironic that your first remark places a lot of trust in the compiler, while the second places none. The compiler is happy to optimize away the left-shift/bitwise-AND pair to this: movq %rdi, %rax shrq $22, %rax andl $1, %eax where 22 is the order of VMX_BASIC_INOUT's only set bit, minus 32. Paolo