From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbeCTI7l (ORCPT ); Tue, 20 Mar 2018 04:59:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52095 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752138AbeCTI7g (ORCPT ); Tue, 20 Mar 2018 04:59:36 -0400 X-Google-Smtp-Source: AG47ELsE6E5rjoC1NJNFoLWiDfJtmAEHsCTtcc8Prg17gHalCTQ1Ozu5qaAZ9JRcIVePxVBXsUohPA== Date: Tue, 20 Mar 2018 09:59:32 +0100 From: Ingo Molnar To: Al Viro Cc: Linus Torvalds , Dominik Brodowski , Linux Kernel Mailing List , Arnd Bergmann , linux-arch , Ralf Baechle , James Hogan , linux-mips , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , ppc-dev , Martin Schwidefsky , Heiko Carstens , linux-s390 , "David S . Miller" , sparclinux@vger.kernel.org, Ingo Molnar , Jiri Slaby , the arch/x86 maintainers Subject: Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation Message-ID: <20180320085932.xnwkpiz5gpegnw5d@gmail.com> References: <20180318161056.5377-1-linux@dominikbrodowski.net> <20180318161056.5377-5-linux@dominikbrodowski.net> <20180318174014.GR30522@ZenIV.linux.org.uk> <20180318181848.GU30522@ZenIV.linux.org.uk> <20180319042300.GW30522@ZenIV.linux.org.uk> <20180319092920.tbh2xwkruegshzqe@gmail.com> <20180319232342.GX30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180319232342.GX30522@ZenIV.linux.org.uk> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Al Viro wrote: > > For example this attempt at creating a new system call: > > > > SYSCALL_DEFINE3(moron, int, fd, loff_t, offset, size_t, count) > > > > ... would translate into something like: > > > > .name = "moron", .pattern = "WWW", .type = "int", .size = 4, > > .name = NULL, .type = "loff_t", .size = 8, > > .name = NULL, .type = "size_t", .size = 4, > > .name = NULL, .type = NULL, .size = 0, /* end of parameter list */ > > > > i.e. "WDW". The build-time constraint checker could then warn about: > > > > # error: System call "moron" uses invalid 'WWW' argument mapping for a 'WDW' sequence > > # please avoid long-long arguments or use 'SYSCALL_DEFINE3_WDW()' instead > > ... if you do 32bit build. Yeah - but the checking tool could do a 32-bit sizing of the types and thus the checks would work on all arches and on all bitness settings. I don't think doing part of this in CPP is a good idea: - It won't be able to do the full range of checks - Wrappers should IMHO be trivial and open coded as much as possible - not hidden inside several layers of macros. - There should be a penalty for newly introduced, badly designed system call ABIs, while most CPP variants I can think of will just make bad but solvable decisions palatable, AFAICS. I.e. I think the way out of this would be two steps: 1) for new system calls: hard-enforce the highest quality at the development stage and hard-reject crap. No new 6-parameter system calls or badly ordered arguments. The tool would also check new extensions to existing system calls, i.e. no more "add a crappy 4th argument to an existing system call that works on x86 but hurts MIPS". 2) for old legacies: cleanly open code all our existing legacies and weird wrappers. No new muck will be added to it so the line count does not matter. ... is there anything I'm missing? Thanks, Ingo