drm/i915: Add GuC TLB Invalidation pci tags
Subsystems (2)
PATCH v4 1/3 drm/i915: Add GuC TLB Invalidation pci tags
Add device info tags for if GuC TLB Invalidation is enabled. Since GuC based TLB invalidation is only strictly necessary for MTL presently, only enable GuC based TLB invalidations for MTL.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 1 + drivers/gpu/drm/i915/intel_device_info.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -821,4 +821,5 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_LMEMBAR_SMEM_STOLEN (i915) (!HAS_LMEM(i915) && \ GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) +#define HAS_GUC_TLB_INVALIDATION (i915) (INTEL_INFO(i915)->has_guc_tlb_invalidation)#endif
drivers/gpu/drm/i915/i915_pci.c +1 -0
@@ -837,6 +837,7 @@ static const struct intel_device_info mtl_info = { .memory_regions = REGION_SMEM | REGION_STOLEN_LMEM, .platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(CCS0), .require_force_probe = 1, + .has_guc_tlb_invalidation = 1, MTL_CACHELEVEL, };
drivers/gpu/drm/i915/intel_device_info.h +2 -1
@@ -173,7 +173,8 @@ enum intel_ppgtt_type {func (has_coherent_ggtt); \func (tuning_thread_rr_after_dep); \func (unfenced_needs_alignment); \ -func (hws_needs_physical); +func (hws_needs_physical); \ +func (has_guc_tlb_invalidation);struct intel_ip_version {u8 ver;
Signature · 1 line
2.25.1
PATCH v4 2/3 drm/i915: Define and use GuC and CTB TLB invalidation routines
From: Prathap Kumar Valsan <[email protected]>
The GuC firmware had defined the interface for Translation Look-Aside Buffer (TLB) invalidation. We should use this interface when invalidating the engine and GuC TLBs.
Add additional functionality to intel_gt_invalidate_tlb, invalidating the GuC TLBs and falling back to GT invalidation when the GuC is disabled.
The invalidation is done by sending a request directly to the GuC tlb_lookup that invalidates the table. The invalidation is submitted as a wait request and is performed in the CT event handler. This means we cannot perform this TLB invalidation path if the CT is not enabled. If the request isn't fulfilled in two seconds, this would constitute an error in the invalidation as that would constitute either a lost request or a severe GuC overload.
With this new invalidation routine, we can perform GuC-based GGTT invalidations. GuC-based GGTT invalidation is incompatible with MMIO invalidation so we should not perform MMIO invalidation when GuC-based GGTT invalidation is expected.
--- drivers/gpu/drm/i915/gt/intel_ggtt.c | 43 ++-- drivers/gpu/drm/i915/gt/intel_tlb.c | 14 +- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 33 +++ drivers/gpu/drm/i915/gt/uc/intel_guc.h | 22 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 15 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 1 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 205 +++++++++++++++++- 7 files changed, 317 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/gt/intel_ggtt.c +30 -13
@@ -206,22 +206,38 @@ static void gen8_ggtt_invalidate(struct i915_ggtt *ggtt)intel_uncore_write_fw (uncore,GFX_FLSH_CNTL_GEN6 ,GFX_FLSH_CNTL_EN ); } -static void guc_ggtt_invalidate (struct i915_ggtt *ggtt) +static void guc_ggtt_ct_invalidate (struct intel_gt *gt) { -struct drm_i915_private *i915 = ggtt->vm.i915; +struct intel_uncore *uncore = gt->uncore; +intel_wakeref_t wakeref; -gen8_ggtt_invalidate (ggtt); + with_intel_runtime_pm_if_active(uncore->rpm, wakeref) { +struct intel_guc *guc = >->uc.guc; -if (GRAPHICS_VER (i915) >=12 ) { -struct intel_gt *gt; +intel_guc_invalidate_tlb (guc); + } +} -list_for_each_entry (gt, &ggtt->gt_list, ggtt_link) -intel_uncore_write_fw (gt->uncore, -GEN12_GUC_TLB_INV_CR , -GEN12_GUC_TLB_INV_CR_INVALIDATE ); - }else { -intel_uncore_write_fw (ggtt->vm.gt->uncore, -GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); +static void guc_ggtt_invalidate (struct i915_ggtt *ggtt) +{ +struct drm_i915_private *i915 = ggtt->vm.i915; +struct intel_gt *gt; + +if (!IS_GEN9_LP (i915) &&GRAPHICS_VER (i915) <11 ) +gen8_ggtt_invalidate (ggtt); + +list_for_each_entry (gt, &ggtt->gt_list, ggtt_link) { +if (HAS_GUC_TLB_INVALIDATION (i915) && +intel_guc_is_ready (>->uc.guc)) { +guc_ggtt_ct_invalidate (gt); + }else if (GRAPHICS_VER (i915) >=12 ) { +intel_uncore_write (gt->uncore, +GEN12_GUC_TLB_INV_CR , +GEN12_GUC_TLB_INV_CR_INVALIDATE ); + }else { +intel_uncore_write (gt->uncore, +GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); + } } }
@@ -1243,7 +1259,8 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) ggtt->vm.raw_insert_page = gen8_ggtt_insert_page; } -if (intel_uc_wants_guc (&ggtt->vm.gt->uc)) +if (intel_uc_wants_guc (&ggtt->vm.gt->uc) && +intel_uc_wants_guc_submission (&ggtt->vm.gt->uc)) ggtt->invalidate = guc_ggtt_invalidate;else ggtt->invalidate = gen8_ggtt_invalidate;
drivers/gpu/drm/i915/gt/intel_tlb.c +13 -1
@@ -12,6 +12,7 @@#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_tlb.h" +#include "uc/intel_guc.h" /* * HW architecture suggest typical invalidation time at 40us,
@@ -131,11 +132,22 @@ void intel_gt_invalidate_tlb_full(struct intel_gt *gt, u32 seqno)return ; with_intel_gt_pm_if_awake(gt, wakeref) { +struct intel_guc *guc = >->uc.guc; +mutex_lock (>->tlb.invalidate_lock);if (tlb_seqno_passed (gt, seqno)) goto unlock; -mmio_invalidate_full (gt); +if (HAS_GUC_TLB_INVALIDATION (gt->i915)) { +/* +* Only perform GuC TLB invalidation if GuC is ready. +* Otherwise, skip invalidation altogeter. +*/ +if (intel_guc_is_ready (guc)) +intel_guc_invalidate_tlb_full (guc); + }else { +mmio_invalidate_full (gt); + }write_seqcount_invalidate (>->tlb.seqno); unlock:
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +33 -0
@@ -138,6 +138,8 @@ enum intel_guc_action {INTEL_GUC_ACTION_REGISTER_CONTEXT_MULTI_LRC =0x4601 ,INTEL_GUC_ACTION_CLIENT_SOFT_RESET =0x5507 ,INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF =0x550A , +INTEL_GUC_ACTION_TLB_INVALIDATION =0x7000 , +INTEL_GUC_ACTION_TLB_INVALIDATION_DONE =0x7001 ,INTEL_GUC_ACTION_STATE_CAPTURE_NOTIFICATION =0x8002 ,INTEL_GUC_ACTION_NOTIFY_FLUSH_LOG_BUFFER_TO_FILE =0x8003 , INTEL_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED = 0x8004,
@@ -181,4 +183,35 @@ enum intel_guc_state_capture_event_status {#define INTEL_GUC_STATE_CAPTURE_EVENT_STATUS_MASK 0x000000FF +#define INTEL_GUC_TLB_INVAL_TYPE_MASK REG_GENMASK(7, 0) +#define INTEL_GUC_TLB_INVAL_MODE_MASK REG_GENMASK(11, 8) +#define INTEL_GUC_TLB_INVAL_FLUSH_CACHE REG_BIT(31) + +enum intel_guc_tlb_invalidation_type { +INTEL_GUC_TLB_INVAL_FULL =0x0 , +INTEL_GUC_TLB_INVAL_GUC =0x3 , +}; + +/* +* 0: Heavy mode of Invalidation: +* The pipeline of the engine(s) for which the invalidation is targeted to is +* blocked, and all the in-flight transactions are guaranteed to be Globally +* Observed before completing the TLB invalidation +* 1: Lite mode of Invalidation: +* TLBs of the targeted engine(s) are immediately invalidated. +* In-flight transactions are NOT guaranteed to be Globally Observed before +* completing TLB invalidation. +* Light Invalidation Mode is to be used only when +* it can be guaranteed (by SW) that the address translations remain invariant +* for the in-flight transactions across the TLB invalidation. In other words, +* this mode can be used when the TLB invalidation is intended to clear out the +* stale cached translations that are no longer in use. Light Invalidation Mode +* is much faster than the Heavy Invalidation Mode, as it does not wait for the +* in-flight transactions to be GOd. +*/ +enum intel_guc_tlb_inval_mode { +INTEL_GUC_TLB_INVAL_MODE_HEAVY =0x0 , +INTEL_GUC_TLB_INVAL_MODE_LITE =0x1 , +}; +#endif /* _ABI_GUC_ACTIONS_ABI_H */
drivers/gpu/drm/i915/gt/uc/intel_guc.h +22 -0
@@ -79,6 +79,18 @@ struct intel_guc {*/ atomic_t outstanding_submission_g2h; +/** @tlb_lookup: xarray to store all pending TLB invalidation requests */ +struct xarray tlb_lookup; + +/** +* @serial_slot: id to the initial waiter created in tlb_lookup, +* which is used only when failed to allocate new waiter. +*/ +u32 serial_slot; + +/** @next_seqno: the next id (sequence no.) to allocate. */ +u32 next_seqno; +/** @interrupts: pointers to GuC interrupt-managing functions. */ struct {bool enabled;
@@ -296,6 +308,11 @@ struct intel_guc {#define MAKE_GUC_VER_STRUCT (ver) MAKE_GUC_VER((ver).major, (ver).minor, (ver).patch)#define GUC_SUBMIT_VER (guc) MAKE_GUC_VER_STRUCT((guc)->submission_version) +struct intel_guc_tlb_wait { +struct wait_queue_head wq; +bool busy; +}; +static inline struct intel_guc *log_to_guc (struct intel_guc_log *log) { return container_of(log, struct intel_guc, log);
@@ -417,6 +434,11 @@ static inline bool intel_guc_is_supported(struct intel_guc *guc) {return intel_uc_fw_is_supported (&guc->fw); } + +int intel_guc_invalidate_tlb_full (struct intel_guc *guc); +int intel_guc_invalidate_tlb (struct intel_guc *guc); +int intel_guc_tlb_invalidation_done (struct intel_guc *guc,const u32 *hxg, +u32 size);static inline bool intel_guc_is_wanted (struct intel_guc *guc) {
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +15 -0
@@ -1186,9 +1186,24 @@ static int ct_handle_event(struct intel_guc_ct *ct, struct ct_incoming_msg *requswitch (action) {case INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE :case INTEL_GUC_ACTION_DEREGISTER_CONTEXT_DONE : +case INTEL_GUC_ACTION_TLB_INVALIDATION_DONE :g2h_release_space (ct, request->size); } +/* +* Handle tlb invalidation response in interrupt context. +* This is processed separately here because this is a cleanup step +* after processing a done action, so there is no followup request +* to process the additional cleanup under as all other done actions +* call g2h_release_space. +*/ +if (action ==INTEL_GUC_ACTION_TLB_INVALIDATION_DONE ) { +int ret =intel_guc_tlb_invalidation_done (ct_to_guc (ct), hxg, request->size); + +ct_free_msg (request); +return ret; + } +spin_lock_irqsave (&ct->requests.lock, flags);list_add_tail (&request->link, &ct->requests.incoming);spin_unlock_irqrestore (&ct->requests.lock, flags);
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -0
@@ -22,6 +22,7 @@/* Payload length only i.e. don't include G2H header length */ #define G2H_LEN_DW_SCHED_CONTEXT_MODE_SET 2#define G2H_LEN_DW_DEREGISTER_CONTEXT 1 +#define G2H_LEN_DW_INVALIDATE_TLB 1#define GUC_CONTEXT_DISABLE 0#define GUC_CONTEXT_ENABLE 1
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +203 -2
256 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [Intel-gfx] [PATCH v4 2/3] drm/i915: Define and use GuC and CTB TLB invalidation routines
Quoted 72 lines · Jonathan Cavitt
From: Prathap Kumar Valsan <[email protected]>
The GuC firmware had defined the interface for Translation Look-Aside Buffer (TLB) invalidation. We should use this interface when invalidating the engine and GuC TLBs.
Add additional functionality tointel_gt_invalidate_tlb, invalidating the GuC TLBs and falling back to GT invalidation when the GuC is disabled.
The invalidation is done by sending a request directly to the GuCtlb_lookupthat invalidates the table. The invalidation is submitted as a wait request and is performed in the CT event handler. This means we cannot perform this TLB invalidation path if the CT is not enabled. If the request isn't fulfilled in two seconds, this would constitute an error in the invalidation as that would constitute either a lost request or a severe GuC overload.With this new invalidation routine, we can perform GuC-based GGTT invalidations. GuC-based GGTT invalidation is incompatible with MMIO invalidation so we should not perform MMIO invalidation when GuC-based GGTT invalidation is expected.
Signed-off-by Prathap Kumar Valsan <[email protected]>Signed-off-by Bruce Chang <[email protected]>Signed-off-by Chris Wilson <[email protected]>Signed-off-by Umesh Nerlige Ramappa <[email protected]>Signed-off-by Jonathan Cavitt <[email protected]>Signed-off-by Aravind Iddamsetty <[email protected]>Signed-off-by Fei Yang <[email protected]>CC Andi Shyti <[email protected]>--- drivers/gpu/drm/i915/gt/intel_ggtt.c | 43 ++-- drivers/gpu/drm/i915/gt/intel_tlb.c | 14 +- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 33 +++ drivers/gpu/drm/i915/gt/uc/intel_guc.h | 22 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 15 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 1 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 205 +++++++++++++++++- 7 files changed, 317 insertions(+), 16 deletions(-)drivers/gpu/drm/i915/gt/intel_ggtt.c +9
-12@@ -206,22 +206,38 @@ static void gen8_ggtt_invalidate(struct i915_ggtt *ggtt)intel_uncore_write_fw (uncore,GFX_FLSH_CNTL_GEN6 ,GFX_FLSH_CNTL_EN ); } -static void guc_ggtt_invalidate (struct i915_ggtt *ggtt) +static void guc_ggtt_ct_invalidate (struct intel_gt *gt) { -struct drm_i915_private *i915 = ggtt->vm.i915; +struct intel_uncore *uncore = gt->uncore; +intel_wakeref_t wakeref; -gen8_ggtt_invalidate (ggtt); + with_intel_runtime_pm_if_active(uncore->rpm, wakeref) { +struct intel_guc *guc = >->uc.guc; -if (GRAPHICS_VER (i915) >=12 ) { -struct intel_gt *gt; +intel_guc_invalidate_tlb (guc); + } +} -list_for_each_entry (gt, &ggtt->gt_list, ggtt_link) -intel_uncore_write_fw (gt->uncore, -GEN12_GUC_TLB_INV_CR , -GEN12_GUC_TLB_INV_CR_INVALIDATE ); - }else { -intel_uncore_write_fw (ggtt->vm.gt->uncore, -GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); +static void guc_ggtt_invalidate (struct i915_ggtt *ggtt)
drivers/gpu/drm/i915/gt/intel_ggtt.c static void gen8_ggtt_invalidate(struct i915_ggtt *ggtt) · line 231
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_ggtt.c +10
-0+{ +struct drm_i915_private *i915 = ggtt->vm.i915; +struct intel_gt *gt; + +if (!IS_GEN9_LP (i915) &&GRAPHICS_VER (i915) <11 ) +gen8_ggtt_invalidate (ggtt); + +list_for_each_entry (gt, &ggtt->gt_list, ggtt_link) { +if (HAS_GUC_TLB_INVALIDATION (i915) && +intel_guc_is_ready (>->uc.guc)) {
I am okay with HAS_GUC_TLB_INVALIDATION as a device info flag but leave it to people more familiar with GuC flows to make a final verdict.
Quoted 13 lines
drivers/gpu/drm/i915/gt/intel_ggtt.c +9
-0+guc_ggtt_ct_invalidate (gt); + }else if (GRAPHICS_VER (i915) >=12 ) { +intel_uncore_write (gt->uncore, +GEN12_GUC_TLB_INV_CR , +GEN12_GUC_TLB_INV_CR_INVALIDATE ); + }else { +intel_uncore_write (gt->uncore, +GEN8_GTCR ,GEN8_GTCR_INVALIDATE ); + } } }
drivers/gpu/drm/i915/gt/intel_ggtt.c static int gen8_gmch_probe(struct i915_ggtt *ggtt) · line 1263
Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_ggtt.c +2
-1@@ -1243,7 +1259,8 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) ggtt->vm.raw_insert_page = gen8_ggtt_insert_page; } -if (intel_uc_wants_guc (&ggtt->vm.gt->uc)) +if (intel_uc_wants_guc (&ggtt->vm.gt->uc) && +intel_uc_wants_guc_submission (&ggtt->vm.gt->uc))
This I still ask if both conditions are really needed.
Quoted 23 lines
drivers/gpu/drm/i915/gt/intel_ggtt.c +0
-0ggtt->invalidate = guc_ggtt_invalidate; else ggtt->invalidate = gen8_ggtt_invalidate;drivers/gpu/drm/i915/gt/intel_tlb.c +3
-0@@ -12,6 +12,7 @@#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_tlb.h" +#include "uc/intel_guc.h" /* * HW architecture suggest typical invalidation time at 40us, @@ -131,11 +132,22 @@ void intel_gt_invalidate_tlb_full(struct intel_gt *gt, u32 seqno)return ; with_intel_gt_pm_if_awake(gt, wakeref) { +struct intel_guc *guc = >->uc.guc; +mutex_lock (>->tlb.invalidate_lock);if (tlb_seqno_passed (gt, seqno))
drivers/gpu/drm/i915/gt/intel_tlb.c void intel_gt_invalidate_tlb_full(struct intel_gt *gt, u32 seqno) · line 147
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_tlb.c +7
-1goto unlock; -mmio_invalidate_full (gt); +if (HAS_GUC_TLB_INVALIDATION (gt->i915)) { +/* +* Only perform GuC TLB invalidation if GuC is ready. +* Otherwise, skip invalidation altogeter. +*/ +if (intel_guc_is_ready (guc)) +intel_guc_invalidate_tlb_full (guc);
Comment about it being safe or not has dissapeared so I trust people familiar with GuC flows made a verdict there can be no interleaved attempts at mmio register access between the GuC and i915, driven by the runtime transitions of intel_guc_is_ready() (like full reset or something in parallel to put_pages). Or at least that no missed/timed out TLB invalidations (aka security issues) can happen with any hyphotetical interleaved running of the two paths.
Quoted 107 lines
drivers/gpu/drm/i915/gt/intel_tlb.c +3
-0+ }else { +mmio_invalidate_full (gt); + }write_seqcount_invalidate (>->tlb.seqno); unlock:drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +33
-0@@ -138,6 +138,8 @@ enum intel_guc_action {INTEL_GUC_ACTION_REGISTER_CONTEXT_MULTI_LRC =0x4601 ,INTEL_GUC_ACTION_CLIENT_SOFT_RESET =0x5507 ,INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF =0x550A , +INTEL_GUC_ACTION_TLB_INVALIDATION =0x7000 , +INTEL_GUC_ACTION_TLB_INVALIDATION_DONE =0x7001 ,INTEL_GUC_ACTION_STATE_CAPTURE_NOTIFICATION =0x8002 ,INTEL_GUC_ACTION_NOTIFY_FLUSH_LOG_BUFFER_TO_FILE =0x8003 , INTEL_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED = 0x8004,@@ -181,4 +183,35 @@ enum intel_guc_state_capture_event_status {#define INTEL_GUC_STATE_CAPTURE_EVENT_STATUS_MASK 0x000000FF +#define INTEL_GUC_TLB_INVAL_TYPE_MASK REG_GENMASK(7, 0) +#define INTEL_GUC_TLB_INVAL_MODE_MASK REG_GENMASK(11, 8) +#define INTEL_GUC_TLB_INVAL_FLUSH_CACHE REG_BIT(31) + +enum intel_guc_tlb_invalidation_type { +INTEL_GUC_TLB_INVAL_FULL =0x0 , +INTEL_GUC_TLB_INVAL_GUC =0x3 , +}; + +/* +* 0: Heavy mode of Invalidation: +* The pipeline of the engine(s) for which the invalidation is targeted to is +* blocked, and all the in-flight transactions are guaranteed to be Globally +* Observed before completing the TLB invalidation +* 1: Lite mode of Invalidation: +* TLBs of the targeted engine(s) are immediately invalidated. +* In-flight transactions are NOT guaranteed to be Globally Observed before +* completing TLB invalidation. +* Light Invalidation Mode is to be used only when +* it can be guaranteed (by SW) that the address translations remain invariant +* for the in-flight transactions across the TLB invalidation. In other words, +* this mode can be used when the TLB invalidation is intended to clear out the +* stale cached translations that are no longer in use. Light Invalidation Mode +* is much faster than the Heavy Invalidation Mode, as it does not wait for the +* in-flight transactions to be GOd. +*/ +enum intel_guc_tlb_inval_mode { +INTEL_GUC_TLB_INVAL_MODE_HEAVY =0x0 , +INTEL_GUC_TLB_INVAL_MODE_LITE =0x1 , +}; +#endif /* _ABI_GUC_ACTIONS_ABI_H */ drivers/gpu/drm/i915/gt/uc/intel_guc.h +22
-0@@ -79,6 +79,18 @@ struct intel_guc {*/ atomic_t outstanding_submission_g2h; +/** @tlb_lookup: xarray to store all pending TLB invalidation requests */ +struct xarray tlb_lookup; + +/** +* @serial_slot: id to the initial waiter created in tlb_lookup, +* which is used only when failed to allocate new waiter. +*/ +u32 serial_slot; + +/** @next_seqno: the next id (sequence no.) to allocate. */ +u32 next_seqno; +/** @interrupts: pointers to GuC interrupt-managing functions. */ struct {bool enabled;@@ -296,6 +308,11 @@ struct intel_guc {#define MAKE_GUC_VER_STRUCT (ver) MAKE_GUC_VER((ver).major, (ver).minor, (ver).patch)#define GUC_SUBMIT_VER (guc) MAKE_GUC_VER_STRUCT((guc)->submission_version) +struct intel_guc_tlb_wait { +struct wait_queue_head wq; +bool busy; +}; +static inline struct intel_guc *log_to_guc (struct intel_guc_log *log) { return container_of(log, struct intel_guc, log);@@ -417,6 +434,11 @@ static inline bool intel_guc_is_supported(struct intel_guc *guc) {return intel_uc_fw_is_supported (&guc->fw); } + +int intel_guc_invalidate_tlb_full (struct intel_guc *guc); +int intel_guc_invalidate_tlb (struct intel_guc *guc); +int intel_guc_tlb_invalidation_done (struct intel_guc *guc,const u32 *hxg, +u32 size);static inline bool intel_guc_is_wanted (struct intel_guc *guc) {drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +0
-0
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c static int ct_handle_event(struct intel_guc_ct *ct, struct ct_incoming_msg *requ · line 1194
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +3
-0@@ -1186,9 +1186,24 @@ static int ct_handle_event(struct intel_guc_ct *ct, struct ct_incoming_msg *requswitch (action) {case INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE :case INTEL_GUC_ACTION_DEREGISTER_CONTEXT_DONE : +case INTEL_GUC_ACTION_TLB_INVALIDATION_DONE :g2h_release_space (ct, request->size); } +/* +* Handle tlb invalidation response in interrupt context.
Why it needs to happen in the interrupt context part is missing. For instance earlier this function says this:
/*
* Adjusting the space must be done in IRQ or deadlock can occur as the
* CTB processing in the below workqueue can send CTBs which creates a
* circular dependency if the space was returned there.
*/
Is it for the same or different reason here?
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c static int ct_handle_event(struct intel_guc_ct *ct, struct ct_incoming_msg *requ · line 1205
Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +11
-0+* This is processed separately here because this is a cleanup step +* after processing a done action, so there is no followup request +* to process the additional cleanup under as all other done actions +* call g2h_release_space. +*/ +if (action ==INTEL_GUC_ACTION_TLB_INVALIDATION_DONE ) { +int ret =intel_guc_tlb_invalidation_done (ct_to_guc (ct), hxg, request->size); + +ct_free_msg (request); +return ret; + }
Handling cannot be added to ct_process_request() and that called from here directly? It looks it would be more consolidated and more compact like that (all hxg_len and stuff is already done there, just extract the seqno and pass it to intel_guc_tlb_invalidation_done()) , but maybe I am missing something. Then again, yesterday John seemed to agree that would be tidier so dunno.
Quoted 36 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0+spin_lock_irqsave (&ct->requests.lock, flags);list_add_tail (&request->link, &ct->requests.incoming);spin_unlock_irqrestore (&ct->requests.lock, flags);drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1
-0@@ -22,6 +22,7 @@/* Payload length only i.e. don't include G2H header length */ #define G2H_LEN_DW_SCHED_CONTEXT_MODE_SET 2#define G2H_LEN_DW_DEREGISTER_CONTEXT 1 +#define G2H_LEN_DW_INVALIDATE_TLB 1#define GUC_CONTEXT_DISABLE 0#define GUC_CONTEXT_ENABLE 1drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2
-0@@ -1798,9 +1798,11 @@ static void __guc_reset_context(struct intel_context *ce, intel_engine_mask_t stvoid intel_guc_submission_reset (struct intel_guc *guc,intel_engine_mask_t stalled) { +struct intel_guc_tlb_wait *wait;struct intel_context *ce;unsigned long index;unsigned long flags; +unsigned long i;if (unlikely (!guc_submission_initialized (guc))) {/* Reset called during driver load? GuC not yet initialised! */ @@ -1826,6 +1828,16 @@ void intel_guc_submission_reset(struct intel_guc *guc, intel_engine_mask_t stall/* GuC is blown away, drop all references to contexts */ xa_destroy (&guc->context_lookup);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_reset(struct intel_guc *guc, intel_engine_mask_t stall · line 1840
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+ +/* +* The full GT reset will have cleared the TLB caches and flushed the +* G2H message queue; we can release all the blocked waiters. +*/ +xa_for_each (&guc->tlb_lookup, i, wait) { +/* Barrier to ensure the store is observed by the woken thread */ +smp_store_mb (wait->busy,0 ); +wake_up (&wait->wq); + }
Is this safe without the lock against concurrent additions/deletions from the invalidation path?
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2
-0}static void guc_cancel_context_requests (struct intel_context *ce)@@ -1948,6 +1960,41 @@ void intel_guc_submission_reset_finish(struct intel_guc *guc)static void destroyed_worker_func (struct work_struct *w);static void reset_fail_worker_func (struct work_struct *w); +static int init_tlb_lookup (struct intel_guc *guc) +{
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_reset_finish(struct intel_guc *guc) · line 1974
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+struct intel_guc_tlb_wait *wait; +int err; + +xa_init_flags (&guc->tlb_lookup,XA_FLAGS_ALLOC ); + + wait =kzalloc (sizeof (*wait),GFP_KERNEL ); +if (!wait) +return -ENOMEM ; + +init_waitqueue_head (&wait->wq);
Please add a comment here, for the below id allocation:
/* Preallocate a shared id for use under memory pressure. */
Although I have to re-raise the point that the commit message needs to explain why this complexity is needed. Like what do we gain by simply not serializing all invalidations, given how they are serialized in hardware anyway. Again maybe I am missing some super performance win here, but complexity needs to be explained.
Quoted 138 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +102
-2+ err =xa_alloc_cyclic_irq (&guc->tlb_lookup, &guc->serial_slot, wait, + xa_limit_32b, &guc->next_seqno, GFP_KERNEL);> + if (err == -ENOMEM) { +kfree (wait); +return err; + } + +return 0 ; +} + +static void fini_tlb_lookup (struct intel_guc *guc) +{ +struct intel_guc_tlb_wait *wait; + + wait =xa_load (&guc->tlb_lookup, guc->serial_slot); +if (wait) { +GEM_BUG_ON (wait->busy); +kfree (wait); + } + +xa_destroy (&guc->tlb_lookup); +} +/* * Set up the memory resources to be shared with the GuC (via the GGTT) * at firmware loading time. @@ -1966,11 +2013,15 @@ int intel_guc_submission_init(struct intel_guc *guc)return ret; } + ret =init_tlb_lookup (guc); +if (ret) + goto destroy_pool; + guc->submission_state.guc_ids_bitmap =bitmap_zalloc (NUMBER_MULTI_LRC_GUC_ID (guc),GFP_KERNEL );if (!guc->submission_state.guc_ids_bitmap) { ret = -ENOMEM ; - goto destroy_pool; + goto destroy_tlb; } guc->timestamp.ping_delay = (POLL_TIME_CLKS / gt->clock_frequency +1 ) *HZ ;@@ -1979,9 +2030,10 @@ int intel_guc_submission_init(struct intel_guc *guc)return 0 ; +destroy_tlb: +fini_tlb_lookup (guc); destroy_pool:guc_lrc_desc_pool_destroy_v69 (guc); -return ret; }@@ -1994,6 +2046,7 @@ void intel_guc_submission_fini(struct intel_guc *guc)guc_lrc_desc_pool_destroy_v69 (guc);i915_sched_engine_put (guc->sched_engine);bitmap_free (guc->submission_state.guc_ids_bitmap); +fini_tlb_lookup (guc); guc->submission_initialized = false; }@@ -4624,6 +4677,154 @@ g2h_context_lookup(struct intel_guc *guc, u32 ctx_id)return ce; } +static void wait_wake_outstanding_tlb_g2h (struct intel_guc *guc,u32 seqno) +{ +struct intel_guc_tlb_wait *wait; +unsigned long flags; + +xa_lock_irqsave (&guc->tlb_lookup, flags); + wait =xa_load (&guc->tlb_lookup, seqno); + +/* We received a response after the waiting task did exit with a timeout */ +if (wait) +wake_up (&wait->wq); +else +drm_dbg (&guc_to_gt (guc)->i915->drm, +"Stale TLB invalidation response with seqno %d\n" , seqno); + +xa_unlock_irqrestore (&guc->tlb_lookup, flags); +} + +int intel_guc_tlb_invalidation_done (struct intel_guc *guc,const u32 *hxg,u32 size) +{ +u32 seqno, hxg_len, len; + + hxg_len = size -GUC_CTB_MSG_MIN_LEN ; + len = hxg_len -GUC_HXG_MSG_MIN_LEN ; + +/* Check for underflow */ +if (unlikely (len <1 || len > size)) +return -EPROTO ; + + seqno = hxg[GUC_HXG_MSG_MIN_LEN ]; +wait_wake_outstanding_tlb_g2h (guc, seqno); +return 0 ; +} + +static long must_wait_woken (struct wait_queue_entry *wq_entry,long timeout) +{ +/* +* This is equivalent to wait_woken() with the exception that +* we do not wake up early if the kthread task has been completed. +* As we are called from page reclaim in any task context, +* we may be invoked from stopped kthreads, but we *must* +* complete the wait from the HW . +* +* A second problem is that since we are called under reclaim +* and wait_woken() inspected the thread state, it makes an invalid +* assumption that all PF_KTHREAD tasks have set_kthread_struct() +* called upon them, and will trigger a GPF in is_kthread_should_stop(). +*/ +do { +set_current_state (TASK_UNINTERRUPTIBLE ); +if (wq_entry->flags &WQ_FLAG_WOKEN ) +break ; + + timeout =schedule_timeout (timeout); + }while (timeout); +__set_current_state (TASK_RUNNING ); + +/* See wait_woken() and woken_wake_function() */ +smp_store_mb (wq_entry->flags, wq_entry->flags & ~WQ_FLAG_WOKEN ); + +return timeout; +} + +static int guc_send_invalidate_tlb (struct intel_guc *guc,u32 type) +{ +struct intel_guc_tlb_wait _wq, *wq = &_wq; +DEFINE_WAIT_FUNC (wait, woken_wake_function); +struct intel_gt *gt =guc_to_gt (guc); +int err; +u32 seqno; +u32 action[] = { +INTEL_GUC_ACTION_TLB_INVALIDATION ,
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c g2h_context_lookup(struct intel_guc *guc, u32 ctx_id) · line 4761
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+0 , +REG_FIELD_PREP (INTEL_GUC_TLB_INVAL_TYPE_MASK , type) | +REG_FIELD_PREP (INTEL_GUC_TLB_INVAL_MODE_MASK , +INTEL_GUC_TLB_INVAL_MODE_HEAVY ) | + INTEL_GUC_TLB_INVAL_FLUSH_CACHE, + }; +u32 size =ARRAY_SIZE (action); + +if (!intel_guc_ct_enabled (&guc->ct)) +return -EINVAL ;
Isn't this guarded in the callers already?
Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +30
-0+ +init_waitqueue_head (&_wq.wq); + +if (xa_alloc_cyclic_irq (&guc->tlb_lookup, &seqno, wq, + xa_limit_32b, &guc->next_seqno, +GFP_ATOMIC | __GFP_NOWARN) <0 ) { +/* Under severe memory pressure? Serialise TLB allocations */ +xa_lock_irq (&guc->tlb_lookup); + wq =xa_load (&guc->tlb_lookup, guc->serial_slot); +wait_event_lock_irq (wq->wq, + !READ_ONCE (wq->busy), + guc->tlb_lookup.xa_lock); +/* +* Update wq->busy under lock to ensure only one waiter can +* issue the TLB invalidation command using the serial slot at a +* time. The condition is set to true before releasing the lock +* so that other caller continue to wait until woken up again. +*/ + wq->busy = true; +xa_unlock_irq (&guc->tlb_lookup); + + seqno = guc->serial_slot; + } + + action[1 ] = seqno; + +add_wait_queue (&wq->wq, &wait); + + err =intel_guc_send_busy_loop (guc, action, size,G2H_LEN_DW_INVALIDATE_TLB , true); +if (err)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c g2h_context_lookup(struct intel_guc *guc, u32 ctx_id) · line 4801
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-0+ goto out; + +/* +* GuC has a timeout of 1ms for a TLB invalidation response from GAM. On a +* timeout GuC drops the request and has no mechanism to notify the host about +* the timeout. There is also no mechanism for determining the number of +* outstanding requests on the CT buffer. Ergo, keep a larger timeout that accounts +* for this individual timeout and the max number of outstanding invalidation +* requests that can be queued in CT buffer. +*/
AFAIU John explained that it is not just about the queued invalidation requests but any/all messages in the CT channel.
Quoted 19 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +19
-0+#define OUTSTANDING_GUC_TIMEOUT_PERIOD (HZ * 2) +if (!must_wait_woken (&wait,OUTSTANDING_GUC_TIMEOUT_PERIOD )) { +gt_err (gt, +"TLB invalidation response timed out for seqno %u\n" , seqno); + err = -ETIME ; + } +out: +remove_wait_queue (&wq->wq, &wait); +if (seqno != guc->serial_slot) +xa_erase_irq (&guc->tlb_lookup, seqno); + +return err; +} + +/* Full TLB invalidation */ +int intel_guc_invalidate_tlb_full (struct intel_guc *guc) +{ +return guc_send_invalidate_tlb (guc,INTEL_GUC_TLB_INVAL_FULL ); +}
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c g2h_context_lookup(struct intel_guc *guc, u32 ctx_id) · line 4830
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7
-0+ +/* GuC TLB Invalidation: Invalidate the TLB's of GuC itself. */ +int intel_guc_invalidate_tlb (struct intel_guc *guc) +{ +return guc_send_invalidate_tlb (guc,INTEL_GUC_TLB_INVAL_GUC ); +} +int intel_guc_deregister_done_process_msg (struct intel_guc *guc,const u32 *msg,u32 len)
Regards,
Tvrtko
PATCH v4 3/3 drm/i915: No TLB invalidation on wedged or suspended GT
In reply to Jonathan CavittIn case of GT is suspended or wedged, don't allow submission of new TLB invalidation request and cancel all pending requests. The TLB entries will be invalidated either during GuC reload or on system resume.
--- drivers/gpu/drm/i915/gt/intel_gt.h | 26 ++++++++++++ drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 41 +++++++++++++++---- drivers/gpu/drm/i915/i915_driver.c | 5 +++ 4 files changed, 64 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt.h +26 -0
@@ -9,6 +9,7 @@#include "intel_engine_types.h" #include "intel_gt_types.h" #include "intel_reset.h" +#include "i915_drv.h" struct drm_i915_private ;struct drm_printer ;
@@ -179,4 +180,29 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt,void intel_gt_bind_context_set_ready (struct intel_gt *gt);void intel_gt_bind_context_set_unready (struct intel_gt *gt);bool intel_gt_is_bind_context_ready (struct intel_gt *gt); + +static inline void intel_tlb_suspend (struct drm_i915_private *i915) +{ +struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) +wake_up_all_tlb_invalidate (>->uc.guc); +} + +static inline void intel_tlb_resume (struct drm_i915_private *i915) +{ +struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) { +intel_guc_invalidate_tlb_full (>->uc.guc); +intel_guc_invalidate_tlb (>->uc.guc); + } +} +#endif /* __INTEL_GT_H__ */
drivers/gpu/drm/i915/gt/uc/intel_guc.h +1 -0
@@ -536,4 +536,5 @@ void intel_guc_dump_time_info(struct intel_guc *guc, struct drm_printer *p);int intel_guc_sched_disable_gucid_threshold_max (struct intel_guc *guc); +void wake_up_all_tlb_invalidate (struct intel_guc *guc);#endif
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +32 -9
88 lines not on this page · raw message
drivers/gpu/drm/i915/i915_driver.c +5 -0
@@ -1092,6 +1092,9 @@ static int i915_drm_suspend(struct drm_device *dev)intel_dp_mst_suspend (dev_priv);intel_runtime_pm_disable_interrupts (dev_priv); + +intel_tlb_suspend (dev_priv); +intel_hpd_cancel_work (dev_priv);intel_suspend_encoders (dev_priv);
@@ -1263,6 +1266,8 @@ static int i915_drm_resume(struct drm_device *dev)intel_gvt_resume (dev_priv); +intel_tlb_resume (dev_priv); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return 0 ;
Signature · 1 line
2.25.1
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH v4 3/3] drm/i915: No TLB invalidation on wedged or suspended GT
Quoted 19 lines · Jonathan Cavitt
In case of GT is suspended or wedged, don't allow submission of new TLB invalidation request and cancel all pending requests. The TLB entries will be invalidated either during GuC reload or on system resume.
Signed-off-by Fei Yang <[email protected]>Signed-off-by Jonathan Cavitt <[email protected]>CC John Harrison <[email protected]>--- drivers/gpu/drm/i915/gt/intel_gt.h | 26 ++++++++++++ drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 41 +++++++++++++++---- drivers/gpu/drm/i915/i915_driver.c | 5 +++ 4 files changed, 64 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gt/intel_gt.h +0
-0
drivers/gpu/drm/i915/gt/intel_gt.h line 12
Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_gt.h +1
-0@@ -9,6 +9,7 @@#include "intel_engine_types.h" #include "intel_gt_types.h" #include "intel_reset.h" +#include "i915_drv.h"
Do not include headers from headers, especially do not include i915_drv.h from headers.
I thought I just explained this in a previous thread.
Quoted 21 lines
drivers/gpu/drm/i915/gt/intel_gt.h +14
-0struct drm_i915_private ;struct drm_printer ;@@ -179,4 +180,29 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt,void intel_gt_bind_context_set_ready (struct intel_gt *gt);void intel_gt_bind_context_set_unready (struct intel_gt *gt);bool intel_gt_is_bind_context_ready (struct intel_gt *gt); + +static inline void intel_tlb_suspend (struct drm_i915_private *i915) +{ +struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) +wake_up_all_tlb_invalidate (>->uc.guc); +} + +static inline void intel_tlb_resume (struct drm_i915_private *i915) +{
drivers/gpu/drm/i915/gt/intel_gt.h enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt, · line 206
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt.h +10
-0+struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) { +intel_guc_invalidate_tlb_full (>->uc.guc); +intel_guc_invalidate_tlb (>->uc.guc); + } +}
Do not add static inlines that require you to pull in other headers, at least not without justification. I don't think this one could be justified.
I thought I just explained this in a prevous thread.
I honestly don't know what you think you'll achieve by using static inlines here, but *always* err on the side of making them proper functions instead.
Side note on naming, functions beginning with intel_tlb_ prefix belong in intel_tlb.[ch]. If these don't belong there, then the prefix is wrong.
BR,
Jani.
Quoted 134 lines
drivers/gpu/drm/i915/gt/intel_gt.h +1
-0+#endif /* __INTEL_GT_H__ */ drivers/gpu/drm/i915/gt/uc/intel_guc.h +1
-0@@ -536,4 +536,5 @@ void intel_guc_dump_time_info(struct intel_guc *guc, struct drm_printer *p);int intel_guc_sched_disable_gucid_threshold_max (struct intel_guc *guc); +void wake_up_all_tlb_invalidate (struct intel_guc *guc);#endif drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +32
-9@@ -32,6 +32,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_irq.h" #include "i915_trace.h" /** @@ -1796,13 +1797,23 @@ static void __guc_reset_context(struct intel_context *ce, intel_engine_mask_t stintel_context_put (parent); } -void intel_guc_submission_reset (struct intel_guc *guc,intel_engine_mask_t stalled) +void wake_up_all_tlb_invalidate (struct intel_guc *guc) {struct intel_guc_tlb_wait *wait; +unsigned long i; + +xa_for_each (&guc->tlb_lookup, i, wait) { +/* Barrier to ensure the store is observed by the woken thread */ +smp_store_mb (wait->busy,0 ); +wake_up (&wait->wq); + } +} + +void intel_guc_submission_reset (struct intel_guc *guc,intel_engine_mask_t stalled) +{struct intel_context *ce;unsigned long index;unsigned long flags; -unsigned long i;if (unlikely (!guc_submission_initialized (guc))) {/* Reset called during driver load? GuC not yet initialised! */ @@ -1833,11 +1844,7 @@ void intel_guc_submission_reset(struct intel_guc *guc, intel_engine_mask_t stall* The full GT reset will have cleared the TLB caches and flushed the * G2H message queue; we can release all the blocked waiters. */ -xa_for_each (&guc->tlb_lookup, i, wait) { -/* Barrier to ensure the store is observed by the woken thread */ -smp_store_mb (wait->busy,0 ); -wake_up (&wait->wq); - } +wake_up_all_tlb_invalidate (guc); }static void guc_cancel_context_requests (struct intel_context *ce)@@ -1933,6 +1940,12 @@ void intel_guc_submission_cancel_requests(struct intel_guc *guc)/* GuC is blown away, drop all references to contexts */ xa_destroy (&guc->context_lookup); + +/* +* Wedged GT won't respond to any TLB invalidation request. Simply +* release all the blocked waiters. +*/ +wake_up_all_tlb_invalidate (guc); }void intel_guc_submission_reset_finish (struct intel_guc *guc)@@ -4740,6 +4753,14 @@ static long must_wait_woken(struct wait_queue_entry *wq_entry, long timeout)return timeout; } +static bool intel_gt_is_enabled (const struct intel_gt *gt) +{ +/* Check if GT is wedged or suspended */ +if (intel_gt_is_wedged (gt) || !intel_irqs_enabled (gt->i915)) +return false; +return true; +} +static int guc_send_invalidate_tlb (struct intel_guc *guc,u32 type) {struct intel_guc_tlb_wait _wq, *wq = &_wq;@@ -4757,7 +4778,8 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc, u32 type) };u32 size =ARRAY_SIZE (action); -if (!intel_guc_ct_enabled (&guc->ct)) +if (!intel_gt_is_enabled (gt) || + !intel_guc_ct_enabled (&guc->ct))return -EINVAL ;init_waitqueue_head (&_wq.wq);@@ -4800,7 +4822,8 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc, u32 type)* requests that can be queued in CT buffer. */ #define OUTSTANDING_GUC_TIMEOUT_PERIOD (HZ * 2) -if (!must_wait_woken (&wait,OUTSTANDING_GUC_TIMEOUT_PERIOD )) { +if (intel_gt_is_enabled (gt) && + !must_wait_woken (&wait,OUTSTANDING_GUC_TIMEOUT_PERIOD )) {gt_err (gt,"TLB invalidation response timed out for seqno %u\n" , seqno); err = -ETIME ;drivers/gpu/drm/i915/i915_driver.c +5
-0@@ -1092,6 +1092,9 @@ static int i915_drm_suspend(struct drm_device *dev)intel_dp_mst_suspend (dev_priv);intel_runtime_pm_disable_interrupts (dev_priv); + +intel_tlb_suspend (dev_priv); +intel_hpd_cancel_work (dev_priv);intel_suspend_encoders (dev_priv);@@ -1263,6 +1266,8 @@ static int i915_drm_resume(struct drm_device *dev)intel_gvt_resume (dev_priv); +intel_tlb_resume (dev_priv); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return 0 ;
Signature · 1 line
Jani Nikula, Intel
Re: [Intel-gfx] [PATCH v4 3/3] drm/i915: No TLB invalidation on wedged or suspended GT
In reply to Jonathan CavittQuoted 42 lines · Jonathan Cavitt
In case of GT is suspended or wedged, don't allow submission of new TLB invalidation request and cancel all pending requests. The TLB entries will be invalidated either during GuC reload or on system resume.
Signed-off-by Fei Yang <[email protected]>Signed-off-by Jonathan Cavitt <[email protected]>CC John Harrison <[email protected]>--- drivers/gpu/drm/i915/gt/intel_gt.h | 26 ++++++++++++ drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 41 +++++++++++++++---- drivers/gpu/drm/i915/i915_driver.c | 5 +++ 4 files changed, 64 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gt/intel_gt.h +13
-0@@ -9,6 +9,7 @@#include "intel_engine_types.h" #include "intel_gt_types.h" #include "intel_reset.h" +#include "i915_drv.h" struct drm_i915_private ;struct drm_printer ;@@ -179,4 +180,29 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt,void intel_gt_bind_context_set_ready (struct intel_gt *gt);void intel_gt_bind_context_set_unready (struct intel_gt *gt);bool intel_gt_is_bind_context_ready (struct intel_gt *gt); + +static inline void intel_tlb_suspend (struct drm_i915_private *i915) +{ +struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) +wake_up_all_tlb_invalidate (>->uc.guc); +} +
drivers/gpu/drm/i915/gt/intel_gt.h enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt, · line 204
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_gt.h +10
-0+static inline void intel_tlb_resume (struct drm_i915_private *i915) +{ +struct intel_gt *gt; +int i; + +if (!HAS_GUC_TLB_INVALIDATION (i915)) +return ; +for_each_gt (gt, i915, i) { +intel_guc_invalidate_tlb_full (>->uc.guc); +intel_guc_invalidate_tlb (>->uc.guc);
Why full and not full? At least the naming suggestes first to be superset of the second.
drivers/gpu/drm/i915/gt/intel_gt.h enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt, · line 206
Quoted 2 lines
drivers/gpu/drm/i915/gt/intel_gt.h +2
-0+ } +}
I see no justification for static inlines and I see no reason not to have this in intel_tlb.h|c.
Also, I suggested having them called from intel_gt_suspend(_*) and intel_gt_resume. Or there is also intel_uc_suspend/resume. Either of those places would benefit from the existing for_each_gt applied at the GEM level, when it calls into the GT component.
Are those at the wrong spot in the suspend/resume sequence so it wouldn't work?
Maybe it is a matter of taste but since the implementation is so GT centric (everything added operates strictly on a >->uc.guc pointer) that it really looks to me it should be better placed in one of those two components.
Regards,
Tvrtko
Quoted 134 lines
drivers/gpu/drm/i915/gt/intel_gt.h +1
-0+#endif /* __INTEL_GT_H__ */ drivers/gpu/drm/i915/gt/uc/intel_guc.h +1
-0@@ -536,4 +536,5 @@ void intel_guc_dump_time_info(struct intel_guc *guc, struct drm_printer *p);int intel_guc_sched_disable_gucid_threshold_max (struct intel_guc *guc); +void wake_up_all_tlb_invalidate (struct intel_guc *guc);#endif drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +32
-9@@ -32,6 +32,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_irq.h" #include "i915_trace.h" /** @@ -1796,13 +1797,23 @@ static void __guc_reset_context(struct intel_context *ce, intel_engine_mask_t stintel_context_put (parent); } -void intel_guc_submission_reset (struct intel_guc *guc,intel_engine_mask_t stalled) +void wake_up_all_tlb_invalidate (struct intel_guc *guc) {struct intel_guc_tlb_wait *wait; +unsigned long i; + +xa_for_each (&guc->tlb_lookup, i, wait) { +/* Barrier to ensure the store is observed by the woken thread */ +smp_store_mb (wait->busy,0 ); +wake_up (&wait->wq); + } +} + +void intel_guc_submission_reset (struct intel_guc *guc,intel_engine_mask_t stalled) +{struct intel_context *ce;unsigned long index;unsigned long flags; -unsigned long i;if (unlikely (!guc_submission_initialized (guc))) {/* Reset called during driver load? GuC not yet initialised! */ @@ -1833,11 +1844,7 @@ void intel_guc_submission_reset(struct intel_guc *guc, intel_engine_mask_t stall* The full GT reset will have cleared the TLB caches and flushed the * G2H message queue; we can release all the blocked waiters. */ -xa_for_each (&guc->tlb_lookup, i, wait) { -/* Barrier to ensure the store is observed by the woken thread */ -smp_store_mb (wait->busy,0 ); -wake_up (&wait->wq); - } +wake_up_all_tlb_invalidate (guc); }static void guc_cancel_context_requests (struct intel_context *ce)@@ -1933,6 +1940,12 @@ void intel_guc_submission_cancel_requests(struct intel_guc *guc)/* GuC is blown away, drop all references to contexts */ xa_destroy (&guc->context_lookup); + +/* +* Wedged GT won't respond to any TLB invalidation request. Simply +* release all the blocked waiters. +*/ +wake_up_all_tlb_invalidate (guc); }void intel_guc_submission_reset_finish (struct intel_guc *guc)@@ -4740,6 +4753,14 @@ static long must_wait_woken(struct wait_queue_entry *wq_entry, long timeout)return timeout; } +static bool intel_gt_is_enabled (const struct intel_gt *gt) +{ +/* Check if GT is wedged or suspended */ +if (intel_gt_is_wedged (gt) || !intel_irqs_enabled (gt->i915)) +return false; +return true; +} +static int guc_send_invalidate_tlb (struct intel_guc *guc,u32 type) {struct intel_guc_tlb_wait _wq, *wq = &_wq;@@ -4757,7 +4778,8 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc, u32 type) };u32 size =ARRAY_SIZE (action); -if (!intel_guc_ct_enabled (&guc->ct)) +if (!intel_gt_is_enabled (gt) || + !intel_guc_ct_enabled (&guc->ct))return -EINVAL ;init_waitqueue_head (&_wq.wq);@@ -4800,7 +4822,8 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc, u32 type)* requests that can be queued in CT buffer. */ #define OUTSTANDING_GUC_TIMEOUT_PERIOD (HZ * 2) -if (!must_wait_woken (&wait,OUTSTANDING_GUC_TIMEOUT_PERIOD )) { +if (intel_gt_is_enabled (gt) && + !must_wait_woken (&wait,OUTSTANDING_GUC_TIMEOUT_PERIOD )) {gt_err (gt,"TLB invalidation response timed out for seqno %u\n" , seqno); err = -ETIME ;drivers/gpu/drm/i915/i915_driver.c +5
-0@@ -1092,6 +1092,9 @@ static int i915_drm_suspend(struct drm_device *dev)intel_dp_mst_suspend (dev_priv);intel_runtime_pm_disable_interrupts (dev_priv); + +intel_tlb_suspend (dev_priv); +intel_hpd_cancel_work (dev_priv);intel_suspend_encoders (dev_priv);@@ -1263,6 +1266,8 @@ static int i915_drm_resume(struct drm_device *dev)intel_gvt_resume (dev_priv); +intel_tlb_resume (dev_priv); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return 0 ;
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
URL : https://patchwork.freedesktop.org/series/124575/
State : warning
== Summary ==
Error: dim checkpatch failed2112f658680f drm/i915: Add GuC TLB Invalidation pci tags febaffe1c6c6 drm/i915: Define and use GuC and CTB TLB invalidation routines -:124: ERROR:TRAILING_WHITESPACE: trailing whitespace
#124: FILE: drivers/gpu/drm/i915/gt/intel_tlb.c:142:
+^I^I^I/* $
-:224: ERROR:TRAILING_WHITESPACE: trailing whitespace #224: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc.h:437:
+^I$
-:244: ERROR:TRAILING_WHITESPACE: trailing whitespace #244: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c:1193:
+^I/* $
-:338: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #338: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1991:
+ GEM_BUG_ON(wait->busy);
total: 3 errors, 1 warnings, 0 checks, 459 lines checked 6a9427e33b51 drm/i915: No TLB invalidation on wedged or suspended GT
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
URL : https://patchwork.freedesktop.org/series/124575/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags
URL : https://patchwork.freedesktop.org/series/124575/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13706 -> Patchwork_124575v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_124575v1 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_124575v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/index.html
Participating hosts (39 -> 38)
------------------------------
Additional (1): fi-kbl-soraka
Missing (2): fi-tgl-1115g4 fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_124575v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_tlb:
- bat-mtlp-6: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-mtlp-6/igt@i915_selftest@live@gt_tlb.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-mtlp-6/igt@i915_selftest@live@gt_tlb.html
- bat-mtlp-8: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-mtlp-8/igt@i915_selftest@live@gt_tlb.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-mtlp-8/igt@i915_selftest@live@gt_tlb.html
* igt@i915_selftest@live@gtt:
- bat-rpls-1: NOTRUN -> [INCOMPLETE][5]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@kms_addfb_basic@addfb25-framebuffer-vs-set-tiling:
- bat-adlm-1: [PASS][6] -> [INCOMPLETE][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-adlm-1/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-adlm-1/igt@[email protected]
* igt@kms_busy@basic@flip:
- bat-adlp-6: [PASS][8] -> [INCOMPLETE][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-adlp-6/igt@kms_busy@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-adlp-6/igt@kms_busy@[email protected]
* igt@kms_busy@basic@modeset:
- bat-adlp-11: [PASS][10] -> [ABORT][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-adlp-11/igt@kms_busy@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-adlp-11/igt@kms_busy@[email protected]
Known issues
------------
Here are the changes found in Patchwork_124575v1 that come from known issues:
### CI changes ###
#### Issues hit ####
* boot:
- fi-bsw-n3050: [PASS][12] -> [FAIL][13] ([i915#8293])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/fi-bsw-n3050/boot.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-bsw-n3050/boot.html
### IGT changes ###
#### Issues hit ####
* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#2190])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][15] ([fdo#109271] / [i915#4613]) +3 other tests skip
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-soraka/igt@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][16] ([i915#5334] / [i915#7872])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
- fi-apl-guc: [PASS][17] -> [DMESG-FAIL][18] ([i915#5334])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][19] ([i915#1886] / [i915#7913])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@gtt:
- bat-adlp-9: [PASS][20] -> [INCOMPLETE][21] ([i915#7913])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-adlp-9/igt@i915_selftest@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-adlp-9/igt@i915_selftest@[email protected]
- bat-dg2-11: [PASS][22] -> [INCOMPLETE][23] ([i915#7913])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-dg2-11/igt@i915_selftest@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-dg2-11/igt@i915_selftest@[email protected]
* igt@i915_suspend@basic-s3-without-i915:
- bat-mtlp-8: NOTRUN -> [SKIP][24] ([i915#6645])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-mtlp-8/igt@[email protected]
* igt@kms_dsc@dsc-basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][25] ([fdo#109271]) +9 other tests skip
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-soraka/igt@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][26] ([i915#1845]) +3 other tests skip
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-dg2-11/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@mman:
- bat-rpls-1: [TIMEOUT][27] ([i915#6794] / [i915#7392]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-rpls-1/igt@i915_selftest@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@requests:
- bat-mtlp-8: [ABORT][29] ([i915#9414]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/bat-mtlp-8/igt@i915_selftest@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/bat-mtlp-8/igt@i915_selftest@[email protected]
* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [FAIL][31] ([IGT#3]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13706/fi-kbl-guc/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/fi-kbl-guc/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[Intel XE#485]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/485
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794
[i915#7392]: https://gitlab.freedesktop.org/drm/intel/issues/7392
[i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
[i915#9414]: https://gitlab.freedesktop.org/drm/intel/issues/9414
Build changes
-------------
* Linux: CI_DRM_13706 -> Patchwork_124575v1
CI-20190529: 20190529
CI_DRM_13706: cbd5a99e7ee59fc4acc89d448ad548fa126b2dae @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7510: a4b4a33d8312e4e30ca23d26bbd1758e56540e1d @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_124575v1: cbd5a99e7ee59fc4acc89d448ad548fa126b2dae @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
b2e2b9de3d09 drm/i915: No TLB invalidation on wedged or suspended GT 158c13765805 drm/i915: Define and use GuC and CTB TLB invalidation routines ab953a95cb5a drm/i915: Add GuC TLB Invalidation pci tags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v1/index.html
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
URL : https://patchwork.freedesktop.org/series/124575/
State : warning
== Summary ==
Error: dim checkpatch failedd3517ddb590f drm/i915: Add GuC TLB Invalidation pci tags 455d5cfecf10 drm/i915: Define and use GuC and CTB TLB invalidation routines -:124: ERROR:TRAILING_WHITESPACE: trailing whitespace
#124: FILE: drivers/gpu/drm/i915/gt/intel_tlb.c:142:
+^I^I^I/* $
-:224: ERROR:TRAILING_WHITESPACE: trailing whitespace #224: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc.h:437:
+^I$
-:244: ERROR:TRAILING_WHITESPACE: trailing whitespace #244: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c:1193:
+^I/* $
-:338: WARNING:AVOID_BUG: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants #338: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1991:
+ GEM_BUG_ON(wait->busy);
total: 3 errors, 1 warnings, 0 checks, 459 lines checked 3fb6f0af664b drm/i915: No TLB invalidation on wedged or suspended GT
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
URL : https://patchwork.freedesktop.org/series/124575/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
In reply to Jonathan Cavitt== Series Details ==
== Series Details ==
Series: series starting with [v4,1/3] drm/i915: Add GuC TLB Invalidation pci tags (rev2)
URL : https://patchwork.freedesktop.org/series/124575/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13708 -> Patchwork_124575v2
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_124575v2 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_124575v2, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/index.html
Participating hosts (40 -> 40)
------------------------------
Additional (1): bat-dg2-8
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_124575v2:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_tlb:
- bat-mtlp-6: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-mtlp-6/igt@i915_selftest@live@gt_tlb.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-mtlp-6/igt@i915_selftest@live@gt_tlb.html
- bat-mtlp-8: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-mtlp-8/igt@i915_selftest@live@gt_tlb.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-mtlp-8/igt@i915_selftest@live@gt_tlb.html
* igt@i915_selftest@live@gtt:
- bat-rpls-1: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-rpls-1/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@kms_addfb_basic@addfb25-framebuffer-vs-set-tiling:
- bat-adlm-1: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-adlm-1/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-adlm-1/igt@[email protected]
* igt@kms_busy@basic@flip:
- bat-adlp-11: [PASS][9] -> [ABORT][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-adlp-11/igt@kms_busy@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-adlp-11/igt@kms_busy@[email protected]
* igt@kms_busy@basic@modeset:
- bat-adlp-11: [PASS][11] -> [DMESG-WARN][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-adlp-11/igt@kms_busy@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-adlp-11/igt@kms_busy@[email protected]
Known issues
------------
Here are the changes found in Patchwork_124575v2 that come from known issues:
### CI changes ###
#### Issues hit ####
* boot:
- fi-bsw-n3050: [PASS][13] -> [FAIL][14] ([i915#8293])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/fi-bsw-n3050/boot.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/fi-bsw-n3050/boot.html
### IGT changes ###
#### Issues hit ####
* igt@gem_mmap@basic:
- bat-dg2-8: NOTRUN -> [SKIP][15] ([i915#4083])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@gem_mmap_gtt@basic:
- bat-dg2-8: NOTRUN -> [SKIP][16] ([i915#4077]) +2 other tests skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@gem_tiled_pread_basic:
- bat-dg2-8: NOTRUN -> [SKIP][17] ([i915#4079]) +1 other test skip
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@gem_tiled_pread_basic.html
* igt@i915_pm_rps@basic-api:
- bat-dg2-8: NOTRUN -> [SKIP][18] ([i915#6621])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@i915_selftest@live@gtt:
- bat-adlp-9: [PASS][19] -> [INCOMPLETE][20] ([i915#7913])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-adlp-9/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-adlp-9/igt@i915_selftest@[email protected]
- bat-dg2-11: [PASS][21] -> [INCOMPLETE][22] ([i915#7913])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-dg2-11/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-11/igt@i915_selftest@[email protected]
* igt@i915_suspend@basic-s3-without-i915:
- bat-mtlp-8: NOTRUN -> [SKIP][23] ([i915#6645])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-mtlp-8/igt@[email protected]
- bat-dg2-8: NOTRUN -> [SKIP][24] ([i915#6645])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][25] ([i915#5190])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][26] ([i915#4215] / [i915#5190])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_addfb_basic@framebuffer-vs-set-tiling:
- bat-dg2-8: NOTRUN -> [SKIP][27] ([i915#4212]) +6 other tests skip
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg2-8: NOTRUN -> [SKIP][28] ([i915#4212] / [i915#5608])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][29] ([i915#4103] / [i915#4213] / [i915#5608]) +1 other test skip
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- bat-dg2-8: NOTRUN -> [SKIP][30] ([fdo#109285])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_force_connector_basic@prune-stale-modes:
- bat-dg2-8: NOTRUN -> [SKIP][31] ([i915#5274])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [PASS][32] -> [FAIL][33] ([IGT#3])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/fi-kbl-guc/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/fi-kbl-guc/igt@[email protected]
* igt@kms_psr@cursor_plane_move:
- bat-dg2-8: NOTRUN -> [SKIP][34] ([i915#1072]) +3 other tests skip
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@kms_psr@cursor_plane_move.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg2-8: NOTRUN -> [SKIP][35] ([i915#3555])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@prime_vgem@basic-fence-flip:
- bat-dg2-8: NOTRUN -> [SKIP][36] ([i915#3708])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@prime_vgem@basic-fence-mmap:
- bat-dg2-8: NOTRUN -> [SKIP][37] ([i915#3708] / [i915#4077]) +1 other test skip
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
* igt@prime_vgem@basic-write:
- bat-dg2-8: NOTRUN -> [SKIP][38] ([i915#3291] / [i915#3708]) +2 other tests skip
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-8/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s0@smem:
- bat-dg2-9: [INCOMPLETE][39] ([i915#9275]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-dg2-9/igt@gem_exec_suspend@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-dg2-9/igt@gem_exec_suspend@[email protected]
* igt@i915_selftest@live@requests:
- bat-mtlp-8: [ABORT][41] ([i915#9414]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13708/bat-mtlp-8/igt@i915_selftest@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/bat-mtlp-8/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5608]: https://gitlab.freedesktop.org/drm/intel/issues/5608
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275
[i915#9414]: https://gitlab.freedesktop.org/drm/intel/issues/9414
Build changes
-------------
* Linux: CI_DRM_13708 -> Patchwork_124575v2
CI-20190529: 20190529
CI_DRM_13708: e73c26348a1d154ce981707ae3508018267394b1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7510: a4b4a33d8312e4e30ca23d26bbd1758e56540e1d @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_124575v2: e73c26348a1d154ce981707ae3508018267394b1 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
6f9585d61caf drm/i915: No TLB invalidation on wedged or suspended GT 86e07f39ff60 drm/i915: Define and use GuC and CTB TLB invalidation routines 4263383b1aae drm/i915: Add GuC TLB Invalidation pci tags
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_124575v2/index.html
Jani Nikula
maintainerQuoted 3 lines · Jonathan Cavitt
Add device info tags for if GuC TLB Invalidation is enabled. Since GuC based TLB invalidation is only strictly necessary for MTL presently, only enable GuC based TLB invalidations for MTL.
In the subject, what's a "pci tag"?
BR,
Jani.
Quoted 44 lines
Signed-off-by Jonathan Cavitt <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 1 + drivers/gpu/drm/i915/intel_device_info.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -821,4 +821,5 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_LMEMBAR_SMEM_STOLEN (i915) (!HAS_LMEM(i915) && \ GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) +#define HAS_GUC_TLB_INVALIDATION (i915) (INTEL_INFO(i915)->has_guc_tlb_invalidation)#endif drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -837,6 +837,7 @@ static const struct intel_device_info mtl_info = { .memory_regions = REGION_SMEM | REGION_STOLEN_LMEM, .platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(CCS0), .require_force_probe = 1, + .has_guc_tlb_invalidation = 1, MTL_CACHELEVEL, };drivers/gpu/drm/i915/intel_device_info.h +2
-1@@ -173,7 +173,8 @@ enum intel_ppgtt_type {func (has_coherent_ggtt); \func (tuning_thread_rr_after_dep); \func (unfenced_needs_alignment); \ -func (hws_needs_physical); +func (hws_needs_physical); \ +func (has_guc_tlb_invalidation);struct intel_ip_version {u8 ver;
Signature · 1 line
Jani Nikula, Intel