diff mbox series

drm/i915/gt: Add a comment about how to use udev for configuring engines

Message ID 20201221130105.5519-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/gt: Add a comment about how to use udev for configuring engines | expand

Commit Message

Chris Wilson Dec. 21, 2020, 1:01 p.m. UTC
We expose engine properties under sysfs so that the sysadmin can
configure the driver according to their requirements. We can also use
udev rules to then apply that configuration anytime a device is
reloaded. Include a udev snippet provided by Joonas as an example.

v2: Update the snippet

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/sysfs_engines.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Joonas Lahtinen Dec. 22, 2020, 12:36 p.m. UTC | #1
Quoting Chris Wilson (2020-12-21 15:01:05)
> We expose engine properties under sysfs so that the sysadmin can
> configure the driver according to their requirements. We can also use
> udev rules to then apply that configuration anytime a device is
> reloaded. Include a udev snippet provided by Joonas as an example.
> 
> v2: Update the snippet
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gt/sysfs_engines.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c b/drivers/gpu/drm/i915/gt/sysfs_engines.c
> index 9cf943b6a44b..37f078e69a42 100644
> --- a/drivers/gpu/drm/i915/gt/sysfs_engines.c
> +++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c
> @@ -11,6 +11,22 @@
>  #include "intel_engine_heartbeat.h"
>  #include "sysfs_engines.h"
>  
> +/*
> + * The sysfs provides a means for configuring each engine for the intended
> + * usecase, and by utilising a udev the configuration can be made persistent
> + * across reboots and device rebinding.
> + *
> + * An example udev rule to run a custom sysadmin script would be,
> + * /etc/udev/rules.d/50-intel-gpu.rules:
> + *
> + * ACTION=="bind|add",SUBSYSTEM=="pci",DRIVER=="i915",RUN+="/usr/local/libexec/i915-disable-preempt-timeout.sh"
> + *
> + * where the script receives the device name and can open the sysfs, e.g.:
> + * for ENGINE in $(find /sys/$DEVPATH/drm/card?/engine -maxdepth 1) do
> + *   echo 0 > $ENGINE/preempt_timeout_ms # Disable reset on preemption failure
> + * done
> + */

If we just could get this into the output of 'make htmldocs', it would
be good.

Regards, Joonas

> +
>  struct kobj_engine {
>         struct kobject base;
>         struct intel_engine_cs *engine;
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c b/drivers/gpu/drm/i915/gt/sysfs_engines.c
index 9cf943b6a44b..37f078e69a42 100644
--- a/drivers/gpu/drm/i915/gt/sysfs_engines.c
+++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c
@@ -11,6 +11,22 @@ 
 #include "intel_engine_heartbeat.h"
 #include "sysfs_engines.h"
 
+/*
+ * The sysfs provides a means for configuring each engine for the intended
+ * usecase, and by utilising a udev the configuration can be made persistent
+ * across reboots and device rebinding.
+ *
+ * An example udev rule to run a custom sysadmin script would be,
+ * /etc/udev/rules.d/50-intel-gpu.rules:
+ *
+ * ACTION=="bind|add",SUBSYSTEM=="pci",DRIVER=="i915",RUN+="/usr/local/libexec/i915-disable-preempt-timeout.sh"
+ *
+ * where the script receives the device name and can open the sysfs, e.g.:
+ * for ENGINE in $(find /sys/$DEVPATH/drm/card?/engine -maxdepth 1) do
+ *   echo 0 > $ENGINE/preempt_timeout_ms # Disable reset on preemption failure
+ * done
+ */
+
 struct kobj_engine {
 	struct kobject base;
 	struct intel_engine_cs *engine;