Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3040937imu; Mon, 19 Nov 2018 09:44:23 -0800 (PST) X-Google-Smtp-Source: AJdET5f5iO1xh5bk7OInNBBR2awQikOn2AXM2iMCvV8V+v0pTdYwGAQ3wOWGxtSR60WerIqfSa4X X-Received: by 2002:a63:4d0e:: with SMTP id a14mr14206632pgb.408.1542649462925; Mon, 19 Nov 2018 09:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542649462; cv=none; d=google.com; s=arc-20160816; b=p7gWOdo34EPuWxr3+jiJpCmA5wGMUsJaskE4CMi2cKN0yiuKsPfKNohcKaOWujVJXL ude8dzsXelHNZjdQ2jFKJVYIIhPnUB0bsjlgfRK0nABbgj/h0OjzQXKqDrXpaUXZ1Ume nM6Xt1AHBCMPRAEy4YXmLl4rUzwcVhJMKrit++HWTPJ4liEQcdTxkyxa35n28PY9VB/O VXoCnyzgndSbFon2mnSbM3PtsOSEqQbkOXr6OidCdTOEwDYihBQD8kAElpMhnVkd1wkL OFE5BUO1omEwqsHOIFlf5bUhbFgrVCLMVRS1d+FL336R5kP4ScM+RWCQgDafop5aAkKr eIZw== 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; bh=Xg6Y6slrTdFIaEN2P3vXaS05djo0SrywOjWqLbprJVs=; b=u31yYc9nSI6XQZFyzou6XhSGnU/YZ9mbgpBfeAcBwD7nqOg7V9snwwP8lqR5QH2JCZ pLTPHz5IfdFuABomEZ8xYQYQ6fPFuYmFHGZPhv8xM5HlNPLeco0/pbLL6ywo9/oRT/1H hb3rXryZs7M1XcdYuuDP6+RGGPELXIjyxGvFZKCiN+ZJaGoQWk6rYrWWZl266qu5xZp4 HqXTuLR70dMiJpMur8OBqWBq3/YacBRX/D52mmvTy7MDSUI8Kxb8n11YGCvgs40ZXHjg mLewWmXpaUdCH7jURJup2HRWTBKKoHxJohePWoo3kLgARc43mVYD+RSd7Z26UDbOxWhB 6aww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si39620510plt.9.2018.11.19.09.44.07; Mon, 19 Nov 2018 09:44:22 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389402AbeKTDMf (ORCPT + 99 others); Mon, 19 Nov 2018 22:12:35 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39858 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387988AbeKTDMe (ORCPT ); Mon, 19 Nov 2018 22:12:34 -0500 Received: by mail-qk1-f195.google.com with SMTP id q70so32147251qkh.6; Mon, 19 Nov 2018 08:48:21 -0800 (PST) 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=Xg6Y6slrTdFIaEN2P3vXaS05djo0SrywOjWqLbprJVs=; b=Zm5F9AsAnG0IjqUvg5uPtpPdXt7QWS5s0Z3DIBmVuqXy+18/8jrhj4kiHUXemb6wmz e+n7IEc5KYWZXS5W/wng5fhegt/u+2TPeHjyYEP1VpYm5DTO0oR9H6Vj9EAwcij9nZHW uNohseIgx4+wg9Li/+Z1N7XJ8Qcc2/c4qNVCIezTMRYisb9ofMNAIr2mP8Rr8sW22H1c 06DHa0iJZg3L0XG89Mx+6EgxyZg89eF052lMNqy1vTh9XiomrNmA8JJxKtW6QLlY8gkH uSip6QV3qxeFK+qpSPJITYoU7BSx2thQXtoK4syNqUYziYmDcJVZQpRvABC6hnrCaOKM HOCA== X-Gm-Message-State: AGRZ1gLGLqp8E9rW6XGYVVXzqmMjA8XuyXphMPeTQ7apl8PvkViFP+2r 0wR/lniNWHMbT3EQV80nSK2MVryuMbCJpan3/IE= X-Received: by 2002:aed:35c5:: with SMTP id d5mr21493142qte.212.1542646100257; Mon, 19 Nov 2018 08:48:20 -0800 (PST) MIME-Version: 1.0 References: <1542189798-27713-1-git-send-email-firoz.khan@linaro.org> <1542189798-27713-4-git-send-email-firoz.khan@linaro.org> In-Reply-To: <1542189798-27713-4-git-send-email-firoz.khan@linaro.org> From: Arnd Bergmann Date: Mon, 19 Nov 2018 17:48:02 +0100 Message-ID: Subject: Re: [PATCH v2 3/4] powerpc: add system call table generation support To: Firoz Khan Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxram@us.ibm.com, Geert Uytterhoeven , leitao@debian.org, Boqun Feng , linuxppc-dev , Thomas Gleixner , gregkh , 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 On Wed, Nov 14, 2018 at 11:04 AM Firoz Khan wrote: > Adding a new table entry consisting of: > - System call number. > - ABI. > - System call name. > - Entry point name. > - Compat entry name, if required. > > syscallhdr.sh and syscalltbl.sh will generate uapi header- > unistd_32/64.h and syscall_table_32/64/c32.h files respect- > ively. File syscall_table_32/64/c32.h is included by sys- > call.S - the real system call table. Both .sh files will > parse the content syscall.tbl to generate the header and > table files. You don't mention how this handles the SPU, which seems to be the main difference from the other architectures. > +# The format is: > +# > +# > +# The can be common, 64, or 32 for this file. > +# > +0 common restart_syscall sys_restart_syscall sys_restart_syscall > +1 common exit sys_exit sys_exit > +2 common fork ppc_fork ppc_fork > +3 common read sys_read sys_read sys_read > +4 common write sys_write sys_write sys_write > +5 common open sys_open compat_sys_open sys_open > +6 common close sys_close sys_close sys_close > +7 common waitpid sys_waitpid sys_waitpid sys_waitpid > +8 common creat sys_creat sys_creat sys_creat The SPU syscall is always the same as the 64-bit syscall, so listing it explictily in the last column seems to add a lot of duplication, and makes the format different from the other architectures. Have you considered using the field (second column) to decide whether a syscall is used for SPU or not instead? I would have done it like |+0 nospu restart_syscall sys_restart_syscall sys_restart_syscall |+1 nospu exit sys_exit sys_exit |+2 nospu fork ppc_fork ppc_fork |+3 common read sys_read sys_read |+4 common write sys_write sys_write |+5 common open sys_open compat_sys_open |+6 common close sys_close sys_close ... |+291 32 fstatat64 sys_fstatat64 sys_fstatat64 |+291 64 newfstatat sys_newfstatat |+291 spu newfstatat sys_newfstatat ... with 'nospu' meaning 64+32+compat. > +9 common link sys_link sys_link sys_link > +10 common unlink sys_unlink sys_unlink sys_unlink > +11 common execve sys_execve compat_sys_execve > +12 common chdir sys_chdir sys_chdir sys_chdir > +13 common time sys_time compat_sys_time sys_time > +14 common mknod sys_mknod sys_mknod sys_mknod > +15 common chmod sys_chmod sys_chmod sys_chmod > +16 common lchown sys_lchown sys_lchown sys_lchown > +17 common break sys_ni_syscall sys_ni_syscall > +18 32 oldstat sys_stat sys_ni_syscall > +18 64 oldstat sys_ni_syscall 'oldstat' seems odd. Your conversion is correct, but the existing behavior of not providing support for the syscall in compat mode feels wrong. We have four calls in this category: arch/powerpc/include/asm/systbl.h:OLDSYS(stat) arch/powerpc/include/asm/systbl.h:OLDSYS(fstat) arch/powerpc/include/asm/systbl.h:OLDSYS(lstat) arch/powerpc/include/asm/systbl.h:OLDSYS(debug_setcontext) For the first three, it seems that the 64-bit kernel ought to set '__ARCH_WANT_OLD_STAT': diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 96ddce5c76c3..335dfcc47f20 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -42,9 +42,7 @@ #define __ARCH_WANT_SYS_OLDUMOUNT #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK -#ifdef CONFIG_PPC32 #define __ARCH_WANT_OLD_STAT -#endif #ifdef CONFIG_PPC64 #define __ARCH_WANT_SYS_TIME32 #define __ARCH_WANT_SYS_UTIME32 diff --git a/arch/powerpc/include/uapi/asm/stat.h b/arch/powerpc/include/uapi/asm/stat.h index afd25f2ff4e8..f64e47b46e4b 100644 --- a/arch/powerpc/include/uapi/asm/stat.h +++ b/arch/powerpc/include/uapi/asm/stat.h @@ -11,7 +11,7 @@ #define STAT_HAVE_NSEC 1 -#ifndef __powerpc64__ +#if !defined(__powerpc64__) || defined(__KERNEL__) struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; For debug_setcontext(), I don't even know what that does, or whether the omission was intentional, but it seems weird to have one missing syscall in the emulation. > +19 common lseek sys_lseek compat_sys_lseek sys_lseek > +20 common getpid sys_getpid sys_getpid sys_getpid > +21 common mount sys_mount compat_sys_mount > +22 32 umount sys_oldumount sys_oldumount > +22 64 umount sys_ni_syscall Note: for a future cleanup, I suppose we want to remove the '64' line for this one and others that simply refer to sys_ni_syscall. Your version keeps the generated file unchanged, so that that's great for now. > +31 common stty sys_ni_syscall sys_ni_syscall > +32 common gtty sys_ni_syscall sys_ni_syscall same here. > +82 32 select ppc_select sys_ni_syscall > +82 64 select sys_ni_syscall This one again is like 'stat': it lacks a compat handler, which exists in arch/powerpc/kernel/syscalls.c, but is disabled in ppc64/compat mode for unknown reasons. In this case, it's been like that since the compat mode was first added. > +106 common stat sys_newstat compat_sys_newstat sys_newstat > +107 32 lstat sys_newlstat compat_sys_newlstat sys_newlstat > +107 64 lstat sys_lstat > +108 32 fstat sys_newfstat compat_sys_newfstat sys_newfstat > +108 64 fstat sys_fstat Can you explain what is going on here? As far as I can see, those should all be 'common'. Arnd