From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [PATCH v3 2/4] x86/syscalls: Specific usage of verify_pre_usermode_state Date: Wed, 22 Mar 2017 13:49:17 -0700 Message-ID: <679d163f-2927-ed56-71dc-976fcf5e213f@zytor.com> References: <20170311000501.46607-1-thgarnie@google.com> <20170311000501.46607-2-thgarnie@google.com> <20170311094200.GA27700@gmail.com> <733ed189-6c01-2975-a81a-6fbfe4b7b593@zytor.com> <2d9aad2a-a677-40d2-c179-379fb6e9f194@zytor.com> <7389c6e7-87dc-ea0d-5b2a-7925b8c8d33e@zytor.com> <8fa1a789-231f-dc2c-4a43-6406194259f9@zytor.com> <60718a28-1f67-3612-49b0-84ac685e1eba@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: In-Reply-To: To: Thomas Garnier Cc: Andy Lutomirski , Ingo Molnar , Martin Schwidefsky , Heiko Carstens , David Howells , Arnd Bergmann , Al Viro , Dave Hansen , =?UTF-8?Q?Ren=c3=a9_Nyffenegger?= , Andrew Morton , Kees Cook , "Paul E . McKenney" , Andy Lutomirski , Ard Biesheuvel , Nicolas Pitre , Petr Mladek , Sebastian Andrzej Siewior , Sergey Senozhatsky , Helge Deller List-Id: linux-api@vger.kernel.org On 03/22/17 13:41, Thomas Garnier wrote: >>> with the change below for additional feedback. >> >> Can you specify what that means? > > If I set inline by default, the compiler chose not to inline it on > x86. If I force inline the size impact was actually bigger (without > the architecture specific code). > That's utterly bizarre. Something strange is going on there. I suspect the right thing to do is to out-of-line the error case only, but even that seems strange. It should be something like four instructions inline. >> >> On x86, where there is only one caller of this, it really seems like it >> ought to reduce the overhead to almost zero (since it most likely is >> hidden in the pipeline.) >> >> I would like to suggest defining it inline if >> CONFIG_ARCH_NO_SYSCALL_VERIFY_PRE_USERMODE_STATE is set; I really don't >> care about an architecture which doesn't have it. > > But if there is only one caller, does the compiler is not suppose to > inline the function based on options? If it is marked static in the same file, yes, but you have it in a different file from what I can tell. > The assembly will call it too, so I would need an inline and a > non-inline based on the caller. Where? I don't see that anywhere, at least for x86. -hpa