Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4144500ybl; Sat, 21 Dec 2019 00:33:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwu0dxmMfBvrReVCr2V3Z4TLpi1Hkskqm7KE8zpini1jISKJqorwUDID/Z2QrN5wFgw8HAI X-Received: by 2002:a9d:6acd:: with SMTP id m13mr16803543otq.313.1576917222349; Sat, 21 Dec 2019 00:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576917222; cv=none; d=google.com; s=arc-20160816; b=qh537B57/UYRGZvS+4kBOaREF8jNpGSqnQbifIltu9cSKrrsnjfZF2PVgBhJEQrsVb waUpb96TdXhu24pIEPKX+vVOWhEKBzVSrYrHCyKKCxXf94qqXAcxouHOsHCnfCDl8soP KI4SxSDJEk+LhRhby2Q0X5iAk1a/sX0OGd1IlRbQETux4k1z8j+BOe9iYM8ZidQgMJEN odOwmGyLUgizUppBnsu+7abJVFeDZFgGVRLuy6e/j0d9dURTtMESQCIQfS6dwPPjwyRF JfSwykp9SPkzjloZFQyddpgtZITZo0P0uLpT+7JB+4bpNeOOCPLpjdFuheENZ5E+qeud x0oQ== 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=w+xBToVhZ/hhpWFIpAvoRq9RuWR0Mj1UyY+7f+k+jhw=; b=yf+TzG/ULZxmx3QsAPx/TEEhRozVenRdaIZ1ARmAwXgyAP3hm4fY/rXSVLpxPmNrTM m5nZJiRHUNflXsonFs8RQm5zgbdBY/awgGlecZSmLuX+pAArQEtTxaB1Ztg5tMSunlIQ NZfhrcwzfb/5jYrRgnMuxka7x12fziF2jm4yGjIk0mJnRwOLts/DMYkxdWL5C+ynbNvx fr4E1lxS9ZWwCgb3oCpOvcSCI+yjING1zn58SrHemFK4KjfNVN3FBXcQP0eJTLPdvny6 /xjYLBdzcgXv3a9Q991Mer+gkfVh4PJK0DmHHQ3mfPKNLNmM/kJqA0p1GGJogZa8RGek oBeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Zy7fOLTm; 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 x26si1121994oie.73.2019.12.21.00.33.30; Sat, 21 Dec 2019 00:33:42 -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=Zy7fOLTm; 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 S1726887AbfLUIcj (ORCPT + 99 others); Sat, 21 Dec 2019 03:32:39 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:13338 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfLUIcc (ORCPT ); Sat, 21 Dec 2019 03:32:32 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47fzPp1kdgz9txh8; Sat, 21 Dec 2019 09:32:30 +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=Zy7fOLTm; 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 ss6Tha5HnOid; Sat, 21 Dec 2019 09:32:30 +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 47fzPp0jnbz9vBmv; Sat, 21 Dec 2019 09:32:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1576917150; bh=w+xBToVhZ/hhpWFIpAvoRq9RuWR0Mj1UyY+7f+k+jhw=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=Zy7fOLTmrXxdKJvEZyMUeH5zMzM8ETFIXwB8Tq1mhKX7sZjT+bzxUg5i3sErxag5X bCRVN1Xq04EHomwO4imMFp4ULfD+U7s6lxz+4nYr3gnkM+srDaW8Vty8+qYde+xweM JyalDqg6SLgqUhA0aO/jPe5VHfse5cnSgzpFBVh8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 187058B77C; Sat, 21 Dec 2019 09:32:31 +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 bHtHoTsDflDm; Sat, 21 Dec 2019 09:32:31 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D446B8B752; Sat, 21 Dec 2019 09:32:30 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id 9C35C637B6; Sat, 21 Dec 2019 08:32:30 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v5 09/17] powerpc/32: Use vmapped stacks for interrupts To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , dja@axtens.net Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Date: Sat, 21 Dec 2019 08:32:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to also catch overflows on IRQ stacks, use vmapped stacks. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 22 ++++++++++++++++++++++ arch/powerpc/kernel/setup_32.c | 3 +++ 2 files changed, 25 insertions(+) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index add67498c126..5c9b11878555 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -664,8 +665,29 @@ void do_IRQ(struct pt_regs *regs) set_irq_regs(old_regs); } +static void *__init alloc_vm_stack(void) +{ + return __vmalloc_node_range(THREAD_SIZE, THREAD_ALIGN, VMALLOC_START, + VMALLOC_END, THREADINFO_GFP, PAGE_KERNEL, + 0, NUMA_NO_NODE, (void*)_RET_IP_); +} + +static void __init vmap_irqstack_init(void) +{ + int i; + + for_each_possible_cpu(i) { + softirq_ctx[i] = alloc_vm_stack(); + hardirq_ctx[i] = alloc_vm_stack(); + } +} + + void __init init_IRQ(void) { + if (IS_ENABLED(CONFIG_VMAP_STACK)) + vmap_irqstack_init(); + if (ppc_md.init_IRQ) ppc_md.init_IRQ(); } diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index a55b4d9ab824..5b49b26eb154 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -153,6 +153,9 @@ void __init irqstack_early_init(void) { unsigned int i; + if (IS_ENABLED(CONFIG_VMAP_STACK)) + return; + /* interrupt stacks must be in lowmem, we get that for free on ppc32 * as the memblock is limited to lowmem by default */ for_each_possible_cpu(i) { -- 2.13.3