From mboxrd@z Thu Jan 1 00:00:00 1970 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.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 3BCE3C388F2 for ; Mon, 2 Nov 2020 15:34:33 +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 BA9DC2231B for ; Mon, 2 Nov 2020 15:34:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UC+q0612"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BZ0SsxES" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA9DC2231B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M0G3+jQbpHtKj4KR59rAdbl5UJeNTJIQVNaffu8DpvU=; b=UC+q0612WqZ/Xp4aF3LkzBSFl PrIGaDqUkwiPD9qwsYciboGPNKziNpn6siXaDFvxD6nHHx+GvlXFgdiF30iTp08tZuy5A7HO9mz39 kpi9yi9jbH8RjgjYFrLj/F5ozyJOQ5SBqgXihejOefFxqtswc7/OtgB4uGaFv9srsOJEQEXMjoJp7 izoypqqQyUpzfFRY0erwxVY7czzmkoF0T0jJYsImgInkgJkjd0SEv0kaTmwMwqTCjMqeK0He+56Xn HnjigyYdwbgr0rUAQkrpTjl0f8xQw3GLMyjb1pt2uUfxOAfkEC62qD0sm8lyUb2Yhs3x1K0aJU552 M8XgA3I2A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZbqN-0002OG-Ty; Mon, 02 Nov 2020 15:34:03 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZbqK-0002L3-H8 for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 15:34:01 +0000 Received: by mail-qk1-x741.google.com with SMTP id z6so11820069qkz.4 for ; Mon, 02 Nov 2020 07:33:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Jkd5WRUAKaIIbJUIfCjcR2xQVAOUb4rIGq3LFrUWxsE=; b=BZ0SsxESF8rSskfH+stShhCnOd6JGOyfEi8XtbgOg8OATjoZrTZ7s45AsVU0BC82xz ddLpAsGN9vZxHp6av72FDoi/Wrhyj/Kui0p71PX6TrCN2aQIVnlraNYCpd5TQ+3F6sdN 86KHo45OCukF/pRhU4Vk/I7J2Ek1KUauw4cm/KVDK0TVgFlp8BYZwQfR+PL1GlGB2Qh5 7TOR252d9wf/hQY1aa2GtEKgXWWg2tFSQTH7mXi0P3hgg73QciG8eqTk8aINdog0jBfD KD54aS7LUXZ6cML9vt4HGOjSuXDxve0E98pCurySYOto0Iza9iq/jVDun/BoycL0suWA pDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Jkd5WRUAKaIIbJUIfCjcR2xQVAOUb4rIGq3LFrUWxsE=; b=HbPSj0G+UFt/BdEHMgsg7HohxnKzoKhAwA2VrbF0PiuN1zWSRTqCdpGEOfNDcGoc3X A1/Pg1S7gy/dAGei4V84t9ezaWL4cOFgXNAyWEYj8fDbPpD9kUn2pxe9wfsdCGAJQil+ W9xtMy/0GnfLzQENMy/2qgVKQQjkohUbkQs5c2mF0OC39O83osuTFLJeGAAcxuPTOTmo /0BULIoboqVxNoqTHcHEUSOiehD2TK72OUV/3OmYS3DvWovew91p30gwNrUCBFaqxQcK RTim6Tm2qS2PwIk0USwchPF4MZmAknj4kkFz1CW7SyGVH5nmE4xpuZ82xSvD0jaUHxa3 NCZQ== X-Gm-Message-State: AOAM532uMecpAua+6KTfTQ+8Uoq7V/cww6ZHnS6Rd2K5oRUsMUCcuaZD z36Jn39N/Ld/0Ur9DNcnxg== X-Google-Smtp-Source: ABdhPJxxfArhbX9SYy8Rmm26gib6WG8GrpJLzA/QMpD5c6xMFrlMZ2qveL6OMlPTG8NeDaTBLSSq4A== X-Received: by 2002:a37:8cc1:: with SMTP id o184mr15679047qkd.205.1604331234080; Mon, 02 Nov 2020 07:33:54 -0800 (PST) Received: from gabell (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id y82sm7507470qkb.129.2020.11.02.07.33.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Nov 2020 07:33:52 -0800 (PST) Date: Mon, 2 Nov 2020 10:33:49 -0500 From: Masayoshi Mizuma To: Sumit Garg Subject: Re: [PATCH v7 1/7] arm64: Add framework to turn IPI as NMI Message-ID: <20201102153349.fay4f5iam76gfapu@gabell> References: <1604317487-14543-1-git-send-email-sumit.garg@linaro.org> <1604317487-14543-2-git-send-email-sumit.garg@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1604317487-14543-2-git-send-email-sumit.garg@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_103400_602317_4D477D8C X-CRM114-Status: GOOD ( 24.94 ) 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: mark.rutland@arm.com, daniel.thompson@linaro.org, tsbogend@alpha.franken.de, linux-kernel@vger.kernel.org, jason@lakedaemon.net, ito-yuichi@fujitsu.com, maz@kernel.org, x86@kernel.org, linux@armlinux.org.uk, dianders@chromium.org, jason.wessel@windriver.com, mingo@redhat.com, bp@alien8.de, mpe@ellerman.id.au, catalin.marinas@arm.com, kgdb-bugreport@lists.sourceforge.net, tglx@linutronix.de, julien.thierry.kdev@gmail.com, will@kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 02, 2020 at 05:14:41PM +0530, Sumit Garg wrote: > Introduce framework to turn an IPI as NMI using pseudo NMIs. The main > motivation for this feature is to have an IPI that can be leveraged to > invoke NMI functions on other CPUs. > > And current prospective users are NMI backtrace and KGDB CPUs round-up > whose support is added via future patches. > > Signed-off-by: Sumit Garg > --- > arch/arm64/include/asm/nmi.h | 17 ++++++++++++ > arch/arm64/kernel/Makefile | 2 +- > arch/arm64/kernel/ipi_nmi.c | 65 ++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 83 insertions(+), 1 deletion(-) > create mode 100644 arch/arm64/include/asm/nmi.h > create mode 100644 arch/arm64/kernel/ipi_nmi.c > > diff --git a/arch/arm64/include/asm/nmi.h b/arch/arm64/include/asm/nmi.h > new file mode 100644 > index 0000000..4cd14b6 > --- /dev/null > +++ b/arch/arm64/include/asm/nmi.h > @@ -0,0 +1,17 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef __ASM_NMI_H > +#define __ASM_NMI_H > + > +#ifndef __ASSEMBLER__ > + > +#include > + > +extern bool arm64_supports_nmi(void); > +extern void arm64_send_nmi(cpumask_t *mask); > + > +void set_smp_dynamic_ipi(int ipi); > +void dynamic_ipi_setup(int cpu); > +void dynamic_ipi_teardown(int cpu); > + > +#endif /* !__ASSEMBLER__ */ > +#endif > diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile > index bbaf0bc..525a1e0 100644 > --- a/arch/arm64/kernel/Makefile > +++ b/arch/arm64/kernel/Makefile > @@ -17,7 +17,7 @@ obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ > return_address.o cpuinfo.o cpu_errata.o \ > cpufeature.o alternative.o cacheinfo.o \ > smp.o smp_spin_table.o topology.o smccc-call.o \ > - syscall.o proton-pack.o > + syscall.o proton-pack.o ipi_nmi.o > > targets += efi-entry.o > > diff --git a/arch/arm64/kernel/ipi_nmi.c b/arch/arm64/kernel/ipi_nmi.c > new file mode 100644 > index 0000000..a945dcf > --- /dev/null > +++ b/arch/arm64/kernel/ipi_nmi.c > @@ -0,0 +1,65 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * NMI support for IPIs > + * > + * Copyright (C) 2020 Linaro Limited > + * Author: Sumit Garg > + */ > + > +#include > +#include > +#include > + > +#include > + > +static struct irq_desc *ipi_nmi_desc __read_mostly; > +static int ipi_nmi_id __read_mostly; > + > +bool arm64_supports_nmi(void) > +{ > + if (ipi_nmi_desc) > + return true; > + > + return false; > +} > + > +void arm64_send_nmi(cpumask_t *mask) > +{ > + if (WARN_ON_ONCE(!ipi_nmi_desc)) > + return; > + > + __ipi_send_mask(ipi_nmi_desc, mask); > +} > + > +static irqreturn_t ipi_nmi_handler(int irq, void *data) > +{ > + /* nop, NMI handlers for special features can be added here. */ > + > + return IRQ_NONE; > +} > + > +void dynamic_ipi_setup(int cpu) cpu isn't used here, so void is better? void dynamic_ipi_setup(void) > +{ > + if (!ipi_nmi_desc) > + return; > + > + if (!prepare_percpu_nmi(ipi_nmi_id)) > + enable_percpu_nmi(ipi_nmi_id, IRQ_TYPE_NONE); > +} > + > +void dynamic_ipi_teardown(int cpu) Same as here: void dynamic_ipi_teardown(void) > +{ > + if (!ipi_nmi_desc) > + return; > + > + disable_percpu_nmi(ipi_nmi_id); > + teardown_percpu_nmi(ipi_nmi_id); > +} > + > +void __init set_smp_dynamic_ipi(int ipi) > +{ > + if (!request_percpu_nmi(ipi, ipi_nmi_handler, "IPI", &cpu_number)) { > + ipi_nmi_desc = irq_to_desc(ipi); > + ipi_nmi_id = ipi; > + } > +} > -- Otherwise, looks good to me. Please feel free to add: Reviewed-by: Masayoshi Mizuma Thanks, Masa _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel