systemd/rules.d/meson.build
Gustavo Noronha Silva 6b8e90545e Apply known iocost solutions to block devices
Meta's resource control demo project[0] includes a benchmark tool that can
be used to calculate the best iocost solutions for a given SSD.

  [0]: https://github.com/facebookexperimental/resctl-demo

A project[1] has now been started to create a publicly available database
of results that can be used to apply them automatically.

  [1]: https://github.com/iocost-benchmark/iocost-benchmarks

This change adds a new tool that gets triggered by a udev rule for any
block device and queries the hwdb for known solutions. The format for
the hwdb file that is currently generated by the github action looks like
this:

  # This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000.
  # From the following commit:
  # ca82acfe93
  #
  # Match key format:
  # block:<devpath>:name:<model name>:

  # 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249]
  block:*:name:HFS256GD9TNG-62A0A:fwver:*:
    IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive
    IOCOST_MODEL_ISOLATION=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119
    IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
    IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119
    IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
    IOCOST_MODEL_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119
    IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
    IOCOST_MODEL_NAIVE=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119
    IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00

The IOCOST_SOLUTIONS key lists the solutions available for that device
in the preferred order for higher isolation, which is a reasonable
default for most client systems. This can be overriden to choose better
defaults for custom use cases, like the various data center workloads.

The tool can also be used to query the known solutions for a specific
device or to apply a non-default solution (say, isolation or bandwidth).

Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
2023-04-20 16:45:57 +02:00

82 lines
2.3 KiB
Meson

# SPDX-License-Identifier: LGPL-2.1-or-later
install_data(
'README',
install_dir : udevrulesdir)
rules = [
[files('60-autosuspend.rules',
'60-block.rules',
'60-cdrom_id.rules',
'60-drm.rules',
'60-evdev.rules',
'60-fido-id.rules',
'60-infiniband.rules',
'60-input-id.rules',
'60-persistent-alsa.rules',
'60-persistent-input.rules',
'60-persistent-storage-tape.rules',
'60-persistent-v4l.rules',
'60-sensor.rules',
'60-serial.rules',
'70-camera.rules',
'70-joystick.rules',
'70-mouse.rules',
'70-touchpad.rules',
'75-net-description.rules',
'75-probe_mtd.rules',
'78-sound-card.rules',
'80-net-setup-link.rules',
'81-net-dhcp.rules',
'90-iocost.rules',
)],
[files('80-drivers.rules'),
conf.get('HAVE_KMOD') == 1],
[files('70-memory.rules'),
dmi_arches.contains(host_machine.cpu_family())],
[files('70-power-switch.rules'),
enable_logind],
]
all_rules = []
foreach tuple : rules
if tuple.length() == 1 or tuple[1]
install_data(tuple[0],
install_dir : udevrulesdir)
all_rules += tuple[0]
endif
endforeach
rules_in = [
['50-udev-default.rules'],
['60-persistent-storage.rules'],
['64-btrfs.rules'],
['99-systemd.rules'],
['70-uaccess.rules', enable_logind and conf.get('HAVE_ACL') == 1],
['71-seat.rules', enable_logind],
['73-seat-late.rules', enable_logind],
['90-vconsole.rules', conf.get('ENABLE_VCONSOLE') == 1],
]
foreach tuple : rules_in
want = tuple.length() == 1 or tuple[1]
rule = custom_target(
tuple[0],
input : tuple[0] + '.in',
output: tuple[0],
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
install : want,
install_dir : udevrulesdir)
if want
all_rules += rule
endif
endforeach