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.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 D4F9BC433DF for ; Tue, 13 Oct 2020 03:23:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CAA42078E for ; Tue, 13 Oct 2020 03:23:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fVshXDeX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728925AbgJMDXF (ORCPT ); Mon, 12 Oct 2020 23:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727831AbgJMDXE (ORCPT ); Mon, 12 Oct 2020 23:23:04 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95935C0613D0 for ; Mon, 12 Oct 2020 20:23:04 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id f21so6782332qko.5 for ; Mon, 12 Oct 2020 20:23:04 -0700 (PDT) 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=8avc/64suYQeMp5GgzA5tmw2pJjaDuZSyAtFHq8gm34=; b=fVshXDeXRvRHKXbkyOJuRjmLohKcGDX7DDjrMtShzKZFXCDWpDYpbtuY+9/lW0oSzn v31Y9XdnWd7q2wMfv4McLozcmD21u7PQ+peYEDpsaxn+Nwf4on/ItmLJgoPxnggt+dSG 4BmOONWVL5NGd5aeA1Co45HuViM2EoXkePxtaJnVYtuzKej4z68hlFlNZYGza2Kb6I6M KeM75AbjHbF4Cp4YlbCjsyYAQ/af4CxPjze0OrDmeo9gRqNmO12G1+FxnZja2YYiyJ3C Us6YNnhsANN9wHX6gdjni8JiDL6NZcg+9eDp6WcUXAVrAyaa6Z+hX2vukQUeJJy7uHPW enAw== 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=8avc/64suYQeMp5GgzA5tmw2pJjaDuZSyAtFHq8gm34=; b=V3o/W7nryNaIYaZT2NyVDfQ3HJ8Cf207G6r7NwdmaT1hRRKg+JkpEMhRxryj+npcr5 ONORaqRZtMwjerG4ioztMqrgGkLEv065oWcVscsZjO/misIhhyA/qeGz2fWROSiytBmD PIuB2aNEf8LjZ1LLQ1I+cha+ssSw/pvR6+lfDlqCxxQvzQ6wAbdQevDnULX5SjoFiHta NiwPailGj08/Q4zEfZc6isIjS2ilZsthj2rVgRTnsVp6AAx+F1W/2zyk1eWvmVe7vwus cxG8SQcKqfSlxO0tyXzvEKv50qIXI8TppAMKPdThievm5x3yk+aJpFwSDf64WM0VNxyr Dmkg== X-Gm-Message-State: AOAM530hX5QRhxWLWS3RvualPDU0L/R0ZCxQP/RDTLYWMWv2QwbB1T1L 9md5BcJ7v8YarRK2OpesSA== X-Google-Smtp-Source: ABdhPJyHjdm9v8cbZa7XC7+SU1TiL3kuhYJVBffwraE+SqHVz0Unk73Y35kuNXvQXVMGxEraIGfRMw== X-Received: by 2002:a05:620a:677:: with SMTP id a23mr2355679qkh.428.1602559383716; Mon, 12 Oct 2020 20:23:03 -0700 (PDT) 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 w45sm506123qtw.96.2020.10.12.20.23.02 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Oct 2020 20:23:02 -0700 (PDT) Date: Mon, 12 Oct 2020 23:23:00 -0400 From: Masayoshi Mizuma To: Sumit Garg Cc: Marc Zyngier , Catalin Marinas , Will Deacon , Mark Rutland , Daniel Thompson , Jason Cooper , kgdb-bugreport@lists.sourceforge.net, Douglas Anderson , Linux Kernel Mailing List , linux-arm-kernel , Jason Wessel , Thomas Gleixner , julien.thierry.kdev@gmail.com Subject: Re: [PATCH v4 1/5] arm64: Add framework to turn IPI as NMI Message-ID: <20201013032300.djsxeasxaqbzjhzr@gabell> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 05:49:09PM +0530, Sumit Garg wrote: > 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? Yes, make sense to me. Thanks! Masa 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.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,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 E6FD5C433DF for ; Tue, 13 Oct 2020 03:24:38 +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 762C02078E for ; Tue, 13 Oct 2020 03:24:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2l3ttb/h"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fVshXDeX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 762C02078E 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=TmqiDB5vQD3Ti7roukCRxNtbLFbMMPJL3e+uGocv0Hk=; b=2l3ttb/hahjyqdPILNazbohks GaZFeJ+vRHf54EgH5DHWZY8Ql7JXp9tRZwDxCNDn3abGed08CjiQZ1oR30D1vWarlvsPGOV1XGkjy kPEyEFPaG5BM2/Bt5IsepUfEBOxWYWUclWHEo493g7tfWDc4MPybzlgROScVVph8cjkMQVXyho+cv 7YQdBIm18Lq4RdcPFZpZJHKvQvlMQ1tiO7wmVjjONKJIp0SGi8R+mz9pl4jPu0sCWaKmxwj2aH+5B gVCyrsg3uZSCJFe6W5+FG33tvVVXNo42NNeKOe4lxQLzie7lWQXTy4McM8pyV16zGdPl/ouXCN9BT XdNMF72Iw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSAu5-0003ps-Sr; Tue, 13 Oct 2020 03:23:09 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSAu3-0003pI-KT for linux-arm-kernel@lists.infradead.org; Tue, 13 Oct 2020 03:23:08 +0000 Received: by mail-qk1-x743.google.com with SMTP id i22so3326122qkn.9 for ; Mon, 12 Oct 2020 20:23:04 -0700 (PDT) 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=8avc/64suYQeMp5GgzA5tmw2pJjaDuZSyAtFHq8gm34=; b=fVshXDeXRvRHKXbkyOJuRjmLohKcGDX7DDjrMtShzKZFXCDWpDYpbtuY+9/lW0oSzn v31Y9XdnWd7q2wMfv4McLozcmD21u7PQ+peYEDpsaxn+Nwf4on/ItmLJgoPxnggt+dSG 4BmOONWVL5NGd5aeA1Co45HuViM2EoXkePxtaJnVYtuzKej4z68hlFlNZYGza2Kb6I6M KeM75AbjHbF4Cp4YlbCjsyYAQ/af4CxPjze0OrDmeo9gRqNmO12G1+FxnZja2YYiyJ3C Us6YNnhsANN9wHX6gdjni8JiDL6NZcg+9eDp6WcUXAVrAyaa6Z+hX2vukQUeJJy7uHPW enAw== 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=8avc/64suYQeMp5GgzA5tmw2pJjaDuZSyAtFHq8gm34=; b=KPd8RWVK39fDja3igYJHt1Mk//asQJBn817NkenBS8ZyqZwFO91QalupkfUpvgfzbm XyHFh9rHKNmzfBwweJE1ZgJ6JDeeu65ouZY/pdEeeMuiQnlzmK5Pxh70IMmMxq8aegik 6juiflq+/zqzx9wvzMyMh1Q13MnBukNMpZruPmp870IE7i2qlPVHTOAMVziRkcIOIcep X/kxQP/vbXwORPDjMO3VoQ7hq1bOroV1NTW3iTbd7M8axdh6/RCMuGYrMFs0bNoulYuB Dm/Ml0TmCmSztPHfgjFTj6ur0aohfuOKcLzSPNFBBpCsZbpTq6bUjsiX2L70P8p/n6n5 5R5Q== X-Gm-Message-State: AOAM533iNFm6fU1o5pi+6JnSgTw13ZLk3gClztX74O1eS3DvEV4a2mDe cZYYlZCiDn6u6EHs4sRmvw== X-Google-Smtp-Source: ABdhPJyHjdm9v8cbZa7XC7+SU1TiL3kuhYJVBffwraE+SqHVz0Unk73Y35kuNXvQXVMGxEraIGfRMw== X-Received: by 2002:a05:620a:677:: with SMTP id a23mr2355679qkh.428.1602559383716; Mon, 12 Oct 2020 20:23:03 -0700 (PDT) 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 w45sm506123qtw.96.2020.10.12.20.23.02 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Oct 2020 20:23:02 -0700 (PDT) Date: Mon, 12 Oct 2020 23:23:00 -0400 From: Masayoshi Mizuma To: Sumit Garg Subject: Re: [PATCH v4 1/5] arm64: Add framework to turn IPI as NMI Message-ID: <20201013032300.djsxeasxaqbzjhzr@gabell> 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201012_232307_688596_FEA3A9C9 X-CRM114-Status: GOOD ( 29.27 ) 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 On Mon, Oct 12, 2020 at 05:49:09PM +0530, Sumit Garg wrote: > 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? Yes, make sense to me. Thanks! Masa _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel