From: James Morse <james.morse@arm.com>
To: D Scott Phillips <scott@os.amperecomputing.com>,
linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org,
Darren Hart <darren@os.amperecomputing.com>
Subject: Re: [PATCH v6] arm64: sdei: abort running SDEI handlers during crash
Date: Wed, 2 Aug 2023 15:24:18 +0100 [thread overview]
Message-ID: <a7804048-19c8-c7fd-c262-4540621c1fb8@arm.com> (raw)
In-Reply-To: <20230627002939.2758-1-scott@os.amperecomputing.com>
Hi Scott,
On 27/06/2023 01:29, D Scott Phillips wrote:
> Interrupts are blocked in SDEI context, per the SDEI spec: "The client
> interrupts cannot preempt the event handler." If we crashed in the SDEI
> handler-running context (as with ACPI's AGDI) then we need to clean up the
> SDEI state before proceeding to the crash kernel so that the crash kernel
> can have working interrupts.
>
> Track the active SDEI handler per-cpu so that we can COMPLETE_AND_RESUME
> the handler, discarding the interrupted context.
I still argue this is a firmware bug. That preempt text was supposed to mean "PSTATE.DAIF
get set", the whole "GIC abstraction" thing got shoehorned in much later.
But I agree we need to work around it in linux.
> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index f9040bd61081..285fe7ad490d 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -1095,3 +1095,22 @@ int sdei_event_handler(struct pt_regs *regs,
> return err;
> }
> NOKPROBE_SYMBOL(sdei_event_handler);
> +
> +void sdei_handler_abort(void)
> +{
> + /*
> + * If the crash happened in an SDEI event handler then we need to
> + * finish the handler with the firmware so that we can have working
> + * interrupts in the crash kernel.
> + */
> + if (__this_cpu_read(sdei_active_critical_event)) {
> + pr_warn("still in SDEI critical event context, attempting to finish handler.\n");
> + __sdei_handler_abort();
> + __this_cpu_write(sdei_active_critical_event, NULL);
> + }
> + if (__this_cpu_read(sdei_active_normal_event)) {
> + pr_warn("still in SDEI normal event context, attempting to finish handler.\n");
> + __sdei_handler_abort();
> + __this_cpu_write(sdei_active_normal_event, NULL);
> + }
> +}
I'm not sure why this moved out to drivers/firmware when the only caller is the arch code,
but it doesn't matter...
Reviewed-by: James Morse <james.morse@arm.com>
Thanks,
James
next prev parent reply other threads:[~2023-08-02 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 0:29 D Scott Phillips
2023-07-06 22:00 ` D Scott Phillips
2023-07-20 9:43 ` Mihai Carabas
2023-07-24 20:31 ` D Scott Phillips
2023-08-02 14:24 ` James Morse [this message]
2023-08-04 18:10 ` Will Deacon
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=a7804048-19c8-c7fd-c262-4540621c1fb8@arm.com \
--to=james.morse@arm.com \
--cc=catalin.marinas@arm.com \
--cc=darren@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=scott@os.amperecomputing.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®