[RFC] drm/xe: Add separate Kconfig file for SR-IOV options

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Oct 22 21:39:36 UTC 2024


On Mon, Oct 21, 2024 at 10:12:42AM +0200, Michal Wajdeczko wrote:
> There are few SR-IOV config options that we want to define:
> 
>  - DRM_XE_SRIOV_VF to allow compile-out support for the SR-IOV
>    Virtual Function (VF)
>  - DRM_XE_SRIOV_PF to allow compile-out support for the SR-IOV
>    Physical Function (PF)
> 
> and for use by PF only:
> 
>  - DRM_XE_SRIOV_DEFAULT_SCHEDULING_[FLEXIBLE|FIXED|CUSTOM]
>    to select preferred scheduling method using either predefined
>    parameter values, or custom values
>  - DRM_XE_SRIOV_DEFAULT_PF_[EXEC_QUANTUM_MS|PREEMPT_TIMEOUT_US]
>    to define default execution quantum/preempt timeout for the PF
>  - DRM_XE_SRIOV_DEFAULT_VF_[EXEC_QUANTUM_MS|PREEMPT_TIMEOUT_US]
>    to define default execution quantum/preempt timeout for the VF
>  - DRM_XE_SRIOV_DEFAULT_POLICY_[SCHED_IF_IDLE|RESET_ENGINE]
>    to define default values for advanced scheduling policies
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Thomas Hellstrom <thomas.hellstrom at linux.intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
>  drivers/gpu/drm/xe/Kconfig       |   5 ++
>  drivers/gpu/drm/xe/Kconfig.sriov | 140 +++++++++++++++++++++++++++++++
>  2 files changed, 145 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/Kconfig.sriov
> 
> diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
> index bac96c0dd66e..cd68eda9ca79 100644
> --- a/drivers/gpu/drm/xe/Kconfig
> +++ b/drivers/gpu/drm/xe/Kconfig
> @@ -87,6 +87,11 @@ config DRM_XE_FORCE_PROBE
>  
>  	  Use "!*" to block the probe of the driver for all known devices.
>  
> +menu "SR-IOV Configuration"
> +depends on DRM_XE
> +source "drivers/gpu/drm/xe/Kconfig.sriov"
> +endmenu
> +
>  menu "drm/Xe Debugging"
>  depends on DRM_XE
>  depends on EXPERT
> diff --git a/drivers/gpu/drm/xe/Kconfig.sriov b/drivers/gpu/drm/xe/Kconfig.sriov

I'm totally okay with the idea of the separate sriov config. As long as the
options are only getting added when they start to be useful and not in advance
like this patch.

But also, I got scared of how many options you are planning here.
Mind about the exponential combination of validation and our CI
needing to have multiple different configs. Please let's try to
limit those to only the really needed ones.

Thanks,
Rodrigo.

> new file mode 100644
> index 000000000000..3bd3eee51e9f
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/Kconfig.sriov
> @@ -0,0 +1,140 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +config DRM_XE_SRIOV_VF
> +	bool
> +	prompt "Virtual Function (VF) support"
> +	default y
> +	help
> +	    Disable this option only if you want to compile out the SR-IOV VF support.
> +	    Without SR-IOV VF support, driver can still be used in native mode.
> +	    This option does not impact the support for the PF mode (if enabled).
> +
> +	    If in doubt, select "Y".
> +
> +config DRM_XE_SRIOV_PF
> +	bool
> +	prompt "Physical Function (PF) support" if PCI_IOV=y
> +	default PCI_IOV
> +	help
> +	    Disable this option only if you want to compile out the SR-IOV PF support.
> +	    Without SR-IOV PF support, driver can still be used in native mode.
> +	    This option does not impact the support for the VF mode (if enabled).
> +
> +	    If in doubt, select "Y".
> +
> +if DRM_XE_SRIOV_PF
> +
> +choice
> +	prompt "Default Scheduling Profile"
> +	default DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +	help
> +	    Select preferred scheduling profile to applied by default.
> +	    Choose "Flexible" if maximizing the GPU usage is preferred.
> +	    Choose "Fixed" if consitent VF execution time is required.
> +	    Choose "Custom" to define all scheduling parameters.
> +
> +	    If in doubt, select "Flexible".
> +
> +	config DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +		bool "Flexible"
> +		help
> +		    Use this config to prefer flexible scheduling method.
> +		    This config will predefine default scheduling parameters
> +		    to maximize the GPU usage that may cause some fluctuations
> +		    between VF execution slots.
> +
> +	config DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +		bool "Fixed"
> +		help
> +		    Use this config to prefer fixed scheduling method.
> +		    This config will predefine default scheduling parameters
> +		    in a such a way that all VFs execution time slots will
> +		    be consistent.
> +
> +	config DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +		bool "Custom"
> +		help
> +		    Use this config to define custom default scheduling parameters.
> +		    This config is mostly needed only if specific scheduling
> +		    parameters are required without involving any manual
> +		    provisioning over sysfs or debugfs interfaces.
> +
> +endchoice
> +
> +config DRM_XE_SRIOV_DEFAULT_PF_EXEC_QUANTUM_MS
> +	int
> +	range 0 100000
> +	prompt "Default PF execution quantum (ms)" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +	default 20 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +	default 20 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +	default 0 # unlimited
> +	help
> +	    Use this config to define default PF execution-quantum provisioning.
> +	    The value (in millisecond) indicates the amount of time the workloads
> +	    from the PF can run on the GPU.
> +	    Value 0 represents _infinity_ execution-quantum.
> +
> +config DRM_XE_SRIOV_DEFAULT_PF_PREEMPT_TIMEOUT_US
> +	int
> +	range 0 100000000
> +	prompt "Default PF preemption timeout (us)" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +	default 20000 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +	default 20000 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +	default 0 # unlimited
> +	help
> +	    Use this config to define default PF preemption timeout provisioning.
> +	    The value (in microseconds) indicates the amount of time the GPU scheduler
> +	    will wait for the PF workload (context) to yield to other VF.
> +	    Value 0 represents _infinity_ preemption timeout.
> +
> +config DRM_XE_SRIOV_DEFAULT_VF_EXEC_QUANTUM_MS
> +	int
> +	range 0 100000
> +	prompt "Default VF execution quantum (ms)" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +	default 32 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +	default 16 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +	default 0 # unlimited
> +	help
> +	    Use this config to define default VF execution-quantum provisioning.
> +	    The value (in millisecond) indicates the amount of time the workloads
> +	    from the VF can run on the GPU.
> +	    Value 0 represents _infinity_ execution-quantum.
> +
> +config DRM_XE_SRIOV_DEFAULT_VF_PREEMPT_TIMEOUT_US
> +	int
> +	range 0 100000000
> +	prompt "Default VF preemption timeout (us)" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +	default 32000 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FLEXIBLE
> +	default 16000 if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +	default 0 # unlimited
> +	help
> +	    Use this config to define default VF preemption timeout provisioning.
> +	    The value (in microseconds) indicates the amount of time the GPU scheduler
> +	    will wait for the VF workload (context) to yield to other VF.
> +	    Value 0 represents _infinity_ preemption timeout.
> +
> +config DRM_XE_SRIOV_DEFAULT_POLICY_SCHED_IF_IDLE
> +	bool
> +	prompt "Default schedule-if-idle policy" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM
> +	default y if DRM_XE_SRIOV_DEFAULT_SCHEDULING_FIXED
> +	default n
> +	help
> +	    Enable this config to turn on the strict scheduling policy by default.
> +	    When this policy is enabled, VFs that do not have work to submit are
> +	    still allocated a fixed execution time-slice to ensure all active VFs
> +	    execution is always consistent.
> +
> +	    If in doubt, say "N".
> +
> +config DRM_XE_SRIOV_DEFAULT_POLICY_RESET_ENGINE
> +	bool
> +	prompt "Default reset-engine policy" if DRM_XE_SRIOV_DEFAULT_SCHEDULING_CUSTOM && EXPERT
> +	default n
> +	help
> +	    Enable this config to turn on the engine reset policy by default.
> +	    When this policy is enabled, GPU engines will be reset by the GuC
> +	    on each VF switch to enforce cleanup of any stale HW register state.
> +
> +	    If in doubt, say "N".
> +
> +endif # DRM_XE_SRIOV_PF
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list