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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 119ECC433DF for ; Mon, 12 Oct 2020 12:20:55 +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 B9A2A2074F for ; Mon, 12 Oct 2020 12:20:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K+R9KvCk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Zk/N3bev" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9A2A2074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RtDQGqTImYYCdImh06VDprmkEy1AVsxBLaFnSHPF1+k=; b=K+R9KvCkP/CFWGi7MexTMQL8y ZXMahfPo7zZ+Hi/oALE1zhk4QmGzQQFkGswi4SLCBBXJI9yOqzAwFK8nhgPG5iTHpkNu3Kkbkq0zq XYSKnHLFKdLKuzgx7cnEGY4IJ9yAMml60sjy5MXhSBybNqWs7KGa+RLU2pln37PNhaZn/pFi9EcY1 r6NzznKP65jS5fhnf2kFiPZvvWT+mHrpFtKMtXBqjJXwNqc9Pgs40AGl6uU3LRhxyWFH4+9iyhdU0 OoOd0I0aOs9vBzhQ1Ef4vUY16eP+wRFVsRAChzZ3YMF8JHleaS/pbyAp9AiRtDOwpLjHbyFz2EzPO xs9NflKEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRwnZ-0000S2-Pv; Mon, 12 Oct 2020 12:19:29 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRwnW-0000QX-4K for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2020 12:19:27 +0000 Received: by mail-lf1-x142.google.com with SMTP id j30so15766152lfp.4 for ; Mon, 12 Oct 2020 05:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Hz9+UR8vgWlEErBmlAks6gwBc4rojM0m/9wND5ml4Pg=; b=Zk/N3bevPcHY95+DG8fWGjXgh1wRF/zeFkgCONGKHBNvd7ietWrSYV2JKRkGBtUmMw 51CrCf6+HZo7rASqOASaGwDPpd1kzfDVin6DCbxhHVRO+JUmegHgflpViH5LRNYtR5+w fFJ09AImL7q+YsmxQS59buiXFw7dp5hG6WR9JAXzhMKXXendeBs2+voPppL1s3d+ydaq Xd2DT83eepfpJHwS1SL1ipYyLjA3FM0/4JwMHbkff50ZzCzMv3jLkTpypvP7iJ5t6pwi 3RhwTY6s253WbEOgGllIpl+FtHNlzh4AOdZTz9Eho63pE+2fEu7aCLpkhdCoxuWrVJt2 lLjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Hz9+UR8vgWlEErBmlAks6gwBc4rojM0m/9wND5ml4Pg=; b=FN089AsHEG03oztf3y1r/sW6hJctbjc6Fm3qlndhFgsRRbQKBfknatWxPZHvzK/KGp HFQjh3sVZPeUmCZPvgQXC1ThR5vXPA//jPMsgCDAY+cwPz1yGPiO8r1r5fKcGpCVRonp FYfXU/CqtemPY/HtmjSvvJiUF9D6SZ00UnJVmzAJnnuedENLvyupKwMlShDaLliDCazu oV7+7Ae3mgw9ySpWlXikMeBB3jjwZ6OQlNd88Y37pG8FRaFk2tRWmV12mGdMMyUcnK/R FGe5G95PH8jY6t8+aTXTr536VpV+aWIm8XlrwSYpSriDJzKwbto0UdLL/ySaY+gskqpa Pb7Q== X-Gm-Message-State: AOAM532GixfVCxqcCaYR3MjLLD8ZBSMLnZJgvXRnK6iAxcCIoCYcsEyA OWux7F31WhHGAy+Gg1PCJKfK8EgqFyp6WMGxmpV/6g== X-Google-Smtp-Source: ABdhPJyd8IVmtPN6WxlmD3goe4qadYT73jlhbM3RYsE5ppkYNOi1GGukFXDDoXi88fsIfBkcuj4tPGFJu6XoFvhuKBQ= X-Received: by 2002:ac2:5588:: with SMTP id v8mr3577970lfg.435.1602505161755; Mon, 12 Oct 2020 05:19:21 -0700 (PDT) MIME-Version: 1.0 References: <1599830924-13990-1-git-send-email-sumit.garg@linaro.org> <1599830924-13990-2-git-send-email-sumit.garg@linaro.org> <20201010015855.vksetnj4luft5enc@gabell> <877drypgqb.wl-maz@kernel.org> <20201010151307.vq74if4mndjn4nhm@gabell> In-Reply-To: <20201010151307.vq74if4mndjn4nhm@gabell> From: Sumit Garg Date: Mon, 12 Oct 2020 17:49:09 +0530 Message-ID: Subject: Re: [PATCH v4 1/5] arm64: Add framework to turn IPI as NMI To: Masayoshi Mizuma X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201012_081926_441566_10210208 X-CRM114-Status: GOOD ( 24.93 ) 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 , Daniel Thompson , Jason Cooper , Marc Zyngier , Jason Wessel , Douglas Anderson , Linux Kernel Mailing List , julien.thierry.kdev@gmail.com, Catalin Marinas , kgdb-bugreport@lists.sourceforge.net, Thomas Gleixner , Will Deacon , linux-arm-kernel 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 Hi Masa, On Sat, 10 Oct 2020 at 20:43, Masayoshi Mizuma wrote: > > On Sat, Oct 10, 2020 at 10:34:04AM +0100, Marc Zyngier wrote: > > On Sat, 10 Oct 2020 02:58:55 +0100, > > Masayoshi Mizuma wrote: > > > > [...] > > > > > > +void ipi_nmi_setup(int cpu) > > > > +{ > > > > + if (!ipi_desc) > > > > + return; > > > > > > ipi_nmi_setup() may be called twice for CPU0: > > > > > > set_smp_ipi_range => set_smp_ipi_nmi => ipi_nmi_setup > > > => ipi_setup => ipi_nmi_setup > > > > > > Actually, I got the following error message via the second ipi_nmi_setup(): > > > > > > GICv3: Pseudo-NMIs enabled using relaxed ICC_PMR_EL1 synchronisation > > > GICv3: Cannot set NMI property of enabled IRQ 8 > > > genirq: Failed to setup NMI delivery: irq 8 > > > Ah, thanks for catching this which I missed during my testing. > > > Why don't we have a check to prevent that? Like as: > > > > > > if (cpumask_test_cpu(cpu, ipi_desc->percpu_enabled)) > > > return; > > > > That's definitely the wrong thing to do. prepare_nmi_setup() shouldn't > > be called twice, and papering over it isn't acceptable. > > Got it. How about moving ipi_nmi_setup() from ipi_setup() to > secondary_start_kernel() ? so that CPU0 can call ipi_nmi_setup() only > from set_smp_ipi_nmi(). > > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -245,6 +245,7 @@ asmlinkage notrace void secondary_start_kernel(void) > notify_cpu_starting(cpu); > > ipi_setup(cpu); > + ipi_nmi_setup(cpu); > > store_cpu_topology(cpu); > numa_add_cpu(cpu); > @@ -966,8 +967,6 @@ static void ipi_setup(int cpu) > > for (i = 0; i < nr_ipi; i++) > enable_percpu_irq(ipi_irq_base + i, 0); > - > - ipi_nmi_setup(cpu); > } > > #ifdef CONFIG_HOTPLUG_CPU > IMO, it would be more consistent to keep invocation of ipi_nmi_setup() from ipi_setup(). So let me remove other invocation from set_smp_ipi_nmi(): diff --git a/arch/arm64/kernel/ipi_nmi.c b/arch/arm64/kernel/ipi_nmi.c index d3aa430..000e457 100644 --- a/arch/arm64/kernel/ipi_nmi.c +++ b/arch/arm64/kernel/ipi_nmi.c @@ -87,7 +87,4 @@ void __init set_smp_ipi_nmi(int ipi) ipi_desc = irq_to_desc(ipi); irq_set_status_flags(ipi, IRQ_HIDDEN); ipi_id = ipi; - - /* Setup the boot CPU immediately */ - ipi_nmi_setup(smp_processor_id()); } Do let me know if this works for you? -Sumit > Thanks, > Masa _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel