From patchwork Wed Nov 4 08:05:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuichi Ito X-Patchwork-Id: 11879803 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 92E79C2D0A3 for ; Wed, 4 Nov 2020 08:11:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 182CD20735 for ; Wed, 4 Nov 2020 08:11:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="haA1on2g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 182CD20735 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mxmwopXiBNBnh1W6GeZcOdDZadOtrqx75t7HeCcSHrQ=; b=haA1on2grYUno/awxzjOvPx1F lX9PkKlm3WTqPeimDLXszj4e7HmK1u+rqakBYuKUbfJ4CnQ+52KMXStzHkMiHWrBUaaDQqgKGpEGd jdvqTp54zv0NkeCxnrvGqwFKAOxRUPeS94aYXPqleq4XlTdYhv6lW874hXSO+PzqZQCXe7GUN3TpV bw8aliH9sho91XpEcvDfmsSXABukkMGGa2h+GFGwcV+/3sIJ1wsfvH1t/z2bvJVRiwfxctcybb1uq WcUYdDXlHRiqRzUMGbe8DX78lhcYGqN94Vlgvb453nFLojyURxxmEG1X6Ej7hvYp71EMsXMY+f8rZ MMENlCY4Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsg-0005AS-Ny; Wed, 04 Nov 2020 08:10:58 +0000 Received: from esa4.hc1455-7.c3s2.iphmx.com ([68.232.139.117]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsT-000563-63 for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 08:10:46 +0000 IronPort-SDR: wHq0k7RRuHjmk4GSoXpZMzdMcjKu37jib33/iFPhQatFMviAgJVG+sJLN6PBdtETQ3JLkVNkCO eBzzZ2Dz5swm/kdTGms2mblcvMCiN4KYZAJKGcqECb98ShwDkAmEZzOoqmdpYj88oSk2JPkfgm TUnZGWmL3rFUxP1U3YbSbkmZKzPA72b2+b1xqNT6MPxc/gP/XZZO/tIhrV3g372xDC98W12wpW cx1vBntI12oGkQj0DKSKoFEkhhKBKVpH/oVzEL/flog2zpmH84jp2mdDGWgsGkaqP4BcBxLhjh aJU= X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="2271267" X-IronPort-AV: E=Sophos;i="5.77,450,1596466800"; d="scan'208";a="2271267" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa4.hc1455-7.c3s2.iphmx.com with ESMTP; 04 Nov 2020 17:10:41 +0900 Received: from yt-mxq.gw.nic.fujitsu.com (unknown [192.168.83.47]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 8B018EC7AD for ; Wed, 4 Nov 2020 17:10:40 +0900 (JST) Received: from pumpkin.openstacklocal (pumpkin.fct.css.fujitsu.com [10.130.70.189]) by yt-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 8E9E1AC0097 for ; Wed, 4 Nov 2020 17:10:39 +0900 (JST) Received: by pumpkin.openstacklocal (Postfix, from userid 1016) id 30A24B99B; Wed, 4 Nov 2020 17:08:01 +0900 (JST) From: Yuichi Ito To: maz@kernel.org, sumit.garg@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, catalin.marinas@arm.com, will@kernel.org Subject: [PATCH v2 1/3] irqchip/gic-v3: Enable support for SGIs to act as NMIs Date: Wed, 4 Nov 2020 17:05:37 +0900 Message-Id: <20201104080539.3205889-2-ito-yuichi@fujitsu.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> References: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_031045_730919_644F4D75 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: From: Sumit Garg Add support to handle SGIs as pseudo NMIs. As SGIs or IPIs default to a special flow handler: handle_percpu_devid_fasteoi_ipi(), so skip NMI handler update in case of SGIs. Also, enable NMI support prior to gic_smp_init() as allocation of SGIs as IRQs/NMIs happen as part of this routine. Signed-off-by: Sumit Garg --- drivers/irqchip/irq-gic-v3.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 16fecc0..7010ae2 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -461,6 +461,7 @@ static u32 gic_get_ppi_index(struct irq_data *d) static int gic_irq_nmi_setup(struct irq_data *d) { struct irq_desc *desc = irq_to_desc(d->irq); + u32 idx; if (!gic_supports_nmi()) return -EINVAL; @@ -478,16 +479,22 @@ static int gic_irq_nmi_setup(struct irq_data *d) return -EINVAL; /* desc lock should already be held */ - if (gic_irq_in_rdist(d)) { - u32 idx = gic_get_ppi_index(d); + switch (get_intid_range(d)) { + case SGI_RANGE: + break; + case PPI_RANGE: + case EPPI_RANGE: + idx = gic_get_ppi_index(d); /* Setting up PPI as NMI, only switch handler for first NMI */ if (!refcount_inc_not_zero(&ppi_nmi_refs[idx])) { refcount_set(&ppi_nmi_refs[idx], 1); desc->handle_irq = handle_percpu_devid_fasteoi_nmi; } - } else { + break; + default: desc->handle_irq = handle_fasteoi_nmi; + break; } gic_irq_set_prio(d, GICD_INT_NMI_PRI); @@ -498,6 +505,7 @@ static int gic_irq_nmi_setup(struct irq_data *d) static void gic_irq_nmi_teardown(struct irq_data *d) { struct irq_desc *desc = irq_to_desc(d->irq); + u32 idx; if (WARN_ON(!gic_supports_nmi())) return; @@ -515,14 +523,20 @@ static void gic_irq_nmi_teardown(struct irq_data *d) return; /* desc lock should already be held */ - if (gic_irq_in_rdist(d)) { - u32 idx = gic_get_ppi_index(d); + switch (get_intid_range(d)) { + case SGI_RANGE: + break; + case PPI_RANGE: + case EPPI_RANGE: + idx = gic_get_ppi_index(d); /* Tearing down NMI, only switch handler for last NMI */ if (refcount_dec_and_test(&ppi_nmi_refs[idx])) desc->handle_irq = handle_percpu_devid_irq; - } else { + break; + default: desc->handle_irq = handle_fasteoi_irq; + break; } gic_irq_set_prio(d, GICD_INT_DEF_PRI); @@ -1708,6 +1722,7 @@ static int __init gic_init_bases(void __iomem *dist_base, gic_dist_init(); gic_cpu_init(); + gic_enable_nmi_support(); gic_smp_init(); gic_cpu_pm_init(); @@ -1719,8 +1734,6 @@ static int __init gic_init_bases(void __iomem *dist_base, gicv2m_init(handle, gic_data.domain); } - gic_enable_nmi_support(); - return 0; out_free: From patchwork Wed Nov 4 08:05:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuichi Ito X-Patchwork-Id: 11879805 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=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 D8636C2D0A3 for ; Wed, 4 Nov 2020 08:12:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 64BA922384 for ; Wed, 4 Nov 2020 08:12:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="y6GeZbqN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64BA922384 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KHdkrFT82sSLIpLFV+nAJymwN46bO2G1XZUq833d7wM=; b=y6GeZbqN72MF+mzxx6POEuJmV n9c9QY0raXC7rEEdPHCMO/SRZxR3AkyOhSkCARavdzDQ99k/DIRzr64JyeH1c1wa448C72CDCFS5f 1+BloTKl7bvGUh5j3pfU6+BpSJoHFJXMGlVzmLgYS/e+ZjmJ8liKxk2wbGMPrcJ5XJxPcNEqbHz2t KsQGdlWOyBgEkTurT+5/HvsCB1VJqknIYMSsfK41Vu4xerZQJswQhHkU0DV6Ltsghcf24vRZQnASv Pe02l0TYNnkuGJrtiHSkxwVGUmJETT1oIwPK8kE/Oc6dobiRDMhuWiY0bwxgZmJK+smsxVBYXtgBk jHVB+eH9Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsj-0005BL-T4; Wed, 04 Nov 2020 08:11:01 +0000 Received: from esa1.hc1455-7.c3s2.iphmx.com ([207.54.90.47]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsU-00056e-Bz for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 08:10:47 +0000 IronPort-SDR: dU/2ChNZxKftcYHMutp0fqd/dLVMcyiNaoD36s63otR97q1fE0LyoEZQNBP2ibAKDLkBfnKVOT yss/7RJ6vlH8eha71k5tsGXF8E3HHI2BbKpd+GF4AZ5/tEhf++PmPh0uY1zxsaxbZA9VoDJXru RnXua0hddHC3II3zetybRFe4Hep/WclG6mmbEsVsEmhna/xayoUrcD6SzYuG3mY5tUdB92kt+h ft/yPDS8DqKYdcHyud/THnKazwQuzvv3hCvhQHhpSp8O53eAfsay5pFrIwiejqg8Y9oqhwxF67 J+Q= X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="2258695" X-IronPort-AV: E=Sophos;i="5.77,450,1596466800"; d="scan'208";a="2258695" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP; 04 Nov 2020 17:10:43 +0900 Received: from yt-mxq.gw.nic.fujitsu.com (unknown [192.168.83.47]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 9D3E821EC03 for ; Wed, 4 Nov 2020 17:10:41 +0900 (JST) Received: from pumpkin.openstacklocal (pumpkin.fct.css.fujitsu.com [10.130.70.189]) by yt-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 9AAC0AC005E for ; Wed, 4 Nov 2020 17:10:40 +0900 (JST) Received: by pumpkin.openstacklocal (Postfix, from userid 1016) id 3E7DDB9A9; Wed, 4 Nov 2020 17:08:02 +0900 (JST) From: Yuichi Ito To: maz@kernel.org, sumit.garg@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, catalin.marinas@arm.com, will@kernel.org Subject: [PATCH v2 2/3] arm64: smp: Register IPI_CPU_CRASH_STOP IPI as pseudo-NMI Date: Wed, 4 Nov 2020 17:05:38 +0900 Message-Id: <20201104080539.3205889-3-ito-yuichi@fujitsu.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> References: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_031046_683926_C7CA2C78 X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yuichi Ito , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Register IPI_CPU_CRASH_STOP IPI as pseudo-NMI. For systems that do not support pseudo-NMI, register as a normal IRQ. Signed-off-by: Yuichi Ito --- arch/arm64/kernel/smp.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 82e75fc..fd59bc7 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -80,6 +80,8 @@ enum ipi_msg_type { static int ipi_irq_base __read_mostly; static int nr_ipi __read_mostly = NR_IPI; static struct irq_desc *ipi_desc[NR_IPI] __read_mostly; +static int ipi_crash_stop = -1; +static int ipi_crash_stop_enable_nmi; static void ipi_setup(int cpu); @@ -960,8 +962,16 @@ static void ipi_setup(int cpu) if (WARN_ON_ONCE(!ipi_irq_base)) return; - for (i = 0; i < nr_ipi; i++) - enable_percpu_irq(ipi_irq_base + i, 0); + for (i = 0; i < nr_ipi; i++) { + if (ipi_irq_base + i == ipi_crash_stop) { + if (!prepare_percpu_nmi(ipi_irq_base + i)) { + enable_percpu_nmi(ipi_irq_base + i, 0); + ipi_crash_stop_enable_nmi = 1; + } else + pr_crit("CPU%u: IPI_CPU_CRASH_STOP cannot be enabled NMI.\n", cpu); + } else + enable_percpu_irq(ipi_irq_base + i, 0); + } } #ifdef CONFIG_HOTPLUG_CPU @@ -972,24 +982,38 @@ static void ipi_teardown(int cpu) if (WARN_ON_ONCE(!ipi_irq_base)) return; - for (i = 0; i < nr_ipi; i++) - disable_percpu_irq(ipi_irq_base + i); + for (i = 0; i < nr_ipi; i++) { + if (ipi_irq_base + i == ipi_crash_stop) { + if (ipi_crash_stop_enable_nmi) { + disable_percpu_nmi(ipi_irq_base + i); + teardown_percpu_nmi(ipi_irq_base + i); + } + } else + disable_percpu_irq(ipi_irq_base + i); + } } #endif void __init set_smp_ipi_range(int ipi_base, int n) { - int i; + int i, ret; WARN_ON(n < NR_IPI); nr_ipi = min(n, NR_IPI); + ret = request_percpu_nmi(ipi_base + IPI_CPU_CRASH_STOP, + ipi_handler, "IPI", &cpu_number); + if (!ret) + ipi_crash_stop = ipi_base + IPI_CPU_CRASH_STOP; + for (i = 0; i < nr_ipi; i++) { int err; - err = request_percpu_irq(ipi_base + i, ipi_handler, - "IPI", &cpu_number); - WARN_ON(err); + if (ipi_base + i != ipi_crash_stop) { + err = request_percpu_irq(ipi_base + i, ipi_handler, + "IPI", &cpu_number); + WARN_ON(err); + } ipi_desc[i] = irq_to_desc(ipi_base + i); irq_set_status_flags(ipi_base + i, IRQ_HIDDEN); From patchwork Wed Nov 4 08:05:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuichi Ito X-Patchwork-Id: 11879801 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 5A5C1C388F7 for ; Wed, 4 Nov 2020 08:12:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DEEEF22384 for ; Wed, 4 Nov 2020 08:12:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="alNncDm6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEEEF22384 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RXr78JNHxiuDD9YN9edVKSEYWq0y0Wjrw4HgAwDeKzw=; b=alNncDm6UDEYz7I/oLl1BPTV9 kcxgLN0pYMMmSmOqSpFOByyJcvB/wmbF/0Z4QeimH21O3GYS+9ToSGS9e4sDC+desHyW/J9poX08N Ar9BSOk1vwrs/lkkVWlkuJK5GgGckxKfSCZ8gcurjVtRZldYSHe6nG22mECOO6CYNdmnFuiXAQJNH XhmlK6K6BFQdgWvmov76Kt3gSOunIp0tQekmRJFDwLcjRi7EGhlqSWpphEdC4FWqxdeJOyrfUiJI5 q3QV3vlLNvbfUfpWfYn/JXPlBWjaqdwcwr6jpVieu2UzRF3psKYo8diAFFBdwfKYs7nCU0yLl72wM LNf9JTgKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsb-000596-EQ; Wed, 04 Nov 2020 08:10:53 +0000 Received: from esa4.hc1455-7.c3s2.iphmx.com ([68.232.139.117]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaDsT-00056d-8T for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 08:10:46 +0000 IronPort-SDR: QNrRE8F8acdjgqSra5nsXbPgnTMph0xwT6asf6GisZUNaKKhsRrQ40z4MxlYbzXGaffaKvOGRe OUrXrNtbXEC3NMHoQkdr65pX0G3F1KooFPFyLIkbZDV5Ojuz6G4MQvtltUZcNBd4C/LqsK+bAp cnMtDRwuMEZjofRjRd9jPd9opG1EloihoqduUk+4/puaqBvSv0kYuY5XGcdkiCRFMZQW0/Xm6t nPChzVbbxmobZmeRaKwTJitJZoBXRh4uL1jWLEIypBMHvr2SI0IADSqEYJpvR/SffKUtjZ1r4s Eu0= X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="2271279" X-IronPort-AV: E=Sophos;i="5.77,450,1596466800"; d="scan'208";a="2271279" Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa4.hc1455-7.c3s2.iphmx.com with ESMTP; 04 Nov 2020 17:10:43 +0900 Received: from yt-mxq.gw.nic.fujitsu.com (unknown [192.168.83.47]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id AE3AC1F507C for ; Wed, 4 Nov 2020 17:10:42 +0900 (JST) Received: from pumpkin.openstacklocal (pumpkin.fct.css.fujitsu.com [10.130.70.189]) by yt-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id A2A33AC00A7 for ; Wed, 4 Nov 2020 17:10:41 +0900 (JST) Received: by pumpkin.openstacklocal (Postfix, from userid 1016) id 46F05B9A9; Wed, 4 Nov 2020 17:08:03 +0900 (JST) From: Yuichi Ito To: maz@kernel.org, sumit.garg@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, catalin.marinas@arm.com, will@kernel.org Subject: [PATCH v2 3/3] arm64: smp: Disable priority masking when NMI is enable on PSR.I section Date: Wed, 4 Nov 2020 17:05:39 +0900 Message-Id: <20201104080539.3205889-4-ito-yuichi@fujitsu.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> References: <20201104080539.3205889-1-ito-yuichi@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_031045_729775_311D7888 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yuichi Ito , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It should be prohibitted to use priority masking in NMI context. Using local_irq_disable() under the above conditions causes a WARNING. Then, there will be also a mismatch between the PSR.I values and PMR GIC_PRIO_PSR_I_SET. Signed-off-by: Yuichi Ito --- arch/arm64/kernel/smp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index fd59bc7..3c49f06 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -872,7 +872,9 @@ static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs) atomic_dec(&waiting_for_crash_ipi); - local_irq_disable(); + if(!in_nmi()) + local_irq_disable(); + sdei_mask_local_cpu(); if (IS_ENABLED(CONFIG_HOTPLUG_CPU))