[PATCH v8 0/2] drm/i915/gvt: Split gvt lock into per-logic locks

colin.xu at intel.com colin.xu at intel.com
Tue May 15 07:15:27 UTC 2018


From: Colin Xu <colin.xu at intel.com>

The patch set splits out 2 small locks from the original big gvt lock:
  - vgpu_lock protects per-vGPU data and logic, especially the vGPU 
    trap emulation path.
  - sched_lock protects gvt scheudler structure, context schedule logic 
    and vGPU's schedule data.

While the 2 new locks are used, the origianl gvt lock will be rarely used. 
One usage example is to protect the available vGPU list.

V8:
  - Correct coding and comment style.
  - Rebase to latest gvt-staging.
V7:
  - Rebase to latest gvt-staging.
  - Remove gtt_lock since already proteced by gvt_lock and vgpu_lock.
  - Fix a typo in intel_gvt_deactivate_vgpu, unlock the wrong lock.
V6:
  - Rebase to latest gvt-staging.
V5: 
  - Rebase to latest gvt-staging.
  - Use vcpu_lock for intel_vgpu_page_track_handler instead of gvt->lock.
V4: Rebase to latest gvt-staging. Add missing protection.
V3: update to latest code base
V2: fix 2 places lock scope error

Performance comparison on Kabylake platform.
  - Configuration:
    Host: Ubuntu 16.04.
    Guest 1 & 2: Ubuntu 16.04.

glmark2 score comparison:
  - Configuration:
    Host: glxgears.
    Guests: glmark2.
+--------------------------------+-----------------+
| Setup                          | glmark2 score   |
+--------------------------------+-----------------+
| unified lock, iommu=on         | 58~62 (avg. 60) |
+--------------------------------+-----------------+
| unified lock, iommu=igfx_off   | 57~61 (avg. 59) |
+--------------------------------+-----------------+
| per-logic lock, iommu=on       | 60~68 (avg. 64) |
+--------------------------------+-----------------+
| per-logic lock, iommu=igfx_off | 61~67 (avg. 64) |
+--------------------------------+-----------------+

lock_stat comparison:
  - Configuration:
    Stop lock stat immediately after boot up.
    Boot 2 VM Guests.
    Run glmark2 in guests.
    Start perf lock_stat for 20 seconds and stop again.
  - Legend: c - contentions; w - waittime-avg
+------------+-----------------+-----------+---------------+------------+
|            | gvt_lock        |sched_lock | vgpu_lock     | gtt_lock   |
+ lock type; +-----------------+-----------+---------------+------------+
| iommu set  | c     | w       | c  | w    | c    | w      | c   | w    |
+------------+-------+---------+----+------+------+--------+-----+------+
| unified;   | 20697 | 839     |N/A | N/A  | N/A  | N/A    | N/A | N/A  |
| on         |       |         |    |      |      |        |     |      |
+------------+-------+---------+----+------+------+--------+-----+------+
| unified;   | 21838 | 658.15  |N/A | N/A  | N/A  | N/A    | N/A | N/A  |
| igfx_off   |       |         |    |      |      |        |     |      |
+------------+-------+---------+----+------+------+--------+-----+------+
| per-logic; | 1553  | 1599.96 |9458|429.97| 5846 | 274.33 | 0   | 0.00 |
| on         |       |         |    |      |      |        |     |      |
+------------+-------+---------+----+------+------+--------+-----+------+
| per-logic; | 1911  | 1678.32 |8335|445.16| 5451 | 244.80 | 0   | 0.00 |
| igfx_off   |       |         |    |      |      |        |     |      |
+------------+-------+---------+----+------+------+--------+-----+------+

Pei Zhang (2):
  drm/i915/gvt: Use vgpu_lock to protect per vgpu access
  drm/i915/gvt: Use sched_lock to protect gvt scheduler logic.

 drivers/gpu/drm/i915/gvt/display.c      | 35 ++++++++--------
 drivers/gpu/drm/i915/gvt/gvt.c          |  6 +--
 drivers/gpu/drm/i915/gvt/gvt.h          | 16 ++++++++
 drivers/gpu/drm/i915/gvt/handlers.c     |  4 ++
 drivers/gpu/drm/i915/gvt/mmio.c         | 12 +++---
 drivers/gpu/drm/i915/gvt/page_track.c   |  5 +--
 drivers/gpu/drm/i915/gvt/sched_policy.c | 36 +++++++++++++++--
 drivers/gpu/drm/i915/gvt/scheduler.c    | 17 ++++----
 drivers/gpu/drm/i915/gvt/vgpu.c         | 53 +++++++++++++------------
 9 files changed, 117 insertions(+), 67 deletions(-)

-- 
2.17.0



More information about the intel-gvt-dev mailing list