drm/xe/guc: Handle regset overflow check for entire GT
Subsystems (2)
PATCH 1/2 drm/xe/guc: Handle regset overflow check for entire GT
Checking whether a single engine's register save/restore entries overflow the expected/pre-allocated GuC ADS regset area isn't terribly useful; we actually want to check whether the combined entries from all engines on the GT overflow the regset space.
--- drivers/gpu/drm/xe/xe_guc_ads.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_guc_ads.c +5 -2
@@ -482,8 +482,6 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, } } -XE_BUG_ON (ads->regset_size < (count *sizeof (struct guc_mmio_reg ))); -return count; }
@@ -496,6 +494,7 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads)u32 addr =xe_bo_ggtt_addr (ads->bo) + regset_offset;struct iosys_map regset_map =IOSYS_MAP_INIT_OFFSET (ads_to_map (ads), regset_offset); +unsigned int regset_used =0 ;for_each_hw_engine (hwe, gt, id) {unsigned int count;
@@ -521,7 +520,11 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads) addr += count *sizeof (struct guc_mmio_reg );iosys_map_incr (®set_map, count *sizeof (struct guc_mmio_reg )); + + regset_used += count *sizeof (struct guc_mmio_reg ); } + +XE_BUG_ON (regset_used > ads->regset_size); }static void guc_um_init_params (struct xe_guc_ads *ads)
Signature · 1 line
2.39.2
PATCH 2/2 drm/xe: Allocate regset space for Wa_1607983814 unconditionally
As part of commit 6f2c0e92587b ("drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP"), the regset allocation was slimmed down to not unnecessarily include extra LNCFMOCS space in the regset area for the platforms and engines that don't need to save/restore those registers. Unfortunately this change is causing a driver load regression on Xe_LP platforms:
------------[ cut here ]------------ WARNING: CPU: 4 PID: 1677 at drivers/gpu/drm/xe/xe_hw_fence.c:91 xe_hw_fence_irq_finish+0x35/0x120 [xe] Modules linked in: xe(+) drm_ttm_helper drm_suballoc_helper gpu_sched drm_buddy video drm_display_helper drm_kms_helper syscopyarea sysfillrect sysimgblt ttm fuse x86_pkg_temp_thermal coretemp kvm_intel mei_pxp mei_hdcp kvm irqbypass wmi_bmof mei_me mei crct10dif_pcl mul crc32_pclmul e1000e ghash_clmulni_intel ptp i2c_i801 i2c_smbus pps_core intel_lpss_pci wmi [last unloaded: ttm] CPU: 4 PID: 1677 Comm: modprobe Not tainted 6.1.0-CI_DRM_12746-g6ce36b596fa7+ #474 Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWR1.D00.X212.B00.190824175 RIP: 0010:xe_hw_fence_irq_finish+0x35/0x120 [xe] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc f9 37 e1 48 89 ef 88 44 24 07 e8 78 ea 77 e1 48 8b 55 RSP: 0018:ffffc90001967bc8 EFLAGS: 00010206 RAX: ffff88811058f698 RBX: 00000000ffffffc2 RCX: ffff88810c8289a8 RDX: 0000000000000000 RSI: ffffffff822868c2 RDI: ffff888115524a98 RBP: ffff888115524a98 R08: 000000000000011f R09: 00000000ffffffff R10: 0000000000000000 R11: 000000006243100e R12: ffff888115524af8 R13: ffff888115524b10 R14: ffff888115523c38 R15: ffffffffa04ecfbe FS: 00007f6ca9483740(0000) GS:ffff88844dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000557fefd93020 CR3: 00000001157ea004 CR4: 00000000003706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> xe_gt_init+0x343/0x390 [xe] xe_device_probe+0x233/0x2a0 [xe] xe_pci_probe+0x351/0x480 [xe]
The reason for this failure hasn't been identified yet (the smaller regset allocation is still more than large enough to hold all of the registers; it isn't an overflow problem) so let's revert the problematic optimization to restore proper behavior while we investigate further.
--- drivers/gpu/drm/xe/xe_guc_ads.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_guc_ads.c +1 -4
@@ -224,10 +224,7 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; - -if (needs_wa_1607983814 (gt_to_xe (gt))) - count +=LNCFCMOCS_REG_COUNT ; + count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ;return count *sizeof (struct guc_mmio_reg ); }
Signature · 1 line
2.39.2
Re: [Intel-xe] [PATCH 2/2] drm/xe: Allocate regset space for Wa_1607983814 unconditionally
Quoted 6 lines · Matt Roper
As part of commit
6f2c0e92587b("drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP"), the regset allocation was slimmed down to not unnecessarily include extra LNCFMOCS space in the regset area for the platforms and engines that don't need to save/restore those registers. Unfortunately this change is causing a driver load regression onXe_LPplatforms:
s/Xe_LP/some Xe_LP/. I have been loading xe in a TGL without such issue. Report was on DG1
Quoted 32 lines
------------[ cut here ]------------ WARNING: CPU: 4 PID: 1677 at drivers/gpu/drm/xe/xe_hw_fence.c:91 xe_hw_fence_irq_finish+0x35/0x120 [xe] Modules linked in: xe(+) drm_ttm_helper drm_suballoc_helper gpu_sched drm_buddy video drm_display_helper drm_kms_helper syscopyarea sysfillrect sysimgblt ttm fuse x86_pkg_temp_thermal coretemp kvm_intel mei_pxp mei_hdcp kvm irqbypass wmi_bmof mei_me mei crct10dif_pcl mul crc32_pclmul e1000e ghash_clmulni_intel ptp i2c_i801 i2c_smbus pps_core intel_lpss_pci wmi [last unloaded: ttm] CPU: 4 PID: 1677 Comm: modprobe Not tainted 6.1.0-CI_DRM_12746-g6ce36b596fa7+ #474 Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWR1.D00.X212.B00.190824175 RIP: 0010:xe_hw_fence_irq_finish+0x35/0x120 [xe] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc ccf9 37 e1 48 89 ef 88 44 24 07 e8 78 ea 77 e1 48 8b 55
RSP: 0018:ffffc90001967bc8 EFLAGS: 00010206
RAX:ffff88811058f698RBX:00000000ffffffc2RCX:ffff88810c8289a8
RDX: 0000000000000000 RSI:ffffffff822868c2RDI:ffff888115524a98
RBP:ffff888115524a98R08:000000000000011fR09:00000000ffffffff
R10: 0000000000000000 R11:000000006243100eR12:ffff888115524af8
R13:ffff888115524b10R14:ffff888115523c38R15:ffffffffa04ecfbe
FS: 00007f6ca9483740(0000) GS:ffff88844dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2:0000557fefd93020CR3:00000001157ea004CR4:00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6:00000000fffe0ff0DR7: 0000000000000400Call Trace: <TASK> xe_gt_init+0x343/0x390 [xe] xe_device_probe+0x233/0x2a0 [xe] xe_pci_probe+0x351/0x480 [xe]
Quoted 8 lines
The reason for this failure hasn't been identified yet (the smaller regset allocation is still more than large enough to hold all of the registers; it isn't an overflow problem) so let's revert the problematic optimization to restore proper behavior while we investigate further.
Cc Lucas De Marchi <[email protected]>Reported-by Thomas Hellström <[email protected]>Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 23 lines
---
drivers/gpu/drm/xe/xe_guc_ads.c| 5 +----1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/xe/xe_guc_ads.c +1
-4@@ -224,10 +224,7 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; - -if (needs_wa_1607983814 (gt_to_xe (gt))) - count +=LNCFCMOCS_REG_COUNT ; + count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ;return count *sizeof (struct guc_mmio_reg ); }Signature · 1 line
2.39.2
Re: [Intel-xe] [PATCH 2/2] drm/xe: Allocate regset space for Wa_1607983814 unconditionally
Quoted 10 lines · Lucas De Marchi
Quoted 6 lines · Matt Roper
As part of commit
6f2c0e92587b("drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP"), the regset allocation was slimmed down to not unnecessarily include extra LNCFMOCS space in the regset area for the platforms and engines that don't need to save/restore those registers. Unfortunately this change is causing a driver load regression onXe_LPplatforms:s/Xe_LP/some Xe_LP/. I have been loading xe in a TGL without such issue. Report was on DG1
It happens on TGL as well, although far less often. Loading/unloading in a loop will eventually trigger it for me on TGL, whereas it reproduced nearly every time on DG1. I haven't actually tried on RKL or ADL yet, but given that both DG1 and TGL show the problem, I assume they probably will as well.
Matt
Quoted 71 lines
Quoted 34 lines
------------[ cut here ]------------ WARNING: CPU: 4 PID: 1677 at drivers/gpu/drm/xe/xe_hw_fence.c:91 xe_hw_fence_irq_finish+0x35/0x120 [xe] Modules linked in: xe(+) drm_ttm_helper drm_suballoc_helper gpu_sched drm_buddy video drm_display_helper drm_kms_helper syscopyarea sysfillrect sysimgblt ttm fuse x86_pkg_temp_thermal coretemp kvm_intel mei_pxp mei_hdcp kvm irqbypass wmi_bmof mei_me mei crct10dif_pcl mul crc32_pclmul e1000e ghash_clmulni_intel ptp i2c_i801 i2c_smbus pps_core intel_lpss_pci wmi [last unloaded: ttm] CPU: 4 PID: 1677 Comm: modprobe Not tainted 6.1.0-CI_DRM_12746-g6ce36b596fa7+ #474 Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWR1.D00.X212.B00.190824175 RIP: 0010:xe_hw_fence_irq_finish+0x35/0x120 [xe] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc ccf9 37 e1 48 89 ef 88 44 24 07 e8 78 ea 77 e1 48 8b 55
RSP: 0018:ffffc90001967bc8 EFLAGS: 00010206
RAX:ffff88811058f698RBX:00000000ffffffc2RCX:ffff88810c8289a8
RDX: 0000000000000000 RSI:ffffffff822868c2RDI:ffff888115524a98
RBP:ffff888115524a98R08:000000000000011fR09:00000000ffffffff
R10: 0000000000000000 R11:000000006243100eR12:ffff888115524af8
R13:ffff888115524b10R14:ffff888115523c38R15:ffffffffa04ecfbe
FS: 00007f6ca9483740(0000) GS:ffff88844dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2:0000557fefd93020CR3:00000001157ea004CR4:00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6:00000000fffe0ff0DR7: 0000000000000400Call Trace: <TASK> xe_gt_init+0x343/0x390 [xe] xe_device_probe+0x233/0x2a0 [xe] xe_pci_probe+0x351/0x480 [xe]Quoted 8 lines
The reason for this failure hasn't been identified yet (the smaller regset allocation is still more than large enough to hold all of the registers; it isn't an overflow problem) so let's revert the problematic optimization to restore proper behavior while we investigate further.
Cc Lucas De Marchi <[email protected]>Reported-by Thomas Hellström <[email protected]>Signed-off-by Matt Roper <[email protected]>Reviewed-by Lucas De Marchi <[email protected]>Lucas De Marchi
Quoted 23 lines
---
drivers/gpu/drm/xe/xe_guc_ads.c| 5 +----1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/xe/xe_guc_ads.c +1
-4@@ -224,10 +224,7 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; - -if (needs_wa_1607983814 (gt_to_xe (gt))) - count +=LNCFCMOCS_REG_COUNT ; + count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ;return count *sizeof (struct guc_mmio_reg ); }Signature · 1 line
2.39.2
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 2/2] drm/xe: Allocate regset space for Wa_1607983814 unconditionally
Quoted 9 lines · Matt Roper
Quoted 8 lines · Lucas De Marchi
Quoted 6 lines · Matt Roper
As part of commit
6f2c0e92587b("drm/xe/mocs: LNCF MOCS settings only need to be restored on pre-Xe_HP"), the regset allocation was slimmed down to not unnecessarily include extra LNCFMOCS space in the regset area for the platforms and engines that don't need to save/restore those registers. Unfortunately this change is causing a driver load regression onXe_LPplatforms:
Quoted 8 lines
Quoted 2 lines
s/Xe_LP/some Xe_LP/. I have been loading xe in a TGL without such issue. Report was on DG1
It happens on TGL as well, although far less often. Loading/unloading in a loop will eventually trigger it for me on TGL, whereas it reproduced nearly every time on DG1. I haven't actually tried on RKL or ADL yet, but given that both DG1 and TGL show the problem, I assume they probably will as well.
ok, let's keep the wording then. My r-b below still applies.
thanks
Lucas De Marchi
Quoted 81 lines
Matt
Quoted 71 lines
Quoted 34 lines
------------[ cut here ]------------ WARNING: CPU: 4 PID: 1677 at drivers/gpu/drm/xe/xe_hw_fence.c:91 xe_hw_fence_irq_finish+0x35/0x120 [xe] Modules linked in: xe(+) drm_ttm_helper drm_suballoc_helper gpu_sched drm_buddy video drm_display_helper drm_kms_helper syscopyarea sysfillrect sysimgblt ttm fuse x86_pkg_temp_thermal coretemp kvm_intel mei_pxp mei_hdcp kvm irqbypass wmi_bmof mei_me mei crct10dif_pcl mul crc32_pclmul e1000e ghash_clmulni_intel ptp i2c_i801 i2c_smbus pps_core intel_lpss_pci wmi [last unloaded: ttm] CPU: 4 PID: 1677 Comm: modprobe Not tainted 6.1.0-CI_DRM_12746-g6ce36b596fa7+ #474 Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWR1.D00.X212.B00.190824175 RIP: 0010:xe_hw_fence_irq_finish+0x35/0x120 [xe] Code: 54 4c 8d 67 60 55 53 48 83 ec 10 48 8b 47 60 49 39 c4 75 13 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc ccf9 37 e1 48 89 ef 88 44 24 07 e8 78 ea 77 e1 48 8b 55
RSP: 0018:ffffc90001967bc8 EFLAGS: 00010206
RAX:ffff88811058f698RBX:00000000ffffffc2RCX:ffff88810c8289a8
RDX: 0000000000000000 RSI:ffffffff822868c2RDI:ffff888115524a98
RBP:ffff888115524a98R08:000000000000011fR09:00000000ffffffff
R10: 0000000000000000 R11:000000006243100eR12:ffff888115524af8
R13:ffff888115524b10R14:ffff888115523c38R15:ffffffffa04ecfbe
FS: 00007f6ca9483740(0000) GS:ffff88844dc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2:0000557fefd93020CR3:00000001157ea004CR4:00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6:00000000fffe0ff0DR7: 0000000000000400Call Trace: <TASK> xe_gt_init+0x343/0x390 [xe] xe_device_probe+0x233/0x2a0 [xe] xe_pci_probe+0x351/0x480 [xe]Quoted 8 lines
The reason for this failure hasn't been identified yet (the smaller regset allocation is still more than large enough to hold all of the registers; it isn't an overflow problem) so let's revert the problematic optimization to restore proper behavior while we investigate further.
Cc Lucas De Marchi <[email protected]>Reported-by Thomas Hellström <[email protected]>Signed-off-by Matt Roper <[email protected]>Reviewed-by Lucas De Marchi <[email protected]>Lucas De Marchi
Quoted 23 lines
---
drivers/gpu/drm/xe/xe_guc_ads.c| 5 +----1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/xe/xe_guc_ads.c +1
-5@@ -224,10 +224,7 @@ static size_t calculate_regset_size(struct xe_gt *gt)xa_for_each (&hwe->reg_sr.xa, sr_idx, sr_entry) count++; - count +=ADS_REGSET_EXTRA_MAX *XE_NUM_HW_ENGINES ; - -if (needs_wa_1607983814 (gt_to_xe (gt))) - count +=LNCFCMOCS_REG_COUNT ; + count += (ADS_REGSET_EXTRA_MAX +LNCFCMOCS_REG_COUNT ) *XE_NUM_HW_ENGINES ;return count *sizeof (struct guc_mmio_reg ); } --2.39.2
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Quoted 6 lines · Matt Roper
Checking whether a single engine's register save/restore entries overflow the expected/pre-allocated GuC ADS regset area isn't terribly useful; we actually want to check whether the combined entries from all engines on the GT overflow the regset space.
Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 40 lines
---
drivers/gpu/drm/xe/xe_guc_ads.c| 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/xe/xe_guc_ads.c +5
-2@@ -482,8 +482,6 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, } } -XE_BUG_ON (ads->regset_size < (count *sizeof (struct guc_mmio_reg ))); -return count; }@@ -496,6 +494,7 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads)u32 addr =xe_bo_ggtt_addr (ads->bo) + regset_offset;struct iosys_map regset_map =IOSYS_MAP_INIT_OFFSET (ads_to_map (ads), regset_offset); +unsigned int regset_used =0 ;for_each_hw_engine (hwe, gt, id) {unsigned int count;@@ -521,7 +520,11 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads) addr += count *sizeof (struct guc_mmio_reg );iosys_map_incr (®set_map, count *sizeof (struct guc_mmio_reg )); + + regset_used += count *sizeof (struct guc_mmio_reg ); } + +XE_BUG_ON (regset_used > ads->regset_size); }static void guc_um_init_params (struct xe_guc_ads *ads)Signature · 1 line
2.39.2
[Intel-xe] ✗ CI.Patch_applied: failure for series starting with [1/2] drm/xe/guc: Handle regset overflow check for entire GT
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/xe/guc: Handle regset overflow check for entire GT
URL : https://patchwork.freedesktop.org/series/114811/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === commit 91440895e3fe91928c6e8a682e87d2b8ca677d82
Author: Lucas De Marchi <[email protected]> AuthorDate: Wed Mar 1 01:31:12 2023 -0800 Commit: Lucas De Marchi <[email protected]> CommitDate: Fri Mar 10 13:52:30 2023 -0800
drm/xe/pvc: Remove A* steppings
The PVC pre-production A* steppings are not going to be supported in xe driver - the steppings are important for the WAs and since we are not adding the pre-productions ones, there is no need to add the stepping.
=== git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_guc_ads.c:482
error: drivers/gpu/drm/xe/xe_guc_ads.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe/guc: Handle regset overflow check for entire GT Patch failed at 0001 drm/xe/guc: Handle regset overflow check for entire GT When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".