[PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux

Hendrik Wuethrich posted 8 patches 3 months, 3 weeks ago
hw/i386/Kconfig                      |   4 +
hw/i386/meson.build                  |   1 +
hw/i386/rdt.c                        | 286 +++++++++++++++++++++++++++
include/hw/i386/rdt.h                |  76 +++++++
target/i386/cpu.c                    | 114 ++++++++++-
target/i386/cpu.h                    |  24 +++
target/i386/tcg/sysemu/misc_helper.c |  81 ++++++++
7 files changed, 584 insertions(+), 2 deletions(-)
create mode 100644 hw/i386/rdt.c
create mode 100644 include/hw/i386/rdt.h
[PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux
Posted by Hendrik Wuethrich 3 months, 3 weeks ago
From: Hendrik Wüthrich <whendrik@google.com>

The aim of this patch series is to emulate Intel RDT features in order
to make testing of the linux Resctrl subsystem possible with Qemu.

A branch with the patches applied can be found at:
https://github.com/Gray-Colors/Intel_RDT_patches_applied/tree/rdt_v5

The changes made introduce the following features:

* Feature enumeration for Intel RDT allocation.
* Feature enumeration for Intel RDT monitoring.
* Intel RDT monitoring system interface.
* Intel RDT allocation system interface.

By adding these features, a barebones implementation most of the RDT
state and MSRs is introduced, which can be enabled through qemu
command line flags.
The features missing for a faithful recreation of RDT are CDP and
non-linear MBA throttle, as well as the possibility to configure
various values through the command line, as some properties can be
different across different machines. For increased ease of use, the
correct features should be automatically enabled on machines that
support RDT functionality.
The missing features mentioned above will be implemented in the
following order:

* Expand feature set for RDT allocation to include CDP and non-linear
 MBA throttle
* Allow for command line configuration of some values, such as the L3
 CBM length
* Automatically enable RDT on machines that officially support it.

Will NOT be implemented
* Tests to simulate interaction with the host by the guest

Command line examples assuming entire patch series is applied (This
requires a kernel with Resctrl enabled):

To emulate Intel RDT features:

Currently, it is necessary to force the RDT options on in qemu, as it is
not automatically enabled for any machines. An example would be the
following:
-cpu Skylake-Server,+l3-cmt,+rdt-m,+rdt-a,+mba,+l3-cat,+l2-cat
and
-device rdt

Just enabling RDT in qemu won't really help, though. The following
option allows resctrl in the kernel:
- Kernel options: rdt=mbmlocal,mbmtotal,cmt,mba,l2cat,l3cat

To use Resctrl in the Qemu, please refer to:
https://docs.kernel.org/arch/x86/resctrl.html

V4 -> V5
- rebase
- fix feature bit names to all be in hex

‪Hendrik Wüthrich (8):
  i386: Add Intel RDT device and State to config.
  i386: Add init and realize functionality for RDT device.
  i386: Add RDT functionality
  i386: Add RDT device interface through MSRs
  i386: Add CPUID enumeration for RDT
  i386: Add RDT feature flags.
  i386/cpu: Adjust CPUID level for RDT features
  i386/cpu: Adjust level for RDT on full_cpuid_auto_level

 hw/i386/Kconfig                      |   4 +
 hw/i386/meson.build                  |   1 +
 hw/i386/rdt.c                        | 286 +++++++++++++++++++++++++++
 include/hw/i386/rdt.h                |  76 +++++++
 target/i386/cpu.c                    | 114 ++++++++++-
 target/i386/cpu.h                    |  24 +++
 target/i386/tcg/sysemu/misc_helper.c |  81 ++++++++
 7 files changed, 584 insertions(+), 2 deletions(-)
 create mode 100644 hw/i386/rdt.c
 create mode 100644 include/hw/i386/rdt.h

-- 
2.47.1.613.gc27f4b7a9f-goog
Re: [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux
Posted by Michael S. Tsirkin 1 month, 2 weeks ago
On Fri, Dec 13, 2024 at 05:26:37PM +0000, Hendrik Wuethrich wrote:
> From: Hendrik Wüthrich <whendrik@google.com>
> 
> The aim of this patch series is to emulate Intel RDT features in order
> to make testing of the linux Resctrl subsystem possible with Qemu.
> 
> A branch with the patches applied can be found at:
> https://github.com/Gray-Colors/Intel_RDT_patches_applied/tree/rdt_v5
> 
> The changes made introduce the following features:



There was just my minor comment, are you going to post v6?

> * Feature enumeration for Intel RDT allocation.
> * Feature enumeration for Intel RDT monitoring.
> * Intel RDT monitoring system interface.
> * Intel RDT allocation system interface.
> 
> By adding these features, a barebones implementation most of the RDT
> state and MSRs is introduced, which can be enabled through qemu
> command line flags.
> The features missing for a faithful recreation of RDT are CDP and
> non-linear MBA throttle, as well as the possibility to configure
> various values through the command line, as some properties can be
> different across different machines. For increased ease of use, the
> correct features should be automatically enabled on machines that
> support RDT functionality.
> The missing features mentioned above will be implemented in the
> following order:
> 
> * Expand feature set for RDT allocation to include CDP and non-linear
>  MBA throttle
> * Allow for command line configuration of some values, such as the L3
>  CBM length
> * Automatically enable RDT on machines that officially support it.
> 
> Will NOT be implemented
> * Tests to simulate interaction with the host by the guest
> 
> Command line examples assuming entire patch series is applied (This
> requires a kernel with Resctrl enabled):
> 
> To emulate Intel RDT features:
> 
> Currently, it is necessary to force the RDT options on in qemu, as it is
> not automatically enabled for any machines. An example would be the
> following:
> -cpu Skylake-Server,+l3-cmt,+rdt-m,+rdt-a,+mba,+l3-cat,+l2-cat
> and
> -device rdt
> 
> Just enabling RDT in qemu won't really help, though. The following
> option allows resctrl in the kernel:
> - Kernel options: rdt=mbmlocal,mbmtotal,cmt,mba,l2cat,l3cat
> 
> To use Resctrl in the Qemu, please refer to:
> https://docs.kernel.org/arch/x86/resctrl.html
> 
> V4 -> V5
> - rebase
> - fix feature bit names to all be in hex
> 
> ‪Hendrik Wüthrich (8):
>   i386: Add Intel RDT device and State to config.
>   i386: Add init and realize functionality for RDT device.
>   i386: Add RDT functionality
>   i386: Add RDT device interface through MSRs
>   i386: Add CPUID enumeration for RDT
>   i386: Add RDT feature flags.
>   i386/cpu: Adjust CPUID level for RDT features
>   i386/cpu: Adjust level for RDT on full_cpuid_auto_level
> 
>  hw/i386/Kconfig                      |   4 +
>  hw/i386/meson.build                  |   1 +
>  hw/i386/rdt.c                        | 286 +++++++++++++++++++++++++++
>  include/hw/i386/rdt.h                |  76 +++++++
>  target/i386/cpu.c                    | 114 ++++++++++-
>  target/i386/cpu.h                    |  24 +++
>  target/i386/tcg/sysemu/misc_helper.c |  81 ++++++++
>  7 files changed, 584 insertions(+), 2 deletions(-)
>  create mode 100644 hw/i386/rdt.c
>  create mode 100644 include/hw/i386/rdt.h
> 
> -- 
> 2.47.1.613.gc27f4b7a9f-goog


Re: [PATCH v5 0/8] mulate Intel RDT features needed to mount ResCtrl in Linux
Posted by Hendrik Wüthrich 1 month, 2 weeks ago
On Thu, Feb 20, 2025 at 3:50 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Dec 13, 2024 at 05:26:37PM +0000, Hendrik Wuethrich wrote:
> > From: Hendrik Wüthrich <whendrik@google.com>
> >
> > The aim of this patch series is to emulate Intel RDT features in order
> > to make testing of the linux Resctrl subsystem possible with Qemu.
> >
> > A branch with the patches applied can be found at:
> > https://github.com/Gray-Colors/Intel_RDT_patches_applied/tree/rdt_v5
> >
> > The changes made introduce the following features:
>
>
>
> There was just my minor comment, are you going to post v6?

I found out about some larger issues, mostly in the mapping of RDT
state to cores, and am rewriting some parts (mostly of the rdt.c file).
I hope to be able to send something out in the coming week.

>
> > * Feature enumeration for Intel RDT allocation.
> > * Feature enumeration for Intel RDT monitoring.
> > * Intel RDT monitoring system interface.
> > * Intel RDT allocation system interface.
> >
> > By adding these features, a barebones implementation most of the RDT
> > state and MSRs is introduced, which can be enabled through qemu
> > command line flags.
> > The features missing for a faithful recreation of RDT are CDP and
> > non-linear MBA throttle, as well as the possibility to configure
> > various values through the command line, as some properties can be
> > different across different machines. For increased ease of use, the
> > correct features should be automatically enabled on machines that
> > support RDT functionality.
> > The missing features mentioned above will be implemented in the
> > following order:
> >
> > * Expand feature set for RDT allocation to include CDP and non-linear
> >  MBA throttle
> > * Allow for command line configuration of some values, such as the L3
> >  CBM length
> > * Automatically enable RDT on machines that officially support it.
> >
> > Will NOT be implemented
> > * Tests to simulate interaction with the host by the guest
> >
> > Command line examples assuming entire patch series is applied (This
> > requires a kernel with Resctrl enabled):
> >
> > To emulate Intel RDT features:
> >
> > Currently, it is necessary to force the RDT options on in qemu, as it is
> > not automatically enabled for any machines. An example would be the
> > following:
> > -cpu Skylake-Server,+l3-cmt,+rdt-m,+rdt-a,+mba,+l3-cat,+l2-cat
> > and
> > -device rdt
> >
> > Just enabling RDT in qemu won't really help, though. The following
> > option allows resctrl in the kernel:
> > - Kernel options: rdt=mbmlocal,mbmtotal,cmt,mba,l2cat,l3cat
> >
> > To use Resctrl in the Qemu, please refer to:
> > https://docs.kernel.org/arch/x86/resctrl.html
> >
> > V4 -> V5
> > - rebase
> > - fix feature bit names to all be in hex
> >
> > ‪Hendrik Wüthrich (8):
> >   i386: Add Intel RDT device and State to config.
> >   i386: Add init and realize functionality for RDT device.
> >   i386: Add RDT functionality
> >   i386: Add RDT device interface through MSRs
> >   i386: Add CPUID enumeration for RDT
> >   i386: Add RDT feature flags.
> >   i386/cpu: Adjust CPUID level for RDT features
> >   i386/cpu: Adjust level for RDT on full_cpuid_auto_level
> >
> >  hw/i386/Kconfig                      |   4 +
> >  hw/i386/meson.build                  |   1 +
> >  hw/i386/rdt.c                        | 286 +++++++++++++++++++++++++++
> >  include/hw/i386/rdt.h                |  76 +++++++
> >  target/i386/cpu.c                    | 114 ++++++++++-
> >  target/i386/cpu.h                    |  24 +++
> >  target/i386/tcg/sysemu/misc_helper.c |  81 ++++++++
> >  7 files changed, 584 insertions(+), 2 deletions(-)
> >  create mode 100644 hw/i386/rdt.c
> >  create mode 100644 include/hw/i386/rdt.h
> >
> > --
> > 2.47.1.613.gc27f4b7a9f-goog
>