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 F3D43C47074 for ; Thu, 4 Jan 2024 20:44:52 +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=pSy6QyOe6ImNUBRgsQMWQmWWGfYn+MVZ+bdrNL8rKDE=; b=sW5NTgOY1vi5QI y7zujL2cHZ4kh6jFgGJix4f5rUYGjSLhiskdfuDAXzvyGSfGewCXs4bHwAcHz55fz7AGpiA0RKRNp cS2ZsQdHPx55oTS6IKrQWsSIX83EcySxtFMef46+VeqSFK4BllGsPVPr4jEXhhC2kfTLo7unGy4ye sgiAOdssvShFpP/Or9B+6jwNZJLAULK2Mg6iH1PBq0uZh6QoHviRFOydlgFGm5TWRhrEOMCkkJtA2 3eP+7PknbQ/mwgAU8aGNYMBoHNnVIeB7YrgI+qVrPgg+duRPbPsc4vR58kL13eyHK9vIRqsOtQxns xEcU/ETnc/CVPRYfZ4/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLUZn-00FByP-0a; Thu, 04 Jan 2024 20:44:27 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLUZj-00FBxs-2z for linux-arm-kernel@lists.infradead.org; Thu, 04 Jan 2024 20:44:25 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 55ED75C013C; Thu, 4 Jan 2024 15:44:18 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 04 Jan 2024 15:44:18 -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=fm1; t=1704401058; x=1704487458; bh=vxMtzvPMQK d1SiZacsZyfWzRtiMATjf/63voQ2li8VE=; b=GqgKWDGSjf+o89/ZfSg5ye798L UxTrE7QcH3I0GCosFtX/9yacxell1/4rzznVyTJFrtpGtlHyMGnF02j+26vyRlYL 5pJyaRtxz8m2kTC1nd+IKeg5ZfpuQeMqFm8qofiHYO9Mh5jbRxmA55OB55/v0/YQ 3g/O8Rnwdtl1MQPZtM+sZ8LOg4ZblbuJIiHrd+wtjRenx4fRILk0nzcyFNjgP4Nw YablXV5aGDbf1Ennxd4PkgW8909josANAkqdygvHRjgVFsQ627AE0TP9FhRWvW7B zZe8kCHVeC3UpL4wiChnRSOzIzjrry9aknT3Yj73SCOwAyYMHFa0g0xI2l9Q== 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=1704401058; x=1704487458; bh=vxMtzvPMQKd1SiZacsZyfWzRtiMA Tjf/63voQ2li8VE=; b=ttUZcSHwR64wPlT9m++LhG15pGFMrud7o9jpHDOPsbGE uv0KGOze1kJb/NMzAG40DkllRE2uTsH/P1UAQq/cznvm5n9x2VpVH7iiTWGPMVOG urfQhLVGGUuP7b/CkMUPvaG8gkxiYyF0aKlTdZtT7CGF+zjhHyLKIR/IsUiSG10y OQiMcuFaVh5kzrNu5L+SW3e1omrkAo4SaStNp/DJ5b0+O2jAm2COgXvmAAEdz5xh d3jk5ijFE4W4FvIBkU6NDAv5prIjhCbFmGIYQmJcugdY78KMNcX6vhN784LpvFBE 6mJAwilBdxphO3j1AgmN+LCl9R1umieSGlspu+PIyA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegjedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B617AB60092; Thu, 4 Jan 2024 15:44:17 -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: <8412ce8a-7016-4f65-99d3-ce472a75d8cd@app.fastmail.com> In-Reply-To: <20240104192433.109983-2-leobras@redhat.com> References: <20240104192433.109983-2-leobras@redhat.com> Date: Thu, 04 Jan 2024 21:43:56 +0100 From: "Arnd Bergmann" To: "Leonardo Bras" , "Catalin Marinas" , "Will Deacon" , "Oleg Nesterov" , "Ard Biesheuvel" , "Teo Couprie Diaz" , "Mark Rutland" , "Mark Brown" , "Steven Rostedt" , "Guo Hui" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v1 1/1] arm64: add compile-time test into is_compat_task() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_124424_450962_55D65BE3 X-CRM114-Status: GOOD ( 23.77 ) 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 Thu, Jan 4, 2024, at 20:24, Leonardo Bras wrote: > Currently some parts of the codebase will test for CONFIG_COMPAT before > testing is_compat_task(), probably in order to avoid a run-time test into > the task structure, while other parts of codebase will just test even when > the option is not compiled in. > > Since is_compat_task() is an inlined function, it would be helpful to add a > !CONFIG_COMPAT version of the helper, allowing compile-time optimization. > > With this, the compiler is able to understand in build-time that > is_compat_task() will always return 0, and optimize-out some of the extra > code introduced by the option. > > This allows optimizing-out code when the option is not selected, and > otherwise removing a lot #ifdefs that were introduced, making the code > more clean. > > Signed-off-by: Leonardo Bras This looks like a useful cleanup to me, with one change: > --- > arch/arm64/include/asm/compat.h | 5 +++++ > arch/arm64/kernel/ptrace.c | 6 ++---- > arch/arm64/kernel/syscall.c | 5 +---- > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h > index ae904a1ad5293..3cc61cbbb9062 100644 > --- a/arch/arm64/include/asm/compat.h > +++ b/arch/arm64/include/asm/compat.h > @@ -100,6 +100,11 @@ long compat_arm_syscall(struct pt_regs *regs, int scno); > > #else /* !CONFIG_COMPAT */ > > +static inline int is_compat_task(void) > +{ > + return 0; > +} > + I think this bit is not even needed as long as users include linux/compat.h rather than asm/compat.h, as there is already a macro definition in the common file: #define is_compat_task() (0) Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel