From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 230E1C433E2 for ; Tue, 8 Sep 2020 06:21:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFFD7207DE for ; Tue, 8 Sep 2020 06:21:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="w1eK0IvZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFFD7207DE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5djfMuwZGGAHP8X1avgVH9n7oH51dFR3SqPIilrQsAQ=; b=w1eK0IvZDBiyxbC3tvCufLYkI WlNVVkHS805VMM6LdEggdyXzbDsBXAkJqPsvb+z9t4mPBm2cStZyquLIy5vdSnqw8d0mQ7yi7LDhA iCsdOFJwh1O1RGcW1ZHWHA7ioN8pQabsolg5oXyDayUNTS5GMD6VPkaASpXBgKyb2gZmRNb4VziJj ZCzMX+ZVxROOBMtFUBT0d/gfnw2mo9BbpN22uH/ac2kjMyWrs33qpPx2qhr50vT+Hezkn494u9YOD xOwPW/r9AcoIuZRaGLQsC1OzK6OXYg9rHr3oLJO/d3b+a+5HQQRRxUxGKx34g5WQcWsAklK/e2sTV Lr6f/DngQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFWzC-0001rr-Hm; Tue, 08 Sep 2020 06:20:10 +0000 Received: from verein.lst.de ([213.95.11.211]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFWz8-0001qY-Io for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 06:20:07 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 15E9468AFE; Tue, 8 Sep 2020 08:20:03 +0200 (CEST) Date: Tue, 8 Sep 2020 08:20:02 +0200 From: Christoph Hellwig To: Arnd Bergmann Subject: Re: [PATCH 5/9] ARM: oabi-compat: rework epoll_wait/epoll_pwait emulation Message-ID: <20200908062002.GD13930@lst.de> References: <20200907153701.2981205-1-arnd@arndb.de> <20200907153701.2981205-6-arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200907153701.2981205-6-arnd@arndb.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_022006_831552_49C63126 X-CRM114-Status: GOOD ( 30.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Andrew Morton , linus.walleij@linaro.org, kernel@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, Russell King , linux-fsdevel@vger.kernel.org, Christian Brauner , Christoph Hellwig , linux-arm-kernel@lists.infradead.org, Alexander Viro Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 07, 2020 at 05:36:46PM +0200, Arnd Bergmann wrote: > The epoll_wait() system call wrapper is one of the remaining users of > the set_fs() infrasturcture for Arm. Changing it to not require set_fs() > is rather complex unfortunately. > > The approach I'm taking here is to allow architectures to override > the code that copies the output to user space, and let the oabi-compat > implementation check whether it is getting called from an EABI or OABI > system call based on the thread_info->syscall value. > > The in_oabi_syscall() check here mirrors the in_compat_syscall() and > in_x32_syscall() helpers for 32-bit compat implementations on other > architectures. > > Overall, the amount of code goes down, at least with the newly added > sys_oabi_epoll_pwait() helper getting removed again. The downside > is added complexity in the source code for the native implementation. > There should be no difference in runtime performance except for Arm > kernels with CONFIG_OABI_COMPAT enabled that now have to go through > an external function call to check which of the two variants to use. > > Signed-off-by: Arnd Bergmann > --- > arch/arm/include/asm/syscall.h | 11 +++++ > arch/arm/kernel/sys_oabi-compat.c | 72 +++++++------------------------ > arch/arm/tools/syscall.tbl | 4 +- > fs/eventpoll.c | 5 +-- > include/linux/eventpoll.h | 16 +++++++ > 5 files changed, 46 insertions(+), 62 deletions(-) > > diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h > index ff6cc365eaf7..0d8afceeefd9 100644 > --- a/arch/arm/include/asm/syscall.h > +++ b/arch/arm/include/asm/syscall.h > @@ -28,6 +28,17 @@ static inline int syscall_get_nr(struct task_struct *task, > return task_thread_info(task)->syscall; > } > > +static inline bool __in_oabi_syscall(struct task_struct *task) > +{ > + return IS_ENABLED(CONFIG_OABI_COMPAT) && > + (task_thread_info(task)->syscall & __NR_OABI_SYSCALL_BASE); > +} > + > +static inline bool in_oabi_syscall(void) > +{ > + return __in_oabi_syscall(current); > +} > + > static inline void syscall_rollback(struct task_struct *task, > struct pt_regs *regs) > { > diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c > index 2ce3e8c6ca91..abf1153c5315 100644 > --- a/arch/arm/kernel/sys_oabi-compat.c > +++ b/arch/arm/kernel/sys_oabi-compat.c > @@ -83,6 +83,8 @@ > #include > #include > > +#include > + > struct oldabi_stat64 { > unsigned long long st_dev; > unsigned int __pad1; > @@ -264,68 +266,24 @@ asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, > return do_epoll_ctl(epfd, op, fd, &kernel, false); > } > > -static long do_oabi_epoll_wait(int epfd, struct oabi_epoll_event __user *events, > - int maxevents, int timeout) > +struct epoll_event __user * > +epoll_put_uevent(__poll_t revents, __u64 data, struct epoll_event __user *uevent) > { > + if (in_oabi_syscall()) { > + struct oabi_epoll_event *oevent = (void __user *)uevent; > > + if (__put_user(revents, &oevent->events) || > + __put_user(data, &oevent->data)) > + return NULL; > > + return (void __user *)uevent+1; > + } I wonder if we'd be better off doing the in_oabi_syscall() branch in the common code. E.g. rename in_oabi_syscall to in_legacy_syscall and stub it out for all other architectures. Then just do if (in_oabi_syscall() legacy_syscall_foo_bit(); else normal_syscall_foo_bit(); in common code, where so far only arm provides legacy_syscall_foo_bit(). Tons of long lines again in this patch.. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel