Skip to content

awilliam/mdevctl

Repository files navigation

mdevctl is a mediated device management utility for Linux

Description
-----------

mdevctl is a tool for creating/removing, starting/stopping, listing,
and managing persistence of devices created within the mediated device
framework.  mdevctl integrates with udev and systemd such that all
mediated devices are automatically recorded for persistence and may
be started and stopped via systemd services.

This project is early in development, man pages and spec files are
intended, but don't exist yet.  Contribute!

License
-------
Licensed under the GNU Lesser General Public License aka LGPL v2.1.
See COPYING for details.

Source repository
-----------------
https://github.com/mdevctl/mdevctl

Installation
------------
'make install' for now, packaging coming.

Architecture
------------
mdevctl inserts udev rules to trigger when a devices is added on the
mdev subsystem.  The device is recorded in a persistent file under
/etc/mdevctl.d/.  Later, if a rule triggers indicating a device was
added for which we have persistent mdev information stored, mdevctl
provides information to have systemd start services invoking those
persistent mdev devices.

The mdevctl scripts are split between libexec and sbin, the latter is
intended for user consumption while the former is invoked by udev,
systemd, or the sbin script.  This allows consistency in active mdevs
being managed through systemd whether invoked from the command line
or udev events.

Usage
-----

List all possible mdev types supported in the system:

# mdevctl list-all
0000:00:02.0
  i915-GVTg_V4_2
    Available instances: 2
    Device API: vfio-pci
    Description: low_gm_size: 256MB high_gm_size: 1024MB fence: 4 resolution: 1920x1200 weight: 8 
  i915-GVTg_V4_1
    Available instances: 1
    Device API: vfio-pci
    Description: low_gm_size: 512MB high_gm_size: 2048MB fence: 4 resolution: 1920x1200 weight: 16 
  i915-GVTg_V4_8
    Available instances: 7
    Device API: vfio-pci
    Description: low_gm_size: 64MB high_gm_size: 384MB fence: 4 resolution: 1024x768 weight: 2 
  i915-GVTg_V4_4
    Available instances: 5
    Device API: vfio-pci
    Description: low_gm_size: 128MB high_gm_size: 512MB fence: 4 resolution: 1920x1200 weight: 4 

Create an mdev devices:

# mdevctl create-mdev `uuidgen` 0000:00:02.0 i915-GVTg_V4_8

List active mdev devices:

# mdevctl list-mdevs
ad8a4ad1-32cd-4cd4-8ab1-80a0e382b847 0000:00:02.0 i915-GVTg_V4_8

Stop an mdev device (remove it, but it remains persistent):

# mdevctl stop-mdev ad8a4ad1-32cd-4cd4-8ab1-80a0e382b847

Start and mdev device we already know about:

# mdevctl start-mdev ad8a4ad1-32cd-4cd4-8ab1-80a0e382b847

List saved mdev devices:

# mdevctl list-saved
ad8a4ad1-32cd-4cd4-8ab1-80a0e382b847 0000:00:02.0 i915-GVTg_V4_8

Remove an mdev, stopping it if active:

# mdevctl remove-mdev ad8a4ad1-32cd-4cd4-8ab1-80a0e382b847

TODO
----
 * man page

Releases

No releases published

Packages

No packages published