Learn The Architecture - Memory System Resource Partitioning and Monitoring (Mpam) Overview 107768 0100 01 en
Learn The Architecture - Memory System Resource Partitioning and Monitoring (Mpam) Overview 107768 0100 01 en
Non-Confidential Issue 01
Copyright © 2023 Arm Limited (or its affiliates). 107768_0100_01_en
All rights reserved.
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Release information
Document history
Proprietary Notice
This document is protected by copyright and other related rights and the practice or
implementation of the information contained in this document may be protected by one or more
patents or pending patent applications. No part of this document may be reproduced in any form
by any means without the express prior written permission of Arm. No license, express or implied,
by estoppel or otherwise to any intellectual property rights is granted by this document unless
specifically stated.
Your access to the information in this document is conditional upon your acceptance that you
will not use or permit others to use the information for the purposes of determining whether
implementations infringe any third party patents.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR
ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND
REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS
DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that
any use, duplication or disclosure of this document complies fully with any relevant export laws
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
and regulations to assure that this document or any portion thereof is not exported, directly
or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s
customers is not intended to create or refer to any partnership relationship with any other
company. Arm may make changes to this document at any time and without notice.
This document may be translated into other languages for convenience, and you agree that if there
is any conflict between the English version of this document and any translation, the terms of the
English version of the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks
of Arm Limited (or its affiliates) in the US and/or elsewhere. All rights reserved. Other brands and
names mentioned in this document may be the trademarks of their respective owners. Please
follow Arm’s trademark usage guidelines at https://www.arm.com/company/policies/trademarks.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
(LES-PRE-20349|version 21.0)
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be
subject to license restrictions in accordance with the terms of the agreement entered into by Arm
and the party that Arm delivered this document to.
Product Status
Feedback
Arm® welcomes feedback on this product and its documentation. To provide feedback on the
product, create a ticket on https://support.developer.arm.com
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
We believe that this document contains no offensive language. To report offensive language in this
document, email [email protected].
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 4 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Contents
Contents
1. Overview........................................................................................................................................................... 6
1.1 Before you begin............................................................................................................................................ 6
2. Background.......................................................................................................................................................7
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 5 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Overview
1. Overview
This guide introduces the Memory System Resource Partitioning and Monitoring (MPAM), an
optional addition to the Arm architecture to support memory system partitioning. MPAM is
documented in the Memory System Resource Partitioning and Monitoring (MPAM), for A-profile
architecture Arm Architecture Reference Manual Supplement.
• AArch64 exception model: Introduces the Exception and privilege model in AArch64.
• AArch64 memory management: Introduces the MMU, which controls virtual to physical address
translation.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Background
2. Background
Many of today’s computing needs are satisfied by shared-memory computer systems, where
multiple applications, or multiple virtual machines (VMs) run concurrently. Shared-memory
compute systems enable applications or multiple virtual machines to simultaneously share memory
resources. Sharing memory resources reduce design costs and design footprints, enable higher
performance, and greatly reduce redundant data copies.
In an ideal world, each shared application or virtual machine would utilize an equal or proportionate
amount of the shared resources within the system. By doing so, an inherent level of fairness is
present within the system, ensuring that applications or virtual machines do not disproportionately
utilize the system resources. This could otherwise impact bandwidth and performance of the
neighboring shared applications or virtual machines. However, in the real world, each application or
virtual machine competes for resources, interfering with each other.
Memory-system resource partitioning and usage monitoring (MPAM) helps mitigate this effect
by providing memory resource partitioning and associated monitoring features. This guide will
introduce MPAM, its concepts, use cases, and terminology.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Arm Memory System Resource Partitioning and Monitoring (MPAM)
Extension
Memory System Resource Partitioning and Monitoring (MPAM) extends the ability for software
to co-manage runtime resource allocation of memory system components such as caches,
interconnects, and memory controllers. These are resources that otherwise would not be
controllable by software at this granularity.
Such resource control requires runtime reaction and continuous tracking. These requirements are
due to the interchanging of requests from different PEs, Security states, and Exception levels that
could be running different VMs or applications.
MPAM has two functions: Memory-system resource partitioning and Memory-system resource
usage monitoring. These functions provide software with the capabilities to control and monitor
how the allocation of resource is divided between VMs or applications. Software can then provide
an appropriate level of responsiveness, fairness, or purposeful unfairness.
In a memory system shared by multiple VMs, OSs, and applications, the resources available to
each software environment may vary, depending on which other programs are also running. This
is because those other programs may consume more or less of an uncontrolled memory-system
resource.
Memory-system resource partitioning provides controls on the limits and use of previously
uncontrolled memory-system resources.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Arm Memory System Resource Partitioning and Monitoring (MPAM)
Extension
One example of memory-system resource partitioning would be the partitioning of cache, such that
allocations into the cache from a particular VM, OS, or application are limited to a subset of the
total cache resource.
• Dynamically utilizing data gathered by the memory-system resource usage monitor to influence
the level of memory-system resource partitioning for a particular VM, OS, or application.
• Logging data gathered by the memory-system resource usage monitor for applications, VMs, or
systems for offline analysis.
• Statically utilizing data gathered by the memory-system resource usage monitor to determine
appropriate resource partitioning.
• Monitoring to detect anomalous behavior and to apply limits to misbehaving software.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 9 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Why use MPAM?
Memory system performance can be monitored, and the measured usage can guide optimization of
system partitioning.
Partitioning is often statically determined by the system developer. Partitions may be given non-
shared resource allocations to reduce the indeterminism caused by shared resources interference.
The number of partitions required could be small, similar to the number of previously separate
systems.
When a server runs multiple VMs for different users, it is necessary to prevent one VM from using
more resource than allowed by its Service Level Agreement (SLA).
MPAM partitions provide a means to regulate the memory-system resources used by a VM. While
there need only be a few service levels provisioned onto a server, each VM needs a separate
PARTID so that resource-usage controls can be separately responsive to the resource demands of
that VM.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
Why use MPAM?
allocations can be changed dynamically to track system loading while optimizing foreground
response time and background throughput.
An example of this approach is proposed in Heracles: Improving Resource Efficiency at Scale. This
paper describes a system that requires only two partitions, one for web-facing applications and
another for best-effort applications. The Heracles approach measures the service-level objective
of tail latency for web service and adjusts the division of resources between the two partitions.
Resource-usage monitoring is also used to tune resource allocation for particular resources.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 12 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
The architectural maximum width of a PARTID field is 16 bits. This being said, a PE implementation
is permitted to support less than the architectural maximum. For example, the Cortex-A710
supports a 6-bit PARTID.
Arm strongly recommends that the PARTID be the same size in all PEs and MSCs in a system.
Software can only use the smallest PARTID size supported by the system.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 13 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
• Non-secure state
• Secure state
When a PE is executing in a Secure state, the MPAM information bundle indicates the Secure
partition ID (PARTID) space (MPAM_NS == 0x0). When a PE is executing in a Non-secure state,
the MPAM information bundle indicates the Non-secure partition ID (PARTID) space (MPAM_NS
== 0x1).
This guide does not cover FEAT_RME and its effects on MPAM. MPAM for RME systems will be
discussed in a future guide.
• Monitors can be made sensitive only to PMG, thus achieving grouping: they monitor and
aggregate measurements related to all PARTIDs sharing the same PMG value.
• Monitors can be made sensitive to both PARTID and PMG, to achieve finer grain monitoring.
For example, 2 VMs could be assigned the same partition of an MSC, each VM would be
assigned a unique PARTID and a unique PMG. The MPAM resource usage monitor would allow
the monitoring of each VMs usage of the assigned partition.
The architectural maximum width of a PMG field is 8 bits. This being said, a PE implementation is
permitted to support less than the architectural maximum. For example, the Cortex-A710 supports
a 1-bit PMG.
It is expected that a PARTID Space Manager would be responsible for assigning unique partition
numbers (PARTID) and PMGs to applications, VMs, or OSs. The MPAM architecture supports
multiple partition ID (PARTID) spaces, this means that in most cases, coordination between
different PARTID Space Managers is not required.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 14 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
For example, the PARTID Space Manager in EL3 (Secure Monitor) can assign the partition number
(PARTID) 0x55 to a Secure Pprtition and this will be part of the Secure partition ID (PARTID) space.
The PARTID Space Manager in Non-secure EL1 (OS) can also assign partition number (PARTID)
0x55 to an application, this will belong to the Non-secure partition ID (PARTID) space. Each
partition ID (PARTID) can be allocated to a different partition of an MSC.
• Cache memories
• Interconnects
• System Memory Management Units (SMMU)
• Memory controllers
A PARTID Space Manager configures an MSC to partition its resources. A partitionable resource
within the MSC is partitioned according to the programming of the specific resource partitioning
controls. For each memory system request, the MSC uses information provided in the MPAM
information bundle along with the MSCs resource partitioning settings to determine the amount of
partitionable resource a particular VM, or application can utilize.
The following diagram demonstrates a shared memory system containing several MSCs:
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 15 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 16 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
How does MPAM work?
An intermediate MSC must pass the unaltered MPAM information bundle downstream.
A terminating MSC does not forward the MPAM information bundle from a request. An MPAM
aware system requires an interconnect that can support transporting the MPAM information
bundle between the MPAM Requesters and the MSCs.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 17 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
MPAM Usage Model
Each Exception level has its own MPAMn_ELx register. This means that when taking or returning
from an exception, the PE automatically attaches the relevant partition identifiers to memory
accesses that are made while executing at that Exception level.
The Hypervisor and OS are responsible for manually saving the context of the relevant
MPAMn_ELx registers when switching between VMs or applications.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 18 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
MPAM Usage Model
Once a memory system request is sent with an MPAM information bundle, it flows through one of
more MSCs. MSCs will implement one or more partitioning control interfaces which configure how
the resource is partitioned.
• Cache-portion partitioning.
• Cache maximum-capacity partitioning.
• Cache maximum associativity partitioning.
• Memory-bandwidth portion partitioning.
• Memory-bandwidth minimum and maximum partitioning.
• Memory-bandwidth proportional-stride partitioning.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 19 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
MPAM Usage Model
• Priority partitioning.
These control interfaces will be discussed in detail in a future Learn the Architecture MPAM guide.
When enabled, the MPAM information bundle is automatically generated by the PE for every
request using the current Security state and the MPAM register for the current Exception level. For
example, if the current Exception level is EL0, then the MPAM0_EL1 register is used.
The MPAMn_ELx register is part of the context of the software that runs in the ELn. So, an
application running at EL0 has its MPAM state in MPAM0_EL1 and that register is saved and
restored by the operating system when it context switches between applications.
The MPAM information bundle will be assigned by the associated PARTID Space Manager. It would
be expected that the PARTID space manager is not part of this context switching process. Its
purpose is to give an unused PARTID from the PARTID space when one is requested by the OS or
the hypervisor. This is likely a fairly rare occurrence, for example when starting a new VM.
In the following example, the EL1 OS PARTID Space Manager configures the MPAM information
bundle associated with the currently scheduled in application running at Non-secure EL0:
While executing at EL0, any memory accesses will be sent with the above configured MPAM
information bundle.
• MPAM_NS == 0x1
• PARTID_D == 0x2 / PARTID_I == 0x7
• PMG_I == 0x0 / PMG_D == 0x0
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 20 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
MPAM Usage Model
Here, the system shows two MSCs, a system cache and a memory controller:
• The system cache uses the MPAM-defined cache maximum-capacity partitioning control
interface, which allows the MPAM Manager to specify the amount of cache storage capacity a
particular MPAM resource partition may allocate in the cache.
• The memory controller uses the MPAM- defined memory-bandwidth minimum and maximum
partitioning control interface, which allows the MPAM Mangaer to specify the amount of
bandwidth available to a particular MPAM resource partition.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 21 of 22
Learn the architecture - Memory System Resource Document ID: 107768_0100_01_en
Partitioning and Monitoring (MPAM) Overview Version 1.0
MPAM Usage Model
an MPAM resource partition already assigned by the Hypervisor, the Hypervisor needs some
mechanism to virtualize the MPAM resource partitions assigned by a Guest OS.
The way MPAM handles this situation is to allow the hypervisor to tell the VM’s OS through a
simulated MPAMIDR_EL1 register that the VM has some small number of PARTIDs that it may use.
The small number of PARTIDs are preallocated by the hypervisor’s PARTID space manager and
stored in the MPAMVPMn_EL2 registers that map virtual PARTIDs to the “real” (we say “physical”)
PARTIDs preallocated by the hypervisor. The VM’s OS can manage the use of the virtual PARTIDs
without trapping to the hypervisor.
Without the MPAMVPMn virtual PARTID mapping registers, at EL1 and EL0, all accesses to
MPAM1_EL1 and MPAM0_EL1 would need to be trapped.
Accesses from a Guest OS to the configuration registers of all MSCs, and to the System registers
that configure the PE MSCs, may be emulated by the host hypervisor. This allows virtual PARTID
mapping to be emulated and hypervisor policies governing resource partitioning to be applied. To
achieve this, accesses to the MPAM memory mapped registers of the MSC would be trapped using
Stage 2 translations, allowing the hypervisor to trap and emulate the MSC access.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 22 of 22