From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756594AbcA3VXU (ORCPT ); Sat, 30 Jan 2016 16:23:20 -0500 Received: from terminus.zytor.com ([198.137.202.10]:42244 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753709AbcA3VXS (ORCPT ); Sat, 30 Jan 2016 16:23:18 -0500 User-Agent: K-9 Mail for Android In-Reply-To: References: <58d4a95f40e43b894f93288b4a3633963d0ee22e.1454022279.git.luto@kernel.org> <726983A1-F3A9-476B-AAA2-871F0561CB47@zytor.com> <20160130093124.GA14301@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [tip:x86/asm] x86/syscalls: Remove __SYSCALL_COMMON and __SYSCALL_X32 From: "H. Peter Anvin" Date: Sat, 30 Jan 2016 13:22:05 -0800 To: Andy Lutomirski , Ingo Molnar CC: Brian Gerst , "linux-tip-commits@vger.kernel.org" , tip-bot for Andy Lutomirski , Linus Torvalds , Borislav Petkov , Andy Lutomirski , Linux Kernel Mailing List , Thomas Gleixner , Denys Vlasenko , Peter Zijlstra , =?ISO-8859-1?Q?Fr=E9d=E9ric_Weisbecker?= Message-ID: <6004E416-3565-4653-8659-AF2F631442CE@zytor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On January 30, 2016 9:35:57 AM PST, Andy Lutomirski wrote: >On Sat, Jan 30, 2016 at 1:31 AM, Ingo Molnar wrote: >> >> * Andy Lutomirski wrote: >> >>> >>>+ if [ "$abi" == "COMMON" -o "$abi" == "64" ]; then >>> >>>+ # COMMON is the same as 64, except that we don't >expect X32 >>> >>>+ # programs to use it. Our expectation has nothing to >do with >>> >>>+ # any generated code, so treat them the same. >>> >>>+ emit 64 "$nr" "$entry" "$compat" >>> >>>+ elif [ "$abi" == "X32" ]; then >>> >>>+ # X32 is equivalent to 64 on an X32-compatible kernel. >>> >>>+ echo "#ifdef CONFIG_X86_X32_ABI" >>> >>>+ emit 64 "$nr" "$entry" "$compat" >>> >>>+ echo "#endif" >>> >>>+ elif [ "$abi" == "I386" ]; then >>> >>>+ emit "$abi" "$nr" "$entry" "$compat" >>> >>>+ else >>> >>>+ echo "Unknown abi $abi" >&2 >>> >>>+ exit 1 >>> >>>+ fi >> >>> No combinatorial explosion, please. We could use __SYSCALL(nr, sym, >>> abi, qual), though. >> >> Mind fixing it, so that we get back the arch-neutral property? >> > >I need some guidance as to the goal to do a good job. > >In the version in -tip, I have this thing: > >if [ "$abi" == "64" -a -n "$compat" ]; then > echo "a compat entry for a 64-bit syscall makes no sense" >&2 > exit 1 >fi > >Moving that outside the script will either be impossible or an >exercise in really awful C preprocessor hacks. We could keep that >under the theory that it's arch-neutral. > >It might be nice to add a similar warning that a compat entry for an >x32 syscall makes so sense. That's a little less arch-neutral, >although it wouldn't be actively harmful on any architecture, since >"x32" wouldn't occur in the first place. > >Other than that, I could add a little header called >syscall_abi_mapping.h containing something like: > >#ifndef __SYSCALL_ABI_MAPPING_H >#define __SYSCALL_ABI_MAPPING_H > >#ifdef CONFIG_X86_32 > >/* Only I386 entries should ever be compiled into 32-bit kernels. */ >#define __SYSCALL_ABI_I386(nr, entry, qual, compat, compat_qual) >__SYSCALL_I386(nr, entry, qual) > >#else > >/* I386 entries on 64-bit kernels use the compat entry point. */ >#define __SYSCALL_ABI_I386(nr, entry, qual, compat, compat_qual) >__SYSCALL_I386(nr, compat, compat_qual) > >#define __SYSCALL_ABI_common(nr, entry, compat, qual) >#define __SYSCALL_ABI_64(nr, entry, qual, compat, compat_qual) >__SYSCALL_64(nr, entry, qual) >#ifdef CONFIG_X86_X32 >#define __SYSCALL_ABI_x32(nr, entry, qual, compat, compat_qual) >__SYSCALL_64(nr, entry, qual) >#else >#define __SYSCALL_ABI_x32(nr, entry, qual, compat, compat_qual) >__SYSCALL_64(nr, entry, qual) >#endif > >#endif > >#endif > >and teach syscalltbl.sh to emit #include >at the beginning of syscalls_32.h and syscalls_64.h and to reference >those macros. > >hpa, would that meet your requirements? > >IMO this is quite a bit messier than the code in -tip, and I'm >honestly not convinced it's an improvement. > >--Andy Something like that... however, I can't look at in detail right now. -- Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.