All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe
@ 2025-01-07 14:53 Christian König
  2025-01-07 16:00 ` Simona Vetter
  2025-01-07 22:17 ` Felix Kuehling
  0 siblings, 2 replies; 3+ messages in thread
From: Christian König @ 2025-01-07 14:53 UTC (permalink / raw)
  To: amd-gfx, alexander.deucher, sima

We sometimes have people trying to use debugging options in production
environments.

Mark options only meant to be used for debugging as unsafe so that the
kernel is tainted when they are used.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index acb9dc3705ac..9ddfdb02a6a2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -401,7 +401,7 @@ module_param_named(runpm, amdgpu_runtime_pm, int, 0444);
  * the kernel log for the list of IPs on the asic. The default is 0xffffffff (enable all blocks on a device).
  */
 MODULE_PARM_DESC(ip_block_mask, "IP Block Mask (all blocks enabled (default))");
-module_param_named(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
+module_param_named_unsafe(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
 
 /**
  * DOC: bapm (int)
@@ -459,7 +459,7 @@ module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
  * Enable experimental hw support (1 = enable). The default is 0 (disabled).
  */
 MODULE_PARM_DESC(exp_hw_support, "experimental hw support (1 = enable, 0 = disable (default))");
-module_param_named(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
+module_param_named_unsafe(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
 
 /**
  * DOC: dc (int)
@@ -570,14 +570,14 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);
  * Set to enable GPU recovery mechanism (1 = enable, 0 = disable). The default is -1 (auto, disabled except SRIOV).
  */
 MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto)");
-module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
+module_param_named_unsafe(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
 
 /**
  * DOC: emu_mode (int)
  * Set value 1 to enable emulation mode. This is only needed when running on an emulator. The default is 0 (disabled).
  */
 MODULE_PARM_DESC(emu_mode, "Emulation mode, (1 = enable, 0 = disable)");
-module_param_named(emu_mode, amdgpu_emu_mode, int, 0444);
+module_param_named_unsafe(emu_mode, amdgpu_emu_mode, int, 0444);
 
 /**
  * DOC: ras_enable (int)
@@ -732,7 +732,7 @@ module_param_named(noretry, amdgpu_noretry, int, 0644);
  */
 MODULE_PARM_DESC(force_asic_type,
 	"A non negative value used to specify the asic type for all supported GPUs");
-module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
+module_param_named_unsafe(force_asic_type, amdgpu_force_asic_type, int, 0444);
 
 /**
  * DOC: use_xgmi_p2p (int)
@@ -955,7 +955,7 @@ module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
  * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
  */
 MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco)");
-module_param_named(reset_method, amdgpu_reset_method, int, 0644);
+module_param_named_unsafe(reset_method, amdgpu_reset_method, int, 0644);
 
 /**
  * DOC: bad_page_threshold (int) Bad page threshold is specifies the
@@ -1051,7 +1051,7 @@ module_param_named(seamless, amdgpu_seamless, int, 0444);
  * - 0x4: Disable GPU soft recovery, always do a full reset
  */
 MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default");
-module_param_named(debug_mask, amdgpu_debug_mask, uint, 0444);
+module_param_named_unsafe(debug_mask, amdgpu_debug_mask, uint, 0444);
 
 /**
  * DOC: agp (int)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe
  2025-01-07 14:53 [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe Christian König
@ 2025-01-07 16:00 ` Simona Vetter
  2025-01-07 22:17 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Simona Vetter @ 2025-01-07 16:00 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx, alexander.deucher, sima

On Tue, Jan 07, 2025 at 03:53:08PM +0100, Christian König wrote:
> We sometimes have people trying to use debugging options in production
> environments.
> 
> Mark options only meant to be used for debugging as unsafe so that the
> kernel is tainted when they are used.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

Acked-by: Simona Vetter <simona.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index acb9dc3705ac..9ddfdb02a6a2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -401,7 +401,7 @@ module_param_named(runpm, amdgpu_runtime_pm, int, 0444);
>   * the kernel log for the list of IPs on the asic. The default is 0xffffffff (enable all blocks on a device).
>   */
>  MODULE_PARM_DESC(ip_block_mask, "IP Block Mask (all blocks enabled (default))");
> -module_param_named(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
> +module_param_named_unsafe(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
>  
>  /**
>   * DOC: bapm (int)
> @@ -459,7 +459,7 @@ module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
>   * Enable experimental hw support (1 = enable). The default is 0 (disabled).
>   */
>  MODULE_PARM_DESC(exp_hw_support, "experimental hw support (1 = enable, 0 = disable (default))");
> -module_param_named(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
> +module_param_named_unsafe(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
>  
>  /**
>   * DOC: dc (int)
> @@ -570,14 +570,14 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);
>   * Set to enable GPU recovery mechanism (1 = enable, 0 = disable). The default is -1 (auto, disabled except SRIOV).
>   */
>  MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto)");
> -module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
> +module_param_named_unsafe(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
>  
>  /**
>   * DOC: emu_mode (int)
>   * Set value 1 to enable emulation mode. This is only needed when running on an emulator. The default is 0 (disabled).
>   */
>  MODULE_PARM_DESC(emu_mode, "Emulation mode, (1 = enable, 0 = disable)");
> -module_param_named(emu_mode, amdgpu_emu_mode, int, 0444);
> +module_param_named_unsafe(emu_mode, amdgpu_emu_mode, int, 0444);
>  
>  /**
>   * DOC: ras_enable (int)
> @@ -732,7 +732,7 @@ module_param_named(noretry, amdgpu_noretry, int, 0644);
>   */
>  MODULE_PARM_DESC(force_asic_type,
>  	"A non negative value used to specify the asic type for all supported GPUs");
> -module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
> +module_param_named_unsafe(force_asic_type, amdgpu_force_asic_type, int, 0444);
>  
>  /**
>   * DOC: use_xgmi_p2p (int)
> @@ -955,7 +955,7 @@ module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
>   * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
>   */
>  MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco)");
> -module_param_named(reset_method, amdgpu_reset_method, int, 0644);
> +module_param_named_unsafe(reset_method, amdgpu_reset_method, int, 0644);
>  
>  /**
>   * DOC: bad_page_threshold (int) Bad page threshold is specifies the
> @@ -1051,7 +1051,7 @@ module_param_named(seamless, amdgpu_seamless, int, 0444);
>   * - 0x4: Disable GPU soft recovery, always do a full reset
>   */
>  MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default");
> -module_param_named(debug_mask, amdgpu_debug_mask, uint, 0444);
> +module_param_named_unsafe(debug_mask, amdgpu_debug_mask, uint, 0444);
>  
>  /**
>   * DOC: agp (int)
> -- 
> 2.34.1
> 

-- 
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe
  2025-01-07 14:53 [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe Christian König
  2025-01-07 16:00 ` Simona Vetter
@ 2025-01-07 22:17 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Kuehling @ 2025-01-07 22:17 UTC (permalink / raw)
  To: Christian König, amd-gfx, alexander.deucher, sima


On 2025-01-07 09:53, Christian König wrote:
> We sometimes have people trying to use debugging options in production
> environments.
>
> Mark options only meant to be used for debugging as unsafe so that the
> kernel is tainted when they are used.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Acked-by: Felix Kuehling <felix.kuehling@amd.com>

FWIW, we could do the same with some KFD-specific debug options: 
sched_policy, cwsr_enable, halt_if_hws_hang, hws_gws_support, 
no_queue_eviction_on_vm_fault, mtype_local.

Regards,
   Felix


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index acb9dc3705ac..9ddfdb02a6a2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -401,7 +401,7 @@ module_param_named(runpm, amdgpu_runtime_pm, int, 0444);
>    * the kernel log for the list of IPs on the asic. The default is 0xffffffff (enable all blocks on a device).
>    */
>   MODULE_PARM_DESC(ip_block_mask, "IP Block Mask (all blocks enabled (default))");
> -module_param_named(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
> +module_param_named_unsafe(ip_block_mask, amdgpu_ip_block_mask, uint, 0444);
>   
>   /**
>    * DOC: bapm (int)
> @@ -459,7 +459,7 @@ module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
>    * Enable experimental hw support (1 = enable). The default is 0 (disabled).
>    */
>   MODULE_PARM_DESC(exp_hw_support, "experimental hw support (1 = enable, 0 = disable (default))");
> -module_param_named(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
> +module_param_named_unsafe(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
>   
>   /**
>    * DOC: dc (int)
> @@ -570,14 +570,14 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444);
>    * Set to enable GPU recovery mechanism (1 = enable, 0 = disable). The default is -1 (auto, disabled except SRIOV).
>    */
>   MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto)");
> -module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
> +module_param_named_unsafe(gpu_recovery, amdgpu_gpu_recovery, int, 0444);
>   
>   /**
>    * DOC: emu_mode (int)
>    * Set value 1 to enable emulation mode. This is only needed when running on an emulator. The default is 0 (disabled).
>    */
>   MODULE_PARM_DESC(emu_mode, "Emulation mode, (1 = enable, 0 = disable)");
> -module_param_named(emu_mode, amdgpu_emu_mode, int, 0444);
> +module_param_named_unsafe(emu_mode, amdgpu_emu_mode, int, 0444);
>   
>   /**
>    * DOC: ras_enable (int)
> @@ -732,7 +732,7 @@ module_param_named(noretry, amdgpu_noretry, int, 0644);
>    */
>   MODULE_PARM_DESC(force_asic_type,
>   	"A non negative value used to specify the asic type for all supported GPUs");
> -module_param_named(force_asic_type, amdgpu_force_asic_type, int, 0444);
> +module_param_named_unsafe(force_asic_type, amdgpu_force_asic_type, int, 0444);
>   
>   /**
>    * DOC: use_xgmi_p2p (int)
> @@ -955,7 +955,7 @@ module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
>    * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
>    */
>   MODULE_PARM_DESC(reset_method, "GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco)");
> -module_param_named(reset_method, amdgpu_reset_method, int, 0644);
> +module_param_named_unsafe(reset_method, amdgpu_reset_method, int, 0644);
>   
>   /**
>    * DOC: bad_page_threshold (int) Bad page threshold is specifies the
> @@ -1051,7 +1051,7 @@ module_param_named(seamless, amdgpu_seamless, int, 0444);
>    * - 0x4: Disable GPU soft recovery, always do a full reset
>    */
>   MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by default");
> -module_param_named(debug_mask, amdgpu_debug_mask, uint, 0444);
> +module_param_named_unsafe(debug_mask, amdgpu_debug_mask, uint, 0444);
>   
>   /**
>    * DOC: agp (int)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-07 22:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 14:53 [PATCH] drm/amdgpu: mark a bunch of module parameters unsafe Christian König
2025-01-07 16:00 ` Simona Vetter
2025-01-07 22:17 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.