[RFC PATCH v2 13/45] arm64: process: Use helper to check exception state
Vladimir Murzin
vladimir.murzin at arm.com
Fri Aug 21 03:55:06 PDT 2026
On 8/11/26 08:43, Jinjie Ruan wrote:
>
> 在 2026/7/28 0:34, Vladimir Murzin 写道:
>> debug_switch_state() explicitly checks the hardware exception state
>> for both the pseudo-NMI and non-NMI paths. The expected state matches
>> the NOIRQ_CONTEXT exception context introduced alongside the exception
>> masking helpers and state checkers.
>>
>> Use the helper instead of open-coding these checks.
>>
>> Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>
>> Reviewed-by: Jinjie Ruan <ruanjinjie at huawei.com>
>> ---
>> arch/arm64/kernel/process.c | 21 ++-------------------
>> 1 file changed, 2 insertions(+), 19 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
>> index 581f80e9b9b7..0fd09136d398 100644
>> --- a/arch/arm64/kernel/process.c
>> +++ b/arch/arm64/kernel/process.c
>> @@ -51,6 +51,7 @@
>> #include <asm/exec.h>
>> #include <asm/fpsimd.h>
>> #include <asm/gcs.h>
>> +#include <asm/interrupts/common_flags.h>
>> #include <asm/mmu_context.h>
>> #include <asm/mpam.h>
>> #include <asm/mte.h>
>> @@ -703,25 +704,7 @@ void update_sctlr_el1(u64 sctlr)
>>
>> static inline void debug_switch_state(void)
>> {
>> - if (system_uses_irq_prio_masking()) {
>> - unsigned long daif_expected = 0;
>> - unsigned long daif_actual = read_sysreg(daif);
>> - unsigned long pmr_expected = GIC_PRIO_IRQOFF;
>> - unsigned long pmr_actual = read_sysreg_s(SYS_ICC_PMR_EL1);
>> -
>> - WARN_ONCE(daif_actual != daif_expected ||
>> - pmr_actual != pmr_expected,
>> - "Unexpected DAIF + PMR: 0x%lx + 0x%lx (expected 0x%lx + 0x%lx)\n",
>> - daif_actual, pmr_actual,
>> - daif_expected, pmr_expected);
>> - } else {
>> - unsigned long daif_expected = DAIF_PROCCTX_NOIRQ;
>> - unsigned long daif_actual = read_sysreg(daif);
>> -
>> - WARN_ONCE(daif_actual != daif_expected,
>> - "Unexpected DAIF value: 0x%lx (expected 0x%lx)\n",
>> - daif_actual, daif_expected);
>> - }
>> + arm64_debug_exc_context(NOIRQ_CONTEXT);
Hi Jinjie,
> Hi Vladimir,
>
> After taking another look, I have a small suggestion:
>
> if you postpone the introduction of arm64_debug_exc_context() and
> arm64_debug_exc_hwstate() from the previous patch to this one, the code
> review will be easier.
>
Yes, I can do that in the next version. I assume I can preserve your
Reviewed-by tags since it is just a mechanical change; otherwise,
please shout.
Cheers
Vladimir
> Best regards,
> Jinjie
>
>> }
>>
>> /*
>
More information about the linux-arm-kernel
mailing list