Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2026163imm; Sat, 13 Oct 2018 08:35:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Heht+FOLsqzGolROqcFFsqhNNNYcBEA9fqYkN3NBe1u8+amckumtZjGVWlvTU6s5D1pEf X-Received: by 2002:a17:902:3a2:: with SMTP id d31-v6mr10296714pld.287.1539444928750; Sat, 13 Oct 2018 08:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539444928; cv=none; d=google.com; s=arc-20160816; b=JouX/ZWgjqEJEiUYHzOxU5kwjXT2vdgm9qCX5Ai2FJ+JTk9DJdj2hLP0EdXTXeMR4Y xUie82nZL0wZ1n1K5h5FCjz1bctutM4sEVQ0xpCnrJcvoFNyO+5Znygl+sEWtlF6FNB9 yr49c6IDwK6C8m9vco1CYiN67FA1+uo4TiIRzbRbTd+RG+pyNivwvl123ycaVCYB3/Dw UGSQNSCT/dqORAyz0hNlEMqRkc/hEw0o+3YetcbCOPu8wdDnbxXm/fspJizpyJG1bDS0 T6uutJPK/YWDdDzaA9Z3rftqn7EMF6iIRE5W90wWC8phgC0rnUQ6IL00uqDuWNgzJUoB ihtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6eUhFA68+kel2xdQ7TYDrb7mjx/DUjv8aCf06vUmMeo=; b=amAIyifBzeD5cgtOFbh71t/cCqTGueuMya/2OffAFuYKhrFezJAHWs+HzJ14ec8MSo PJi4V0aE1Vc/pO2F7m60R0aG2F4CLKAkCNnA2jAw0WJ8eLbJHb8wsWCh7lMM7sVH0BkG KHdnynj+lpqH88sVLqtQxx/QHXtszLLWjpqOmSzjhiSaf6AUK0BaCov3EvSoTmPm9SZz 6PaJcB8CtoJD9jfqP6d6vItCzXUIhk1V522r27klmwfQEHPLqI6+Aw5AoXJbp0KJk6Gr xKFdKvtnAWyi+k4aC1inzDbgYMp8hdJX+tPQyNPISn/RwwZ3uHjrJaxaoQwEdPBkn77p YJPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3A5LuBB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16-v6si4118884pgl.462.2018.10.13.08.35.11; Sat, 13 Oct 2018 08:35:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3A5LuBB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbeJMXMX (ORCPT + 99 others); Sat, 13 Oct 2018 19:12:23 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:41232 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbeJMXMX (ORCPT ); Sat, 13 Oct 2018 19:12:23 -0400 Received: by mail-yw1-f68.google.com with SMTP id 135-v6so6066965ywo.8 for ; Sat, 13 Oct 2018 08:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6eUhFA68+kel2xdQ7TYDrb7mjx/DUjv8aCf06vUmMeo=; b=K3A5LuBBD5uPx3dKmbna+tK41m+gqRd9yKZOQqt4DbqAvtNwm+kHFgufSdKw29xdH0 lCGBUYjflAtH8XGG+omQHfh63B5HHRKxkzm4W8RUw8NFwaQvEQZ17WRpQmi2CbE7KxfA F9fiyNx16vtONmWTTLDJ8deIh0tUcnkSSlVvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6eUhFA68+kel2xdQ7TYDrb7mjx/DUjv8aCf06vUmMeo=; b=sTbIOw7QXfQb5hfzLWEzGAbbAXf1OmReL84UGFKjBZU2SFhwUWnM2iOnuA+WwI/iyK RSoTyWNGDl0G2VNAgr60TwmGFV1LBcR2qyjwHpqIup2hgW291orI7o0RWZVeCkpsziAH EGO2aWQSgMLahuiOuFJILg0TFZOhNTtrjZmZoz2h36r5w069zi+G0XrlOlnxOG3Bc5QX aMaW9u/ASDGUlm9NRJkUSqbx68iT8c2dsKjhdcZxXjn42tbswuICCTuy4F0Njlrsg7xS qOb2MsbsUzIxHuMe1ob+gjwBoWlE9eEjEbAXTh+HEzeQ3A/ohxW1olVKgzlQwpniqWvm Tqfw== X-Gm-Message-State: ABuFfoiHQlqMZHBjhk9yeHc+pM2knr3opPJIBKKGt7wNO1wH65iR20AB B7mFYySt8isYWWGDW8wkyS8/Alu8/J8alWRaJ1dnRA== X-Received: by 2002:a81:5f86:: with SMTP id t128-v6mr5987898ywb.84.1539444885945; Sat, 13 Oct 2018 08:34:45 -0700 (PDT) MIME-Version: 1.0 References: <1539337442-3676-1-git-send-email-firoz.khan@linaro.org> <1539337442-3676-4-git-send-email-firoz.khan@linaro.org> In-Reply-To: From: Firoz Khan Date: Sat, 13 Oct 2018 21:04:34 +0530 Message-ID: Subject: Re: [PATCH v4 3/6] parisc: add system call table generation support To: Arnd Bergmann , Rolf Eike Beer Cc: linux-parisc@vger.kernel.org, "James E . J . Bottomley" , Helge Deller , Thomas Gleixner , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , Linux-Arch , Deepa Dinamani , Marcin Juszkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + Rolf Hi Arnd, Helge, Rolf, On Fri, 12 Oct 2018 at 17:21, Arnd Bergmann wrote: > > On Fri, Oct 12, 2018 at 11:45 AM Firoz Khan wrote: > > > diff --git a/arch/parisc/kernel/syscalls/Makefile b/arch/parisc/kernel/syscalls/Makefile > > new file mode 100644 > > index 0000000..a0af5a3 > > --- /dev/null > > +++ b/arch/parisc/kernel/syscalls/Makefile > > > +syshdr_abi_unistd_32 := common,32 > > +syshdr_offset_unistd_32 := __NR_Linux > > +$(uapi)/unistd_32.h: $(syscall) $(syshdr) > > + $(call if_changed,syshdr) > > + > > +syshdr_abi_unistd_64 := common,64 > > +syshdr_offset_unistd_64 := __NR_Linux > > +$(uapi)/unistd_64.h: $(syscall) $(syshdr) > > + $(call if_changed,syshdr) > > The __NR_Linux seems misplaced here, don't we need that only for ia64 > and mips? No, It wasn't misplaced. you can refer below link. https://github.com/torvalds/linux/blob/master/arch/parisc/include/uapi/asm/unistd.h#L16 FYI, In IA64, I added the __NR_Linux to come up a generic .tbl file starts with 0 as a part system call table generation. I think you might be applied my IA64 patches locally sometimes before and now you might be confused. https://github.com/torvalds/linux/blob/master/arch/ia64/include/uapi/asm/unistd.h Yes, MIPS also uses this macro. > > > +systbl_abi_syscall_table_32 := common,32 > > +$(kapi)/syscall_table_32.h: $(syscall) $(systbl) > > + $(call if_changed,systbl) > > + > > +systbl_abi_syscall_table_64 := common,64 > > +$(kapi)/syscall_table_64.h: $(syscall) $(systbl) > > + $(call if_changed,systbl) > > Have you considered making the 'common' part implied? > I expected to see it done that way, although listing it explicitly > doesn't seem harmful either. It can't be done in that way easily, I see some problem there existing script. The problem you will understand by removing "common" and run the script. You can do diff before and after the generated files. ref: grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( FYI, x86/arm/s390 implementation listing explicitly! So I almost followed there way of implementation. If you really want that way, please comment here. I need to redo the scripting for all 10 architecture. > > > +systbl_abi_syscall_table_c32 := common,compat,32 > > +$(kapi)/syscall_table_c32.h: $(syscall) $(systbl) > > + $(call if_changed,systbl) > > The way you specify 'compat' as one item in a list of > ABIs seems rather odd, I'd suggest keeping that a separate > flag. Commented below. > > Passing "common|32" as the list of ABIs in the first argument, > and 'compat' as the second argument. > > I think you can also pass arguments to 'if_changed', rather than > setting a global variable to control it. Sure. I'll have a look into this one! > arch/powerpc/boot/Makefile has some examples of that. > It should be possible to do this like > > $(kapi)/syscall_table_c32.h: $(syscall) $(systbl) > $(call if_changed,systbl,common|32,compat) This is something interesting! Rolf, I was trying to explain this one yesterday. Sorry, I know I haven't composed the mail properly. The uapi header generation script syscall table header generation script is invoked by this Makefile. systbl_abi_syscall_table_32 := common,32 $(kapi)/syscall_table_32.h: $(syscall) $(systbl) $(call if_changed,systbl) Here I want to generate systbl_abi_syscall_table_32, so I'll pass few args including the .tbl file. So script must have to identify that it is for 32. It has to read 4th column as <32/64 entry point> from the .tbl file. # The format is: # <32/64 entry point> 5 common open sys_open compat_sys_open Similarly for 64 also. Same 4th column should have to read. systbl_abi_syscall_table_c32 := common,compat,32 $(kapi)/syscall_table_c32.h: $(syscall) $(systbl) $(call if_changed,systbl) But for compat interface either it has to read 5th column if present, otherwise 4th column. Script won't understand it is for compat unless we have to explicitly inform from Makefile. There are multiple way to do: 1. This implementation systbl_abi_syscall_table_c32 := common,compat,32 /* Makefile */ my_abi="$(cut -d'|' -f2 <<< $my_abis)" /*systbl.sh */ if [ $my_abi = "compat" ]; then if [ -z "$compat" ]; then emit $nxt $nr $entry else emit $nxt $nr $compat fi else emit $nxt $nr $entry fi 2. Add extra flag in the Makefile systbl_abi_syscall_table_c32 := common,32 systbl_xyz_syscall_table_c32 := compat $(kapi)/syscall_table_c32.h: $(syscall) $(systbl) $(call if_changed,systbl) and check from the script and identify it. This looks the direct method. Here I think the problem is adding one more args 3. Without Makefile change we can identify it. No need to add extra flag Makefile ------------ systbl_abi_syscall_table_c32 := common,32 $(kapi)/syscall_table_c32.h: $(syscall) $(systbl) $(call if_changed,systbl) systbl.sh ------------- if [ ${out: -5} = "c32.h" ]; then if [ -z "$compat" ]; then emit $nxt $nr $entry else emit $nxt $nr $compat fi elif [ ${out: -4} = "64.h" -o ${out: -4} = "32.h" ]; then emit $nxt $nr $entry fi Here I was asking is there any better way to do the same. Note: The name compat in Makefile may change to c32. Note: This implementation remain same for spark and powerpc hopefully. But Mips has extra one more interface. We need to consider that also here. > > > diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl > > new file mode 100644 > > index 0000000..7c9f268 > > --- /dev/null > > +++ b/arch/parisc/kernel/syscalls/syscall.tbl > ... > > +346 common copy_file_range sys_copy_file_range > > +347 common preadv2 sys_preadv2 compat_sys_preadv2 > > +348 common pwritev2 sys_pwritev2 compat_sys_pwritev2 > > +349 common statx sys_statx > > +350 common io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents > > \ No newline at end of file > > Here is the missing newline again. This should never happen if your text > editor is configured correctly. > > > diff --git a/arch/parisc/kernel/syscalls/syscallhdr.sh b/arch/parisc/kernel/syscalls/syscallhdr.sh > > new file mode 100644 > > index 0000000..607d4ca > > --- /dev/null > > +++ b/arch/parisc/kernel/syscalls/syscallhdr.sh > > @@ -0,0 +1,35 @@ > > +#!/bin/sh > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +in="$1" > > +out="$2" > > +my_abis=`echo "($3)" | tr ',' '|'` > > +prefix="$4" > > +offset="$5" > > + > > +fileguard=_UAPI_ASM_PARISC_`basename "$out" | sed \ > > + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ > > + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` > > Maybe use ${ARCH} instead of PARISC here to keep it the same > across architectures? Sure. FYI, x86/arm/s390 has the above implementation, > > > + my_abi="$(cut -d'|' -f2 <<< $my_abis)" > > + while read nr abi name entry compat ; do > > + if [ $my_abi = "compat" ]; then > > This check seems really fragile, but if you add another argument to the > script instead of listing "compat" as the second option in the > list of ABIs, I think it's fine. Hmm. Please share ur comment in the above for the same. Thanks Firoz > > ARnd