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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB79EC3DA6E for ; Mon, 8 Jan 2024 16:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Date:References: In-Reply-To:Message-Id:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Od0OPsPH3dc9eqBY7uG8uO4XepPd5o9qMeEAWB7m5Xc=; b=DaMPPki49vhohf P3Gzc3J3r3LApOF/B0clg7J3wJjGILSIbKMuCh/8m1QWRKSQzuaM8n0OHc6Yr7guPHhAV0W4dWOmz DLGxWyS3Xi59fisrq/PnH+50e6Nr4OOwLfdYj9htJD+lHISa4p4VgMUDSDYzYqHPzwFkRyu6OaOul NsVukwY/BBvcZFGGhRKjdJyiiEb8VTIrBaOR1Fgan1Ssr16iMgN/a9rT5+d3gt3KOAmK6UP325cLW Udn+D6GoTVYxstcOc/5PKPRyDYcSlslU/CClYgAYPvrzaPWFeZYH7+kXjJP/qdjmtvNczKiLAls5q fOi4Ik0ej459TFezllDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rMsSm-005d84-2k; Mon, 08 Jan 2024 16:26:56 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rMsSk-005d6m-0X for linux-arm-kernel@lists.infradead.org; Mon, 08 Jan 2024 16:26:56 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id EFC6F5C031A; Mon, 8 Jan 2024 11:26:46 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 08 Jan 2024 11:26:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1704731206; x=1704817606; bh=eeIzoqxrLX o1KH8BIqbi+bTf8TyIf0sMlfYqbdxX6QQ=; b=eLMqCnP2BUFKyAsVgX1rOKjFDV S4KTs1mPwq7THeA/it05hV74OvJykOS2Ujskkn0Ts3NirCjUIMXkMf/QJuTlBydQ 0z229j2CYF1edy8Yeumj0noQqTYJ88fNAGEldPqeIoGHkkvQKveP9cRRJLGlvN0a eHy4mtyZd4Y3eLNnJaBbvJsOkRmvxyg6litoOungLvIA2FAS6dmSU57eD76piW9T 8iqwB1s0yESSTg3haVNSrMl8PHf11QxXj2yvl4/r7j0yIGHupOOLfD/Seg60TRnH e2P3DUnVLIn7OQv3lMnGvjE+h3A7thi5s5hzs3hyAqN7jR3mrCIKeAt+yJBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704731206; x=1704817606; bh=eeIzoqxrLXo1KH8BIqbi+bTf8TyI f0sMlfYqbdxX6QQ=; b=53g7yn4eUzL7WZbr/n2CLy6X06nxW3hQkQOhlf5MdIMV PZadsxw2um0gDWTEJeWqjsj/C5IEt3WJCRRA6UcO9Sj42CVQuijH3WOYr9TuDlqy t2QwiHJZS6tNsenQQXvOmkWh9Ieayb6HjwNawg0inUWZZzDn/DIfCHbrUwxIPE7U kQnFV3kox04ZKdUj2BBN6LcAjp6cUspt1G43MZxG+1TAQc64lsdyCIylRaPgi45b uPrTART495RqYGjpnY6JT1aHRGhwA1ChAq9ZnuynUnjIQeEiQdwfKSwiieeY3lCz b9g/YE8YJRV99Wa5GwwN8xp0ygDOFccLJq0fDNL7Kg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehjedgkeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5C0BFB6008F; Mon, 8 Jan 2024 11:26:46 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 MIME-Version: 1.0 Message-Id: <6278e066-a443-4055-9e5c-b13dea5909de@app.fastmail.com> In-Reply-To: References: <20240105041458.126602-3-leobras@redhat.com> <112ae7d5-61b2-4887-a56f-35ea7c3b1bfa@app.fastmail.com> Date: Mon, 08 Jan 2024 17:26:26 +0100 From: "Arnd Bergmann" To: "Leonardo Bras" Cc: "Mark Rutland" , "Oleg Nesterov" , "Catalin Marinas" , "Will Deacon" , "Mark Brown" , "Steven Rostedt" , "Guo Hui" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/1] arm64: remove unnecessary ifdefs around is_compat_task() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240108_082654_670619_8C3F10D5 X-CRM114-Status: GOOD ( 25.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Jan 8, 2024, at 17:04, Leonardo Bras wrote: > On Mon, Jan 08, 2024 at 12:07:48PM -0300, Leonardo Bras wrote: >> On Fri, Jan 05, 2024 at 03:38:05PM +0100, Arnd Bergmann wrote: >> > >> > I suspect it's enough to remove all of the other >> > "#ifdef CONFIG_COMPAT" checks in this file and rely on >> > dead code elimination to remove the rest, but there might >> > be additional problems if some extern declarations are >> > hidden in an #ifdef as well. > > I could remove all CONFIG_COMPAT ifdefs from this file, and for compiling > it required a few extra defines (in other files) to be moved outside of > their #ifdef CONFIG_COMPAT. Those being: > > #define VFP_STATE_SIZE ((32 * 8) + 4) > #define VFP_FPSCR_STAT_MASK 0xf800009f > #define VFP_FPSCR_CTRL_MASK 0x07f79f00 > > #define COMPAT_ELF_NGREG 18 > typedef unsigned int compat_elf_greg_t; > typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; > > > OTOH, the size of the final arch/arm64/kernel/ptrace.o went from 44768 to > 56328 bytes, which I understand to be undesired. Right, unfortunately it seems that compat_arch_ptrace() is globally visible and consequently not dropped by the compiler in dead code elimination. > A different (and simpler) solution is to have an empty struct in case of > !CONFIG_COMPAT, that will be optimized out in compile-time: > > diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c > index 9f8781f1fdfda..d2f275d8a3e6e 100644 > --- a/arch/arm64/kernel/ptrace.c > +++ b/arch/arm64/kernel/ptrace.c > @@ -2107,6 +2107,9 @@ long compat_arch_ptrace(struct task_struct > *child, compat_long_t request, > > return ret; > } > +#else > +static const struct user_regset_view user_aarch32_view = {}; > +static const struct user_regset_view user_aarch32_ptrace_view = {}; > #endif /* CONFIG_COMPAT */ > > const struct user_regset_view *task_user_regset_view(struct task_struct *task) > > With this the patch will build successfully and arch/arm64/kernel/ptrace.o > will be able to keep it's original size. > > Arnd, is that ok? I don't see it being worth it if you add extra unused lines in order to remove one more #ifdef. I would either leave the task_user_regset_view() function unchanged here, or (if this works) move the #ifdef down a few lines so the existing user_regset_view structures can be shared: @@ -1595,7 +1595,6 @@ static const struct user_regset_view user_aarch64_view = { .regsets = aarch64_regsets, .n = ARRAY_SIZE(aarch64_regsets) }; -#ifdef CONFIG_COMPAT enum compat_regset { REGSET_COMPAT_GPR, REGSET_COMPAT_VFP, @@ -1852,6 +1851,7 @@ static const struct user_regset_view user_aarch32_ptrace_view = { .regsets = aarch32_ptrace_regsets, .n = ARRAY_SIZE(aarch32_ptrace_regsets) }; +#ifdef CONFIG_COMPAT static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off, compat_ulong_t __user *ret) { Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel