From: Oliver Upton <oliver.upton@linux.dev>
To: "Mikołaj Lenczewski" <miko.lenczewski@arm.com>
Cc: ryan.roberts@arm.com, yang@os.amperecomputing.com,
catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com,
broonie@kernel.org, mark.rutland@arm.com, james.morse@arm.com,
yangyicong@hisilicon.com, robin.murphy@arm.com,
anshuman.khandual@arm.com, maz@kernel.org, liaochang1@huawei.com,
akpm@linux-foundation.org, david@redhat.com, baohua@kernel.org,
ioworker0@gmail.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/3] arm64: Add BBM Level 2 cpu feature
Date: Wed, 19 Feb 2025 15:34:04 -0800 [thread overview]
Message-ID: <Z7ZqbLdlbmeVX5a0@linux.dev> (raw)
In-Reply-To: <20250219143837.44277-5-miko.lenczewski@arm.com>
Hi Miko,
On Wed, Feb 19, 2025 at 02:38:38PM +0000, Mikołaj Lenczewski wrote:
> +config ARM64_ENABLE_BBML2
nit: consider calling this ARM64_BBML2_NOABORT or similar, since this
assumes behavior that exceeds the BBML2 baseline.
> + bool "Enable support for Break-Before-Make Level 2 detection and usage"
> + default y
> + help
> + FEAT_BBM provides detection of support levels for break-before-make
> + sequences. If BBM level 2 is supported, some TLB maintenance requirements
> + can be relaxed to improve performance. Selecting N causes the kernel to
> + fallback to BBM level 0 behaviour even if the system supports BBM level 2.
> +
[...]
> +static bool has_bbml2_noconflict(const struct arm64_cpu_capabilities *entry,
> + int scope)
> +{
> + if (!IS_ENABLED(CONFIG_ARM64_ENABLE_BBML2))
> + return false;
> +
> + /* We want to allow usage of bbml2 in as wide a range of kernel contexts
> + * as possible. This list is therefore an allow-list of known-good
> + * implementations that both support bbml2 and additionally, fulfil the
typo: fullfill
> + * extra constraint of never generating TLB conflict aborts when using
> + * the relaxed bbml2 semantics (such aborts make use of bbml2 in certain
> + * kernel contexts difficult to prove safe against recursive aborts).
> + */
We should be *very* specific of what qualifies a 'known-good'
implementation here. Implementations shouldn't be added to this list
based on the observed behavior, only if *the implementer* states their
design will not generate conflict aborts for BBML2 mapping granularity
changes.
> + static const struct midr_range supports_bbml2_without_abort_list[] = {
> + MIDR_REV_RANGE(MIDR_CORTEX_X4, 0, 3, 0xf),
> + MIDR_REV_RANGE(MIDR_NEOVERSE_V3, 0, 2, 0xf),
> + {}
> + };
> +
> + if (!is_midr_in_range_list(read_cpuid_id(), supports_bbml2_without_abort_list))
> + return false;
> +
> + return true;
> +}
> +
> #ifdef CONFIG_ARM64_PAN
> static void cpu_enable_pan(const struct arm64_cpu_capabilities *__unused)
> {
> @@ -2926,6 +2951,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
> .matches = has_cpuid_feature,
> ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, EVT, IMP)
> },
> + {
> + .desc = "BBM Level 2 without conflict abort",
> + .capability = ARM64_HAS_BBML2_NOCONFLICT,
> + .type = ARM64_CPUCAP_SYSTEM_FEATURE,
> + .matches = has_bbml2_noconflict,
> + ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, BBM, 2)
> + },
> {
> .desc = "52-bit Virtual Addressing for KVM (LPA2)",
> .capability = ARM64_HAS_LPA2,
> diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
> index 1e65f2fb45bd..8d67bb4448c5 100644
> --- a/arch/arm64/tools/cpucaps
> +++ b/arch/arm64/tools/cpucaps
> @@ -26,6 +26,7 @@ HAS_ECV
> HAS_ECV_CNTPOFF
> HAS_EPAN
> HAS_EVT
> +HAS_BBML2_NOCONFLICT
Please add this cap to cpucap_is_possible() test for the config option.
Thanks,
Oliver
next prev parent reply other threads:[~2025-02-19 23:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 14:38 [PATCH v1 0/3] Initial BBML2 support for contpte_convert() Mikołaj Lenczewski
2025-02-19 14:38 ` [PATCH v1 1/3] arm64: Add BBM Level 2 cpu feature Mikołaj Lenczewski
2025-02-19 15:39 ` Robin Murphy
2025-02-19 15:43 ` Ryan Roberts
2025-02-19 16:25 ` Robin Murphy
2025-02-20 9:33 ` Mikołaj Lenczewski
2025-02-19 23:34 ` Oliver Upton [this message]
2025-02-19 23:57 ` Oliver Upton
2025-02-20 9:37 ` Mikołaj Lenczewski
2025-02-20 1:25 ` Yang Shi
2025-02-20 10:34 ` Mikołaj Lenczewski
2025-02-20 20:01 ` Yang Shi
2025-02-19 14:38 ` [PATCH v1 2/3] arm64/mm: Delay tlbi in contpte_convert() under BBML2 Mikołaj Lenczewski
2025-02-19 14:38 ` [PATCH v1 3/3] arm64/mm: Elide " Mikołaj Lenczewski
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=Z7ZqbLdlbmeVX5a0@linux.dev \
--to=oliver.upton@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=baohua@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=ioworker0@gmail.com \
--cc=james.morse@arm.com \
--cc=joey.gouly@arm.com \
--cc=liaochang1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=miko.lenczewski@arm.com \
--cc=robin.murphy@arm.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
--cc=yangyicong@hisilicon.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;
as well as URLs for NNTP newsgroup(s).