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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B978C433EF for ; Thu, 30 Sep 2021 13:35:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D06CD615E2 for ; Thu, 30 Sep 2021 13:35:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D06CD615E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=Ny1n+H23913fZpIi98NkbJS8rUbO+boYswC2cuYMG2A=; b=ak3+5s8/zgLlfn JrfYxDSjMUzvmNPhq93X1XoIBhTRy7iUYVbJk8ATWj9dRKH6/hu6EPf3vu/mwuGI8sgLXpt4JI78h 14Ma7W6hpWtxtvqTCefgEU563AXhTLiGoK2ou9EefAC0vUlvbGROtE3MH44j7W0EVbuFgiP2I0k20 1qXrR8YXEj7hjjtkA9D2t9v4Z3LNpFEe7Wx4Fs2NmSbqzdzbvDEgMWR3UesxGiRhI/pJRphYuKMlL UDH/EiEOXZ/ka/k9OVU8fywM1nEo1k2JT8WB67aUzkIXms39sTiaQWNS1pR52uQK8u25dqcJhh/8o YIxXS9Gt6wnfRIzONR+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVwBZ-00EVKF-Ja; Thu, 30 Sep 2021 13:33:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVwBL-00EVH2-Td for linux-arm-kernel@lists.infradead.org; Thu, 30 Sep 2021 13:33:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B87B6101E; Thu, 30 Sep 2021 06:33:00 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4CDE73F793; Thu, 30 Sep 2021 06:32:59 -0700 (PDT) Date: Thu, 30 Sep 2021 14:32:57 +0100 From: Mark Rutland To: Pingfan Liu Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Marc Zyngier , Joey Gouly , Sami Tolvanen , Julien Thierry , Thomas Gleixner , Yuichi Ito , linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 1/5] arm64/entry-common: push the judgement of nmi ahead Message-ID: <20210930133257.GB18258@lakrids.cambridge.arm.com> References: <20210924132837.45994-1-kernelfans@gmail.com> <20210924132837.45994-2-kernelfans@gmail.com> <20210924175306.GB42068@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210930_063304_099703_0049B17B X-CRM114-Status: GOOD ( 28.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Sat, Sep 25, 2021 at 11:39:55PM +0800, Pingfan Liu wrote: > On Fri, Sep 24, 2021 at 06:53:06PM +0100, Mark Rutland wrote: > > On Fri, Sep 24, 2021 at 09:28:33PM +0800, Pingfan Liu wrote: > > > In enter_el1_irq_or_nmi(), it can be the case which NMI interrupts an > > > irq, which makes the condition !interrupts_enabled(regs) fail to detect > > > the NMI. This will cause a mistaken account for irq. > > > Sorry about the confusing word "account", it should be "lockdep/rcu/.." > > > Can you please explain this in more detail? It's not clear which > > specific case you mean when you say "NMI interrupts an irq", as that > > could mean a number of distinct scenarios. > > > > AFAICT, if we're in an IRQ handler (with NMIs unmasked), and an NMI > > causes a new exception we'll do the right thing. So either I'm missing a > > subtlety or you're describing a different scenario.. > > > > Note that the entry code is only trying to distinguish between: > > > > a) This exception is *definitely* an NMI (because regular interrupts > > were masked). > > > > b) This exception is *either* and IRQ or an NMI (and this *cannot* be > > distinguished until we acknowledge the interrupt), so we treat it as > > an IRQ for now. > > > b) is the aim. > > At the entry, enter_el1_irq_or_nmi() -> enter_from_kernel_mode()->rcu_irq_enter()/rcu_irq_enter_check_tick() etc. > While at irqchip level, gic_handle_irq()->gic_handle_nmi()->nmi_enter(), > which does not call rcu_irq_enter_check_tick(). So it is not proper to > "treat it as an IRQ for now" I'm struggling to understand the problem here. What is "not proper", and why? Do you think there's a correctness problem, or that we're doing more work than necessary? If you could give a specific example of a problem, it would really help. I'm aware that we do more work than strictly necessary when we take a pNMI from a context with IRQs enabled, but that's how we'd intended this to work, as it's vastly simpler to manage the state that way. Unless there's a real problem with that approach I'd prefer to leave it as-is. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel