[PATCH 2/2] amdgpu: Use 'dev_err_ratelimited()' over 'dev_err()' on vm faults

Michel Dänzer michel at daenzer.net
Mon Nov 7 03:55:08 UTC 2016


On 07/11/16 12:47 PM, Edward O'Callaghan wrote:
> It can be the case that upon GPU page faults we start trashing
> the logs, and so let us ratelimit here to avoid that.
> 
> Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 8 ++++----
>  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 8 ++++----
>  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 8 ++++----
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index b13c8aa..79af3f2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -549,7 +549,7 @@ static void gmc_v6_0_vm_decode_fault(struct amdgpu_device *adev,
>  	mc_id = REG_GET_FIELD(status, mmVM_CONTEXT1_PROTECTION_FAULT_STATUS,
>  			      xxMEMORY_CLIENT_ID);
>  
> -	dev_err(adev->dev, "VM fault (0x%02x, vmid %d) at page %u, %s from '%s' (0x%08x) (%d)\n",
> +	dev_err_ratelimited(adev->dev, "VM fault (0x%02x, vmid %d) at page %u, %s from '%s' (0x%08x) (%d)\n",
>  	       protections, vmid, addr,
>  	       REG_GET_FIELD(status, mmVM_CONTEXT1_PROTECTION_FAULT_STATUS,
>  			     xxMEMORY_CLIENT_RW) ?
> @@ -1007,11 +1007,11 @@ static int gmc_v6_0_process_interrupt(struct amdgpu_device *adev,
>  	if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_FIRST)
>  		gmc_v6_0_set_fault_enable_default(adev, false);
>  
> -	dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n",
> +	dev_err_ratelimited(adev->dev, "GPU fault detected: %d 0x%08x\n",
>  		entry->src_id, entry->src_data);
> -	dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_ADDR   0x%08X\n",
> +	dev_err_ratelimited(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_ADDR   0x%08X\n",
>  		addr);
> -	dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
> +	dev_err_ratelimited(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
>  		status);
>  	gmc_v6_0_vm_decode_fault(adev, status, addr, 0);

If calling dev_err_ratelimited separately for each line means that some
lines corresponding to a single VM fault may or may not appear depending
on the rate, it'd be better to use a single call per VM fault.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list