]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
amdgpu: Wrap dev_err() calls on vm faults with printk_ratelimit()
authorEdward O'Callaghan <funfunctor@folklore1984.net>
Mon, 7 Nov 2016 04:35:09 +0000 (15:35 +1100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Nov 2016 20:08:43 +0000 (15:08 -0500)
It can be the case that upon GPU page faults we start trashing
the logs, and so let us ratelimit here to avoid that.

V2. Fix issue where 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.
    - Michel Dänzer.

Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c

index 3b6ad84df39bd5768372ebebbc81c5949057d914..64d3c1e6014c08ddfd1a3f0ef1c809254ea2325d 100644 (file)
@@ -1036,13 +1036,15 @@ 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",
-               entry->src_id, entry->src_data);
-       dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_ADDR   0x%08X\n",
-               addr);
-       dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
-               status);
-       gmc_v6_0_vm_decode_fault(adev, status, addr, 0);
+       if (printk_ratelimit()) {
+               dev_err(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",
+                       addr);
+               dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
+                       status);
+               gmc_v6_0_vm_decode_fault(adev, status, addr, 0);
+       }
 
        return 0;
 }
index 18a0612764a9c86de23bf7024fa8ab549ef99224..fbe1d9ac500add22390260018b675be83bffcc4d 100644 (file)
@@ -1198,13 +1198,15 @@ static int gmc_v7_0_process_interrupt(struct amdgpu_device *adev,
        if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_FIRST)
                gmc_v7_0_set_fault_enable_default(adev, false);
 
-       dev_err(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",
-               addr);
-       dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
-               status);
-       gmc_v7_0_vm_decode_fault(adev, status, addr, mc_client);
+       if (printk_ratelimit()) {
+               dev_err(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",
+                       addr);
+               dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
+                       status);
+               gmc_v7_0_vm_decode_fault(adev, status, addr, mc_client);
+       }
 
        return 0;
 }
index af2c6ccf0e5b7ae8d91dba095efd843f937c15b8..12ea3404dd65c0ed20299514f93e3276a045c557 100644 (file)
@@ -1242,13 +1242,15 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
        if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_FIRST)
                gmc_v8_0_set_fault_enable_default(adev, false);
 
-       dev_err(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",
-               addr);
-       dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
-               status);
-       gmc_v8_0_vm_decode_fault(adev, status, addr, mc_client);
+       if (printk_ratelimit()) {
+               dev_err(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",
+                       addr);
+               dev_err(adev->dev, "  VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
+                       status);
+               gmc_v8_0_vm_decode_fault(adev, status, addr, mc_client);
+       }
 
        return 0;
 }