Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp44882pxk; Wed, 23 Sep 2020 21:58:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxICrL1SBM5BC7LGv8ZDWv68dWgZ7gbImQYQcXGyF1Xdy87RA8KQlOAFP9g10RpGvR8+Jlk X-Received: by 2002:a05:6402:3193:: with SMTP id di19mr2636917edb.211.1600923489471; Wed, 23 Sep 2020 21:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600923489; cv=none; d=google.com; s=arc-20160816; b=i6LfceDH6bU8pfjb402yOsONo6fb+yLityZQXDQUYurTtRI6/qx3JmTabBa8NX4NMk aa0j7AZ9BC61ec5odOGELy+FekH0Kx4hufPMTanzGMiBoXDbqN78bsrP7bQe2yzNwSTB Ik4VbBsgej49c18sAK2EUdctYnxAHPatuv4E8xTNGf0WKEvoLO2YnGYY/oXjpGQVRn7/ QxhUVYCyLm6OnH6ZJDrjgDihXYca4myUsUShnS+wMsFF71Dih14/WQsaLQU9Jl7v67dt Te2MkXWyCAkgsM3U4+Mgn56VOCKeJSAe45pqZNaGEELTxBa4Bt1DZNKwTwRgP19NvLQr m8Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FTUXMeEj1KBa+Jv1ycCErXlttnkCVNA/v1oQypgoWkI=; b=cyf/Hf2Ew2bnK30o1Bp8fy9t9YcbE9/w61WLkl+C95Zti+LIRIHKmO3sISmJwL8CVs 5jE2erq8L4TsOqGFrLDR6xamXk3Cll+jAXuVY+fKs6W9K5U6IKADduLVVDa8tZgT0WWJ FkSRi4UWDsODkiFhw7OPJsnGb7cRLHmTfghj66/21+LAmSQ1zcvD39xR+SZk+DjYxABL v9ojmicHG9SRiqUQzCgYdsx+3cab2XC2ACCPzCCrsoiQXHTPiR5Psi5SoyFewDFSzTQI DdBZmasDwoiCaojQt10pirW+rm30XojhzVPZuxtsjUKpKK+p3GLbv7TuzKmShylF8/2j 02KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si1135296ejr.574.2020.09.23.21.57.43; Wed, 23 Sep 2020 21:58:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbgIXEzP (ORCPT + 99 others); Thu, 24 Sep 2020 00:55:15 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:51380 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726799AbgIXEzN (ORCPT ); Thu, 24 Sep 2020 00:55:13 -0400 X-Greylist: delayed 682 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Sep 2020 00:55:11 EDT Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm01.jp.fujitsu.com with smtp id 6f2d_0859_aeb77cb9_8c5b_4ea6_9804_e9f6eaa60eff; Thu, 24 Sep 2020 13:43:47 +0900 Received: from pumpkin.openstacklocal (pumpkin.fct.css.fujitsu.com [10.130.70.189]) by kw-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id 8E2C6AC008F for ; Thu, 24 Sep 2020 13:43:47 +0900 (JST) Received: by pumpkin.openstacklocal (Postfix, from userid 1016) id E4F1A1C014; Thu, 24 Sep 2020 13:42:48 +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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yuichi Ito Subject: [PATCH 2/2] Register IPI_CPU_CRASH_STOP IPI as pseudo-NMI Date: Thu, 24 Sep 2020 13:42:36 +0900 Message-Id: <20200924044236.1245808-3-ito-yuichi@fujitsu.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200924044236.1245808-1-ito-yuichi@fujitsu.com> References: <20200924044236.1245808-1-ito-yuichi@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index b6bde2675ccc..d929dd7221ff 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -79,6 +79,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); static void ipi_teardown(int cpu); @@ -954,8 +956,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); + } } static void ipi_teardown(int cpu) @@ -965,23 +975,37 @@ 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); + } } 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); -- 2.25.1