[PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter

Christian K├Ânig ckoenig.leichtzumerken at gmail.com
Tue Oct 10 16:40:46 UTC 2017


Am 10.10.2017 um 18:33 schrieb Alex Deucher:
> On Tue, Oct 10, 2017 at 6:39 AM, Rex Zhu <Rex.Zhu at amd.com> wrote:
>> used to clamp system memmoy for smu debug usage.
>>
>> Change-Id: I8399f55069b8dcc05a3a79f9285744fcc8549af0
>> Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
>>   2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index da48f97..43fbcfe 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -132,6 +132,7 @@
>>   #ifdef CONFIG_DRM_AMDGPU_CIK
>>   extern int amdgpu_cik_support;
>>   #endif
>> +extern uint amdgpu_smu_memory_pool_size;
>>
>>   #define AMDGPU_DEFAULT_GTT_SIZE_MB             3072ULL /* 3GB by default */
>>   #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS         3000
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index ebcba56..d033904 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -126,6 +126,7 @@
>>   int amdgpu_job_hang_limit = 0;
>>   int amdgpu_lbpw = -1;
>>   int amdgpu_compute_multipipe = -1;
>> +uint amdgpu_smu_memory_pool_size = 0;
>>
>>   MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
>>   module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
>> @@ -301,6 +302,10 @@
>>   module_param_named(cik_support, amdgpu_cik_support, int, 0444);
>>   #endif
>>
>> +MODULE_PARM_DESC(smu_memory_pool_size,
>> +       "clamp max system memory for smu debug usage, 0 = disable,"
>> +               "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
>> +module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
> Sorry, I should have been more clear.  I want to avoid adding another
> module parameter.  I was thinking of a debugfs file (e.g.,
> amdgpu_smu_log_size or something like that) and if you set the file to
> 0, it would disable smu power logging and if you set it to a different
> size, it would allocate the memory and then send the smu messages to
> enable the logging.  Within the debugfs handler it would check the
> size against the current gart size and return an error (-ENOMEM) if
> the gart wasn't big enough or the allocation failed.
>
> to disable:
> echo 0 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size
> to enable a 64M SMU log:
> echo 64 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size

Seconded, assuming that you can send the message to the SMU while it is 
running that sounds like a much better approach.

You also don't need to really check the size, allocating and pinning a 
buffer which is bigger than GART should fail no matter what.

Christian.

>
> Alex
>
>>   static const struct pci_device_id pciidlist[] = {
>>   #ifdef  CONFIG_DRM_AMDGPU_SI
>> --
>> 1.9.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx




More information about the amd-gfx mailing list