Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755373AbcCUWLU (ORCPT ); Mon, 21 Mar 2016 18:11:20 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:33928 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753305AbcCUWLS (ORCPT ); Mon, 21 Mar 2016 18:11:18 -0400 MIME-Version: 1.0 In-Reply-To: <20160321194336.GC5083@two.firstfloor.org> References: <1458576969-13309-1-git-send-email-andi@firstfloor.org> <1458576969-13309-5-git-send-email-andi@firstfloor.org> <20160321185429.GY5083@two.firstfloor.org> <20160321194336.GC5083@two.firstfloor.org> From: Andy Lutomirski Date: Mon, 21 Mar 2016 15:10:58 -0700 Message-ID: Subject: Re: [PATCH 4/9] x86: Enumerate kernel FSGS capability in AT_HWCAP2 To: Andi Kleen Cc: "linux-kernel@vger.kernel.org" , Brian Gerst , "the arch/x86 maintainers" , Andi Kleen Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1298 Lines: 32 On Mar 21, 2016 12:43 PM, "Andi Kleen" wrote: > > > It would be less complicated actually, as normal userspace would just > > continue to call arch_prctl() as it does today. Glibc would implement > > We already have that through the system call, no advantage of > putting it into a vsyscall. > > Also the experience with getcpu and similar so far is that > vsyscalls are too slow for the users who want really fast paths. > So they're prefer to use the direct instructions anyways. Getcpu is mainly slow because the overcomplicated API requires branches. I've been tempted to add __vdso_get_cpu as an alternative that simply returns the CPU number. > > > arch_prctl() just like it does with gettimeofday() -- with an ifunc > > selector [1] that calls the VDSO function if it is available, or the > > syscall if not. No custom assembly needed. > > vdso always needs custom assembler, please see how glibc implements it. This is simply not true. I haven't checked the glibc implementation, and I wouldn't be remotely surprised if it is maliciously incomprehensible, but there is no reason whatsoever that using any vdso mechanism other than AT_SYSINFO itself requires assembler. AT_SYSINFO, of course, requires assembler because the calling convention is weird. --Andy