linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zayd Qumsieh <zayd_qumsieh@apple.com>
To: zayd_qumsieh@apple.com
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Mark Brown <broonie@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mateusz Guzik <mjguzik@gmail.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oliver.upton@linux.dev>,
	Miguel Luis <miguel.luis@oracle.com>,
	Joey Gouly <joey.gouly@arm.com>,
	Christoph Paasch <cpaasch@apple.com>,
	Kees Cook <keescook@chromium.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Baoquan He <bhe@redhat.com>,
	Lecopzer Chen <lecopzer.chen@mediatek.com>,
	Joel Granados <j.granados@samsung.com>,
	Dawei Li <dawei.li@shingroup.cn>,
	Andrew Morton <akpm@linux-foundation.org>,
	Florent Revest <revest@chromium.org>,
	David Hildenbrand <david@redhat.com>,
	Stefan Roesch <shr@devkernel.io>,
	Andy Chiu <andy.chiu@sifive.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Oleg Nesterov <oleg@redhat.com>, Helge Deller <deller@gmx.de>,
	Zev Weiss <zev@bewilderbeest.net>,
	Ondrej Mosnacek <omosnace@redhat.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] tso: aarch64: Expose TSO for virtualized linux on Apple Silicon
Date: Wed, 10 Apr 2024 14:16:38 -0700	[thread overview]
Message-ID: <20240410211652.16640-1-zayd_qumsieh@apple.com> (raw)

x86 CPUs use a TSO memory model. Apple Silicon CPUs have the ability to
selectively use a TSO memory model. This can be done by setting the
ACTLR.TSOEN bit to 1. This feature is useful for x86 emulators, since it
removes the need for emulators to insert memory barriers in order to abide
by the TSO memory model. This patch series will add ACTLR.TSOEN support to
virtualized linux on Apple Silicon machines. Userspace will be able to use
a prctl to change the memory model of the CPU from the default ARM64 memory
model to a TSO memory model.

A simple test can be used to determine if the TSO memory model is in use.
This must be done on Apple Silicon MacOS Sonoma version 14.4 or later,
since earlier versions do not support modification of the TSOEN bit.
https://github.com/saagarjha/TSOEnabler/blob/master/testtso/main.c

This program will hang indefinitely if TSO is in use, and will crash almost
immediately if it is not in use.

Zayd Qumsieh (3):
  tso: aarch64: allow linux kernel to read/write ACTLR.TSOEN
  tso: aarch64: context-switch tso bit on thread switch
  tso: aarch64: allow userspace to set tso bit using prctl

 arch/arm64/Kconfig                 | 19 +++++++++
 arch/arm64/include/asm/processor.h |  4 ++
 arch/arm64/include/asm/sysreg.h    |  7 ++++
 arch/arm64/include/asm/tso.h       | 19 +++++++++
 arch/arm64/kernel/Makefile         |  2 +-
 arch/arm64/kernel/process.c        | 61 +++++++++++++++++++++++++++++
 arch/arm64/kernel/tso.c            | 62 ++++++++++++++++++++++++++++++
 include/uapi/linux/prctl.h         |  9 +++++
 kernel/sys.c                       | 11 ++++++
 9 files changed, 193 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/include/asm/tso.h
 create mode 100644 arch/arm64/kernel/tso.c

-- 
2.39.3 (Apple Git-146)


             reply	other threads:[~2024-04-10 22:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 21:16 Zayd Qumsieh [this message]
2024-04-10 21:16 ` [PATCH 1/3] tso: aarch64: allow linux kernel to read/write ACTLR.TSOEN Zayd Qumsieh
2024-04-10 21:16 ` [PATCH 2/3] tso: aarch64: context-switch tso bit on thread switch Zayd Qumsieh
2024-04-10 21:16 ` [PATCH 3/3] tso: aarch64: allow userspace to set tso bit using prctl Zayd Qumsieh
2024-04-10 23:23 ` [PATCH 0/3] tso: aarch64: Expose TSO for virtualized linux on Apple Silicon Hector Martin
2024-04-11 13:37 ` 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=20240410211652.16640-1-zayd_qumsieh@apple.com \
    --to=zayd_qumsieh@apple.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy.chiu@sifive.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=bhe@redhat.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cpaasch@apple.com \
    --cc=david@redhat.com \
    --cc=dawei.li@shingroup.cn \
    --cc=deller@gmx.de \
    --cc=j.granados@samsung.com \
    --cc=joey.gouly@arm.com \
    --cc=josh@joshtriplett.org \
    --cc=keescook@chromium.org \
    --cc=lecopzer.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=miguel.luis@oracle.com \
    --cc=mjguzik@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=oleg@redhat.com \
    --cc=oliver.upton@linux.dev \
    --cc=omosnace@redhat.com \
    --cc=revest@chromium.org \
    --cc=samitolvanen@google.com \
    --cc=shr@devkernel.io \
    --cc=will@kernel.org \
    --cc=zev@bewilderbeest.net \
    /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).