amdgpu: Don't print L2 status if there's nothing to print
Subsystems (2)
PATCH 1/1 amdgpu: Don't print L2 status if there's nothing to print
If a 2nd fault comes in before the 1st is handled, the 1st fault will clear out the FAULT STATUS registers before the 2nd fault is handled. Thus we get a lot of zeroes. If status=0, just skip the L2 fault status information, to avoid confusion of why some VM fault status prints in dmesg are all zeroes.
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 ++++++++++ 4 files changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +10 -0
@@ -175,6 +175,16 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, addr, entry->client_id, soc15_ih_clientid_name[entry->client_id]); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status);
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +10 -0
@@ -144,6 +144,16 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,dev_err (adev->dev," in page starting at address 0x%016llx from client %d\n" , addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status); }
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +10 -0
@@ -137,6 +137,16 @@ static int gmc_v12_0_process_interrupt(struct amdgpu_device *adev,dev_err (adev->dev," in page starting at address 0x%016llx from client %d\n" , addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status); }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10 -0
@@ -675,6 +675,16 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,if (!amdgpu_sriov_vf (adev))WREG32_P (hub->vm_l2_pro_fault_cntl,1 , ~1 ); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +amdgpu_vm_update_fault_cache (adev, entry->pasid, addr, status, vmhub); dev_err(adev->dev,
Signature · 1 line
2.43.0
Quoted 21 lines · Kent Russell
If a 2nd fault comes in before the 1st is handled, the 1st fault will clear out the FAULT STATUS registers before the 2nd fault is handled. Thus we get a lot of zeroes. If status=0, just skip the L2 fault status information, to avoid confusion of why some VM fault status prints in dmesg are all zeroes.
Signed-off-by Kent Russell <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 ++++++++++ 4 files changed, 40 insertions(+)drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0@@ -175,6 +175,16 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, addr, entry->client_id, soc15_ih_clientid_name[entry->client_id]);
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · line 186
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9
-0+/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ;
I'm not sure if this lengthy comment needs to be duplicated in so many places. If you check for status == 0, you also don't need the amdgpu_sriov_vf condition below any more, because it doesn't read the status register under SRIOV and status is 0-initialized. So you could just do this:
/* Only print L2 fault status if the status register could be read and * contains useful information */ if (status != 0) hub->vmhub_funcs->print_l2_protection_fault_status(adev,
status);
Regards,
Felix
Quoted 67 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status);drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +10
-0@@ -144,6 +144,16 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,dev_err (adev->dev," in page starting at address 0x%016llx from client %d\n" , addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status); }drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +10
-0@@ -137,6 +137,16 @@ static int gmc_v12_0_process_interrupt(struct amdgpu_device *adev,dev_err (adev->dev," in page starting at address 0x%016llx from client %d\n" , addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status); }drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10
-0@@ -675,6 +675,16 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,if (!amdgpu_sriov_vf (adev))WREG32_P (hub->vm_l2_pro_fault_cntl,1 , ~1 ); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +amdgpu_vm_update_fault_cache (adev, entry->pasid, addr, status, vmhub); dev_err(adev->dev,
[Public]
Quoted 49 lines
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Friday, October 18, 2024 2:43 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Cornwall, Jay <[email protected]>
Subject: Re: [PATCH] amdgpu: Don't print L2 status if there's nothing to printQuoted 7 lines · Kent Russell
If a 2nd fault comes in before the 1st is handled, the 1st fault will clear out the FAULT STATUS registers before the 2nd fault is handled. Thus we get a lot of zeroes. If status=0, just skip the L2 fault status information, to avoid confusion of why some VM fault status prints in dmesg are all zeroes.
Signed-off-by Kent Russell <[email protected]>Review
Quoted 8 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 10 ++++++++++ 4 files changed, 40 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.cdrivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_process_interrupt(struct
Quoted 4 lines
index
5cf2002fcba8..14a52c33bffa100644drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-0@@ -175,6 +175,16 @@ static int gmc_v10_0_process_interrupt(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · line 186
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9
-0addr, entry->client_id, soc15_ih_clientid_name[entry->client_id]); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ;I'm not sure if this lengthy comment needs to be duplicated in so many places. If you check for status == 0, you also don't need the
amdgpu_sriov_vfcondition below any more, because it doesn't read the status register under SRIOV and status is 0-initialized. So you could just do this:
Quoted 6 lines
/* Only print L2 fault status if the status register could be read and
* contains useful information
*/
if (status != 0)
hub->vmhub_funcs->print_l2_protection_fault_status(adev,
status);Sounds good. I can leave the verbose description in the commit and cut it down in these spots. Thanks!
Kent
Quoted 82 lines
Regards,
FelixReview
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-0+if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status (adev, status);(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.cdrivers/gpu/drm/amd/amdgpu/gmc_v11_0.c static int gmc_v11_0_process_interrupt(struct
Quoted 4 lines
index
4df4d73038f8..c5fe31070cf3100644drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0
-0@@ -144,6 +144,16 @@ static int gmc_v11_0_process_interrupt(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c static int gmc_v11_0_process_interrupt(struct · line 144
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0
-0dev_err(adev->dev, " in page starting at address 0x%016llx fromclient %d\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2
-0addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c static int gmc_v11_0_process_interrupt(struct · line 158
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +8
-0+* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status(adev,status);
Review
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0
-0}(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.cdrivers/gpu/drm/amd/amdgpu/gmc_v12_0.c static int gmc_v12_0_process_interrupt(struct
Quoted 4 lines
index
e33f9e9058cc..fcfe512f1271100644drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +0
-0@@ -137,6 +137,16 @@ static int gmc_v12_0_process_interrupt(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c static int gmc_v12_0_process_interrupt(struct · line 137
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +0
-0dev_err(adev->dev, " in page starting at address 0x%016llx fromclient %d\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2
-0addr, entry->client_id); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c static int gmc_v12_0_process_interrupt(struct · line 151
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +8
-0+* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +if (!amdgpu_sriov_vf (adev)) hub->vmhub_funcs->print_l2_protection_fault_status(adev,status);
Review
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +0
-0}(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.cdrivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_process_interrupt(struct
Quoted 4 lines
index
010db0e58650..6da2ca28375e100644drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0@@ -675,6 +675,16 @@ static int gmc_v9_0_process_interrupt(struct
amdgpu_device*adev,Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10
-0if (!amdgpu_sriov_vf (adev))WREG32_P (hub->vm_l2_pro_fault_cntl,1 , ~1 ); +/* If status=0, we don't have anything to process. Most often, this is +* caused by a 2nd fault coming in before the 1st one is handled. +* Once the 1st fault is handled, the fault registers are cleared, so +* we have nothing to print for fault #2. In that case, don't try to +* print the fault status information. The information above is +* sufficient to note that another fault occurred. +*/ +if (!status) +return 0 ; +amdgpu_vm_update_fault_cache (adev, entry->pasid, addr, status, vmhub); dev_err(adev->dev,