Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1580854ybc; Wed, 13 Nov 2019 00:44:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzaXPGkPgqfxxrWalxliM1Nh1/IZ+ObPIIq7yTBvcXMZsMh8s/2I6UFaq0EwayTAaop4kM6 X-Received: by 2002:a50:8dc9:: with SMTP id s9mr2269736edh.155.1573634649454; Wed, 13 Nov 2019 00:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573634649; cv=none; d=google.com; s=arc-20160816; b=QTkYwknhZzouepc8GrG3ZcoUPXx8wQlVJkpbBy0G0iS/jGW8vWNhZxyLgpjoKL5tqj WYu5vbgOp6TX37kUBPhBtpswhwu5OIq0pVG3+VaBPZ6R0nQAOAY69gpLs+R40pRWhuX1 GBtkSU4s4XPC9Mb+tW84mNCglFAIN3lwsPgS4cfhky7Hv0/dbglv+XN3JGbqNbM8u6RC ZrPdPIYDOzROeumcJ1SSTm4P9p1IbTnvVN6bBbcfxVWhkE0z81oA28cpMvO/CfrT/tTA vnM/3CUUQsR3p3HV3ZZnCkl28RjYUKM065wRHbGExqCrgN7CWxw3I60Ll0AOUPepj9YL /Xww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CJ7XX+kebLE0P4b080ckFhOpNfrXNTe+zTulvTYDKfQ=; b=0LdP9FH+6UAs5iEpyYX0hCR1qnopws8GJdtRKx6YmcoiEZGCI4iVxECGL5PFh2Xa3p IBE6lczvzk8ArerhGdM52azr0kRsgWWZD/rXyiL2FiUM25gbALumjpLqkjs2eq2TTUiJ rozsunX4wBIwcRj4LoMDis1/m/WdNIQ+PVTUE7YIMxNsfalvqJOhOdN/wSYOixpoemek YsGI+5TJYUybxRKIv0tDEXtKIXBSu8Ph2Y09ETht12+6WV4ewToxGfKzVylGX+46qv57 RuNJNa3PLFawvYftiKqjytRUOjTnVuQLQE8KMOGPnGtc5PXXKSklUsvTGfuLX2m/X3dK 1cBw== 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 u24si1004491edl.447.2019.11.13.00.43.43; Wed, 13 Nov 2019 00:44:09 -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 S1727211AbfKMIly (ORCPT + 99 others); Wed, 13 Nov 2019 03:41:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:45956 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725996AbfKMIly (ORCPT ); Wed, 13 Nov 2019 03:41:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2237BB11F; Wed, 13 Nov 2019 08:41:49 +0000 (UTC) Date: Wed, 13 Nov 2019 09:41:37 +0100 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org, Andrew Morton , Allison Randal , Andrew Donnellan , Arnd Bergmann , Benjamin Herrenschmidt , Brajeswar Ghosh , Claudio Carvalho , Christian Brauner , Christophe Leroy , David Hildenbrand , David Howells , Diana Craciun , Daniel Axtens , Dmitry Vyukov , "Eric W. Biederman" , Firoz Khan , Geert Uytterhoeven , Greg Kroah-Hartman , Gustavo Romero , Hari Bathini , Heiko Carstens , Jagadeesh Pagadala , Breno Leitao , linux-kernel@vger.kernel.org, Madhavan Srinivasan , Mahesh Salgaonkar , Mathieu Malaterre , Michael Neuling , Michael Ellerman , "Naveen N. Rao" , Nicolai Stange , Oleg Nesterov , Paul Mackerras , Steven Rostedt , Russell Currey , Thomas Gleixner , Valentin Schneider , Alexander Viro , Masahiro Yamada Subject: Re: [PATCH 31/33] powerpc/64: make buildable without CONFIG_COMPAT Message-ID: <20191113084137.GI2770@kitsune.suse.cz> References: <13fa324dc879a7f325290bf2e131b87eb491cd7b.1573576649.git.msuchanek@suse.de> <1573613683.ylw9dz9mlc.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1573613683.ylw9dz9mlc.astroid@bobo.none> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 13, 2019 at 01:02:34PM +1000, Nicholas Piggin wrote: > Michal Suchanek's on November 13, 2019 2:52 am: > > There are numerous references to 32bit functions in generic and 64bit > > code so ifdef them out. > > > > Signed-off-by: Michal Suchanek > > For the most part these seem okay to me. > > > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile > > index 45f1d5e54671..35874119b398 100644 > > --- a/arch/powerpc/kernel/Makefile > > +++ b/arch/powerpc/kernel/Makefile > > @@ -44,16 +44,16 @@ CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING > > endif > > > > obj-y := cputable.o ptrace.o syscalls.o \ > > - irq.o align.o signal_32.o pmc.o vdso.o \ > > + irq.o align.o signal_$(BITS).o pmc.o vdso.o \ > > process.o systbl.o idle.o \ > > signal.o sysfs.o cacheinfo.o time.o \ > > prom.o traps.o setup-common.o \ > > udbg.o misc.o io.o misc_$(BITS).o \ > > of_platform.o prom_parse.o > > -obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ > > - signal_64.o ptrace32.o \ > > +obj-$(CONFIG_PPC64) += setup_64.o \ > > paca.o nvram_64.o firmware.o note.o \ > > syscall_64.o > > +obj-$(CONFIG_COMPAT) += sys_ppc32.o ptrace32.o signal_32.o > > obj-$(CONFIG_VDSO32) += vdso32/ > > obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o > > obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o > > diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S > > index 00173cc904ef..c339a984958f 100644 > > --- a/arch/powerpc/kernel/entry_64.S > > +++ b/arch/powerpc/kernel/entry_64.S > > @@ -52,8 +52,10 @@ > > SYS_CALL_TABLE: > > .tc sys_call_table[TC],sys_call_table > > > > +#ifdef CONFIG_COMPAT > > COMPAT_SYS_CALL_TABLE: > > .tc compat_sys_call_table[TC],compat_sys_call_table > > +#endif > > > > /* This value is used to mark exception frames on the stack. */ > > exception_marker: > > diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c > > index 60436432399f..61678cb0e6a1 100644 > > --- a/arch/powerpc/kernel/signal.c > > +++ b/arch/powerpc/kernel/signal.c > > @@ -247,7 +247,6 @@ static void do_signal(struct task_struct *tsk) > > sigset_t *oldset = sigmask_to_save(); > > struct ksignal ksig = { .sig = 0 }; > > int ret; > > - int is32 = is_32bit_task(); > > > > BUG_ON(tsk != current); > > > > @@ -277,7 +276,7 @@ static void do_signal(struct task_struct *tsk) > > > > rseq_signal_deliver(&ksig, tsk->thread.regs); > > > > - if (is32) { > > + if (is_32bit_task()) { > > if (ksig.ka.sa.sa_flags & SA_SIGINFO) > > ret = handle_rt_signal32(&ksig, oldset, tsk); > > else > > This is just a clean up I guess. It also expands directly to if(0) or if(1) for the !COMPAT cases. I am not sure how it would work with the intermediate variable. There was more complex change initially but after some additional cleanups removing the variable is the only part left. > > > diff --git a/arch/powerpc/kernel/syscall_64.c b/arch/powerpc/kernel/syscall_64.c > > index d00cfc4a39a9..319ebd4f494d 100644 > > --- a/arch/powerpc/kernel/syscall_64.c > > +++ b/arch/powerpc/kernel/syscall_64.c > > @@ -17,7 +17,6 @@ typedef long (*syscall_fn)(long, long, long, long, long, long); > > > > long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8, unsigned long r0, struct pt_regs *regs) > > { > > - unsigned long ti_flags; > > syscall_fn f; > > > > if (IS_ENABLED(CONFIG_PPC_BOOK3S)) > > @@ -64,8 +63,7 @@ long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8, > > > > __hard_irq_enable(); > > > > - ti_flags = current_thread_info()->flags; > > - if (unlikely(ti_flags & _TIF_SYSCALL_DOTRACE)) { > > + if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) { > > /* > > * We use the return value of do_syscall_trace_enter() as the > > * syscall number. If the syscall was rejected for any reason > > @@ -81,7 +79,7 @@ long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8, > > /* May be faster to do array_index_nospec? */ > > barrier_nospec(); > > > > - if (unlikely(ti_flags & _TIF_32BIT)) { > > + if (unlikely(is_32bit_task())) { > > f = (void *)compat_sys_call_table[r0]; > > > > r3 &= 0x00000000ffffffffULL; > > I guess this is okay, I did want to be careful about where ti_flags > was loaded exactly, but I think DOTRACE and 32BIT are not volatile. > Is it possible to define _TIF_32BIT to zero for 64-bit !compat case > and have the original branch eliminated, or does that cause other > problems? is_32bit_task() expands to 0 or 1 constant unless CONFIG_COMPAT is set. That's why the test needs replacing here. Unsetting _TIF_32BIT might also be feasible but it is not necessary. Thanks Michal