Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7943031rdb; Thu, 4 Jan 2024 12:44:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpARKqtHuSyRNKJn6xFmTIyiB7THMIwJ7H80ha8E3SaIalMY/GiH/vCit2BKxHQcmAaqyp X-Received: by 2002:a05:6214:27c9:b0:67f:6056:7dd6 with SMTP id ge9-20020a05621427c900b0067f60567dd6mr1472567qvb.32.1704401071009; Thu, 04 Jan 2024 12:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704401070; cv=none; d=google.com; s=arc-20160816; b=pnBql9A+Lns27g21SjBrY2tEwEADw0rmaa9sTMA8AP7LT1KRChxWQ65wCc7WO65NWt +aL4XCCSdDZ6U/CHy4leJOfIMxPtfhsDwdVMkLpCxUsSIkYeDq/4boBgr4L/jxzy9xuK CNp5YGAWPYBs9yBKmHGKydG+uTdZmmPmnIvfcwj7DaHZgY4qbyfGatuMdLGeeVu618v8 LqM4ntXIr7C4x79w+w7nwNj6OMIwx8OZYrks9sjB3ihYJ5pN0aV89I6qEVJmDjwrKXJZ 4T6UV/Jx0PZ0zkCtyibusjDo6yYqXb4qYjENQKT2HBHifgRyajT2GUqkbEq8rOf4cUo9 7EnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=vxMtzvPMQKd1SiZacsZyfWzRtiMATjf/63voQ2li8VE=; fh=Vb44sp0Mb3c/C90pOoYJT92NQ+jIAk22We1AH1oAEho=; b=rFtLR4hlqRTvhRvhctLZxF2xmRPU5jFbqnBXnfXy4XTOrLEleHbn6vsqIo4ybjpo5D Y33FNgvs8gMU52Dy+rIVGdizXKUaCjkVM+byu4/oB+PcI5XkSOnLOc+HfRoIKhDR/BVV ZFVpGGtelP3H9mutzoB/NASkL/Zq7xoOI8NK9sYhUPC1fv14STpqMeUdqKV1bLOfID50 DS9EFCkTzXhR8wL7ND7mzJM+UaX/zkWIzAcWa+NpcJ1t4ycif2TYu2eiRDjM8ztxVRju sCZDiDXFbRTK2ddn+xh1vyRGJaoxJvTw1HYb6SuKnT3uXUCumbJpgC5V/4AxkGTCF9Fa zBVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=GqgKWDGS; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ttUZcSHw; spf=pass (google.com: domain of linux-kernel+bounces-17203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g29-20020a0caadd000000b0067f85f97066si229990qvb.586.2024.01.04.12.44.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 12:44:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=GqgKWDGS; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ttUZcSHw; spf=pass (google.com: domain of linux-kernel+bounces-17203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C11201C229A2 for ; Thu, 4 Jan 2024 20:44:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3829721A02; Thu, 4 Jan 2024 20:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="GqgKWDGS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ttUZcSHw" X-Original-To: linux-kernel@vger.kernel.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66E5E1E516 for ; Thu, 4 Jan 2024 20:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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() Content-Type: text/plain 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