All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: Kiryl Shutsemau <kas@kernel.org>, Thomas Huth <thuth@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Marc Zyngier <maz@kernel.org>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	kernel-team@meta.com, Doug Anderson <dianders@chromium.org>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	mrigendrachaubey <mrigendra.chaubey@gmail.com>,
	Breno Leitao <leitao@debian.org>,
	Linus Walleij <linusw@kernel.org>, Dawei Li <dawei.li@linux.dev>
Subject: Re: [PATCH 2/3] arm64: entry: sdei: save and restore PMR for pseudo-NMI
Date: Wed, 18 Nov 2026 15:43:33 +0000	[thread overview]
Message-ID: <dddc12e4-bb27-4a55-98fb-de5c3d56e726@arm.com> (raw)
In-Reply-To: <628b2774-30bc-4399-98c3-2d99ad5090b6@arm.com>

Hi Vladimir,

On 18/11/2026 09:58, Vladimir Murzin wrote:
> Hi Ada,
>
> On 11/17/26 17:48, Ada Couprie Diaz wrote:
>> If using pseudo-NMI, PMR must be saved and restored on exception
>> entry/exit. We do so, and set it to a known value reflecting that DAIF
>> is masking all interrupts, in the regular entry path.
>>
>> Do the same for SDEI, as it can interrupt the kernel at any point
>> and does not mandate firmware to touch PMR, but does mandate masking DAIF.
>> This avoids potentially returning with a different PMR than interrupted,
>> and SDEI having the DAIF/PMR pair in a unexpected state compared to
>> the rest of the kernel.
>>
> I think we need to save/restore PMR into/from pt_regs similarly to regular
> entry path, otherwise regs_irqs_disabled() is still broken, like it was
> pointed in the thread [1] (and Sashiko has raised the same concern on
> FEAT_NMI series)
>
> Cheers
> Vladimir
>
> [1] https://lore.kernel.org/all/auzM-l40BLsT3clg@arm.com/

Thanks for checking, that's definitely what should be done, I was
a bit hasty...
Given it's a very simple code change (I rewrote the commit message
accordingly) I sent the proper fix as a reply to the patch directly.
Happy to send a full v2 if that would be better !

Kind regards,
Ada



WARNING: multiple messages have this Message-ID (diff)
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>, Kiryl Shutsemau <kas@kernel.org>,
	Breno Leitao <leitao@debian.org>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	Doug Anderson <dianders@chromium.org>,
	Linus Walleij <linusw@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Huth <thuth@redhat.com>, Dawei Li <dawei.li@linux.dev>,
	mrigendrachaubey <mrigendra.chaubey@gmail.com>,
	kernel-team@meta.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	Ada Couprie Diaz <ada.coupriediaz@arm.com>
Subject: Re: [PATCH 2/3] arm64: entry: sdei: save and restore PMR for pseudo-NMI
Date: Wed, 18 Nov 2026 15:43:33 +0000	[thread overview]
Message-ID: <dddc12e4-bb27-4a55-98fb-de5c3d56e726@arm.com> (raw)
In-Reply-To: <628b2774-30bc-4399-98c3-2d99ad5090b6@arm.com>

Hi Vladimir,

On 18/11/2026 09:58, Vladimir Murzin wrote:
> Hi Ada,
>
> On 11/17/26 17:48, Ada Couprie Diaz wrote:
>> If using pseudo-NMI, PMR must be saved and restored on exception
>> entry/exit. We do so, and set it to a known value reflecting that DAIF
>> is masking all interrupts, in the regular entry path.
>>
>> Do the same for SDEI, as it can interrupt the kernel at any point
>> and does not mandate firmware to touch PMR, but does mandate masking DAIF.
>> This avoids potentially returning with a different PMR than interrupted,
>> and SDEI having the DAIF/PMR pair in a unexpected state compared to
>> the rest of the kernel.
>>
> I think we need to save/restore PMR into/from pt_regs similarly to regular
> entry path, otherwise regs_irqs_disabled() is still broken, like it was
> pointed in the thread [1] (and Sashiko has raised the same concern on
> FEAT_NMI series)
>
> Cheers
> Vladimir
>
> [1] https://lore.kernel.org/all/auzM-l40BLsT3clg@arm.com/

Thanks for checking, that's definitely what should be done, I was
a bit hasty...
Given it's a very simple code change (I rewrote the commit message
accordingly) I sent the proper fix as a reply to the patch directly.
Happy to send a full v2 if that would be better !

Kind regards,
Ada


  reply	other threads:[~2026-11-18 15:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 17:48 [PATCH 0/3] arm64: sdei: fix entry edge cases, pseudo-NMI Ada Couprie Diaz
2026-11-17 17:48 ` Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 1/3] arm64: entry: sdei: always set VBAR_EL1 on SDEI entry Ada Couprie Diaz
2026-11-17 17:48   ` Ada Couprie Diaz
2026-11-19 16:57   ` Kiryl Shutsemau (Meta)
2026-11-23 11:22     ` Ada Couprie Diaz
2026-11-23 11:22       ` Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 2/3] arm64: entry: sdei: save and restore PMR for pseudo-NMI Ada Couprie Diaz
2026-11-17 17:48   ` Ada Couprie Diaz
2026-11-18  9:58   ` Vladimir Murzin
2026-11-18 15:43     ` Ada Couprie Diaz [this message]
2026-11-18 15:43       ` Ada Couprie Diaz
2026-11-18 15:42   ` [PATCH v2 " Ada Couprie Diaz
2026-11-18 15:42     ` Ada Couprie Diaz
2026-11-17 17:48 ` [PATCH 3/3] arm64: head: set __entry_task along with task setup Ada Couprie Diaz
2026-11-17 17:48   ` Ada Couprie Diaz
2026-11-18 11:01   ` Vladimir Murzin
2026-11-18 15:30     ` Ada Couprie Diaz
2026-11-19 17:09       ` Kiryl Shutsemau (Meta)
2026-11-23 11:27         ` Ada Couprie Diaz
2026-11-23 11:27           ` Ada Couprie Diaz

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=dddc12e4-bb27-4a55-98fb-de5c3d56e726@arm.com \
    --to=ada.coupriediaz@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dawei.li@linux.dev \
    --cc=dianders@chromium.org \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=peterz@infradead.org \
    --cc=ruanjinjie@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=thuth@redhat.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.