lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri,  9 Feb 2024 07:40:44 +0100
From: Christoph Müllner <christoph.muellner@...ll.eu>
To: linux-riscv@...ts.infradead.org,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org,
	Jonas Oberhauser <jonas.oberhauser@...weicloud.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Palmer Dabbelt <palmer@...belt.com>,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Albert Ou <aou@...s.berkeley.edu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Shuah Khan <shuah@...nel.org>,
	Jonathan Corbet <corbet@....net>,
	Anup Patel <apatel@...tanamicro.com>,
	Philipp Tomsich <philipp.tomsich@...ll.eu>,
	Andrew Jones <ajones@...tanamicro.com>,
	Guo Ren <guoren@...nel.org>,
	Daniel Henrique Barboza <dbarboza@...tanamicro.com>,
	Conor Dooley <conor.dooley@...rochip.com>,
	Björn Töpel <bjorn@...osinc.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Will Deacon <will@...nel.org>,
	Daniel Lustig <dlustig@...dia.com>,
	Brendan Sweeney <turtwig@...xas.edu>,
	Andrew Waterman <andrew@...ive.com>,
	Brendan Sweeney <brs@...keley.edu>,
	Andrea Parri <parri.andrea@...il.com>,
	Hans Boehm <hboehm@...gle.com>
Cc: Christoph Müllner <christoph.muellner@...ll.eu>
Subject: [RFC PATCH v2 0/6] RISC-V: Add dynamic TSO support

The upcoming RISC-V Ssdtso specification introduces a bit in the senvcfg
CSR to switch the memory consistency model of user mode at run-time from
RVWMO to TSO. The active consistency model can therefore be switched on a
per-hart base and managed by the kernel on a per-process base.

This patchset implements basic Ssdtso support and adds a prctl API on top
so that user-space processes can switch to a stronger memory consistency
model (than the kernel was written for) at run-time.
The patchset also comes with a short documentation of the prctl API.

This series is based on the third draft of the Ssdtso specification
which can be found here:
  https://github.com/riscv/riscv-ssdtso/releases/tag/v1.0-draft3
Note, that the Ssdtso specification is in development state
(i.e., not frozen or even ratified) which is also the reason
why this series is marked as RFC.

This series saw the following changes since v1:
* Reordered/restructured patches
* Fixed build issues
* Addressed typos
* Removed ability to switch TSO->WMO
* Moved the state from per-thread to per-process
* Reschedule all CPUs after switching
* Some cleanups in the documentation
* Adding compatibility with Ztso (spec change in draft 3)

This patchset can also be found in this GitHub branch:
  https://github.com/cmuellner/linux/tree/ssdtso-v2

A QEMU implementation of DTSO can be found in this GitHub branch:
  https://github.com/cmuellner/qemu/tree/ssdtso-v2

Christoph Müllner (6):
  mm: Add dynamic memory consistency model switching
  uapi: prctl: Add new prctl call to set/get the memory consistency
    model
  RISC-V: Enable dynamic memory consistency model support with Ssdtso
  RISC-V: Implement prctl call to set/get the memory consistency model
  RISC-V: Expose Ssdtso via hwprobe API
  RISC-V: selftests: Add DTSO tests

 Documentation/arch/riscv/hwprobe.rst          |  3 +
 .../mm/dynamic-memory-consistency-model.rst   | 86 ++++++++++++++++
 Documentation/mm/index.rst                    |  1 +
 arch/Kconfig                                  | 14 +++
 arch/riscv/Kconfig                            | 11 +++
 arch/riscv/include/asm/csr.h                  |  1 +
 arch/riscv/include/asm/dtso.h                 | 97 +++++++++++++++++++
 arch/riscv/include/asm/hwcap.h                |  1 +
 arch/riscv/include/asm/processor.h            |  7 ++
 arch/riscv/include/asm/switch_to.h            |  3 +
 arch/riscv/include/uapi/asm/hwprobe.h         |  1 +
 arch/riscv/kernel/Makefile                    |  1 +
 arch/riscv/kernel/asm-offsets.c               |  3 +
 arch/riscv/kernel/cpufeature.c                |  1 +
 arch/riscv/kernel/dtso.c                      | 67 +++++++++++++
 arch/riscv/kernel/sys_hwprobe.c               |  2 +
 include/linux/sched.h                         |  5 +
 include/uapi/linux/prctl.h                    |  5 +
 kernel/sys.c                                  | 12 +++
 tools/testing/selftests/riscv/Makefile        |  2 +-
 tools/testing/selftests/riscv/dtso/.gitignore |  1 +
 tools/testing/selftests/riscv/dtso/Makefile   | 11 +++
 tools/testing/selftests/riscv/dtso/dtso.c     | 82 ++++++++++++++++
 23 files changed, 416 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/mm/dynamic-memory-consistency-model.rst
 create mode 100644 arch/riscv/include/asm/dtso.h
 create mode 100644 arch/riscv/kernel/dtso.c
 create mode 100644 tools/testing/selftests/riscv/dtso/.gitignore
 create mode 100644 tools/testing/selftests/riscv/dtso/Makefile
 create mode 100644 tools/testing/selftests/riscv/dtso/dtso.c

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ