From: Catalin Marinas <catalin.marinas@arm.com>
To: Kristina Martsenko <kristina.martsenko@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Will Deacon <will@kernel.org>,
Mark Rutland <Mark.Rutland@arm.com>,
Robin Murphy <Robin.Murphy@arm.com>,
Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH 3/5] arm64: mops: Document booting requirement for HCR_EL2.MCE2
Date: Wed, 2 Oct 2024 18:09:55 +0100 [thread overview]
Message-ID: <Zv1-YzLAOcxCmp4w@arm.com> (raw)
In-Reply-To: <f9347826-1a95-4039-916c-e86cc7e33bd1@arm.com>
On Wed, Oct 02, 2024 at 02:31:47PM +0100, Kristina Martsenko wrote:
> On 02/10/2024 11:38, Catalin Marinas wrote:
> > On Mon, Sep 30, 2024 at 05:10:49PM +0100, Kristina Martsenko wrote:
> >> diff --git a/Documentation/arch/arm64/booting.rst b/Documentation/arch/arm64/booting.rst
> >> index b57776a68f15..db46af5b9f0f 100644
> >> --- a/Documentation/arch/arm64/booting.rst
> >> +++ b/Documentation/arch/arm64/booting.rst
> >> @@ -385,6 +385,9 @@ Before jumping into the kernel, the following conditions must be met:
> >>
> >> - HCRX_EL2.MSCEn (bit 11) must be initialised to 0b1.
> >>
> >> + - HCRX_EL2.MCE2 (bit 10) must be initialised to 0b1. The exception
> >> + handler must set PSTATE.SS to 0b0.
> >
> > That's a booting document, do we need to specify the single-step
> > exception?
>
> A hypervisor can't just set MCE2 at kernel boot without also implementing an
> exception handler for MOPS exceptions. The handler needs to implement the
> algorithm from the Arm ARM, and in addition the kernel needs it to also clear
> SS so that breakpoints/watchpoints (and KGDB single stepping) work as expected.
> Is there a better place to specify this?
Not sure, maybe a short mops.rst document describing the exception
handling needs for a hypervisor running Linux (well, if it's just a couple
of sentences, we might as well keep them in booting.rst). In a mops.rst
you could add more lines explaining the exception handling and the
reasoning behind PSTATE.SS. In booting.rst you can just refer mops.rst.
I'm trying to remember the discussions that lead to such requirement.
Basically the worry is that the vCPU the kernel is running on migrates
to another physical CPU with a different MOPS implementation and
triggers a fault into the kernel. The kernel may not be able to handle
the fault itself, hence setting MCE2 to force trapping to EL2.
This is all fine but the requirement for the hypervisor to clear
PSTATE.SS feels a bit strange. Doesn't it break the kernel's state
machine (or gdb's) if, suddenly, it no longer traps the next
instruction?
--
Catalin
next prev parent reply other threads:[~2024-10-02 17:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 16:10 [PATCH 0/5] arm64: Use memory copy instructions in kernel routines Kristina Martsenko
2024-09-30 16:10 ` [PATCH 1/5] arm64: probes: Disable kprobes/uprobes on MOPS instructions Kristina Martsenko
2024-10-02 10:28 ` Catalin Marinas
2024-09-30 16:10 ` [PATCH 2/5] arm64: mops: Handle MOPS exceptions from EL1 Kristina Martsenko
2024-09-30 16:10 ` [PATCH 3/5] arm64: mops: Document booting requirement for HCR_EL2.MCE2 Kristina Martsenko
2024-10-02 10:38 ` Catalin Marinas
2024-10-02 13:31 ` Kristina Martsenko
2024-10-02 17:09 ` Catalin Marinas [this message]
2024-09-30 16:10 ` [PATCH 4/5] arm64: lib: Use MOPS for memcpy() routines Kristina Martsenko
2024-10-02 15:29 ` Catalin Marinas
2024-10-03 16:46 ` Kristina Martsenko
2024-10-04 10:07 ` Catalin Marinas
2024-10-16 13:08 ` Kristina Martsenko
2024-10-17 11:57 ` Catalin Marinas
2024-09-30 16:10 ` [PATCH 5/5] arm64: lib: Use MOPS for copy_page() and clear_page() Kristina Martsenko
2024-10-02 15:37 ` Catalin Marinas
2024-10-02 16:20 ` [PATCH 0/5] arm64: Use memory copy instructions in kernel routines Catalin Marinas
2024-10-03 16:49 ` Kristina Martsenko
2024-10-04 10:10 ` Catalin Marinas
2024-10-17 18:00 ` Catalin Marinas
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=Zv1-YzLAOcxCmp4w@arm.com \
--to=catalin.marinas@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Robin.Murphy@arm.com \
--cc=kristina.martsenko@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--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.