drm/i915/gt: Keep a no-frills swappable copy of the default context state
Subsystems (2)
PATCH 1/2 drm/i915/gt: Keep a no-frills swappable copy of the default context state
We need to keep the default context state around to instantiate new contexts (aka golden rendercontext), and we also keep it pinned while the engine is active so that we can quickly reset a hanging context. However, the default contexts are large enough to merit keeping in swappable memory as opposed to kernel memory, so we store them inside shmemfs. Currently, we use the normal GEM objects to create the default context image, but we can throw away all but the shmemfs file.
This greatly simplifies the tricky power management code which wants to run underneath the normal GT locking, and we definitely do not want to use any high level objects that may appear to recurse back into the GT. Though perhaps the primary advantage of the complex GEM object is that we aggressively cache the mapping, but here we are recreating the vm_area everytime time we unpark. At the worst, we add a lightweight cache, but first find a microbenchmark that is impacted.
Having started to create some utility functions to make working with shmemfs objects easier, we can start putting them to wider use, where GEM objects are overkill, such as storing persistent error state.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/gt/intel_engine_pm.c | 10 +- drivers/gpu/drm/i915/gt/intel_engine_types.h | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 4 +- drivers/gpu/drm/i915/gt/intel_lrc.c | 25 +-- .../gpu/drm/i915/gt/intel_ring_submission.c | 16 +- drivers/gpu/drm/i915/gt/selftest_context.c | 2 +- drivers/gpu/drm/i915/gt/selftest_lrc.c | 10 +- drivers/gpu/drm/i915/gt/shmem_utils.c | 176 ++++++++++++++++++ drivers/gpu/drm/i915/gt/shmem_utils.h | 22 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 26 --- 12 files changed, 224 insertions(+), 72 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/shmem_utils.c create mode 100644 drivers/gpu/drm/i915/gt/shmem_utils.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -111,6 +111,7 @@ gt-y += \ gt/intel_sseu.o \ gt/intel_timeline.o \ gt/intel_workarounds.o \ + gt/shmem_utils.o \ gt/sysfs_engines.o # autogenerated null render state gt-y += \
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
@@ -834,7 +834,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)intel_engine_cleanup_cmd_parser (engine);if (engine->default_state) -i915_gem_object_put (engine->default_state); +fput (engine->default_state);if (engine->kernel_context) {intel_context_unpin (engine->kernel_context);
drivers/gpu/drm/i915/gt/intel_engine_pm.c +5 -5
@@ -15,6 +15,7 @@#include "intel_gt_pm.h" #include "intel_rc6.h" #include "intel_ring.h" +#include "shmem_utils.h" static int __engine_unpark (struct intel_wakeref *wf) {
@@ -30,10 +31,8 @@ static int __engine_unpark(struct intel_wakeref *wf)/* Pin the default state for fast resets from atomic context. */ map =NULL ;if (engine->default_state) - map =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (!IS_ERR_OR_NULL (map)) - engine->pinned_default_state = map; + map =shmem_pin_map (engine->default_state); + engine->pinned_default_state = map;/* Discard stale context state from across idling */ ce = engine->kernel_context;
@@ -264,7 +263,8 @@ static int __engine_park(struct intel_wakeref *wf) engine->park (engine);if (engine->pinned_default_state) { -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, + engine->pinned_default_state); engine->pinned_default_state =NULL ; }
drivers/gpu/drm/i915/gt/intel_engine_types.h +1 -1
@@ -339,7 +339,7 @@ struct intel_engine_cs {unsigned long wakeref_serial;struct intel_wakeref wakeref; -struct drm_i915_gem_object *default_state; +struct file *default_state;void *pinned_default_state;struct {
drivers/gpu/drm/i915/gt/intel_gt.c +3 -1
@@ -16,6 +16,7 @@#include "intel_rps.h" #include "intel_uncore.h" #include "intel_pm.h" +#include "shmem_utils.h" void intel_gt_init_early (struct intel_gt *gt,struct drm_i915_private *i915) {
@@ -501,7 +502,8 @@ static int __engines_record_defaults(struct intel_gt *gt) goto out; } - rq->engine->default_state =i915_gem_object_get (state->obj); + rq->engine->default_state = +shmem_create_from_object (state->obj);i915_gem_object_unpin_map (state->obj); }
drivers/gpu/drm/i915/gt/intel_lrc.c +6 -19
@@ -147,6 +147,7 @@#include "intel_reset.h" #include "intel_ring.h" #include "intel_workarounds.h" +#include "shmem_utils.h" #define RING_EXECLIST_QFULL (1 << 0x2)#define RING_EXECLIST1_VALID (1 << 0x3)
@@ -5083,30 +5084,18 @@ populate_lr_context(struct intel_context *ce, {bool inhibit = true;void *vaddr; -int ret; vaddr =i915_gem_object_pin_map (ctx_obj,I915_MAP_WB );if (IS_ERR (vaddr)) { - ret =PTR_ERR (vaddr); -drm_dbg (&engine->i915->drm, -"Could not map object pages! (%d)\n" , ret); -return ret; +drm_dbg (&engine->i915->drm,"Could not map object pages!\n" ); +return PTR_ERR (vaddr); }set_redzone (vaddr, engine);if (engine->default_state) { -void *defaults; - - defaults =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (IS_ERR (defaults)) { - ret =PTR_ERR (defaults); - goto err_unpin_ctx; - } - -memcpy (vaddr, defaults, engine->context_size); -i915_gem_object_unpin_map (engine->default_state); +shmem_read (engine->default_state,0 , + vaddr, engine->context_size);__set_bit (CONTEXT_VALID_BIT , &ce->flags); inhibit = false; }
@@ -5121,11 +5110,9 @@ populate_lr_context(struct intel_context *ce,execlists_init_reg_state (vaddr +LRC_STATE_OFFSET , ce, engine, ring, inhibit); - ret =0 ; -err_unpin_ctx:__i915_gem_object_flush_map (ctx_obj,0 , engine->context_size);i915_gem_object_unpin_map (ctx_obj); -return ret; +return 0 ; } static int __execlists_context_alloc(struct intel_context *ce,
drivers/gpu/drm/i915/gt/intel_ring_submission.c +4 -12
@@ -42,6 +42,7 @@#include "intel_reset.h" #include "intel_ring.h" #include "intel_workarounds.h" +#include "shmem_utils.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch.
@@ -1241,7 +1242,7 @@ alloc_context_vma(struct intel_engine_cs *engine)i915_gem_object_set_cache_coherency (obj,I915_CACHE_L3_LLC );if (engine->default_state) { -void *defaults, *vaddr; +void *vaddr; vaddr =i915_gem_object_pin_map (obj,I915_MAP_WB );if (IS_ERR (vaddr)) {
@@ -1249,15 +1250,8 @@ alloc_context_vma(struct intel_engine_cs *engine) goto err_obj; } - defaults =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (IS_ERR (defaults)) { - err =PTR_ERR (defaults); - goto err_map; - } - -memcpy (vaddr, defaults, engine->context_size); -i915_gem_object_unpin_map (engine->default_state); +shmem_read (engine->default_state,0 , + vaddr, engine->context_size);i915_gem_object_flush_map (obj);i915_gem_object_unpin_map (obj);
@@ -1271,8 +1265,6 @@ alloc_context_vma(struct intel_engine_cs *engine)return vma; -err_map: -i915_gem_object_unpin_map (obj); err_obj:i915_gem_object_put (obj);return ERR_PTR (err);
drivers/gpu/drm/i915/gt/selftest_context.c +1 -1
@@ -155,7 +155,7 @@ static int live_context_size(void *arg)for_each_engine (engine, gt, id) {struct { -struct drm_i915_gem_object *state; +struct file *state;void *pinned; } saved;
drivers/gpu/drm/i915/gt/selftest_lrc.c +4 -6
@@ -4452,8 +4452,7 @@ static int live_lrc_layout(void *arg)if (!engine->default_state)continue ; - hw =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); + hw =shmem_pin_map (engine->default_state);if (IS_ERR (hw)) { err =PTR_ERR (hw);break ;
@@ -4525,7 +4524,7 @@ static int live_lrc_layout(void *arg)hexdump (lrc,PAGE_SIZE ); } -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, hw);if (err)break ; }
@@ -4630,8 +4629,7 @@ static int live_lrc_fixed(void *arg)if (!engine->default_state)continue ; - hw =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); + hw =shmem_pin_map (engine->default_state);if (IS_ERR (hw)) { err =PTR_ERR (hw);break ;
@@ -4652,7 +4650,7 @@ static int live_lrc_fixed(void *arg) } } -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, hw); }return err;
drivers/gpu/drm/i915/gt/shmem_utils.c new file +176 -0
176 lines not on this page · raw message
drivers/gpu/drm/i915/gt/shmem_utils.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef SHMEM_UTILS_H +#define SHMEM_UTILS_H + +#include <linux/types.h> + +struct drm_i915_gem_object ; +struct file ; + +struct file *shmem_create_from_data (const char *name,void *data,size_t len); +struct file *shmem_create_from_object (struct drm_i915_gem_object *obj); + +void *shmem_pin_map (struct file *file); +void shmem_unpin_map (struct file *file,void *ptr); + +int shmem_read (struct file *file,loff_t off,void *dst,size_t len); + +#endif /* SHMEM_UTILS_H */
drivers/gpu/drm/i915/i915_gpu_error.c +0 -26
@@ -1318,26 +1318,6 @@ capture_user(struct intel_engine_capture_vma *capture,return capture; } -static struct i915_vma_coredump * -capture_object (const struct intel_gt *gt, -struct drm_i915_gem_object *obj, -const char *name, -struct i915_vma_compress *compress) -{ -if (obj &&i915_gem_object_has_pages (obj)) { -struct i915_vma fake = { - .node = { .start =U64_MAX , .size = obj->base.size }, - .size = obj->base.size, - .pages = obj->mm.pages, - .obj = obj, - }; - -return i915_vma_coredump_create (gt, &fake, name, compress); - }else { -return NULL ; - } -} -static void add_vma (struct intel_engine_coredump *ee,struct i915_vma_coredump *vma) {
@@ -1426,12 +1406,6 @@ intel_engine_coredump_add_vma(struct intel_engine_coredump *ee, engine->wa_ctx.vma,"WA context" , compress)); - -add_vma (ee, -capture_object (engine->gt, - engine->default_state, -"NULL context" , - compress)); } static struct intel_engine_coredump *
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915/gt: Stop keeping the pinned_default_state
As we only restore the default context state upon banning a context, we only need enough of the state to run the ring and nothing more. That is we only need our bare protocontext.
--- drivers/gpu/drm/i915/gt/intel_engine_pm.c | 14 +----- drivers/gpu/drm/i915/gt/intel_engine_types.h | 1 - drivers/gpu/drm/i915/gt/intel_lrc.c | 9 ++-- drivers/gpu/drm/i915/gt/selftest_context.c | 11 ++-- drivers/gpu/drm/i915/gt/selftest_lrc.c | 53 +++++++++++++++----- 5 files changed, 47 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_pm.c +1 -13
@@ -22,18 +22,11 @@ static int __engine_unpark(struct intel_wakeref *wf)struct intel_engine_cs *engine =container_of (wf,typeof (*engine), wakeref);struct intel_context *ce; -void *map;ENGINE_TRACE (engine,"\n" );intel_gt_pm_get (engine->gt); -/* Pin the default state for fast resets from atomic context. */ - map =NULL ; -if (engine->default_state) - map =shmem_pin_map (engine->default_state); - engine->pinned_default_state = map; -/* Discard stale context state from across idling */ ce = engine->kernel_context;if (ce) {
@@ -43,6 +36,7 @@ static int __engine_unpark(struct intel_wakeref *wf)if (IS_ENABLED (CONFIG_DRM_I915_DEBUG_GEM ) && ce->state) {struct drm_i915_gem_object *obj = ce->state->obj;int type =i915_coherent_map_type (engine->i915); +void *map; map =i915_gem_object_pin_map (obj, type);if (!IS_ERR (map)) {
@@ -262,12 +256,6 @@ static int __engine_park(struct intel_wakeref *wf)if (engine->park) engine->park (engine); -if (engine->pinned_default_state) { -shmem_unpin_map (engine->default_state, - engine->pinned_default_state); - engine->pinned_default_state =NULL ; - } - engine->execlists.no_priolist = false;/* While gt calls i915_vma_parked(), we have to break the lock cycle */
drivers/gpu/drm/i915/gt/intel_engine_types.h +0 -1
@@ -340,7 +340,6 @@ struct intel_engine_cs {unsigned long wakeref_serial;struct intel_wakeref wakeref;struct file *default_state; -void *pinned_default_state;struct {struct intel_ring *ring;
drivers/gpu/drm/i915/gt/intel_lrc.c +3 -6
@@ -1293,14 +1293,11 @@ execlists_check_context(const struct intel_context *ce,static void restore_default_state (struct intel_context *ce,struct intel_engine_cs *engine) { -u32 *regs = ce->lrc_reg_state; - -if (engine->pinned_default_state) -memcpy (regs,/* skip restoring the vanilla PPHWSP */ - engine->pinned_default_state +LRC_STATE_OFFSET , - engine->context_size -PAGE_SIZE ); +u32 *regs; + regs =memset (ce->lrc_reg_state,0 , engine->context_size -PAGE_SIZE );execlists_init_reg_state (regs, ce, engine, ce->ring, false); + ce->runtime.last =intel_context_get_runtime (ce); }
drivers/gpu/drm/i915/gt/selftest_context.c +3 -8
@@ -154,10 +154,7 @@ static int live_context_size(void *arg)*/ for_each_engine (engine, gt, id) { -struct { -struct file *state; -void *pinned; - } saved; +struct file *saved;if (!engine->context_size)continue ;
@@ -171,8 +168,7 @@ static int live_context_size(void *arg)* active state is sufficient, we are only checking that we * don't use more than we planned. */ - saved.state =fetch_and_zero (&engine->default_state); - saved.pinned =fetch_and_zero (&engine->pinned_default_state); + saved =fetch_and_zero (&engine->default_state);/* Overlaps with the execlists redzone */ engine->context_size +=I915_GTT_PAGE_SIZE ;
@@ -181,8 +177,7 @@ static int live_context_size(void *arg) engine->context_size -=I915_GTT_PAGE_SIZE ; - engine->pinned_default_state = saved.pinned; - engine->default_state = saved.state; + engine->default_state = saved;intel_engine_pm_put (engine);
drivers/gpu/drm/i915/gt/selftest_lrc.c +40 -13
120 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/gt: Keep a no-frills swappable copy of the default context state
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/gt: Keep a no-frills swappable copy of the default context state
URL : https://patchwork.freedesktop.org/series/76686/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip f78daa371c45 drm/i915/gt: Keep a no-frills swappable copy of the default context state -:291: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #291: new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 438 lines checked 933a5f26fe79 drm/i915/gt: Stop keeping the pinned_default_state
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/gt: Keep a no-frills swappable copy of the default context state
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/gt: Keep a no-frills swappable copy of the default context state
URL : https://patchwork.freedesktop.org/series/76686/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_8388 -> Patchwork_17502
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_17502 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_17502, 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_17502/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_17502:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@gt_mocs:
- fi-icl-u2: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-u2/igt@i915_selftest@live@gt_mocs.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-u2/igt@i915_selftest@live@gt_mocs.html
- fi-icl-y: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-y/igt@i915_selftest@live@gt_mocs.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-y/igt@i915_selftest@live@gt_mocs.html
- fi-tgl-y: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-y/igt@i915_selftest@live@gt_mocs.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-y/igt@i915_selftest@live@gt_mocs.html
- fi-icl-guc: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-guc/igt@i915_selftest@live@gt_mocs.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-guc/igt@i915_selftest@live@gt_mocs.html
* igt@i915_selftest@live@workarounds:
- fi-skl-6700k2: [PASS][9] -> [DMESG-FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-skl-6700k2/igt@i915_selftest@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-skl-6700k2/igt@i915_selftest@[email protected]
- fi-bsw-n3050: [PASS][11] -> [DMESG-FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-bsw-n3050/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-bsw-n3050/igt@i915_selftest@[email protected]
- fi-cml-s: [PASS][13] -> [DMESG-FAIL][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-cml-s/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-cml-s/igt@i915_selftest@[email protected]
- fi-icl-y: [PASS][15] -> [DMESG-FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-y/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-y/igt@i915_selftest@[email protected]
- fi-kbl-x1275: [PASS][17] -> [DMESG-FAIL][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-kbl-x1275/igt@i915_selftest@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-kbl-x1275/igt@i915_selftest@[email protected]
- fi-cfl-guc: [PASS][19] -> [DMESG-FAIL][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-cfl-guc/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-cfl-guc/igt@i915_selftest@[email protected]
- fi-tgl-y: [PASS][21] -> [DMESG-FAIL][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-y/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-y/igt@i915_selftest@[email protected]
- fi-skl-guc: [PASS][23] -> [DMESG-FAIL][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-skl-guc/igt@i915_selftest@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-skl-guc/igt@i915_selftest@[email protected]
- fi-skl-6600u: [PASS][25] -> [DMESG-FAIL][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-skl-6600u/igt@i915_selftest@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-skl-6600u/igt@i915_selftest@[email protected]
- fi-glk-dsi: [PASS][27] -> [DMESG-FAIL][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-glk-dsi/igt@i915_selftest@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-glk-dsi/igt@i915_selftest@[email protected]
- fi-apl-guc: [PASS][29] -> [DMESG-FAIL][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-apl-guc/igt@i915_selftest@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-apl-guc/igt@i915_selftest@[email protected]
- fi-kbl-8809g: [PASS][31] -> [DMESG-FAIL][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-kbl-8809g/igt@i915_selftest@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-kbl-8809g/igt@i915_selftest@[email protected]
- fi-bsw-kefka: [PASS][33] -> [DMESG-FAIL][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-bsw-kefka/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-bsw-kefka/igt@i915_selftest@[email protected]
- fi-cfl-8700k: [PASS][35] -> [DMESG-FAIL][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-cfl-8700k/igt@i915_selftest@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-cfl-8700k/igt@i915_selftest@[email protected]
- fi-kbl-r: [PASS][37] -> [DMESG-FAIL][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-kbl-r/igt@i915_selftest@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-kbl-r/igt@i915_selftest@[email protected]
- fi-icl-guc: [PASS][39] -> [DMESG-FAIL][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-guc/igt@i915_selftest@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-guc/igt@i915_selftest@[email protected]
- fi-icl-u2: [PASS][41] -> [DMESG-FAIL][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-icl-u2/igt@i915_selftest@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-icl-u2/igt@i915_selftest@[email protected]
- fi-cfl-8109u: [PASS][43] -> [DMESG-FAIL][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-cfl-8109u/igt@i915_selftest@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-cfl-8109u/igt@i915_selftest@[email protected]
- fi-bsw-nick: [PASS][45] -> [DMESG-FAIL][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-bsw-nick/igt@i915_selftest@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-bsw-nick/igt@i915_selftest@[email protected]
- fi-skl-lmem: [PASS][47] -> [DMESG-FAIL][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-skl-lmem/igt@i915_selftest@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-skl-lmem/igt@i915_selftest@[email protected]
- fi-kbl-guc: [PASS][49] -> [DMESG-FAIL][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-kbl-guc/igt@i915_selftest@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-kbl-guc/igt@i915_selftest@[email protected]
- fi-bdw-5557u: [PASS][51] -> [DMESG-FAIL][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-bdw-5557u/igt@i915_selftest@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-bdw-5557u/igt@i915_selftest@[email protected]
- fi-kbl-soraka: [PASS][53] -> [DMESG-FAIL][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-kbl-soraka/igt@i915_selftest@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-kbl-soraka/igt@i915_selftest@[email protected]
- fi-whl-u: [PASS][55] -> [DMESG-FAIL][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-whl-u/igt@i915_selftest@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-whl-u/igt@i915_selftest@[email protected]
- fi-bxt-dsi: [PASS][57] -> [DMESG-FAIL][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-bxt-dsi/igt@i915_selftest@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-bxt-dsi/igt@i915_selftest@[email protected]
- fi-cml-u2: [PASS][59] -> [DMESG-FAIL][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-cml-u2/igt@i915_selftest@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-cml-u2/igt@i915_selftest@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_selftest@live@gt_mocs:
- {fi-tgl-dsi}: [PASS][61] -> [INCOMPLETE][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-dsi/igt@i915_selftest@live@gt_mocs.html
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-dsi/igt@i915_selftest@live@gt_mocs.html
- {fi-tgl-u}: [PASS][63] -> [INCOMPLETE][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-u/igt@i915_selftest@live@gt_mocs.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-u/igt@i915_selftest@live@gt_mocs.html
- {fi-ehl-1}: [PASS][65] -> [INCOMPLETE][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-ehl-1/igt@i915_selftest@live@gt_mocs.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-ehl-1/igt@i915_selftest@live@gt_mocs.html
* igt@i915_selftest@live@workarounds:
- {fi-tgl-dsi}: [PASS][67] -> [DMESG-FAIL][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-dsi/igt@i915_selftest@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-dsi/igt@i915_selftest@[email protected]
- {fi-ehl-1}: [PASS][69] -> [DMESG-FAIL][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-ehl-1/igt@i915_selftest@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-ehl-1/igt@i915_selftest@[email protected]
- {fi-tgl-u}: [PASS][71] -> [DMESG-FAIL][72]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-tgl-u/igt@i915_selftest@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-tgl-u/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_17502 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@i915_selftest@live@gt_pm:
- fi-glk-dsi: [INCOMPLETE][73] ([i915#58] / [k.org#198133]) -> [PASS][74]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8388/fi-glk-dsi/igt@i915_selftest@live@gt_pm.html
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/fi-glk-dsi/igt@i915_selftest@live@gt_pm.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#58]: https://gitlab.freedesktop.org/drm/intel/issues/58
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133
Participating hosts (48 -> 42)
------------------------------
Missing (6): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-ctg-p8600 fi-byt-clapper
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_8388 -> Patchwork_17502
CI-20190529: 20190529
CI_DRM_8388: 12346af5b9d3ccf046d5e736c02851eec98e49ff @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5614: d095827add11d4e8158b87683971ee659749d9a4 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17502: 933a5f26fe796218febe9b9c20a23f91bca9cf49 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
933a5f26fe79 drm/i915/gt: Stop keeping the pinned_default_state f78daa371c45 drm/i915/gt: Keep a no-frills swappable copy of the default context state
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17502/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Chris Wilson
We need to keep the default context state around to instantiate new contexts (aka golden rendercontext), and we also keep it pinned while the engine is active so that we can quickly reset a hanging context. However, the default contexts are large enough to merit keeping in swappable memory as opposed to kernel memory, so we store them inside shmemfs. Currently, we use the normal GEM objects to create the default context image, but we can throw away all but the shmemfs file.
This greatly simplifies the tricky power management code which wants to run underneath the normal GT locking, and we definitely do not want to use any high level objects that may appear to recurse back into the GT. Though perhaps the primary advantage of the complex GEM object is that we aggressively cache the mapping, but here we are recreating the
vm_areaeverytime time we unpark. At the worst, we add a lightweight cache, but first find a microbenchmark that is impacted.
Quoted 3 lines
Having started to create some utility functions to make working with shmemfs objects easier, we can start putting them to wider use, where GEM objects are overkill, such as storing persistent error state.
Is there any point in having the default state in device local-memory, and if so does this change the story at all? I'm guessing not...
Anyway, the shmem helper stuff sounds like just what we need.
Quoted 525 lines
Signed-off-by Chris Wilson <[email protected]>Cc Matthew Auld <[email protected]>Cc Ramalingam C <[email protected]>Cc Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/gt/intel_engine_pm.c | 10 +- drivers/gpu/drm/i915/gt/intel_engine_types.h | 2 +- drivers/gpu/drm/i915/gt/intel_gt.c | 4 +- drivers/gpu/drm/i915/gt/intel_lrc.c | 25 +-- .../gpu/drm/i915/gt/intel_ring_submission.c | 16 +- drivers/gpu/drm/i915/gt/selftest_context.c | 2 +- drivers/gpu/drm/i915/gt/selftest_lrc.c | 10 +- drivers/gpu/drm/i915/gt/shmem_utils.c | 176 ++++++++++++++++++ drivers/gpu/drm/i915/gt/shmem_utils.h | 22 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 26 --- 12 files changed, 224 insertions(+), 72 deletions(-)create mode 100644
drivers/gpu/drm/i915/gt/shmem_utils.ccreate mode 100644drivers/gpu/drm/i915/gt/shmem_utils.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -111,6 +111,7 @@ gt-y += \ gt/intel_sseu.o \ gt/intel_timeline.o \ gt/intel_workarounds.o \ + gt/shmem_utils.o \ gt/sysfs_engines.o # autogenerated null render state gt-y += \drivers/gpu/drm/i915/gt/intel_engine_cs.c +1
-1@@ -834,7 +834,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)intel_engine_cleanup_cmd_parser (engine);if (engine->default_state) -i915_gem_object_put (engine->default_state); +fput (engine->default_state);if (engine->kernel_context) {intel_context_unpin (engine->kernel_context);drivers/gpu/drm/i915/gt/intel_engine_pm.c +5
-5@@ -15,6 +15,7 @@#include "intel_gt_pm.h" #include "intel_rc6.h" #include "intel_ring.h" +#include "shmem_utils.h" static int __engine_unpark (struct intel_wakeref *wf) {@@ -30,10 +31,8 @@ static int __engine_unpark(struct intel_wakeref *wf)/* Pin the default state for fast resets from atomic context. */ map =NULL ;if (engine->default_state) - map =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (!IS_ERR_OR_NULL (map)) - engine->pinned_default_state = map; + map =shmem_pin_map (engine->default_state); + engine->pinned_default_state = map;/* Discard stale context state from across idling */ ce = engine->kernel_context;@@ -264,7 +263,8 @@ static int __engine_park(struct intel_wakeref *wf) engine->park (engine);if (engine->pinned_default_state) { -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, + engine->pinned_default_state); engine->pinned_default_state =NULL ; }drivers/gpu/drm/i915/gt/intel_engine_types.h +1
-1@@ -339,7 +339,7 @@ struct intel_engine_cs {unsigned long wakeref_serial;struct intel_wakeref wakeref; -struct drm_i915_gem_object *default_state; +struct file *default_state;void *pinned_default_state;struct {drivers/gpu/drm/i915/gt/intel_gt.c +3
-1@@ -16,6 +16,7 @@#include "intel_rps.h" #include "intel_uncore.h" #include "intel_pm.h" +#include "shmem_utils.h" void intel_gt_init_early (struct intel_gt *gt,struct drm_i915_private *i915) {@@ -501,7 +502,8 @@ static int __engines_record_defaults(struct intel_gt *gt) goto out; } - rq->engine->default_state =i915_gem_object_get (state->obj); + rq->engine->default_state = +shmem_create_from_object (state->obj);i915_gem_object_unpin_map (state->obj); }drivers/gpu/drm/i915/gt/intel_lrc.c +6
-19@@ -147,6 +147,7 @@#include "intel_reset.h" #include "intel_ring.h" #include "intel_workarounds.h" +#include "shmem_utils.h" #define RING_EXECLIST_QFULL (1 << 0x2)#define RING_EXECLIST1_VALID (1 << 0x3)@@ -5083,30 +5084,18 @@ populate_lr_context(struct intel_context *ce, {bool inhibit = true;void *vaddr; -int ret; vaddr =i915_gem_object_pin_map (ctx_obj,I915_MAP_WB );if (IS_ERR (vaddr)) { - ret =PTR_ERR (vaddr); -drm_dbg (&engine->i915->drm, -"Could not map object pages! (%d)\n" , ret); -return ret; +drm_dbg (&engine->i915->drm,"Could not map object pages!\n" ); +return PTR_ERR (vaddr); }set_redzone (vaddr, engine);if (engine->default_state) { -void *defaults; - - defaults =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (IS_ERR (defaults)) { - ret =PTR_ERR (defaults); - goto err_unpin_ctx; - } - -memcpy (vaddr, defaults, engine->context_size); -i915_gem_object_unpin_map (engine->default_state); +shmem_read (engine->default_state,0 , + vaddr, engine->context_size);__set_bit (CONTEXT_VALID_BIT , &ce->flags); inhibit = false; }@@ -5121,11 +5110,9 @@ populate_lr_context(struct intel_context *ce,execlists_init_reg_state (vaddr +LRC_STATE_OFFSET , ce, engine, ring, inhibit); - ret =0 ; -err_unpin_ctx:__i915_gem_object_flush_map (ctx_obj,0 , engine->context_size);i915_gem_object_unpin_map (ctx_obj); -return ret; +return 0 ; } static int __execlists_context_alloc(struct intel_context *ce,drivers/gpu/drm/i915/gt/intel_ring_submission.c +4
-12@@ -42,6 +42,7 @@#include "intel_reset.h" #include "intel_ring.h" #include "intel_workarounds.h" +#include "shmem_utils.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch. @@ -1241,7 +1242,7 @@ alloc_context_vma(struct intel_engine_cs *engine)i915_gem_object_set_cache_coherency (obj,I915_CACHE_L3_LLC );if (engine->default_state) { -void *defaults, *vaddr; +void *vaddr; vaddr =i915_gem_object_pin_map (obj,I915_MAP_WB );if (IS_ERR (vaddr)) {@@ -1249,15 +1250,8 @@ alloc_context_vma(struct intel_engine_cs *engine) goto err_obj; } - defaults =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); -if (IS_ERR (defaults)) { - err =PTR_ERR (defaults); - goto err_map; - } - -memcpy (vaddr, defaults, engine->context_size); -i915_gem_object_unpin_map (engine->default_state); +shmem_read (engine->default_state,0 , + vaddr, engine->context_size);i915_gem_object_flush_map (obj);i915_gem_object_unpin_map (obj);@@ -1271,8 +1265,6 @@ alloc_context_vma(struct intel_engine_cs *engine)return vma; -err_map: -i915_gem_object_unpin_map (obj); err_obj:i915_gem_object_put (obj);return ERR_PTR (err);drivers/gpu/drm/i915/gt/selftest_context.c +1
-1@@ -155,7 +155,7 @@ static int live_context_size(void *arg)for_each_engine (engine, gt, id) {struct { -struct drm_i915_gem_object *state; +struct file *state;void *pinned; } saved;drivers/gpu/drm/i915/gt/selftest_lrc.c +4
-6@@ -4452,8 +4452,7 @@ static int live_lrc_layout(void *arg)if (!engine->default_state)continue ; - hw =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); + hw =shmem_pin_map (engine->default_state);if (IS_ERR (hw)) { err =PTR_ERR (hw);break ;@@ -4525,7 +4524,7 @@ static int live_lrc_layout(void *arg)hexdump (lrc,PAGE_SIZE ); } -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, hw);if (err)break ; }@@ -4630,8 +4629,7 @@ static int live_lrc_fixed(void *arg)if (!engine->default_state)continue ; - hw =i915_gem_object_pin_map (engine->default_state, -I915_MAP_WB ); + hw =shmem_pin_map (engine->default_state);if (IS_ERR (hw)) { err =PTR_ERR (hw);break ;@@ -4652,7 +4650,7 @@ static int live_lrc_fixed(void *arg) } } -i915_gem_object_unpin_map (engine->default_state); +shmem_unpin_map (engine->default_state, hw); }return err;drivers/gpu/drm/i915/gt/shmem_utils.c new file +176
-0@@ -0,0 +1,176 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ + +#include <linux/mm.h> +#include <linux/pagemap.h> +#include <linux/shmem_fs.h> + +#include "gem/i915_gem_object.h" +#include "shmem_utils.h" + +struct file *shmem_create_from_data (const char *name,void *data,size_t len) +{ +struct file *file; +unsigned long pfn; +unsigned long sz; +int err; + + sz =PAGE_ALIGN (len); + file =shmem_file_setup (name, sz,VM_NORESERVE ); +if (IS_ERR (file)) +return file; + +for (pfn =0 ; pfn < sz >>PAGE_SHIFT ; pfn++) { +unsigned int this =min_t (size_t,PAGE_SIZE , len); +struct page *page; +void *vaddr; + + page =shmem_read_mapping_page_gfp (file->f_mapping, pfn, +GFP_KERNEL ); +if (IS_ERR (page)) { + err =PTR_ERR (page); + goto err_file; + } + + vaddr =kmap (page); +memcpy (vaddr, data, this); +kunmap (page); +put_page (page); + + len -= this; + data += this; + } + +return file; + +err_file: +fput (file); +return ERR_PTR (err); +} + +struct file *shmem_create_from_object (struct drm_i915_gem_object *obj) +{ +struct file *file; +void *ptr; + +if (obj->ops == &i915_gem_shmem_ops) { + file = obj->base.filp; +atomic_long_inc (&file->f_count); +return file; + } + + ptr =i915_gem_object_pin_map (obj,I915_MAP_WB ); +if (IS_ERR (ptr)) +return ERR_CAST (ptr); + + file =shmem_create_from_data ("" , ptr, obj->base.size); +i915_gem_object_unpin_map (obj); + +return file; +} + +static size_t shmem_npte (struct file *file) +{ +return file->f_mapping->host->i_size >>PAGE_SHIFT ; +} + +static void __shmem_unpin_map (struct file *file,void *ptr,size_t n_pte) +{ +unsigned long pfn; + +vunmap (ptr); + +for (pfn =0 ; pfn < n_pte; pfn++) { +struct page *page; + + page =shmem_read_mapping_page_gfp (file->f_mapping, pfn, +GFP_KERNEL ); +if (!WARN_ON (IS_ERR (page))) { +put_page (page); +put_page (page); + } + } +} + +void *shmem_pin_map (struct file *file) +{ +const size_t n_pte =shmem_npte (file); +pte_t *stack[32 ], **ptes, **mem; +struct vm_struct *area; +unsigned long pfn; + + mem = stack; +if (n_pte >ARRAY_SIZE (stack)) { + mem =kvmalloc_array (n_pte,sizeof (*mem),GFP_KERNEL ); +if (!mem) +return NULL ; + } + + area =alloc_vm_area (n_pte <<PAGE_SHIFT , mem); +if (!area) { +if (mem != stack) +kvfree (mem); +return NULL ; + } + + ptes = mem; +for (pfn =0 ; pfn < n_pte; pfn++) { +struct page *page; + + page =shmem_read_mapping_page_gfp (file->f_mapping, pfn, +GFP_KERNEL ); +if (IS_ERR (page)) + goto err_page; + + **ptes++ =mk_pte (page,PAGE_KERNEL ); + } + +if (mem != stack) +kvfree (mem); + +mapping_set_unevictable (file->f_mapping); +return area->addr; + +err_page: +if (mem != stack) +kvfree (mem); + +__shmem_unpin_map (file, area->addr, pfn); +return NULL ; +} + +void shmem_unpin_map (struct file *file,void *ptr) +{ +mapping_clear_unevictable (file->f_mapping); +__shmem_unpin_map (file, ptr,shmem_npte (file)); +} + +int shmem_read (struct file *file,loff_t off,void *dst,size_t len) +{ +unsigned long pfn; + +for (pfn = off >>PAGE_SHIFT ; len; pfn++) { +unsigned int this = +min_t (size_t,PAGE_SIZE -offset_in_page (off), len); +struct page *page; +void *vaddr; + + page =shmem_read_mapping_page_gfp (file->f_mapping, pfn, +GFP_KERNEL ); +if (IS_ERR (page)) +return PTR_ERR (page); + + vaddr =kmap (page); +memcpy (dst, vaddr +offset_in_page (off), this); +kunmap (page); +put_page (page); + + len -= this; + dst += this; + off =0 ; + } + +return 0 ; +}drivers/gpu/drm/i915/gt/shmem_utils.h new file +22
-0@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef SHMEM_UTILS_H +#define SHMEM_UTILS_H + +#include <linux/types.h> + +struct drm_i915_gem_object ; +struct file ; + +struct file *shmem_create_from_data (const char *name,void *data,size_t len); +struct file *shmem_create_from_object (struct drm_i915_gem_object *obj); + +void *shmem_pin_map (struct file *file); +void shmem_unpin_map (struct file *file,void *ptr); + +int shmem_read (struct file *file,loff_t off,void *dst,size_t len); + +#endif /* SHMEM_UTILS_H */ drivers/gpu/drm/i915/i915_gpu_error.c +0
-20@@ -1318,26 +1318,6 @@ capture_user(struct intel_engine_capture_vma *capture,return capture; } -static struct i915_vma_coredump * -capture_object (const struct intel_gt *gt, -struct drm_i915_gem_object *obj, -const char *name, -struct i915_vma_compress *compress) -{ -if (obj &&i915_gem_object_has_pages (obj)) { -struct i915_vma fake = { - .node = { .start =U64_MAX , .size = obj->base.size }, - .size = obj->base.size, - .pages = obj->mm.pages, - .obj = obj, - }; - -return i915_vma_coredump_create (gt, &fake, name, compress); - }else { -return NULL ; - } -} -static void add_vma (struct intel_engine_coredump *ee,struct i915_vma_coredump *vma) {@@ -1426,12 +1406,6 @@ intel_engine_coredump_add_vma(struct intel_engine_coredump *ee, engine->wa_ctx.vma, "WA context",
drivers/gpu/drm/i915/i915_gpu_error.c intel_engine_coredump_add_vma(struct intel_engine_coredump *ee, · line 1411
Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +0
-6compress)); - -add_vma (ee, -capture_object (engine->gt, - engine->default_state, -"NULL context" , - compress)); } static struct intel_engine_coredump *
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Matthew Auld (2020-04-29 17:11:38)
Quoted 17 lines · Chris Wilson
Quoted 16 lines
We need to keep the default context state around to instantiate new contexts (aka golden rendercontext), and we also keep it pinned while the engine is active so that we can quickly reset a hanging context. However, the default contexts are large enough to merit keeping in swappable memory as opposed to kernel memory, so we store them inside shmemfs. Currently, we use the normal GEM objects to create the default context image, but we can throw away all but the shmemfs file.
This greatly simplifies the tricky power management code which wants to run underneath the normal GT locking, and we definitely do not want to use any high level objects that may appear to recurse back into the GT. Though perhaps the primary advantage of the complex GEM object is that we aggressively cache the mapping, but here we are recreating the
vm_areaeverytime time we unpark. At the worst, we add a lightweight cache, but first find a microbenchmark that is impacted.
Quoted 6 lines
Quoted 3 lines
Having started to create some utility functions to make working with shmemfs objects easier, we can start putting them to wider use, where GEM objects are overkill, such as storing persistent error state.
Is there any point in having the default state in device local-memory, and if so does this change the story at all? I'm guessing not...
We want it in CPU memory unless you plan on blitting the default context image? Otherwise we have to do UC reads for each new context.
And it since the default state is not required for running the context, we'd prefer not to waste precious device memory on them, if we can avoid doing so. At worst, we could reuse the kernel_context image for the default state. Hmm. Well we'd have to give up poisoning it, and do some recovery after [runtime] suspend. I'd rather keep a copy of the default state in swap, and push it to lmem on demand :)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx