* [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool @ 2020-07-24 16:37 Chris Wilson 2020-07-24 16:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: Chris Wilson @ 2020-07-24 16:37 UTC (permalink / raw) To: intel-gfx; +Cc: Chris Wilson Some very low hanging fruit, but contention on the pool->lock is noticeable between intel_gt_get_buffer_pool() and pool_retire(), with the majority of the hold time due to the locked list iteration. If we make the node itself RCU protected, we can perform the search for an suitable node just under RCU, reserving taking the lock itself for claiming the node and manipulating the list. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- .../gpu/drm/i915/gt/intel_gt_buffer_pool.c | 57 ++++++++++++------- .../drm/i915/gt/intel_gt_buffer_pool_types.h | 7 ++- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c index 418ae184cecf..7c688dee982b 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c @@ -35,37 +35,46 @@ static void node_free(struct intel_gt_buffer_pool_node *node) { i915_gem_object_put(node->obj); i915_active_fini(&node->active); - kfree(node); + kfree_rcu(node, rcu); } static void pool_free_work(struct work_struct *wrk) { struct intel_gt_buffer_pool *pool = container_of(wrk, typeof(*pool), work.work); - struct intel_gt_buffer_pool_node *node, *next; + struct intel_gt_buffer_pool_node *node, *stale = NULL; unsigned long old = jiffies - HZ; bool active = false; - LIST_HEAD(stale); int n; /* Free buffers that have not been used in the past second */ - spin_lock_irq(&pool->lock); for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) { struct list_head *list = &pool->cache_list[n]; - /* Most recent at head; oldest at tail */ - list_for_each_entry_safe_reverse(node, next, list, link) { - if (time_before(node->age, old)) - break; + if (list_empty(list)) + continue; - list_move(&node->link, &stale); + /* Most recent at head; oldest at tail */ + if (spin_trylock_irq(&pool->lock)) { + list_for_each_entry_reverse(node, list, link) { + if (time_before(node->age, old)) + break; + + node->age = 0; + list_del_rcu(&node->link); + node->free = stale; + stale = node; + } + spin_unlock_irq(&pool->lock); } + active |= !list_empty(list); } - spin_unlock_irq(&pool->lock); - list_for_each_entry_safe(node, next, &stale, link) + while ((node = stale)) { + stale = stale->free; node_free(node); + } if (active) schedule_delayed_work(&pool->work, @@ -110,7 +119,7 @@ static void pool_retire(struct i915_active *ref) spin_lock_irqsave(&pool->lock, flags); node->age = jiffies; - list_add(&node->link, list); + list_add_rcu(&node->link, list); spin_unlock_irqrestore(&pool->lock, flags); schedule_delayed_work(&pool->work, @@ -151,22 +160,32 @@ intel_gt_get_buffer_pool(struct intel_gt *gt, size_t size) struct intel_gt_buffer_pool *pool = >->buffer_pool; struct intel_gt_buffer_pool_node *node; struct list_head *list; - unsigned long flags; + bool found = false; int ret; size = PAGE_ALIGN(size); list = bucket_for_size(pool, size); - spin_lock_irqsave(&pool->lock, flags); - list_for_each_entry(node, list, link) { + rcu_read_lock(); + list_for_each_entry_rcu(node, list, link) { + unsigned long flags; + if (node->obj->base.size < size) continue; - list_del(&node->link); - break; + + spin_lock_irqsave(&pool->lock, flags); + if (node->age) { + list_del_rcu(&node->link); + node->age = 0; + found = true; + } + spin_unlock_irqrestore(&pool->lock, flags); + if (found) + break; } - spin_unlock_irqrestore(&pool->lock, flags); + rcu_read_unlock(); - if (&node->link == list) { + if (!found) { node = node_create(pool, size); if (IS_ERR(node)) return node; diff --git a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h index e28bdda771ed..d30dc6d32f10 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h @@ -25,8 +25,13 @@ struct intel_gt_buffer_pool_node { struct i915_active active; struct drm_i915_gem_object *obj; struct list_head link; - struct intel_gt_buffer_pool *pool; + union { + struct intel_gt_buffer_pool *pool; + struct intel_gt_buffer_pool_node *free; + struct rcu_head rcu; + }; unsigned long age; + }; #endif /* INTEL_GT_BUFFER_POOL_TYPES_H */ -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson @ 2020-07-24 16:44 ` Patchwork 2020-07-24 17:02 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-07-24 16:44 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool URL : https://patchwork.freedesktop.org/series/79855/ State : warning == Summary == $ dim sparse --fast origin/drm-tip Sparse version: v0.6.0 Fast mode used, each commit won't be checked separately. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson 2020-07-24 16:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork @ 2020-07-24 17:02 ` Patchwork 2020-07-24 17:51 ` [Intel-gfx] [PATCH] " Chris Wilson ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-07-24 17:02 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx [-- Attachment #1.1: Type: text/plain, Size: 13687 bytes --] == Series Details == Series: drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool URL : https://patchwork.freedesktop.org/series/79855/ State : failure == Summary == CI Bug Log - changes from CI_DRM_8783 -> Patchwork_18240 ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with Patchwork_18240 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_18240, please notify your bug team 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_18240/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in Patchwork_18240: ### IGT changes ### #### Possible regressions #### * igt@gem_ctx_create@basic-files: - fi-kbl-r: [PASS][1] -> [INCOMPLETE][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-r/igt@gem_ctx_create@basic-files.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-r/igt@gem_ctx_create@basic-files.html - fi-kbl-8809g: [PASS][3] -> [INCOMPLETE][4] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-8809g/igt@gem_ctx_create@basic-files.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-8809g/igt@gem_ctx_create@basic-files.html - fi-cfl-guc: [PASS][5] -> [INCOMPLETE][6] [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-cfl-guc/igt@gem_ctx_create@basic-files.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-cfl-guc/igt@gem_ctx_create@basic-files.html - fi-skl-guc: [PASS][7] -> [DMESG-WARN][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-skl-guc/igt@gem_ctx_create@basic-files.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-skl-guc/igt@gem_ctx_create@basic-files.html - fi-cml-s: [PASS][9] -> [INCOMPLETE][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-cml-s/igt@gem_ctx_create@basic-files.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-cml-s/igt@gem_ctx_create@basic-files.html - fi-skl-6700k2: [PASS][11] -> [INCOMPLETE][12] [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-skl-6700k2/igt@gem_ctx_create@basic-files.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-skl-6700k2/igt@gem_ctx_create@basic-files.html - fi-kbl-x1275: [PASS][13] -> [INCOMPLETE][14] [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-x1275/igt@gem_ctx_create@basic-files.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-x1275/igt@gem_ctx_create@basic-files.html - fi-kbl-7500u: [PASS][15] -> [INCOMPLETE][16] [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-7500u/igt@gem_ctx_create@basic-files.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-7500u/igt@gem_ctx_create@basic-files.html - fi-kbl-soraka: [PASS][17] -> [INCOMPLETE][18] [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-soraka/igt@gem_ctx_create@basic-files.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-soraka/igt@gem_ctx_create@basic-files.html - fi-skl-lmem: [PASS][19] -> [INCOMPLETE][20] [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-skl-lmem/igt@gem_ctx_create@basic-files.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-skl-lmem/igt@gem_ctx_create@basic-files.html - fi-kbl-guc: [PASS][21] -> [INCOMPLETE][22] [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-guc/igt@gem_ctx_create@basic-files.html [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-guc/igt@gem_ctx_create@basic-files.html - fi-cfl-8109u: [PASS][23] -> [INCOMPLETE][24] [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-cfl-8109u/igt@gem_ctx_create@basic-files.html [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-cfl-8109u/igt@gem_ctx_create@basic-files.html * igt@gem_exec_create@basic: - fi-skl-6600u: [PASS][25] -> [INCOMPLETE][26] [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-skl-6600u/igt@gem_exec_create@basic.html [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-skl-6600u/igt@gem_exec_create@basic.html - fi-cml-u2: [PASS][27] -> [INCOMPLETE][28] [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-cml-u2/igt@gem_exec_create@basic.html [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-cml-u2/igt@gem_exec_create@basic.html * igt@gem_exec_gttfill@basic: - fi-tgl-y: [PASS][29] -> [INCOMPLETE][30] [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-tgl-y/igt@gem_exec_gttfill@basic.html [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-tgl-y/igt@gem_exec_gttfill@basic.html - fi-icl-y: [PASS][31] -> [INCOMPLETE][32] [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-icl-y/igt@gem_exec_gttfill@basic.html [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-icl-y/igt@gem_exec_gttfill@basic.html - fi-bdw-5557u: [PASS][33] -> [INCOMPLETE][34] [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bdw-5557u/igt@gem_exec_gttfill@basic.html [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bdw-5557u/igt@gem_exec_gttfill@basic.html - fi-blb-e6850: [PASS][35] -> [INCOMPLETE][36] [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-blb-e6850/igt@gem_exec_gttfill@basic.html [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-blb-e6850/igt@gem_exec_gttfill@basic.html - fi-hsw-4770: [PASS][37] -> [INCOMPLETE][38] [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-hsw-4770/igt@gem_exec_gttfill@basic.html [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-hsw-4770/igt@gem_exec_gttfill@basic.html - fi-ivb-3770: [PASS][39] -> [INCOMPLETE][40] [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-ivb-3770/igt@gem_exec_gttfill@basic.html [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-ivb-3770/igt@gem_exec_gttfill@basic.html - fi-icl-u2: [PASS][41] -> [INCOMPLETE][42] [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-icl-u2/igt@gem_exec_gttfill@basic.html [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-icl-u2/igt@gem_exec_gttfill@basic.html - fi-byt-j1900: [PASS][43] -> [INCOMPLETE][44] [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-byt-j1900/igt@gem_exec_gttfill@basic.html [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-byt-j1900/igt@gem_exec_gttfill@basic.html - fi-snb-2520m: [PASS][45] -> [INCOMPLETE][46] [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-snb-2520m/igt@gem_exec_gttfill@basic.html [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-snb-2520m/igt@gem_exec_gttfill@basic.html - fi-tgl-u2: [PASS][47] -> [INCOMPLETE][48] [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-tgl-u2/igt@gem_exec_gttfill@basic.html [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-tgl-u2/igt@gem_exec_gttfill@basic.html - fi-ilk-650: [PASS][49] -> [INCOMPLETE][50] [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-ilk-650/igt@gem_exec_gttfill@basic.html [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-ilk-650/igt@gem_exec_gttfill@basic.html * igt@gem_exec_parallel@engines@basic: - fi-bsw-n3050: [PASS][51] -> [INCOMPLETE][52] [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bsw-n3050/igt@gem_exec_parallel@engines@basic.html [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bsw-n3050/igt@gem_exec_parallel@engines@basic.html - fi-bsw-kefka: [PASS][53] -> [INCOMPLETE][54] [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bsw-kefka/igt@gem_exec_parallel@engines@basic.html [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bsw-kefka/igt@gem_exec_parallel@engines@basic.html - fi-bsw-nick: [PASS][55] -> [INCOMPLETE][56] [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bsw-nick/igt@gem_exec_parallel@engines@basic.html [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bsw-nick/igt@gem_exec_parallel@engines@basic.html * igt@gem_exec_parallel@engines@contexts: - fi-bdw-gvtdvm: [PASS][57] -> [INCOMPLETE][58] [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bdw-gvtdvm/igt@gem_exec_parallel@engines@contexts.html [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bdw-gvtdvm/igt@gem_exec_parallel@engines@contexts.html #### Suppressed #### The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@gem_ctx_create@basic-files: - {fi-kbl-7560u}: [PASS][59] -> [INCOMPLETE][60] [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-7560u/igt@gem_ctx_create@basic-files.html [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-7560u/igt@gem_ctx_create@basic-files.html * igt@gem_exec_gttfill@basic: - {fi-tgl-dsi}: [PASS][61] -> [INCOMPLETE][62] [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-tgl-dsi/igt@gem_exec_gttfill@basic.html [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-tgl-dsi/igt@gem_exec_gttfill@basic.html Known issues ------------ Here are the changes found in Patchwork_18240 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_close_race@basic-threads: - fi-pnv-d510: [PASS][63] -> [INCOMPLETE][64] ([CI#80] / [i915#299]) [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-pnv-d510/igt@gem_close_race@basic-threads.html [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-pnv-d510/igt@gem_close_race@basic-threads.html - fi-cfl-8700k: [PASS][65] -> [INCOMPLETE][66] ([CI#80]) [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-cfl-8700k/igt@gem_close_race@basic-threads.html [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-cfl-8700k/igt@gem_close_race@basic-threads.html * igt@gem_ctx_create@basic-files: - fi-bxt-dsi: [PASS][67] -> [INCOMPLETE][68] ([i915#1635]) [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-bxt-dsi/igt@gem_ctx_create@basic-files.html [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-bxt-dsi/igt@gem_ctx_create@basic-files.html - fi-apl-guc: [PASS][69] -> [INCOMPLETE][70] ([i915#1635]) [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-apl-guc/igt@gem_ctx_create@basic-files.html [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-apl-guc/igt@gem_ctx_create@basic-files.html * igt@gem_exec_gttfill@basic: - fi-snb-2600: [PASS][71] -> [INCOMPLETE][72] ([i915#82]) [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-snb-2600/igt@gem_exec_gttfill@basic.html [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-snb-2600/igt@gem_exec_gttfill@basic.html - fi-elk-e7500: [PASS][73] -> [INCOMPLETE][74] ([i915#66]) [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-elk-e7500/igt@gem_exec_gttfill@basic.html [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-elk-e7500/igt@gem_exec_gttfill@basic.html #### Possible fixes #### * igt@debugfs_test@read_all_entries: - fi-kbl-soraka: [DMESG-WARN][75] ([i915#1982]) -> [PASS][76] [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8783/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [CI#80]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/80 [i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635 [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982 [i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299 [i915#66]: https://gitlab.freedesktop.org/drm/intel/issues/66 [i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82 Participating hosts (47 -> 40) ------------------------------ Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus Build changes ------------- * Linux: CI_DRM_8783 -> Patchwork_18240 CI-20190529: 20190529 CI_DRM_8783: 9780545cd4109baff8c6eb1cb1060a29b7ab919f @ git://anongit.freedesktop.org/gfx-ci/linux IGT_5746: d818f0c54e5e781ba3fb372aab8f270cf153776c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools Patchwork_18240: 0ab11d2707e94ea4d9df80fde49667dcf726b660 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 0ab11d2707e9 drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18240/index.html [-- Attachment #1.2: Type: text/html, Size: 15167 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson 2020-07-24 16:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork 2020-07-24 17:02 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork @ 2020-07-24 17:51 ` Chris Wilson 2020-07-24 18:05 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) Patchwork 2020-07-24 18:31 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork 4 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2020-07-24 17:51 UTC (permalink / raw) To: intel-gfx; +Cc: Chris Wilson Some very low hanging fruit, but contention on the pool->lock is noticeable between intel_gt_get_buffer_pool() and pool_retire(), with the majority of the hold time due to the locked list iteration. If we make the node itself RCU protected, we can perform the search for an suitable node just under RCU, reserving taking the lock itself for claiming the node and manipulating the list. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- .../gpu/drm/i915/gt/intel_gt_buffer_pool.c | 64 +++++++++++++------ .../drm/i915/gt/intel_gt_buffer_pool_types.h | 6 +- 2 files changed, 49 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c index 418ae184cecf..ae92f1267ad0 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c @@ -35,37 +35,51 @@ static void node_free(struct intel_gt_buffer_pool_node *node) { i915_gem_object_put(node->obj); i915_active_fini(&node->active); - kfree(node); + kfree_rcu(node, rcu); } static void pool_free_work(struct work_struct *wrk) { struct intel_gt_buffer_pool *pool = container_of(wrk, typeof(*pool), work.work); - struct intel_gt_buffer_pool_node *node, *next; + struct intel_gt_buffer_pool_node *node, *stale = NULL; unsigned long old = jiffies - HZ; bool active = false; - LIST_HEAD(stale); int n; /* Free buffers that have not been used in the past second */ - spin_lock_irq(&pool->lock); for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) { struct list_head *list = &pool->cache_list[n]; - /* Most recent at head; oldest at tail */ - list_for_each_entry_safe_reverse(node, next, list, link) { - if (time_before(node->age, old)) - break; + if (list_empty(list)) + continue; + + if (spin_trylock_irq(&pool->lock)) { + struct list_head *pos; + + /* Most recent at head; oldest at tail */ + list_for_each_prev(pos, list) { + node = list_entry(pos, typeof(*node), link); + if (time_before(node->age, old)) + break; - list_move(&node->link, &stale); + node->age = 0; + node->free = stale; + stale = node; + } + if (!list_is_last(pos, list)) + __list_del_many(pos, list); + + spin_unlock_irq(&pool->lock); } + active |= !list_empty(list); } - spin_unlock_irq(&pool->lock); - list_for_each_entry_safe(node, next, &stale, link) + while ((node = stale)) { + stale = stale->free; node_free(node); + } if (active) schedule_delayed_work(&pool->work, @@ -109,8 +123,8 @@ static void pool_retire(struct i915_active *ref) i915_gem_object_make_purgeable(node->obj); spin_lock_irqsave(&pool->lock, flags); - node->age = jiffies; - list_add(&node->link, list); + node->age = jiffies ?: 1; + list_add_rcu(&node->link, list); spin_unlock_irqrestore(&pool->lock, flags); schedule_delayed_work(&pool->work, @@ -151,22 +165,32 @@ intel_gt_get_buffer_pool(struct intel_gt *gt, size_t size) struct intel_gt_buffer_pool *pool = >->buffer_pool; struct intel_gt_buffer_pool_node *node; struct list_head *list; - unsigned long flags; + bool found = false; int ret; size = PAGE_ALIGN(size); list = bucket_for_size(pool, size); - spin_lock_irqsave(&pool->lock, flags); - list_for_each_entry(node, list, link) { + rcu_read_lock(); + list_for_each_entry_rcu(node, list, link) { + unsigned long flags; + if (node->obj->base.size < size) continue; - list_del(&node->link); - break; + + spin_lock_irqsave(&pool->lock, flags); + if (node->age) { + list_del_rcu(&node->link); + node->age = 0; + found = true; + } + spin_unlock_irqrestore(&pool->lock, flags); + if (found) + break; } - spin_unlock_irqrestore(&pool->lock, flags); + rcu_read_unlock(); - if (&node->link == list) { + if (!found) { node = node_create(pool, size); if (IS_ERR(node)) return node; diff --git a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h index e28bdda771ed..bcf1658c9633 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_buffer_pool_types.h @@ -25,7 +25,11 @@ struct intel_gt_buffer_pool_node { struct i915_active active; struct drm_i915_gem_object *obj; struct list_head link; - struct intel_gt_buffer_pool *pool; + union { + struct intel_gt_buffer_pool *pool; + struct intel_gt_buffer_pool_node *free; + struct rcu_head rcu; + }; unsigned long age; }; -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson ` (2 preceding siblings ...) 2020-07-24 17:51 ` [Intel-gfx] [PATCH] " Chris Wilson @ 2020-07-24 18:05 ` Patchwork 2020-07-24 18:31 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork 4 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-07-24 18:05 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) URL : https://patchwork.freedesktop.org/series/79855/ State : warning == Summary == $ dim sparse --fast origin/drm-tip Sparse version: v0.6.0 Fast mode used, each commit won't be checked separately. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson ` (3 preceding siblings ...) 2020-07-24 18:05 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) Patchwork @ 2020-07-24 18:31 ` Patchwork 4 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-07-24 18:31 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx [-- Attachment #1.1: Type: text/plain, Size: 7259 bytes --] == Series Details == Series: drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) URL : https://patchwork.freedesktop.org/series/79855/ State : failure == Summary == CI Bug Log - changes from CI_DRM_8784 -> Patchwork_18241 ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with Patchwork_18241 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_18241, please notify your bug team 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_18241/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in Patchwork_18241: ### IGT changes ### #### Possible regressions #### * igt@i915_selftest@live@execlists: - fi-skl-lmem: [PASS][1] -> [INCOMPLETE][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-skl-lmem/igt@i915_selftest@live@execlists.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-skl-lmem/igt@i915_selftest@live@execlists.html Known issues ------------ Here are the changes found in Patchwork_18241 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@debugfs_test@read_all_entries: - fi-kbl-soraka: [PASS][3] -> [DMESG-WARN][4] ([i915#1982]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html * igt@gem_exec_suspend@basic-s0: - fi-tgl-u2: [PASS][5] -> [FAIL][6] ([i915#1888]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html * igt@kms_addfb_basic@bad-pitch-1024: - fi-tgl-y: [PASS][7] -> [DMESG-WARN][8] ([i915#402]) +1 similar issue [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-tgl-y/igt@kms_addfb_basic@bad-pitch-1024.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-tgl-y/igt@kms_addfb_basic@bad-pitch-1024.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic: - fi-icl-u2: [PASS][9] -> [DMESG-WARN][10] ([i915#1982]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-icl-u2/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-icl-u2/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html #### Possible fixes #### * igt@i915_module_load@reload: - fi-tgl-u2: [DMESG-WARN][11] ([i915#402]) -> [PASS][12] [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-tgl-u2/igt@i915_module_load@reload.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-tgl-u2/igt@i915_module_load@reload.html - fi-tgl-y: [DMESG-WARN][13] ([i915#1982]) -> [PASS][14] [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-tgl-y/igt@i915_module_load@reload.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-tgl-y/igt@i915_module_load@reload.html * igt@i915_pm_rpm@module-reload: - fi-bsw-kefka: [DMESG-WARN][15] ([i915#1982]) -> [PASS][16] +1 similar issue [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-bsw-kefka/igt@i915_pm_rpm@module-reload.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-bsw-kefka/igt@i915_pm_rpm@module-reload.html * igt@kms_busy@basic@flip: - fi-kbl-x1275: [DMESG-WARN][17] ([i915#62] / [i915#92] / [i915#95]) -> [PASS][18] [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-kbl-x1275/igt@kms_busy@basic@flip.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-kbl-x1275/igt@kms_busy@basic@flip.html * igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1: - fi-icl-u2: [DMESG-WARN][19] ([i915#1982]) -> [PASS][20] [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html * igt@vgem_basic@create: - fi-tgl-y: [DMESG-WARN][21] ([i915#402]) -> [PASS][22] +1 similar issue [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-tgl-y/igt@vgem_basic@create.html [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-tgl-y/igt@vgem_basic@create.html #### Warnings #### * igt@gem_exec_suspend@basic-s0: - fi-kbl-x1275: [DMESG-WARN][23] ([i915#1982] / [i915#62] / [i915#92]) -> [DMESG-WARN][24] ([i915#62] / [i915#92]) [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-kbl-x1275/igt@gem_exec_suspend@basic-s0.html [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-kbl-x1275/igt@gem_exec_suspend@basic-s0.html * igt@kms_flip@basic-flip-vs-modeset@a-dp1: - fi-kbl-x1275: [DMESG-WARN][25] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][26] ([i915#62] / [i915#92]) +3 similar issues [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-modeset@a-dp1.html [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-modeset@a-dp1.html * igt@prime_vgem@basic-fence-flip: - fi-kbl-x1275: [DMESG-WARN][27] ([i915#62] / [i915#92]) -> [DMESG-WARN][28] ([i915#62] / [i915#92] / [i915#95]) +4 similar issues [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8784/fi-kbl-x1275/igt@prime_vgem@basic-fence-flip.html [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/fi-kbl-x1275/igt@prime_vgem@basic-fence-flip.html [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888 [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982 [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402 [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62 [i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92 [i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95 Participating hosts (47 -> 40) ------------------------------ Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus Build changes ------------- * Linux: CI_DRM_8784 -> Patchwork_18241 CI-20190529: 20190529 CI_DRM_8784: 54c280cc3ea43c8d6ac7a9ed37c14ff583d7fa66 @ git://anongit.freedesktop.org/gfx-ci/linux IGT_5747: 6980775bcadec862cd5e5affd65928ef79e5b580 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools Patchwork_18241: 877f7488e619f9ac04291e6317c1930d8cb9ff74 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 877f7488e619 drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18241/index.html [-- Attachment #1.2: Type: text/html, Size: 9580 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-24 18:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-24 16:37 [Intel-gfx] [PATCH] drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool Chris Wilson 2020-07-24 16:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork 2020-07-24 17:02 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork 2020-07-24 17:51 ` [Intel-gfx] [PATCH] " Chris Wilson 2020-07-24 18:05 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gt: Delay taking the spinlock for grabbing from the buffer pool (rev2) Patchwork 2020-07-24 18:31 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).