drm/amd: Clarify kdoc for amdgpu.gttsize
Subsystems (2)
PATCH v2 1/2 drm/amd: Clarify kdoc for amdgpu.gttsize
From: Mario Limonciello <[email protected]>
Effectively amdgpu.gttsize gets set to ~1/2 of RAM, but that's controlled by what the TTM page limit is set to. Clarify the kdoc.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -282,7 +282,7 @@ module_param_named(gartsize, amdgpu_gart_size, uint, 0600);/** * DOC: gttsize (int) * Restrict the size of GTT domain (for userspace use) in MiB for testing. -* The default is -1 (Use 1/2 RAM, minimum value is 3GB). +* The default is -1 (Use value specified by TTM). */ MODULE_PARM_DESC (gttsize,"Size of the GTT userspace domain in megabytes (-1 = auto)" );module_param_named (gttsize, amdgpu_gtt_size, int,0600 );
Signature · 1 line
2.48.0
PATCH v2 2/2 drm/amd: Mark amdgpu.gttsize parameter as deprecated and show warnings on use
From: Mario Limonciello <[email protected]>
When not set gttsize module parameter by default will get the value to use for the GTT pool from the TTM page limit, which is set by a separate module parameter.
This inevitably leads to people not sure which one to set when they want more addressable memory for the GPU, and you'll end up seeing instructions online saying to set both.
Add some messages to try to guide people both who are using or misusing the parameters and mark the parameter as deprecated with the plan to drop it after the next LTS kernel release.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -283,6 +283,7 @@ module_param_named(gartsize, amdgpu_gart_size, uint, 0600);* DOC: gttsize (int) * Restrict the size of GTT domain (for userspace use) in MiB for testing. * The default is -1 (Use value specified by TTM). +* This parameter is deprecated and will be removed in the future. */ MODULE_PARM_DESC (gttsize,"Size of the GTT userspace domain in megabytes (-1 = auto)" );module_param_named (gttsize, amdgpu_gtt_size, int,0600 );
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +13 -4
@@ -1960,10 +1960,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)/* Compute GTT size, either based on TTM limit * or whatever the user passed on module init. */ -if (amdgpu_gtt_size ==-1 ) - gtt_size =ttm_tt_pages_limit () <<PAGE_SHIFT ; -else - gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; + gtt_size =ttm_tt_pages_limit () <<PAGE_SHIFT ; +if (amdgpu_gtt_size !=-1 ) { +uint64_t configured_size = (uint64_t )amdgpu_gtt_size <<20 ; + +drm_warn (&adev->ddev, +"Configuring gttsize via module parameter is deprecated, please use ttm.pages_limit" ); +if (gtt_size != configured_size) +drm_warn (&adev->ddev, +"GTT size has been set as %llu but TTM size has been set as %llu, this is unusual" , + configured_size, gtt_size); + + gtt_size = configured_size; + }/* Initialize GTT memory pool */ r =amdgpu_gtt_mgr_init (adev, gtt_size);
Signature · 1 line
2.48.0
Re: [PATCH v2 2/2] drm/amd: Mark amdgpu.gttsize parameter as deprecated and show warnings on use
Quoted 41 lines · Mario Limonciello
From: Mario Limonciello <[email protected]>
When not set
gttsizemodule parameter by default will get the value to use for the GTT pool from the TTM page limit, which is set by a separate module parameter.This inevitably leads to people not sure which one to set when they want more addressable memory for the GPU, and you'll end up seeing instructions online saying to set both.
Add some messages to try to guide people both who are using or misusing the parameters and mark the parameter as deprecated with the plan to drop it after the next LTS kernel release.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -283,6 +283,7 @@ module_param_named(gartsize, amdgpu_gart_size, uint, 0600);* DOC: gttsize (int) * Restrict the size of GTT domain (for userspace use) in MiB for testing. * The default is -1 (Use value specified by TTM). +* This parameter is deprecated and will be removed in the future. */ MODULE_PARM_DESC (gttsize,"Size of the GTT userspace domain in megabytes (-1 = auto)" );module_param_named (gttsize, amdgpu_gtt_size, int,0600 );drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-0@@ -1960,10 +1960,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)/* Compute GTT size, either based on TTM limit * or whatever the user passed on module init. */
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1968
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6
-4-if (amdgpu_gtt_size ==-1 ) - gtt_size =ttm_tt_pages_limit () <<PAGE_SHIFT ; -else - gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; + gtt_size =ttm_tt_pages_limit () <<PAGE_SHIFT ; +if (amdgpu_gtt_size !=-1 ) { +uint64_t configured_size = (uint64_t )amdgpu_gtt_size <<20 ; + +drm_warn (&adev->ddev, +"Configuring gttsize via module parameter is deprecated, please use ttm.pages_limit" );
Missing newline at the end.
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1971
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0+if (gtt_size != configured_size) + drm_warn(&adev->ddev, + "GTT size has been set as %llu but TTM size has been set as %llu, this is unusual",
Same here.
With those fixed:
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-1+ configured_size, gtt_size); + + gtt_size = configured_size; + }/* Initialize GTT memory pool */ r =amdgpu_gtt_mgr_init (adev, gtt_size); --2.48.0
Quoted 7 lines · Mario Limonciello
From: Mario Limonciello <[email protected]>
Effectively amdgpu.gttsize gets set to ~1/2 of RAM, but that's controlled by what the TTM page limit is set to. Clarify the kdoc.
Signed-off-by Mario Limonciello <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-2@@ -282,7 +282,7 @@ module_param_named(gartsize, amdgpu_gart_size, uint, 0600);/** * DOC: gttsize (int) * Restrict the size of GTT domain (for userspace use) in MiB for testing. -* The default is -1 (Use 1/2 RAM, minimum value is 3GB). +* The default is -1 (Use value specified by TTM). */ MODULE_PARM_DESC (gttsize,"Size of the GTT userspace domain in megabytes (-1 = auto)" );module_param_named (gttsize, amdgpu_gtt_size, int,0600 ); --2.48.0