From patchwork Fri Dec 15 01:27:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 848819 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyXsj5lNKz9t3t for ; Fri, 15 Dec 2017 12:29:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y4+S84db"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yyXsj44SMzDqZ0 for ; Fri, 15 Dec 2017 12:29:45 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y4+S84db"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com; envelope-from=bsingharora@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y4+S84db"; dkim-atps=neutral Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yyXqW0kKQzDrd4 for ; Fri, 15 Dec 2017 12:27:51 +1100 (AEDT) Received: by mail-pg0-x244.google.com with SMTP id e14so4682081pgr.9 for ; Thu, 14 Dec 2017 17:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=z7x4VKdDCxXFQMOpHH/uDBXH4cxpCkGLWk7/6mOWrqo=; b=Y4+S84dbEZ7QFTvms8QkNFa+nrGab3hZFyMMliGtB7KklJkDNVQHrkB8ODGCnm3n8R 8q1c4cI5hyzhF+nkIhAQBZ5Tsjtj4ouuW1Tqesk22iAIUj2G7QxGdE2xu8sGmPLQxG1Q Sh3PwrHi02jwQajHL+e+KCgJyKUX+zxRMtyeY0uMD5K9t2e9FPHAqZ4UmxnnA4ezUxiZ WOeDJ3FLbkl+eFfqLSNymd2bCarrAj5INuN4nz/dSMbAt2xlUbbemF/p+M+9JK/kPu2M LIflU1aht3ECJ5eSbLIDDHZBhogHju/OwkThXt/olzylk1iapa2i0kJJY5mbuiswCnK/ lzng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=z7x4VKdDCxXFQMOpHH/uDBXH4cxpCkGLWk7/6mOWrqo=; b=Rmz529JrN5xMRy9oc1vIblIS42Wjcz2Fea0thm3TKc+fiZZRFZBxXPs/+s5JIbMLX2 wP3eV00BtIuqkRelOu5N37hzVKgWSuJFUuj1G8mJIeEclcy1ApiNPLZKiJXUsi5I7BGi 2CL5kXtIuE8TqD2tyODZ3qT0+4M4Ee1tV/tG6o4IJ4OYTGiXj+6raxWkirtxIRW1B+Tk sgYXjFIS029zcIn8WDkbEMUnu5iojb/stzOFB7zmF9wOryod+BQDmVkHKfe7fFWNWatj KE0W7SIEsKlWA3/Z23E4o/5/0OtYwmnnRHxaoe3pYHifw2/cM+rALn/U1Wv5odo7UN0a tlfQ== X-Gm-Message-State: AKGB3mIKjRYFqtfjCwLHYEBlKkoNbnQvzC4jWIOsjpI6Mvg5mCz+wnbZ 5ATqY87nUolGebFL8MLeqret+dTM X-Google-Smtp-Source: ACJfBot/4Rp6+XYHaFLq4n3n54CnYQnyN775F5xKjaA0XeG0zDTmdDGivf8LUlK9rt1+JP11RBEwJw== X-Received: by 10.98.214.21 with SMTP id r21mr11611762pfg.74.1513301268433; Thu, 14 Dec 2017 17:27:48 -0800 (PST) Received: from localhost.au.ibm.com (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.googlemail.com with ESMTPSA id s72sm8307208pgc.18.2017.12.14.17.27.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 17:27:47 -0800 (PST) From: Balbir Singh To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 1/3] powerpc/crash: Remove the test for cpu_online in the IPI callback Date: Fri, 15 Dec 2017 12:27:38 +1100 Message-Id: <20171215012740.30291-1-bsingharora@gmail.com> X-Mailer: git-send-email 2.13.6 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: npiggin@gmail.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Our check was extra cautious, we've audited crash_send_ipi and it sends an IPI only to online CPU's. Removal of this check should have not functional impact on crash kdump. Signed-off-by: Balbir Singh --- arch/powerpc/kernel/crash.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index cbabb5adccd9..29c56ca2ddfd 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c @@ -69,9 +69,6 @@ static void crash_ipi_callback(struct pt_regs *regs) int cpu = smp_processor_id(); - if (!cpu_online(cpu)) - return; - hard_irq_disable(); if (!cpumask_test_cpu(cpu, &cpus_state_saved)) { crash_save_cpu(regs, cpu); From patchwork Fri Dec 15 01:27:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 848820 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyXwN6vg9z9t2M for ; Fri, 15 Dec 2017 12:32:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fdnNYUIW"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yyXwN5ZkfzDrWJ for ; Fri, 15 Dec 2017 12:32:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fdnNYUIW"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::241; helo=mail-pf0-x241.google.com; envelope-from=bsingharora@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fdnNYUIW"; dkim-atps=neutral Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yyXqZ4gkKzDrd4 for ; Fri, 15 Dec 2017 12:27:54 +1100 (AEDT) Received: by mail-pf0-x241.google.com with SMTP id m26so4976447pfj.11 for ; Thu, 14 Dec 2017 17:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2c91PN5xtVc4i4330IB2VeOCtygRRFBkYM9ZDwygo2o=; b=fdnNYUIWxZhTUOhaKzytVAIakVkCsQBRViHFLT7Coy804HsPIb4j9RQdfHL/TW4Tyk UIM6QLif1CzUN3fMJ0ElcQ5tleLTsBYc5MC0ktfBhUATrmjlxuja5dZ7Rp4pbdBfF7z1 IjMGnJmiBt3R4yZ3LbyLc1+eaaGl4tOFCaWejE8CpJkgC+V2pW8dABTghUG6YsPBV7OZ ZFuPDb4T07hQmwX/EHCb+VS04BOAKD5tk5ruQWHs2uyjr9ZazTg9OMcIcWbALt5aSP2H HUkdDpxYOkm2s6fen7xqCAojgmx/ICz6aduvD7eN95zlFKyufu8otSSCGhT7iWNgWmJA SX1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2c91PN5xtVc4i4330IB2VeOCtygRRFBkYM9ZDwygo2o=; b=W2Cma75XvWeooSNo56CPbWcepFxN95RDCn6NDgFu0fGNlhwSfCTiSWkPpUFEFWq3xA RXyUwjIHHUZTom3A1u8xYZp7ydVT8CWwBokJfHjl3eRhj2R1dC+3Ikp5eJE80GgGno8P 0W05tcVCejuq23bOXVOH9d3kcdmqzKqAIKuFo6eX/AIvJV59IUReyWwc1KmflkwA3O6a aAgN5hX8yY9KUst5E6PVzg6CDUkdosLI/Mduss6o7nxFfbMhUOmIsQ5Oek2PuGWd/a1Z imbVluBNWtwhirQ3a3x6RMMK3yNUQW/K5pYimNufMrwwm+8g2+gzmwDQ1+SSq6y8S3zV VWEg== X-Gm-Message-State: AKGB3mLn4/QmjZp3WaICsnUhtXgXWgKcYT6PltyPPqWpXK35dB2OeZj/ i4TniBVrb9pBvw3wVuFWRPhmOwFh X-Google-Smtp-Source: ACJfBos0cOwSx/nrDu1TujmbTxLGQQa4yGfdqooiMaHlU/Wfc+wcqls4+9Yqlz6rFtz24+d7FJzZSw== X-Received: by 10.98.135.138 with SMTP id i132mr11363234pfe.130.1513301271431; Thu, 14 Dec 2017 17:27:51 -0800 (PST) Received: from localhost.au.ibm.com (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.googlemail.com with ESMTPSA id s72sm8307208pgc.18.2017.12.14.17.27.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 17:27:50 -0800 (PST) From: Balbir Singh To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 2/3] powerpc/powernv: Identify scom driven system reset Date: Fri, 15 Dec 2017 12:27:39 +1100 Message-Id: <20171215012740.30291-2-bsingharora@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171215012740.30291-1-bsingharora@gmail.com> References: <20171215012740.30291-1-bsingharora@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: npiggin@gmail.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In irq_set_pending_from_srr1() we were missing 0x2 as system reset identified from SRR1 caused by back to back system resets or when interrupts are caused by SCOM when the thread is not in power saving mode. This helps us get to NMI handling in both the case where NMI is caused when in power-saving and not in power-saving mode. The actual exploitation is expected when we are doing a kdump and an offline CPU might not be in power-saving mode due to an already spurious IPI or any other reason. Signed-off-by: Balbir Singh --- arch/powerpc/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index b7a84522e652..ec89104e8ab9 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -413,7 +413,7 @@ bool prep_irq_for_idle_irqsoff(void) #define IRQ_SYSTEM_RESET 0xff static const u8 srr1_to_lazyirq[0x10] = { - 0, 0, 0, + 0, 0, IRQ_SYSTEM_RESET, PACA_IRQ_DBELL, IRQ_SYSTEM_RESET, PACA_IRQ_DBELL, From patchwork Fri Dec 15 01:27:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 848821 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyXyr1RZSz9t2M for ; Fri, 15 Dec 2017 12:34:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qa5x/MA+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yyXyr07jxzDqmD for ; Fri, 15 Dec 2017 12:34:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qa5x/MA+"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com; envelope-from=bsingharora@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qa5x/MA+"; dkim-atps=neutral Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yyXqc5WvjzDrhs for ; Fri, 15 Dec 2017 12:27:56 +1100 (AEDT) Received: by mail-pg0-x241.google.com with SMTP id o2so4684313pgc.8 for ; Thu, 14 Dec 2017 17:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HcXYoxIttCScGY42fTYEyQK2meYZDy80qkSuOEOO2ag=; b=Qa5x/MA+tRV8Mv6bwERghQjdd/HSxVLComnECPsXNNV2pQKJ5wJLnW/ipxkyAVAio4 jCQwwePl2J4PhcKPfvjF331GG7LanzhpuY8MtloHNdzrGT9lh9WvsfdaAnK/44DppI/H 9YWOlrfnVl7/Us4UGMcKTlvutz9j79TfqnL2j2MPfvG21gb/OYW0mEykc/aGPLpqmGgt 7p6ipG2K3pqeQ4iqWQhYqvo+v9mrKBkVHDbvYz2/BiULX5cP1BbDex0d2y1Be8vq09d9 0HoMJJa85AraxmegKx5WZVkTnOxMrcm9gwqdMOwqDM6IOtHvNIDbnZ0O0vifordUTJS7 nCqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HcXYoxIttCScGY42fTYEyQK2meYZDy80qkSuOEOO2ag=; b=AlcJuv22pJHiRxvNzQ2EBh72un5c7OgwPA466VCRfNpULjfn2jz/APt9BfS5SM7qsf Kx+xZYxz2oTsylMjI22h7iNNBXUFc5k/89tVLQkghkB/AzDGAqGJsrgMHqyXKUBc4H7H Sg8AyIgYRbDxnJzNY0CMpqwJkLm0TiJR6hzHrSk+BaapIYMYIM4m/xxmWq1cDC1Bjyg6 2X5p8utuHwChZ0wLa4MeEXakdnUEpjRCS5f2G1kElt+3zn4c6bKWRAFxAN5Ds+Ptg76/ 3oOiBo0oHtZo4w6QWMyPrgGo1p6SdSQYUDO4WplyXl/JQ5WL8hizNkyP96E372WoYyFS Y6Yg== X-Gm-Message-State: AKGB3mKNp5/1d83e8cgDyQBRePf6Rohq1imi/VAOefRNtRcC5uyvKxhU QB77mq21ycZhq8ZoJ4892dSIJ+Se X-Google-Smtp-Source: ACJfBov+fKuLJ+FnsqAxaIPstyQXSn+udPHwC/O2zW/0y5ayq22qFlK7GBlOf9ICrppzJ6XU9lAN+w== X-Received: by 10.98.13.133 with SMTP id 5mr11559996pfn.112.1513301274467; Thu, 14 Dec 2017 17:27:54 -0800 (PST) Received: from localhost.au.ibm.com (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.googlemail.com with ESMTPSA id s72sm8307208pgc.18.2017.12.14.17.27.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 17:27:53 -0800 (PST) From: Balbir Singh To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 3/3] powernv/kdump: Fix cases where the kdump kernel can get HMI's Date: Fri, 15 Dec 2017 12:27:40 +1100 Message-Id: <20171215012740.30291-3-bsingharora@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171215012740.30291-1-bsingharora@gmail.com> References: <20171215012740.30291-1-bsingharora@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: npiggin@gmail.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Certain HMI's such as malfunction error propagate through all threads/core on the system. If a thread was offline prior to us crashing the system and jumping to the kdump kernel, bad things happen when it wakes up due to an HMI in the kdump kernel. There are several possible ways to solve this problem 1. Put the offline cores in a state such that they are not woken up for machine check and HMI errors. This does not work, since we might need to wake up offline threads to handle TB errors 2. Ignore HMI errors, setup HMEER to mask HMI errors, but this still leads the window open for any MCEs and masking them for the duration of the dump might be a concern 3. Wake up offline CPUs, as in send them to crash_ipi_callback (not wake them up as in mark them online as seen by the hotplug). kexec does a wake_online_cpus() call, this patch does something similar, but instead sends an IPI and forces them to crash_ipi_callback() This patch takes approach #3. Care is taken to enable this only for powenv platforms via crash_wake_offline (a global value set at setup time). The crash code sends out IPI's to all CPU's which then move to crash_ipi_callback and kexec_smp_wait(). Signed-off-by: Balbir Singh --- Changelog v3 - Use SRR1's reason to wake up to drive replay_system_reset() as a means of getting to kdump() as opposed to calling crash_ipi_callback based on comments from Nick Piggin. arch/powerpc/include/asm/kexec.h | 2 ++ arch/powerpc/kernel/crash.c | 13 ++++++++++++- arch/powerpc/kernel/smp.c | 18 ++++++++++++++++++ arch/powerpc/platforms/powernv/smp.c | 12 ++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 4419d435639a..9dcbfa6bbb91 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -73,6 +73,8 @@ extern void kexec_smp_wait(void); /* get and clear naca physid, wait for master to copy new code to 0 */ extern int crashing_cpu; extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)); +extern void crash_ipi_callback(struct pt_regs *); +extern int crash_wake_offline; struct kimage; struct pt_regs; diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 29c56ca2ddfd..00b215125d3e 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c @@ -44,6 +44,14 @@ #define REAL_MODE_TIMEOUT 10000 static int time_to_dump; +/* + * crash_wake_offline should be set to 1 by platforms that intend to wake + * up offline cpus prior to jumping to a kdump kernel. Currently powernv + * sets it to 1, since we want to avoid things from happening when an + * offline CPU wakes up due to something like an HMI (malfunction error), + * which propagates to all threads. + */ +int crash_wake_offline; #define CRASH_HANDLER_MAX 3 /* List of shutdown handles */ @@ -63,7 +71,7 @@ static int handle_fault(struct pt_regs *regs) #ifdef CONFIG_SMP static atomic_t cpus_in_crash; -static void crash_ipi_callback(struct pt_regs *regs) +void crash_ipi_callback(struct pt_regs *regs) { static cpumask_t cpus_state_saved = CPU_MASK_NONE; @@ -106,6 +114,9 @@ static void crash_kexec_prepare_cpus(int cpu) printk(KERN_EMERG "Sending IPI to other CPUs\n"); + if (crash_wake_offline) + ncpus = num_present_cpus() - 1; + crash_send_ipi(crash_ipi_callback); smp_wmb(); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index e0a4c1f82e25..bbe7634b3a43 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -543,7 +543,25 @@ void smp_send_debugger_break(void) #ifdef CONFIG_KEXEC_CORE void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) { + int cpu; + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_ipi_callback, 1000000); + if (kdump_in_progress() && crash_wake_offline) { + for_each_present_cpu(cpu) { + if (cpu_online(cpu)) + continue; + /* + * crash_ipi_callback will wait for + * all cpus, including offline CPUs. + * We don't care about nmi_ipi_function. + * Offline cpus will jump straight into + * crash_ipi_callback, we can skip the + * entire NMI dance and waiting for + * cpus to clear pending mask, etc. + */ + do_smp_send_nmi_ipi(cpu); + } + } } #endif diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index ba030669eca1..1594bbff3dec 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include "powernv.h" @@ -212,6 +214,13 @@ static void pnv_smp_cpu_kill_self(void) } smp_mb(); + /* + * For kdump kernels, we process the ipi and jump to + * handling the system reset exception. + */ + if (kdump_in_progress()) + irq_set_pending_from_srr1(srr1); + if (cpu_core_split_required()) continue; @@ -371,5 +380,8 @@ void __init pnv_smp_init(void) #ifdef CONFIG_HOTPLUG_CPU ppc_md.cpu_die = pnv_smp_cpu_kill_self; +#ifdef CONFIG_KEXEC_CORE + crash_wake_offline = 1; +#endif #endif }