Skip to contentSkip to conversation

Add support of AMD 3D V-Cache optimizer driver

PATCH In review Basavaraj Natikar 2 participants 4 messages Nov 12, 2024 – Nov 13, 2024

Subsystems (2)
lore
Share & tools
lore

Basavaraj Natikar

author maintainer
#0 lore raw

v6 cover Add support of AMD 3D V-Cache optimizer driver

AMD 3D V-Cache Technology significantly enhances per-core performance by increasing the amount of L3 cache available—up to three times compared to traditional architectures. This large cache allows for quicker access to frequently used data, minimizing latency and boosting overall efficiency in tasks that depend heavily on rapid data retrieval.

To fully leverage this technology, the AMD 3D V-Cache Optimizer has been developed. This patch series introduces two distinct modes: Frequency mode and Cache mode.

Frequency Mode: In this setting, the optimizer prioritizes boosting the clock speed of the cores. This is particularly advantageous for applications and workloads that benefit from higher clock frequencies, enabling faster processing of tasks that are less reliant on cache size.

Cache Mode: Conversely, this mode focuses on maximizing the usage of the expanded L3 cache. For workloads that are cache-sensitive—such as certain gaming applications, data analytics, and other compute-intensive processes—this mode allows the system to take full advantage of the increased cache capacity, improving data throughput and reducing bottlenecks.

Changes in v6:
- Added error checking for devm_mutex_init.
- Rebased onto the pxd86/for-next branch.

Changes in v5:
- Removed the extra line.
- Added the missing #include directives.
- Modified the splitting of the line.
- Changed spaces to tabs.

Changes in v4:
- Directly returned the result of function.

Changes in v3:
- Changed the module parameter visibility to 0.
- Removed the error log message.
- Removed the error condition that will not be triggered.
- Protected the data read case.
- Moved the acpi_check_dsm check before allocation.
- Added PM operations.

Changes in v2:
- Used kfree() instead of ACPI_FREE().
- Changed the ternary operator to an if statement.
- Used acpi_check_dsm().
- Used devm_mutex_init().
- Removed acpi_match_device().
- Removed the string format.

Basavaraj Natikar (2):
platform/x86/amd: amd_3d_vcache: Add AMD 3D V-Cache optimizer driver platform/x86/amd: amd_3d_vcache: Add sysfs ABI documentation

 .../sysfs-bus-platform-drivers-amd_x3d_vcache |  12 ++
 MAINTAINERS                                   |   8 +
 drivers/platform/x86/amd/Kconfig              |  12 ++
 drivers/platform/x86/amd/Makefile             |   2 +
 drivers/platform/x86/amd/x3d_vcache.c         | 176 ++++++++++++++++++
 5 files changed, 210 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-drivers-amd_x3d_vcache
 create mode 100644 drivers/platform/x86/amd/x3d_vcache.c
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v6 1/2 platform/x86/amd: amd_3d_vcache: Add AMD 3D V-Cache optimizer driver

AMD X3D processors, also known as AMD 3D V-Cache, feature dual Core Complex Dies (CCDs) and enlarged L3 cache, enabling dynamic mode switching between Frequency and Cache modes. To optimize performance, implement the AMD 3D V-Cache Optimizer, which allows selecting either:

Frequency mode: cores within the faster CCD are prioritized before those in the slower CCD.

Cache mode: cores within the larger L3 CCD are prioritized before those in the smaller L3 CCD.

---
 MAINTAINERS                           |   7 +
 drivers/platform/x86/amd/Kconfig      |  12 ++
 drivers/platform/x86/amd/Makefile     |   2 +
 drivers/platform/x86/amd/x3d_vcache.c | 176 ++++++++++++++++++++++++++
 4 files changed, 197 insertions(+)
 create mode 100644 drivers/platform/x86/amd/x3d_vcache.c
MAINTAINERS +7 -0
index 4803908768e8..087d76c1f6bb 100644
@@ -966,6 +966,13 @@ Q:	https://patchwork.kernel.org/project/linux-rdma/list/
 F:	drivers/infiniband/hw/efa/
 F:	include/uapi/rdma/efa-abi.h
 
+AMD 3D V-CACHE PERFORMANCE OPTIMIZER DRIVER
+M:	Basavaraj Natikar <[email protected]>
+R:	Mario Limonciello <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	drivers/platform/x86/amd/x3d_vcache.c
+
 AMD ADDRESS TRANSLATION LIBRARY (ATL)
 M:	Yazen Ghannam <[email protected]>
 L:	[email protected]
drivers/platform/x86/amd/Kconfig +12 -0
index 2c671cc17d63..c3e086ea64fc 100644
@@ -7,6 +7,18 @@ source "drivers/platform/x86/amd/hsmp/Kconfig"
 source "drivers/platform/x86/amd/pmf/Kconfig"
 source "drivers/platform/x86/amd/pmc/Kconfig"
 
+config AMD_3D_VCACHE
+	tristate "AMD 3D V-Cache Performance Optimizer Driver"
+	depends on X86_64 && ACPI
+	help
+	  The driver provides a sysfs interface, enabling the setting of a bias
+	  that alters CPU core reordering. This bias prefers cores with higher
+	  frequencies or larger L3 caches on processors supporting AMD 3D V-Cache
+	  technology.
+
+	  If you choose to compile this driver as a module the module will be
+	  called amd_3d_vcache.
+
 config AMD_WBRF
 	bool "AMD Wifi RF Band mitigations (WBRF)"
 	depends on ACPI
drivers/platform/x86/amd/Makefile +2 -0
index f0b2fe81c685..56f62fc9c97b 100644
@@ -4,6 +4,8 @@
 # AMD x86 Platform-Specific Drivers
 #
 
+obj-$(CONFIG_AMD_3D_VCACHE)	+= amd_3d_vcache.o
+amd_3d_vcache-objs		:= x3d_vcache.o
 obj-$(CONFIG_AMD_PMC)		+= pmc/
 obj-$(CONFIG_AMD_HSMP)		+= hsmp/
 obj-$(CONFIG_AMD_PMF)		+= pmf/
drivers/platform/x86/amd/x3d_vcache.c new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH v6 2/2 platform/x86/amd: amd_3d_vcache: Add sysfs ABI documentation

In reply to Basavaraj Natikar

Add documentation for the amd_3d_vcache sysfs bus platform driver interface so that userspace applications can use it to change mode preferences, either frequency or cache.

---
 .../sysfs-bus-platform-drivers-amd_x3d_vcache        | 12 ++++++++++++
 MAINTAINERS                                          |  1 +
 2 files changed, 13 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-drivers-amd_x3d_vcache
Documentation/ABI/testing/sysfs-bus-platform-drivers-amd_x3d_vcache new file +12 -0
new file mode 100644
index 000000000000..ac3431736f5c
@@ -0,0 +1,12 @@
+What:		/sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode
+Date:		November 2024
+KernelVersion:	6.13
+Contact:	Basavaraj Natikar <[email protected]>
+Description:	(RW) AMD 3D V-Cache optimizer allows users to switch CPU core
+		rankings dynamically.
+
+		This file switches between these two modes:
+		- "frequency" cores within the faster CCD are prioritized before
+		those in the slower CCD.
+		- "cache" cores within the larger L3 CCD are prioritized before
+		those in the smaller L3 CCD.
MAINTAINERS +1 -0
index 087d76c1f6bb..d9f3d7fa8db9 100644
@@ -971,6 +971,7 @@ M:	Basavaraj Natikar <[email protected]>
 R:	Mario Limonciello <[email protected]>
 L:	[email protected]
 S:	Supported
+F:	Documentation/ABI/testing/sysfs-bus-platform-drivers-amd_x3d_vcache
 F:	drivers/platform/x86/amd/x3d_vcache.c
 
 AMD ADDRESS TRANSLATION LIBRARY (ATL)
Signature · 1 line
2.25.1
maintainer
#3 lore raw
In reply to Basavaraj Natikar
Quoted 11 lines · Basavaraj Natikar

AMD 3D V-Cache Technology significantly enhances per-core performance by increasing the amount of L3 cache available—up to three times compared to traditional architectures. This large cache allows for quicker access to frequently used data, minimizing latency and boosting overall efficiency in tasks that depend heavily on rapid data retrieval.

To fully leverage this technology, the AMD 3D V-Cache Optimizer has been developed. This patch series introduces two distinct modes: Frequency mode and Cache mode.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo branch. Note it will show up in the public platform-drivers-x86/review-ilpo branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/2] platform/x86/amd: amd_3d_vcache: Add AMD 3D V-Cache optimizer driver

      commit: 5a67c0d1c8bdcdba5dff49cfbf0d4c453b827a9d
[2/2] platform/x86/amd: amd_3d_vcache: Add sysfs ABI documentation
      commit: bd17863a708692bbd7a265212daf8a3aa4a3d0b7

--
i.