Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6537192ybl; Mon, 23 Dec 2019 07:28:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxOGTbwmv77v5KzitKLtLwlI2U9NIgmsmf3fs066XoFaOwpVRHaRmXq1maBW2lrZFNcm5jq X-Received: by 2002:aca:43c1:: with SMTP id q184mr5587009oia.116.1577114900704; Mon, 23 Dec 2019 07:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577114900; cv=none; d=google.com; s=arc-20160816; b=wuy9V/ys99mEmfKzNqilegYfqzSwAXXD7ASXw0GClI97dxx7Rea99H8wt2LgbnmDxY bbqYKPGNxqRvkg8DGu5H+3AYaTYJWHBBc9xJtBSzm4g1uroWmAisRGgt8UMy0jj9deGR A/+4fvizAbiwMid/2GydUeBW5D5FrS2OIXengX/S+U1HWgVcoud3nCRG1N0cxACs4Zf2 rsA5UbKTfsd0GMSPsddO3d4RRCN7QHkj1l80DA1iePamF49I/wWKzvTANAWwtO85HoFm bASZmwn0bnLOauGMpsZI3l5/M/+JIdGHJ1JKKWXUZmt732z7ZCqjx5tjB+hc7697L+Za YbZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=sK12wjRZfrby2Z/oe0vR7BYWS1jDKg9slrhX8TwMHvc=; b=oOaBvr8WPhm8lIzEgzFz57hiT87xt8plwBOpYoL2r7JTWOHvVP/mOWsUBsZJ5BX9+s ONi4IKyaZZzWl5nrURYAg/XJ2JRMrGYYCuaD9yPr+0ELvuTgDvk/KefWZyNzguqB91RY nh2QvhNfm/Q26EfALK+p6XAHVsTOP49klVIcwRSn/CSsLrSLeQGmTg4RGn4IotFprV1v n1sDUq0x7Zz2wMeb7qXvFr619+pfg8MT8MkwAIAXVYxMKAckKhHWK7QTCR0v7Om6Nj2b n74gjF+BHZHYhDoXyM5cXapvV3x/SYKnTu9HqBNPLXGvMhRALGerVvKTYrEVdldiJQnp 0zww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=FfwGbqCe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si8348909oib.115.2019.12.23.07.28.09; Mon, 23 Dec 2019 07:28:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=FfwGbqCe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727072AbfLWP0U (ORCPT + 99 others); Mon, 23 Dec 2019 10:26:20 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:14100 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbfLWP0S (ORCPT ); Mon, 23 Dec 2019 10:26:18 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47hNVD00x6z9vJyv; Mon, 23 Dec 2019 16:26:12 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=FfwGbqCe; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id d-7QULOjJFaa; Mon, 23 Dec 2019 16:26:11 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47hNVC62yCz9vJyp; Mon, 23 Dec 2019 16:26:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1577114771; bh=sK12wjRZfrby2Z/oe0vR7BYWS1jDKg9slrhX8TwMHvc=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=FfwGbqCeZjDMlv8wLU7Rp8NmOSL+7xj9DH7jV5O0Xd7qew+gVu6k6aMqUfLJTsmyz Im0u710FzSLBsWB39gfxmcHKzzFmxGzmKB45I5Q2niznSVGaH6syGKnuGR5KzCXIJa DZzShAQ+OLpk7IHcFH99YZveHhrVsXxUN4bnjYXM= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0B21A8B7AB; Mon, 23 Dec 2019 16:26:17 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id YgF9-JgEU1Bo; Mon, 23 Dec 2019 16:26:16 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E3F1A8B7A1; Mon, 23 Dec 2019 16:26:16 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id EAA6A637D8; Mon, 23 Dec 2019 15:26:16 +0000 (UTC) Message-Id: <6469f08e55055d80a4c11cf339c69c2395b5bf78.1577114567.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH 6/8] powerpc/irq: cleanup check_stack_overflow() a bit To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 23 Dec 2019 15:26:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of #ifdef, use IS_ENABLED(CONFIG_DEBUG_STACKOVERFLOW). This enable GCC to check for code validity even when the option is not selected. The function is not using current_stack_pointer() anymore so no need to declare it inline, let GCC decide. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 4df49f6e9987..a1122ef4a16c 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -596,20 +596,19 @@ u64 arch_irq_stat_cpu(unsigned int cpu) return sum; } -static inline void check_stack_overflow(struct pt_regs *regs) +static void check_stack_overflow(struct pt_regs *regs) { -#ifdef CONFIG_DEBUG_STACKOVERFLOW bool is_user = user_mode(regs); - long sp; + long sp = regs->gpr[1] & (THREAD_SIZE - 1); - sp = regs->gpr[1] & (THREAD_SIZE - 1); + if (!IS_ENABLED(CONFIG_DEBUG_STACKOVERFLOW)) + return; /* check for stack overflow: is there less than 2KB free? */ if (unlikely(!is_user && sp < 2048)) { pr_err("do_IRQ: stack overflow: %ld\n", sp); dump_stack(); } -#endif } #ifdef CONFIG_PPC32 -- 2.13.3