public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-arm-kernel@lists.infradead.org, Will Deacon <will@kernel.org>
Cc: ardb@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com
Subject: [PATCH 0/2] arm64: cpucap handling cleanups
Date: Tue, 12 Dec 2023 17:09:08 +0000	[thread overview]
Message-ID: <20231212170910.3745497-1-mark.rutland@arm.com> (raw)

The recent changes to remove cpus_have_const_cap() left a period between
detecting cpucaps and patching alternatives where it is necessary to use
cpus_have_cap() to check that a cpucap has been detected. During this
period we do a few things, and there's a risk that code using a mixture
of cpus_have_cap() and alternative_has_cap_*() sees an inconsistent
state.

These patches rework the cpucap code to minimize the period between
detecting cpucaps and patching the relevant alternatives, deferring
other work until after the alternatives have been patched. This removes
the need for some code to use cpus_have_cap(), and allows them to use
common helper functions that may use alternative_has_cap_*() internally,
making them consistent with other kernel code.

This cleanup was requested by Will across:

  https://lore.kernel.org/linux-arm-kernel/20231127154818.GA8453@willie-the-truck/
  https://lore.kernel.org/linux-arm-kernel/20231127163103.GA8627@willie-the-truck/
  https://lore.kernel.org/linux-arm-kernel/20231127164127.GB8627@willie-the-truck/
  https://lore.kernel.org/linux-arm-kernel/20231128110339.GA9717@willie-the-truck/

The patches are based on the arm64 for-next/fixes branch, whose HEAD
commit is currently:

  f5259997f3e8d6ed ("arm64: Avoid enabling KPTI unnecessarily")

... which patch 1 is partially a cleanup for.

I've given both patches some testing in a few configurations (e.g.
with and without nVHE forced on the command line) to check that
detection and patching works as expected.

Mark.

Mark Rutland (2):
  arm64: Cleanup system cpucap handling
  arm64: Align boot cpucap handling with system cpucap handling

 arch/arm64/include/asm/cpufeature.h |   1 +
 arch/arm64/kernel/cpufeature.c      | 105 +++++++++++++++-------------
 arch/arm64/kernel/fpsimd.c          |   4 +-
 arch/arm64/kernel/smp.c             |  12 +---
 4 files changed, 64 insertions(+), 58 deletions(-)

-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2023-12-12 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 17:09 Mark Rutland [this message]
2023-12-12 17:09 ` [PATCH 1/2] arm64: Cleanup system cpucap handling Mark Rutland
2023-12-12 17:09 ` [PATCH 2/2] arm64: Align boot cpucap handling with " Mark Rutland
2023-12-13 17:25 ` [PATCH 0/2] arm64: cpucap handling cleanups Will Deacon
2023-12-13 17:39   ` Mark Rutland

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=20231212170910.3745497-1-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox