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 BD748C47073 for ; Fri, 5 Jan 2024 01:17:48 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5epkPpH8tVJgRXlibW3X+B0vKVObcb2YWlUM2U9AbqI=; b=4cWWrX8i4FaDTK +Q9he67HqDrUWzFWWd9AAKdQ5qV99upMk+kqEBqkH+Qxj70bcG/FRzqCLT7Fez7T1HVpTsPDc+ECw zTjbotVE9J65cTzvT5X4afeeFcahsj+cI8DC2yN6kFT4uhJ9OQzBTRDm+WaZC6zoPypZNM8/DC5Gc UGlO5bSGyKPmwU09YKCXHJ1omtTCGclFAbKe0ublPDaUwzAMGDQpUmwGHX2I7Wlwe7NA7TOcVkESu GJwagW8VRXuHD34wt2UosFzUGqaAEXhoDSKEE6Uy5f6mnX2IeRPPXsI1gTtH4DnQZg2KQsJpuPm5R w8Fr2fxwcLhBwXkowp0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLYpp-00Fhb9-37; Fri, 05 Jan 2024 01:17:17 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLYpm-00FhYB-2F for linux-arm-kernel@lists.infradead.org; Fri, 05 Jan 2024 01:17:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704417420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EYg2hT5GJFO9Dm7UK9vv+m54JH3ByTaotG3gHMUWSUE=; b=GIlbzsVzrHyI5DeLbz4jcfWsgdnoTVAzV3wrDwByQHBHSvCekUEtX9cPlC5wWQ5fxYFqi1 e/tyt7BM6ngDU+jWgj+neueV08jl1Y9/F+Dr0anrQO7pMQit13sf8Tr9HnnqHuy6LdwAKA Fwv4vkwhbxyZ2jndVG0HmLptkSArc1c= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-SMv_hUaOOTq_S4RM5iFgnA-1; Thu, 04 Jan 2024 20:16:52 -0500 X-MC-Unique: SMv_hUaOOTq_S4RM5iFgnA-1 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1d4c36e9507so7606765ad.0 for ; Thu, 04 Jan 2024 17:16:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704417411; x=1705022211; h=content-transfer-encoding:content-disposition:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EYg2hT5GJFO9Dm7UK9vv+m54JH3ByTaotG3gHMUWSUE=; b=dhqRaTHgfmlH553nmEa+jZxQzev4hp0VgaAClIrAohEPg3ijIL/nr+x7x+QCQ5Y9GN xBVXPiOguNoZaXPyoDdx0s+wjaX5a8nciUq7os3lbAWZtTOVbm27Cub0Oc9WhrKosKi7 q2aJTOt14A0q8dHxIaeYni1rqsXO6pLN0ZdRha0EXhwiIn3sIssuNV+sbnE6++lb7//c 7Py5agVlY8cWB1++ROKT6BZZBfXyYz/4y168F3TD5HaD9YfaaBofLMEEh/LEW3sl4RFz 71G3RImA+fIHptx+IxIyp+nk3jPdsBQazhsn0ZMPAORoy7uho1rAJNiVSfua7LfmOYBz 4yZQ== X-Gm-Message-State: AOJu0YyQkEQb8LfGuFQfsG56GyerrMliD8Z7TZmUE12C2i4UFkQrlDOc EHGexi2NMd/Tf+IPDDQKjVo86BNiRXvaNtzHiypPi3ev5hOgf6z+4F+mZnMU5er/5C7vjZXYuHK g8Gz3OfDbji6pWBYr0O1wtBbNJ9sm5mManYJqh7GIDqE= X-Received: by 2002:a17:903:985:b0:1d4:e0e6:693 with SMTP id mb5-20020a170903098500b001d4e0e60693mr1286300plb.35.1704417411080; Thu, 04 Jan 2024 17:16:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPdpjsnnQ4TQBGiWJZm3UZ6CIwGk4aZKcDyuKK3ECvN3dbEXpbAHii3Y/0MTOuDP2Q95V7Sw== X-Received: by 2002:a17:903:985:b0:1d4:e0e6:693 with SMTP id mb5-20020a170903098500b001d4e0e60693mr1286294plb.35.1704417410748; Thu, 04 Jan 2024 17:16:50 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ec:3efd:1dbc:859f:ecb4:d775]) by smtp.gmail.com with ESMTPSA id d4-20020a170903230400b001d3675664c9sm232413plh.59.2024.01.04.17.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 17:16:50 -0800 (PST) From: Leonardo Bras To: Arnd Bergmann Cc: Leonardo Bras , Catalin Marinas , Will Deacon , Oleg Nesterov , Ard Biesheuvel , Teo Couprie Diaz , Mark Rutland , Mark Brown , Steven Rostedt , Guo Hui , 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() Date: Thu, 4 Jan 2024 22:16:39 -0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: <8412ce8a-7016-4f65-99d3-ce472a75d8cd@app.fastmail.com> References: <20240104192433.109983-2-leobras@redhat.com> <8412ce8a-7016-4f65-99d3-ce472a75d8cd@app.fastmail.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_171714_803438_D5620B6E X-CRM114-Status: GOOD ( 32.66 ) 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 04, 2024 at 09:43:56PM +0100, Arnd Bergmann wrote: > 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, Hello Arnd, thanks for reviewing! > 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) > Oh, I was unaware of this macro. Thanks for pointing it out! I just checked every use of is_compat_task() in the codebase for (arch == arm64 && non-arch code), and it seems like the file will either include linux/compat.h or another header which includes linux/compat.h. So it's safe to assume the macro will be available for every user. I will send a v1 soon. Thanks! Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel