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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6A2EC433E0 for ; Thu, 11 Feb 2021 04:43:29 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE36864E7A for ; Thu, 11 Feb 2021 04:43:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE36864E7A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DbkXZ489WzDwmK for ; Thu, 11 Feb 2021 15:43:26 +1100 (AEDT) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4DbkVm2nQqzDwk4 for ; Thu, 11 Feb 2021 15:41:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=WHKKAh5P; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4DbkVl4Yc9z9s1l; Thu, 11 Feb 2021 15:41:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1613018512; bh=XZIJXgbO1KqMKnW3T+HnSm+5++f1RbxBkJ/WTWFEgPA=; h=From:To:Subject:In-Reply-To:References:Date:From; b=WHKKAh5PGP6VE6c3UICueTMADK3KXPDFEn8HtzIjHfMt19htL8ODgc7NLf/jkgnSi T7yesfk3kpQXMZkUWHu1DpXFoB6z5DDyDSDB6x0YjPepRPzj3Lh2boNGHptTK6scVe RC1pvbcS0HOLCmhpoj06Nk3wX+HZuPF9d3kquxvDfr3icCZGb/6izJnMolu92ube1Z pe5EMaVKO3c8ZX7ST/g7jMVd6O/xaIGAb03sA1VUamZogOPbhEb6IvHlUMa6B1FRUq 3zJTj+wrPBqQoLNAG7IOryeSZCi3hTLwMtOM83Phu6DM2i8rMvTjeWUa7n5XaBWVf1 JiO4iAYNHUsDw== From: Michael Ellerman To: Nicholas Piggin , Christophe Leroy , "linuxppc-dev@lists.ozlabs.org" Subject: Re: Declaring unrecoverable_exception() as __noreturn ? In-Reply-To: <1613004125.9jpd8u2w0w.astroid@bobo.none> References: <5ecc1a9a-92eb-7006-6c94-2b7b700d182a@csgroup.eu> <1613004125.9jpd8u2w0w.astroid@bobo.none> Date: Thu, 11 Feb 2021 15:41:48 +1100 Message-ID: <87mtwbnrlf.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Nicholas Piggin writes: > Excerpts from Christophe Leroy's message of February 11, 2021 2:44 am: >> As far as I can see, almost all callers of unrecoverable_exception() expect it to never return. >> >> Can we mark it __noreturn ? > > I don't see why not, do_exit is noreturn. We could make die() noreturn > as well. I'm always nervous about that, because we can return if a debugger is involved: DEFINE_INTERRUPT_HANDLER(unrecoverable_exception) { pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n", regs->trap, regs->nip, regs->msr); die("Unrecoverable exception", regs, SIGABRT); } void die(const char *str, struct pt_regs *regs, long err) { unsigned long flags; /* * system_reset_excption handles debugger, crash dump, panic, for 0x100 */ if (TRAP(regs) != 0x100) { if (debugger(regs)) return; We obviously don't want to optimise for that case, but it worries me slightly if we're marking things noreturn when they can actually return. cheers