Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6360862imu; Mon, 21 Jan 2019 07:36:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Uq76MHTyZ7FY5Ar0Zk9JXBFMVIOx1Nn07+ane/bupNVEO6BsLGGht9515j0LuIeqSRbkq X-Received: by 2002:a63:484c:: with SMTP id x12mr28366313pgk.375.1548085012433; Mon, 21 Jan 2019 07:36:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085012; cv=none; d=google.com; s=arc-20160816; b=T8seQ3ngZvAVA4kW+Ka1wOkE7f26uBhCoxN4sU+6RSt3zWcCfrAlLyLsK3YYwnNjCY tbUO5fIPwtLHTz9+gUmyZI1PEsfvN7Z0pPBoxr1AnZXjEx7BMTV+ErUer+09NQNs5jEg 0teB7rHHU2gDUreK+SN/4t7mkKdtIEYMN6EbCb06octnSPjnpD+eAaFOsYKuZUKCHC5y x4LqG8N17Zk+x1z5IVofLA9dRHpor60Uw7wMcfjHbLoYXPzhJsO1olGXhws3jUw3IEND 8mlkTFmv/Iqy51XiPZxbnp+2NpvRttZuoOw8fNLl5k0j66WxG+S1VXrFMf5fbOmWOrB7 eqTg== 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=9n57iFEKD8GQpICV1W7n49NUkwnU3SW57I36Fliu+Vw=; b=kXy0zVPwZ6y1fVFxXLGUY8S++iRapeKjSZ2/My298Y9f1gXxg/6b5f1Vclie4AnP+d gFJr37b0jh7nDm9ALMRYYxLdt7CjHAyOgfQwJc9IkbRtJKwxLp93IJ0AGMqLLssdshiM EuSYlVBYIwLoMCjQKaB0ddLhegIpqo1GAl670wFGbBRfNstpzYlUGbbhke5iHc2rjsxi hVaaeaGXHRRMx/KBjLcblTY25jNMXPGVDumKvNIGIseMnh8/Q62izKk2VFOFO2Nqm9yt sg9g2JLYjp60Zz1XE2kayVzIL8PrlQ6kK676mumCguBg+BGF3wQlEwLwojTwTtDWSPod 9JFg== 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 203si8185689pgb.440.2019.01.21.07.36.37; Mon, 21 Jan 2019 07:36:52 -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 S1728664AbfAUPfB (ORCPT + 99 others); Mon, 21 Jan 2019 10:35:01 -0500 Received: from foss.arm.com ([217.140.101.70]:36688 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730564AbfAUPe6 (ORCPT ); Mon, 21 Jan 2019 10:34:58 -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 D4E3515BE; Mon, 21 Jan 2019 07:34:57 -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 D896F3F5C1; Mon, 21 Jan 2019 07:34:55 -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, mark.rutland@arm.com, Julien Thierry Subject: [PATCH v9 24/26] arm64: Skip preemption when exiting an NMI Date: Mon, 21 Jan 2019 15:33:43 +0000 Message-Id: <1548084825-8803-25-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548084825-8803-1-git-send-email-julien.thierry@arm.com> References: <1548084825-8803-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 Handling of an NMI should not set any TIF flags. For NMIs received from EL0 the current exit path is safe to use. However, an NMI received at EL1 could have interrupted some task context that has set the TIF_NEED_RESCHED flag. Preempting a task should not happen as a result of an NMI. Skip preemption after handling an NMI from EL1. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier --- arch/arm64/kernel/entry.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 35a47f6..a0b0a22 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -624,6 +624,14 @@ el1_irq: #ifdef CONFIG_PREEMPT ldr x24, [tsk, #TSK_TI_PREEMPT] // get preempt count +alternative_if ARM64_HAS_IRQ_PRIO_MASKING + /* + * DA_F were cleared at start of handling. If anything is set in DAIF, + * we come back from an NMI, so skip preemption + */ + mrs x0, daif + orr x24, x24, x0 +alternative_else_nop_endif cbnz x24, 1f // preempt count != 0 bl el1_preempt 1: -- 1.9.1