From: "Jan Beulich" Subject: Re: [PATCH 3/4] VMX: use proper instruction mnemonics if assembler supports them Date: Mon, 26 Aug 2013 10:06:18 +0100 Message-ID: <521B36AA02000078000EE496@nat28.tlf.novell.com> References: <521786A002000078000EE064@nat28.tlf.novell.com> <521787C602000078000EE07F@nat28.tlf.novell.com> <52193148.2090601@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VDski-00067T-S5 for xen-devel@lists.xenproject.org; Mon, 26 Aug 2013 09:06:25 +0000 In-Reply-To: <52193148.2090601@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser , Eddie Dong , Jun Nakajima List-Id: xen-devel@lists.xenproject.org >>> On 25.08.13 at 00:18, Andrew Cooper wrote: > I certainly like and encourage of the idea of getting rid of the fixed > registers due to the hex literals. However, are macros really the > correct solution? > > __vmread_safe(field, value) now has non-function like semantics for value. > > To me, the more obvious (and as far as I can tell, functionally > identical) approach would be for > > unsigned long always_inline __vmread_safe(unsigned long field, unsigned > long *value) > > The compiler, given the correct constraints for value could resolve the > pointer back to the caller as it inlined the function, and calls would > look like "__vmread_safe(field, &value);" which looks rather more natural. The constraints aren't the problem - the use of sizeof(value) inside the macro is. You can't pass both pointers to 32-bit and 64-bit data items into the function, and then have the function guess what the type is to be. > As for the memory clobbers, I see no indication from the VMX instruction > reference that vmread or inv{ept,vpid} have relevant side effects > requiring a clobber. For the load functions and vmwrite, there is a > possibilty of a memory clobber if someone has peaked into the relevant > VMCS page(s). However, doing so defeats the purpose of vmread/write, so > as far as I can tell, we could argue away the clobbers on those grounds > alone. Good; I'm still hoping to hear an opinion from Intel engineers too. Jan