From mboxrd@z Thu Jan 1 00:00:00 1970 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 5CACF3FB049 for ; Wed, 25 Mar 2026 16:35:41 +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=1774456541; cv=none; b=XsuA59Okdd00kfTiXF8LXIoknMrWtUilX3tamFzUSnM8d2E0NJzCb5RpcCUib56IngtRJcRleAi4gBVLns66Hy3fRvesqcnHuw2ueztwmhFNNmjGr1pm0rlvljw+/diw3QNfI+PGemPMlvX3ZE0VjlOIQeI8vU7hSCU0riAZuGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774456541; c=relaxed/simple; bh=e0RZsWo0PGMZlAbfKytC5RYpmLuG3nP0M8rJFiCYFsU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=StlwK6KcecefLMD7k6OTJEk3WV6NOQABvaAqH7/r+8eAFcNGwoWkNC5HPI3HdyvJtByzQb39sbnrB3hJHDEVvTcyX89YRkbFmTMkZWywVnMSSGgLDzV+c4pJ2uHCVDeupZtY3lW3kaeVEzqSfptyVOlZ+MDwqHb404jYUusBhDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jo7K3OXE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jo7K3OXE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B769C19423; Wed, 25 Mar 2026 16:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774456540; bh=e0RZsWo0PGMZlAbfKytC5RYpmLuG3nP0M8rJFiCYFsU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Jo7K3OXEGOEVLEort8/CMLp2itGbgwwdm5Z8hI6qh/cROLtO59B2F+AM9fCZoBnbu YT4uPwV0PN78JGTe0KD9+yyIhPUplu26Wpgnt9Ae8OSmP9eu1lwtgpk1H4pGVnB8Us PJU1wihxPwsI3sP6FhGSbvhlZanfRdUvBx203++yJMGVAgEjhh1WmE4L0cmxNAhNBu QQrI643pIPHr7USOpsGr4p8zOvakktgUSgESMRyUliWq1T1ETyiSAJjPtCMkTFuZue 53DdgFeRCc2Koc8Sveo4V2iLHqpjUe0xOsCdwZkb8PBueHr1bhL3j2hKU7fAwfNLZF Aglw6rleP9pcQ== Date: Wed, 25 Mar 2026 16:35:35 +0000 From: Will Deacon To: Osama Abdelkader Cc: Catalin Marinas , Mark Rutland , Ard Biesheuvel , Breno Leitao , Ryo Takakura , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: panic if IRQ shadow call stack allocation fails Message-ID: References: <20260324161545.5441-1-osama.abdelkader@gmail.com> 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: <20260324161545.5441-1-osama.abdelkader@gmail.com> On Tue, Mar 24, 2026 at 05:15:41PM +0100, Osama Abdelkader wrote: > diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c > index 15dedb385b9e..b32ed7ef8e00 100644 > --- a/arch/arm64/kernel/irq.c > +++ b/arch/arm64/kernel/irq.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -32,23 +33,26 @@ DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); > > DEFINE_PER_CPU(unsigned long *, irq_stack_ptr); > > - > DECLARE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); > > #ifdef CONFIG_SHADOW_CALL_STACK > DEFINE_PER_CPU(unsigned long *, irq_shadow_call_stack_ptr); > #endif > > -static void init_irq_scs(void) > +static void __init init_irq_scs(void) > { > int cpu; > + void *s; > > if (!scs_is_enabled()) > return; > > - for_each_possible_cpu(cpu) > - per_cpu(irq_shadow_call_stack_ptr, cpu) = > - scs_alloc(early_cpu_to_node(cpu)); > + for_each_possible_cpu(cpu) { > + s = scs_alloc(early_cpu_to_node(cpu)); > + if (!s) > + panic("irq: Failed to allocate shadow call stack\n"); > + per_cpu(irq_shadow_call_stack_ptr, cpu) = s; > + } I don't especially see the point in these panic() messages given that presumably all sorts of other things will go wrong if we fail simple allocations this early during boot. If you really want to check this, then we should at least do the same for the IRQ stack itself, otherwise it's all a bit academic. So maybe have init_irq_scs() and init_irq_stacks() return -ENOMEM so that init_IRQ() can panic? Will