Received: by 2002:a05:7208:3228:b0:82:47:81bb with SMTP id cb40csp554205rbb; Fri, 12 Apr 2024 09:10:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWI7Pg9ipVehTjeGdElTN5pPVIk/X08ml3asBOZ2n6FvPOMrcVnbaFY+LTP+SSTcaAfNb+icc8oCrc3d3EVsIUQhJOEHnCgWpz3LYcgjw== X-Google-Smtp-Source: AGHT+IF2Y/1o/8Y9x02TCFQ2CQlZ0Tbq/+rDDwatWfw/80Ukoro+eEmwLJ+Pt7LJyT2yeWf+q+Vf X-Received: by 2002:a54:4716:0:b0:3c6:4c9:9888 with SMTP id k22-20020a544716000000b003c604c99888mr3192941oik.17.1712938240115; Fri, 12 Apr 2024 09:10:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712938240; cv=pass; d=google.com; s=arc-20160816; b=heTKEOSy+PTKcnNtVaXHEHLfCZlkfRchuDUsrZiOOJ/0ACAA4YjezBNhL1c1xtJogG f1TcwGma8N4D9zc9yAQ8tmSKXh2kYU1DT0i9NNDqNNvQSrBlDuJEfOr6dUvhKvFdVeTf vLfSVOuhl773AJhF1jA518RVNc9aSeOBgXPWTU0qwW9CT2LD6HnCpoj+9XTe266NyUqQ 3XNLNGIBRW6KtCHVGUbYvqJN3dD6q5CC5IxPIm992STZNSZcMBsbHsdn39cezNzepzDg tcpeCAsmE+Xisg63AMRBTgyOVxmj+ObXoBCw+MjEyqbUizyVLFs347RbHhL2uANOPrxf n+WA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6JMzIw2HI80pzG9/gYMo9svWEFvqtkqbKFqW/KiPmps=; fh=sKcE0dWiLHyILvQ7i3khZQZ0ubdR6EvZAPE0kWYozK0=; b=0TjamuxOff1KhLJtkia1T6zf9yqTSrR89UEBPNpid2M4QuR/Xxh74mqkVBqgL+83vM /KwuvbhuDk3olrSSIa1xhoYXFvPL0t2C9/EgsMZJeySdfY0txut2RbjJAWeOd7SrSlh7 fvqgKb+H2lu7H30Qo8/u5it4Jz6VMcd6CmQodXTwCadhZFv4BfEK3E63+esEduYzMorj nkVhKOyejOHeekl5MpvtfKptGKKEnShwiLGCosF3ttReWprllqk4p9i9Iquyv8YFCYLt dapTbUFdcI9p3gTJQHllBbeqfx7IcFDSGU7PyMWfUfO8DApPmPjmAJFntSf2hw8ZWLzJ xfZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lhtgdG9+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143018-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143018-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q10-20020a056102126a00b0046b567b185esi592707vsg.812.2024.04.12.09.10.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 09:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143018-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=@kernel.org header.s=k20201202 header.b=lhtgdG9+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143018-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143018-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 CFAAD1C218D4 for ; Fri, 12 Apr 2024 16:10:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FE001494D5; Fri, 12 Apr 2024 16:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lhtgdG9+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C2CA11487EB; Fri, 12 Apr 2024 16:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712938190; cv=none; b=Uw4RrDaiQzGa4qeArQjsb6oj3Re2rR3P5DzVVGopEzB2tBOfcUrBIalcRwQviooq1ciNsn8Qj+ZvUMxP9Gdv34lvKz6hF964ZTQ0Ee0nGjLJDg3l73KCWVg9iWBKPZcwWHycnfthGpy0hlkB/NdPzJFhUFuaF4XyradZQwD9Qrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712938190; c=relaxed/simple; bh=NHEosDAr8Rb4zus1id61A96KJAOMQUosPKWpMjsuoMI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QLV5NSI3oCPWfkzfAPZKBbpN7e0uHHdXbIEqiDmc3knHR5riszpwDhCYKGo1vn2BbnmYun+YbNNOV5ZYoAwpJyQmLl8R+CRhejG+I+g7EHxcjIJMdWE1iG8+FuiTBLjkgPb3ui5UQ2SyYcehuJZXHemzptX3TdEpp6+4DVt9JBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lhtgdG9+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92823C113CC; Fri, 12 Apr 2024 16:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712938190; bh=NHEosDAr8Rb4zus1id61A96KJAOMQUosPKWpMjsuoMI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lhtgdG9+Gv7WDPh93a8RcZRn5LmUGW8J3FrZjyxaym4sjg5hScyJ5ZHDbl7ToE4kF NhBd4IwZROEiTjGKRge+mkoR219UDgYrNAWPJ0N2AzyLFCO+8y3hd/ziZ0xrwDxwNC AeBc8NTb4IClRXlC6Zhykgfvmxy01tEdpqR6ONTuLb/f7h5SaCkpU91qNmKKkaUaZy lHDQKCVXg9vn4WXzQalHW5TfnMA6Fx7CsFC6p1qckePQSuJOhBTFIWL9lHsrnWt80W CWxAYSq/wMasawkgQrCD2RTjA43PoML54gWT5bizPQLVDYJkAh6qR1/5DJ+TrIKAVg xzjMBSTi87Mqg== Date: Fri, 12 Apr 2024 09:09:47 -0700 From: Nathan Chancellor To: Thomas Gleixner , shuah@kernel.org Cc: oleg@redhat.com, anna-maria@linutronix.de, frederic@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, John Stultz Subject: Re: [PATCH] kselftest: Mark functions that unconditionally call exit() as __noreturn Message-ID: <20240412160947.GA2252629@dev-arch.thelio-3990X> References: <20240411-mark-kselftest-exit-funcs-noreturn-v1-1-b027c948f586@kernel.org> <87sezqzsys.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sezqzsys.ffs@tglx> On Fri, Apr 12, 2024 at 02:05:47PM +0200, Thomas Gleixner wrote: > On Thu, Apr 11 2024 at 11:45, Nathan Chancellor wrote: > > I have based this change on timers/urgent, as the commit that introduces > > this particular warning is there and it is marked for stable, even > > though this appears to be a generic kselftest issue. I think it makes > > the most sense for this change to go via timers/urgent with Shuah's ack. > > While __noreturn with a return type other than 'void' does not make much > > sense semantically, there are many places that these functions are used > > as the return value for other functions such as main(), so I did not > > change the return type of these functions from 'int' to 'void' to > > minimize the necessary changes for a backport (it is an existing issue > > anyways). > > Hrmm. This really want's to be fixed once the change hits Linus tree as this: > > static inline __noreturn int ksft_exit_pass(void) > > looks seriously broken :) Yeah, I only realized this morning that prior to this change, making these functions return void instead of int would have broken int main(void) { ksft_exit_pass(); } because without __noreturn, the compiler will complain that main() is missing a return value. So 'int' -> '__noreturn void' would have been the proper atomic change but the use of 'return ksft_exit_...();' made that seem rather difficult when I was writing/testing that change on top of this one. However, now that I am actually sitting down and looking at it with a fresh perspective, I am able to produce a pretty mechanical looking change with just two sed commands: sed -i 's;__noreturn\(.*\)int;__noreturn\1void;g' tools/testing/selftests/kselftest.h && sed -i 's/\(\s\+\)return\s\+\(.*ksft_exit_x\?\(fail\|pass\|skip\)\)/\1\2/g' $(git grep -lP 'return.*ksft_exit_x?(fail|pass|skip)' | sed s/:/-/g) Perhaps Shuah could just run that in the kselftest tree and commit the result once the change from Linus's tree is merged there? Otherwise, I am happy to send a formal patch once I have something proper to base on. Thanks for taking just the minimal change :) Cheers, Nathan