drm/i915: to make vgpu ppgtt notificaiton as atomic operation
Subsystems (3)
PATCH v2 1/1 drm/i915: to make vgpu ppgtt notificaiton as atomic operation
vgpu ppgtt notification was split into 2 steps, the first step is to update PVINFO's pdp register and then write PVINFO's g2v_notify register with action code to tirgger ppgtt notification to GVT side.
currently these steps were not atomic operations due to no any protection, so it is easy to enter race condition state during the MTBF, stress and IGT test to cause GPU hang.
the solution is to add a lock to make vgpu ppgtt notication as atomic operation.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/i915_vgpu.c | 1 + 3 files changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -961,6 +961,7 @@ struct i915_frontbuffer_tracking { };struct i915_virtual_gpu { +struct mutex lock;bool active;u32 caps; };
drivers/gpu/drm/i915/i915_gem_gtt.c +4 -0
@@ -833,6 +833,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)enum vgt_g2v_type msg;int i; +mutex_lock (&dev_priv->vgpu.lock); +if (create)atomic_inc (px_used (ppgtt->pd));/* never remove */ else
@@ -860,6 +862,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)I915_WRITE (vgtif_reg (g2v_notify), msg); +mutex_unlock (&dev_priv->vgpu.lock); +return 0 ; }
drivers/gpu/drm/i915/i915_vgpu.c +1 -0
@@ -94,6 +94,7 @@ void i915_detect_vgpu(struct drm_i915_private *dev_priv) dev_priv->vgpu.caps =readl (shared_area +vgtif_offset (vgt_caps)); dev_priv->vgpu.active = true; +mutex_init (&dev_priv->vgpu.lock);DRM_INFO ("Virtual GPU for Intel GVT-g detected.\n" ); out:
Signature · 1 line
2.7.4
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm/i915: to make vgpu ppgtt notificaiton as atomic operation
== Series Details ==
== Series Details ==
Series: drm/i915: to make vgpu ppgtt notificaiton as atomic operation
URL : https://patchwork.freedesktop.org/series/65669/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 09841439a4f2 drm/i915: to make vgpu ppgtt notificaiton as atomic operation -:28: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment #28: FILE: drivers/gpu/drm/i915/i915_drv.h:965: + struct mutex lock;
total: 0 errors, 0 warnings, 1 checks, 30 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: to make vgpu ppgtt notificaiton as atomic operation
In reply to Xiaolin Zhang== Series Details ==
== Series Details ==
Series: drm/i915: to make vgpu ppgtt notificaiton as atomic operation
URL : https://patchwork.freedesktop.org/series/65669/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6772 -> Patchwork_14153
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/
Known issues
------------
Here are the changes found in Patchwork_14153 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_exec@basic:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-icl-u3/igt@[email protected]
* igt@gem_ctx_switch@legacy-render:
- fi-apl-guc: [PASS][3] -> [INCOMPLETE][4] ([fdo#103927])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-apl-guc/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-apl-guc/igt@[email protected]
* igt@kms_chamelium@dp-crc-fast:
- fi-cml-u2: [PASS][5] -> [FAIL][6] ([fdo#110627])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-cml-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-cml-u2/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_reloc@basic-write-read-noreloc:
- fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-icl-u3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-icl-u3/igt@[email protected]
* igt@kms_chamelium@hdmi-edid-read:
- {fi-icl-u4}: [FAIL][9] ([fdo#111045]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-icl-u4/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-icl-u4/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-blb-e6850: [INCOMPLETE][11] ([fdo#107718]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6772/fi-blb-e6850/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/fi-blb-e6850/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#110627]: https://bugs.freedesktop.org/show_bug.cgi?id=110627
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
Participating hosts (52 -> 46)
------------------------------
Additional (2): fi-bxt-dsi fi-bwr-2160
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6772 -> Patchwork_14153
CI-20190529: 20190529
CI_DRM_6772: 98a2f110ff04ef9de442e86ec6f29c5ccaf815a4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5148: 50390dd7adaccae21cafa85b866c17606cec94c3 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14153: 09841439a4f24997ffcf83137cbbecc5fc5502b9 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
09841439a4f2 drm/i915: to make vgpu ppgtt notificaiton as atomic operation
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14153/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Xiaolin Zhang (2019-08-23 07:57:31)
Quoted 45 lines
vgpu ppgtt notification was split into 2 steps, the first step is to update PVINFO's pdp register and then write PVINFO's
g2v_notifyregister with action code to tirgger ppgtt notification to GVT side.currently these steps were not atomic operations due to no any protection, so it is easy to enter race condition state during the MTBF, stress and IGT test to cause GPU hang.
the solution is to add a lock to make vgpu ppgtt notication as atomic operation.
Signed-off-by Xiaolin Zhang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/i915_vgpu.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -961,6 +961,7 @@ struct i915_frontbuffer_tracking { };struct i915_virtual_gpu { +struct mutex lock;bool active;u32 caps; };drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -833,6 +833,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)enum vgt_g2v_type msg;int i; +mutex_lock (&dev_priv->vgpu.lock); +if (create)atomic_inc (px_used (ppgtt->pd));/* never remove */ else
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create) · line 864
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -860,6 +862,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)I915_WRITE (vgtif_reg (g2v_notify), msg);
How do you know the operation is complete and it is now safe to overwrite the data regs?
-Chris
Quoted 47 lines · Chris Wilson
Quoting Xiaolin Zhang (2019-08-23 07:57:31)
Quoted 46 lines
vgpu ppgtt notification was split into 2 steps, the first step is to update PVINFO's pdp register and then write PVINFO's
g2v_notifyregister with action code to tirgger ppgtt notification to GVT side.currently these steps were not atomic operations due to no any protection, so it is easy to enter race condition state during the MTBF, stress and IGT test to cause GPU hang.
the solution is to add a lock to make vgpu ppgtt notication as atomic operation.
Signed-off-by Xiaolin Zhang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/i915_vgpu.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -961,6 +961,7 @@ struct i915_frontbuffer_tracking { };struct i915_virtual_gpu { +struct mutex lock;bool active;u32 caps; };drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -833,6 +833,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)enum vgt_g2v_type msg;int i; +mutex_lock (&dev_priv->vgpu.lock); +if (create)atomic_inc (px_used (ppgtt->pd));/* never remove */ else @@ -860,6 +862,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create) · line 864
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0I915_WRITE (vgtif_reg (g2v_notify), msg);How do you know the operation is complete and it is now safe to overwrite the data regs?
-Chris
by design, the data reg value is copied out to use, so as long as the action and data is operated together, how long the operation is not a issue and it is safe to overwrite the data regs with new action next time.
-BRs, Xiaolin
Quoting Zhang, Xiaolin (2019-08-23 09:07:01)
Quoted 54 lines · Chris Wilson
Quoted 47 lines
Quoting Xiaolin Zhang (2019-08-23 07:57:31)
Quoted 46 lines
vgpu ppgtt notification was split into 2 steps, the first step is to update PVINFO's pdp register and then write PVINFO's
g2v_notifyregister with action code to tirgger ppgtt notification to GVT side.currently these steps were not atomic operations due to no any protection, so it is easy to enter race condition state during the MTBF, stress and IGT test to cause GPU hang.
the solution is to add a lock to make vgpu ppgtt notication as atomic operation.
Signed-off-by Xiaolin Zhang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/i915_vgpu.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -961,6 +961,7 @@ struct i915_frontbuffer_tracking { };struct i915_virtual_gpu { +struct mutex lock;bool active;u32 caps; };drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -833,6 +833,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)enum vgt_g2v_type msg;int i; +mutex_lock (&dev_priv->vgpu.lock); +if (create)atomic_inc (px_used (ppgtt->pd));/* never remove */ else @@ -860,6 +862,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create) · line 864
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0I915_WRITE (vgtif_reg (g2v_notify), msg);How do you know the operation is complete and it is now safe to overwrite the data regs?
-Chris
Quoted 3 lines
by design, the data reg value is copied out to use, so as long as the action and data is operated together, how long the operation is not a issue and it is safe to overwrite the data regs with new action next time.
When and how quickly is it copied? Consider that it will be immediately overwritten by the next packet. Does the vgpu mmio write cause the calling CPU to be trapped?
-Chris
Quoted 55 lines · Chris Wilson
Quoting Zhang, Xiaolin (2019-08-23 09:07:01)
Quoted 54 lines · Chris Wilson
Quoted 53 lines
Quoting Xiaolin Zhang (2019-08-23 07:57:31)
Quoted 45 lines
vgpu ppgtt notification was split into 2 steps, the first step is to update PVINFO's pdp register and then write PVINFO's
g2v_notifyregister with action code to tirgger ppgtt notification to GVT side.currently these steps were not atomic operations due to no any protection, so it is easy to enter race condition state during the MTBF, stress and IGT test to cause GPU hang.
the solution is to add a lock to make vgpu ppgtt notication as atomic operation.
Signed-off-by Xiaolin Zhang <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++++ drivers/gpu/drm/i915/i915_vgpu.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -961,6 +961,7 @@ struct i915_frontbuffer_tracking { };struct i915_virtual_gpu { +struct mutex lock;bool active;u32 caps; };drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -833,6 +833,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)enum vgt_g2v_type msg;int i; +mutex_lock (&dev_priv->vgpu.lock); +if (create)atomic_inc (px_used (ppgtt->pd));/* never remove */ else drivers/gpu/drm/i915/i915_gem_gtt.c static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create) · line 864
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -860,6 +862,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)I915_WRITE (vgtif_reg (g2v_notify), msg);How do you know the operation is complete and it is now safe to overwrite the data regs?
-Chris
Quoted 7 lines
Quoted 3 lines
by design, the data reg value is copied out to use, so as long as the action and data is operated together, how long the operation is not a issue and it is safe to overwrite the data regs with new action next time.
When and how quickly is it copied? Consider that it will be immediately overwritten by the next packet. Does the vgpu mmio write cause the calling CPU to be trapped?
yeah, mmio write will always be trapped, this data is got in notify mmio reg write trap handler. We need to add doc to tell that for current gvt notify interface, client needs to ensure serialized write but without data overwrite.
Signature · 3 lines
Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827