Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3983069imu; Mon, 12 Nov 2018 03:59:48 -0800 (PST) X-Google-Smtp-Source: AJdET5fCQKNpA64cJ+oxPucu6c9dAxMoYqllZ8YTLcG1whuRyaqtQE2WOpAFjWh+qbz5wcwOgIjc X-Received: by 2002:a63:7a5b:: with SMTP id j27mr592744pgn.112.1542023988381; Mon, 12 Nov 2018 03:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542023988; cv=none; d=google.com; s=arc-20160816; b=rqx/3Y2bxnpYpF6EzAKJsB+UUGsPb/H/ZPnyluDBVX/HcJpDnRXfS3AliRWLFr+rYm 1JGepCVikEO/Gbwr1e6Imjn3h1T+nHfCaG6NWaxxzhsnMOVKBZh8kggJ9GKcPmx+GUsD tmzkYtdgIlDtW32aKoPBYsU5RmydtXmMDZjBtZaJ3dnVw05Wn/nXI39hcxwXfW//CvMf K2ejMbFOZ9ew+RQLl2MQMe3t9vUsZZU9A4U0FWLzLqFTh9GdYRKL9JPf++yqA/uHehpM Hu5du0ErQuo/PDqLTSdoavP83uLjxpFQXYArxFWkYMcbJVT4tJ/rVWBJNTeW9qdpcJ8S hwfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=hpW29TnGSRACMNbOPVUXqWm9FNPbeQwVa9+XgyiaClg=; b=T45eXsZa+oyLtZpqrPZ9tCVr8/UD9dqvkf2EaAGN5UZEFfIZPbHNtObGHOH7MCtSFD 8KrDthE6KdcBFXBUJYdJgRyeleNFT+G5QZypXSV0QMkuQuS5hir8Fi9sc3eg+OWytUL7 eoN4Ys7MNUhoDYZSapHXLCGYX3Archu+bjka8nc1J8jhZfs3Xub7Qtmwh1UynXJvdeXS YyRN1riYlY3V+e4rZyWQHSC/DWk1/Q4zs1hrHhKkGrfiIB2y0wsP3gu66QJG1FrnDnCf B/ZBIjIxoBeEZdScY+C+KIpV+BkjocHm0IzC8niQ0KTjSLckPI6ZXLN+yiSlyFfSt7uP ooew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c72-v6si189508pfc.57.2018.11.12.03.59.33; Mon, 12 Nov 2018 03:59:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730145AbeKLVvP (ORCPT + 99 others); Mon, 12 Nov 2018 16:51:15 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34826 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729293AbeKLVvO (ORCPT ); Mon, 12 Nov 2018 16:51:14 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15AA31650; Mon, 12 Nov 2018 03:58:18 -0800 (PST) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 40E093F5A0; Mon, 12 Nov 2018 03:58:16 -0800 (PST) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry Subject: [PATCH v6 23/24] arm64: Skip irqflags tracing for NMI in IRQs disabled context Date: Mon, 12 Nov 2018 11:57:14 +0000 Message-Id: <1542023835-21446-24-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> References: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When an NMI is raised while interrupts where disabled, the IRQ tracing already is in the correct state (i.e. hardirqs_off) and should be left as such when returning to the interrupted context. Check whether PMR was masking interrupts when the NMI was raised and skip IRQ tracing if necessary. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier --- arch/arm64/kernel/entry.S | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index e02ee55..f175f18 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -629,7 +629,17 @@ el1_irq: kernel_entry 1 enable_da_f #ifdef CONFIG_TRACE_IRQFLAGS +#ifdef CONFIG_ARM64_PSEUDO_NMI +alternative_if ARM64_HAS_IRQ_PRIO_MASKING + ldr x20, [sp, #S_PMR_SAVE] +alternative_else + mov x20, #GIC_PRIO_IRQON +alternative_endif + /* Irqs were disabled, don't trace */ + tbz x20, GIC_PRIO_STATUS_SHIFT, 1f +#endif bl trace_hardirqs_off +1: #endif irq_handler @@ -651,8 +661,17 @@ alternative_else_nop_endif 1: #endif #ifdef CONFIG_TRACE_IRQFLAGS +#ifdef CONFIG_ARM64_PSEUDO_NMI + /* + * if IRQs were disabled when we received the interrupt, we have an NMI + * and we are not re-enabling interrupt upon eret. Skip tracing. + */ + tbz x20, GIC_PRIO_STATUS_SHIFT, 1f +#endif bl trace_hardirqs_on +1: #endif + kernel_exit 1 ENDPROC(el1_irq) -- 1.9.1