Linux Documentation
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: catalin.marinas@arm.com, will@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org, maz@kernel.org, ardb@kernel.org,
	ilias.apalodimas@linaro.org, oupton@kernel.org,
	joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
	yuzenghui@huawei.com, oleg@redhat.com, lpieralisi@kernel.org,
	tglx@kernel.org, ada.coupriediaz@arm.com,
	anshuman.khandual@arm.com, ebiggers@kernel.org,
	broonie@kernel.org, mrigendra.chaubey@gmail.com,
	baohua@kernel.org, lucaswei@google.com, james.morse@arm.com,
	zengheng4@huawei.com, thuth@redhat.com,
	yang@os.amperecomputing.com, leo.bras@arm.com,
	Sascha.Bischoff@arm.com, james.clark@linaro.org,
	peterz@infradead.org, leitao@debian.org, ben.horgan@arm.com,
	punit.agrawal@oss.qualcomm.com, gshan@redhat.com,
	osama.abdelkader@gmail.com, fengchengwen@huawei.com,
	ryan.roberts@arm.com, yangyicong@hisilicon.com,
	kevin.brodsky@arm.com, kees@kernel.org, jeson.gao@unisoc.com,
	zhaoyang.huang@unisoc.com, ryotkkr98@gmail.com, wsw9603@163.com,
	pasha.tatashin@soleen.com, jeremy.linton@arm.com,
	schuster.simon@siemens-energy.com, osandov@fb.com, arnd@arndb.de,
	zhangpengjie2@huawei.com, smostafa@google.com,
	vladimir.murzin@arm.com, tabba@google.com, vdonnefort@google.com,
	kaleshsingh@google.com, jic23@kernel.org, timothy.hayes@arm.com,
	alexandru.elisei@arm.com, zenghui.yu@linux.dev, david@kernel.org,
	akpm@linux-foundation.org, ljs@kernel.org, memxor@gmail.com,
	qperret@google.com, chaitanyas.prakash@arm.com,
	linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
	kvmarm@lists.linux.dev
Subject: Re: [PATCH 00/17] arm64: Support FEAT_NMI and Rework Exception Masking
Date: Fri, 3 Jul 2026 15:15:36 +0100	[thread overview]
Message-ID: <akfECMwlZL1aoXHl@J2N7QTR9R3> (raw)
In-Reply-To: <20260703100135.2512312-1-ruanjinjie@huawei.com>

Hi Jinjie
On Fri, Jul 03, 2026 at 06:01:18PM +0800, Jinjie Ruan wrote:
> Hi all,

Vladimir (cc'd) has also been working on NMI support, but hadn't posted
to the list yet (due to some delays with testing).

I haven't had the chance to look at this yet, but at a high-level we'll
need to figure out what to do going forwards.

Mark.

> This patch series implements support for the ARMv8.8-A/v9.3-A
> hardware NMI extension (FEAT_NMI), introducing the use of PSTATE.ALLINT
> to manage superpriority interrupts on arm64.
> 
> Background and Current Status
> -----------------------------
> 
> The hardware ecosystem is already mature and fully ready for FEAT_NMI:
> 
> - Production Hardware: Huawei's Kunpeng servers (such as the HIP12 based
>   platforms) already feature native hardware support for FEAT_NMI.
> 
> - Emulation: QEMU has integrated robust FEAT_NMI emulation[1] support
>   since 2024.
> 
> Despite the hardware readiness, upstream support for FEAT_NMI has been
> delayed. Previous patch[2] attempts tried to bundle ALLINT management
> directly into the existing DAIF abstraction layers. As Mark Rutland
> pointed out[3], pretending ALLINT or pseudo-NMI (GIC PMR) is part of
> DAIF creates convoluted, unmaintainable hacks that frequently fail to
> handle complex edge cases correctly (such as state escape during
> context switching).
> 
> Reworking Exception Masking (Mark's Feedback)
> ---------------------------------------------
> 
> Following Mark Rutland's strong recommendation ("We must clean up
> the existing approach before we add the real NMI support"), this series
> does not simply stack FEAT_NMI on top of the old framework. Instead, it
> completely reworks how the arm64 kernel manages abstract and logical
> exception masks.
> 
> Per Mark's guidelines, this series achieves the following architectural
> improvements:
> 
> 1. Entry/Exit Specific Helpers (a):
> 
>    Introduces abstract exception mask helpers specifically for exception
>    boundaries. They handle unified unmask-at-entry and mask-at-exit
>    behaviors. This decouples the entry/exit paths from raw DAIF
>    manipulation. In this series, these helpers are first refactored to
>    manage DAIF + PMR cleanly, preparing the ground before any FEAT_NMI
>    code is introduced.
> 
> 2. Logical Exception Mask Separation (b):
> 
>    Introduces a decoupled logical mask tracking mechanism that treats DAIF,
>    PMR, and ALLINT as separate, distinct elements. This enables accurate
>    irqflag tracking and debug assertions to save, restore, and validate all
>    elements without forcing them to fake or pollute a traditional DAIF
>    layout.
> 
> Production Bug Fixes & Integration
> -----------------------------------
> 
> On top of this solid architectural foundation, this series adds the actual
> support for FEAT_NMI (ALLINT management). Crucially, during baisc testing
> and validation on production Kunpeng (HIP12) servers, we identified and
> resolved several critical bugs.
> 
> The series is structured as follows:
> 
> - Patches 1-5: Clean up and rework the existing DAIF/PMR masking into
>   separate logical exception helpers (Pre-requisite refactoring).
> 
> - Patches 6-17: Add FEAT_NMI support for ARM64, including specific
>   stability fixes found on Kunpeng hardware and QEmu.
> 
> Any feedback, testing, or review, especially regarding the exception
> masking refactoring, is highly appreciated.
> 
> [1]: https://lore.kernel.org/all/20240407081733.3231820-1-ruanjinjie@huawei.com/
> [2]: https://lore.kernel.org/linux-arm-kernel/20221112151708.175147-1-broonie@kernel.org/
> [3]: https://lore.kernel.org/linux-arm-kernel/Y5c9SLeJacLYHmP7@FVFF77S0Q05N/
> 
> Jinjie Ruan (5):
>   arm64: Move DAIF macros to ptrace.h and use them centrally
>   arm64: Rework exception masking into abstract logical mask
>   arm64: entry: arm64: entry: Move DAIF masking for EL1 exit to C code
>   arm64: entry: Add entry-specific helpers
>   arm64: Introduce helpers for restoring standard exception masks
> 
> Lorenzo Pieralisi (1):
>   irqchip/gic-v3: Implement FEAT_GICv3_NMI support
> 
> Mark Brown (11):
>   arm64/booting: Document boot requirements for FEAT_NMI
>   arm64/sysreg: Add definitions for immediate versions of MSR ALLINT
>   arm64/hyp-stub: Enable access to ALLINT
>   arm64/idreg: Add an override for FEAT_NMI
>   arm64/cpufeature: Detect PE support for FEAT_NMI
>   KVM: arm64: Hide FEAT_NMI from guests
>   arm64/nmi: Manage masking for superpriority interrupts along with DAIF
>   arm64/entry: Don't call preempt_schedule_irq() with NMIs masked
>   arm64/irq: Document handling of FEAT_NMI in irqflags.h
>   arm64/nmi: Add handling of superpriority interrupts as NMIs
>   arm64/nmi: Add Kconfig for NMI
> 
>  Documentation/arch/arm64/booting.rst     |   6 +
>  arch/arm64/Kconfig                       |  17 ++
>  arch/arm64/include/asm/arch_gicv3.h      |   7 +-
>  arch/arm64/include/asm/assembler.h       |  17 +-
>  arch/arm64/include/asm/cpufeature.h      |   5 +
>  arch/arm64/include/asm/cpuidle.h         |  30 ++-
>  arch/arm64/include/asm/daifflags.h       | 144 --------------
>  arch/arm64/include/asm/efi.h             |  22 ++-
>  arch/arm64/include/asm/el2_setup.h       |  13 ++
>  arch/arm64/include/asm/entry-common.h    |  11 +-
>  arch/arm64/include/asm/exception_masks.h | 232 +++++++++++++++++++++++
>  arch/arm64/include/asm/irq.h             |   2 +
>  arch/arm64/include/asm/irqflags.h        |  10 +
>  arch/arm64/include/asm/kvm_host.h        |   2 +-
>  arch/arm64/include/asm/mmu_context.h     |   2 +-
>  arch/arm64/include/asm/nmi.h             |  23 +++
>  arch/arm64/include/asm/ptrace.h          |  11 +-
>  arch/arm64/include/asm/sysreg.h          |   2 +
>  arch/arm64/include/uapi/asm/ptrace.h     |   1 +
>  arch/arm64/kernel/acpi.c                 |  14 +-
>  arch/arm64/kernel/cpufeature.c           |  58 +++++-
>  arch/arm64/kernel/debug-monitors.c       |   9 +-
>  arch/arm64/kernel/entry-common.c         | 167 +++++++++++-----
>  arch/arm64/kernel/entry.S                |   4 -
>  arch/arm64/kernel/hibernate.c            |  10 +-
>  arch/arm64/kernel/idle.c                 |   7 +-
>  arch/arm64/kernel/irq.c                  |  36 +++-
>  arch/arm64/kernel/machine_kexec.c        |   4 +-
>  arch/arm64/kernel/pi/idreg-override.c    |   1 +
>  arch/arm64/kernel/probes/kprobes.c       |   9 +-
>  arch/arm64/kernel/process.c              |   7 +-
>  arch/arm64/kernel/setup.c                |   4 +-
>  arch/arm64/kernel/signal.c               |   2 +-
>  arch/arm64/kernel/smp.c                  |  22 +--
>  arch/arm64/kernel/suspend.c              |  15 +-
>  arch/arm64/kernel/traps.c                |   2 +-
>  arch/arm64/kvm/emulate-nested.c          |   6 +-
>  arch/arm64/kvm/hyp/include/hyp/switch.h  |   6 +
>  arch/arm64/kvm/hyp/nvhe/host.S           |   4 +-
>  arch/arm64/kvm/hyp/nvhe/hyp-init.S       |   3 +-
>  arch/arm64/kvm/hyp/nvhe/hyp-main.c       |   4 +-
>  arch/arm64/kvm/hyp/vgic-v3-sr.c          |   6 +-
>  arch/arm64/kvm/hyp/vhe/switch.c          |   6 +-
>  arch/arm64/kvm/reset.c                   |   6 +-
>  arch/arm64/mm/fault.c                    |   2 +-
>  arch/arm64/mm/mmu.c                      |   6 +-
>  arch/arm64/tools/cpucaps                 |   2 +
>  drivers/firmware/psci/psci.c             |   7 +-
>  drivers/irqchip/irq-gic-v3.c             | 152 +++++++++++++--
>  include/linux/irqchip/arm-gic-v3.h       |   4 +
>  50 files changed, 822 insertions(+), 320 deletions(-)
>  delete mode 100644 arch/arm64/include/asm/daifflags.h
>  create mode 100644 arch/arm64/include/asm/exception_masks.h
>  create mode 100644 arch/arm64/include/asm/nmi.h
> 
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2026-07-03 14:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 10:01 [PATCH 00/17] arm64: Support FEAT_NMI and Rework Exception Masking Jinjie Ruan
2026-07-03 10:01 ` [PATCH 01/17] arm64: Move DAIF macros to ptrace.h and use them centrally Jinjie Ruan
2026-07-03 16:44   ` Breno Leitao
2026-07-03 10:01 ` [PATCH 02/17] arm64: Rework exception masking into abstract logical mask Jinjie Ruan
2026-07-03 13:38   ` Leonardo Bras
2026-07-03 13:48   ` Leonardo Bras
2026-07-03 10:01 ` [PATCH 03/17] arm64: entry: arm64: entry: Move DAIF masking for EL1 exit to C code Jinjie Ruan
2026-07-03 10:01 ` [PATCH 04/17] arm64: entry: Add entry-specific helpers Jinjie Ruan
2026-07-03 10:01 ` [PATCH 05/17] arm64: Introduce helpers for restoring standard exception masks Jinjie Ruan
2026-07-03 10:01 ` [PATCH 06/17] arm64/booting: Document boot requirements for FEAT_NMI Jinjie Ruan
2026-07-03 10:01 ` [PATCH 07/17] arm64/sysreg: Add definitions for immediate versions of MSR ALLINT Jinjie Ruan
2026-07-03 10:01 ` [PATCH 08/17] arm64/hyp-stub: Enable access to ALLINT Jinjie Ruan
2026-07-03 10:01 ` [PATCH 09/17] arm64/idreg: Add an override for FEAT_NMI Jinjie Ruan
2026-07-03 10:01 ` [PATCH 10/17] arm64/cpufeature: Detect PE support " Jinjie Ruan
2026-07-03 10:01 ` [PATCH 11/17] KVM: arm64: Hide FEAT_NMI from guests Jinjie Ruan
2026-07-03 10:01 ` [PATCH 12/17] arm64/nmi: Manage masking for superpriority interrupts along with DAIF Jinjie Ruan
2026-07-03 10:01 ` [PATCH 13/17] arm64/entry: Don't call preempt_schedule_irq() with NMIs masked Jinjie Ruan
2026-07-03 10:01 ` [PATCH 14/17] arm64/irq: Document handling of FEAT_NMI in irqflags.h Jinjie Ruan
2026-07-03 10:01 ` [PATCH 15/17] arm64/nmi: Add handling of superpriority interrupts as NMIs Jinjie Ruan
2026-07-03 10:01 ` [PATCH 16/17] arm64/nmi: Add Kconfig for NMI Jinjie Ruan
2026-07-03 10:01 ` [PATCH 17/17] irqchip/gic-v3: Implement FEAT_GICv3_NMI support Jinjie Ruan
2026-07-03 14:15 ` Mark Rutland [this message]
2026-07-06  1:10   ` [PATCH 00/17] arm64: Support FEAT_NMI and Rework Exception Masking Jinjie Ruan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=akfECMwlZL1aoXHl@J2N7QTR9R3 \
    --to=mark.rutland@arm.com \
    --cc=Sascha.Bischoff@arm.com \
    --cc=ada.coupriediaz@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandru.elisei@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=baohua@kernel.org \
    --cc=ben.horgan@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=chaitanyas.prakash@arm.com \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=fengchengwen@huawei.com \
    --cc=gshan@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=james.clark@linaro.org \
    --cc=james.morse@arm.com \
    --cc=jeremy.linton@arm.com \
    --cc=jeson.gao@unisoc.com \
    --cc=jic23@kernel.org \
    --cc=joey.gouly@arm.com \
    --cc=kaleshsingh@google.com \
    --cc=kees@kernel.org \
    --cc=kevin.brodsky@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=leitao@debian.org \
    --cc=leo.bras@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lucaswei@google.com \
    --cc=maz@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=oleg@redhat.com \
    --cc=osama.abdelkader@gmail.com \
    --cc=osandov@fb.com \
    --cc=oupton@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterz@infradead.org \
    --cc=punit.agrawal@oss.qualcomm.com \
    --cc=qperret@google.com \
    --cc=ruanjinjie@huawei.com \
    --cc=ryan.roberts@arm.com \
    --cc=ryotkkr98@gmail.com \
    --cc=schuster.simon@siemens-energy.com \
    --cc=seiden@linux.ibm.com \
    --cc=skhan@linuxfoundation.org \
    --cc=smostafa@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=tglx@kernel.org \
    --cc=thuth@redhat.com \
    --cc=timothy.hayes@arm.com \
    --cc=vdonnefort@google.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    --cc=wsw9603@163.com \
    --cc=yang@os.amperecomputing.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yuzenghui@huawei.com \
    --cc=zengheng4@huawei.com \
    --cc=zenghui.yu@linux.dev \
    --cc=zhangpengjie2@huawei.com \
    --cc=zhaoyang.huang@unisoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox