1. 05 7月, 2018 1 次提交
  2. 14 5月, 2018 3 次提交
  3. 23 4月, 2018 1 次提交
    • Z
      drm/i915/gvt: scan non-privileged batch buffer for debug purpose · 96bebe39
      Zhao Yan 提交于
      For perfomance purpose, scanning of non-privileged batch buffer is turned
      off by default. But for debugging purpose, it can be turned on via debugfs.
      After scanning, we submit the original non-privileged batch buffer into
      hardware, so that the scanning is only a peeking window of guest submitted
      commands and will not affect the execution results.
      
      v4:
      - refine debugfs print format&content (zhenyu wang)
      - print engine id instread of engine name to prevent potential memory leak
        in debugfs warning message. (zhenyu wang)
      
      v3:
      - change vgpu->scan_nonprivbb from type bool to u32, so it is able to
        selectively turn on/off scanning of non-privileged batch buffer on engine
        level. e.g.
        if vgpu->scan_nonprivbb=3, then it will scan non-privileged batch buffer
        on engine 0 and 1.
      - in debugfs interface to set vgpu->scan_nonprivbb, print warning message
        to warn user and explicitly tell state change in kernel log (zhenyu wang)
      v2:
      - rebase
      - update comments for start_gma_offset (henry)
      Signed-off-by: NZhao Yan <yan.y.zhao@intel.com>
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      96bebe39
  4. 11 4月, 2018 1 次提交
  5. 28 3月, 2018 1 次提交
    • Z
      drm/i915/gvt: Make MI_USER_INTERRUPT nop in cmd parser · 5da795b0
      Zhipeng Gong 提交于
      GVT-g dispatches request to host i915 and depends on i915 notify
      ring interrupt mechanism to check completion of request.
      For now MI_USER_INTERRUPT in guest requests is passed through
      in GVT-g cmd parser and i915 does not use it, which causes
      unnecessary interrupt handling in i915.
      On the other hand, if several requests from guest are combined into
      one request in and contain MI_USER_INTERRUPT in the middle of
      combined request. GVT-g still has to wait on the whole request to
      complete to inject user interrupts to guest.
      
      This patch makes all the MI_USER_INTERRUPT nop to save some interrupt
      handling.
      
      Here is test result to run glmark2 on guest for 10 seconds:
      host master interrupts number is reduced from 16021 to 11162
      host user interrupts number is reduced from 7936 to 3536
      
      v2:
      - revise commit message. (Kevin)
      Reviewed-by: NKevin Tian <kevin.tian@intel.com>
      Signed-off-by: NZhipeng Gong <zhipeng.gong@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      5da795b0
  6. 15 3月, 2018 1 次提交
    • F
      drm/i915/gvt: Correct the privilege shadow batch buffer address · ef75c685
      fred gao 提交于
      Once the ring buffer is copied to ring_scan_buffer and scanned,
      the shadow batch buffer start address is only updated into
      ring_scan_buffer, not the real ring address allocated through
      intel_ring_begin in later copy_workload_to_ring_buffer.
      
      This patch is only to set the right shadow batch buffer address
      from Ring buffer, not include the shadow_wa_ctx.
      
      v2:
      - refine some comments. (Zhenyu)
      v3:
      - fix typo in title. (Zhenyu)
      v4:
      - remove the unnecessary comments. (Zhenyu)
      - add comments in bb_start_cmd_va update. (Zhenyu)
      
      Fixes: 0a53bc07 ("drm/i915/gvt: Separate cmd scan from request allocation")
      Cc: stable@vger.kernel.org  # v4.15
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Yulei Zhang <yulei.zhang@intel.com>
      Signed-off-by: Nfred gao <fred.gao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      ef75c685
  7. 08 1月, 2018 1 次提交
    • C
      drm/i915/gvt: Fix stack-out-of-bounds bug in cmd parser · 65e74392
      Changbin Du 提交于
      for_each_set_bit() only accepts variable of type unsigned long, and we can
      not cast it from smaller types.
      
      [   16.499365] ==================================================================
      [   16.506655] BUG: KASAN: stack-out-of-bounds in find_first_bit+0x1d/0x70
      [   16.513313] Read of size 8 at addr ffff8803616cf510 by task systemd-udevd/180
      [   16.521998] CPU: 0 PID: 180 Comm: systemd-udevd Tainted: G     U     O     4.15.0-rc3+ #14
      [   16.530317] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 1.2.8 01/26/2016
      [   16.537760] Call Trace:
      [   16.540230]  dump_stack+0x7c/0xbb
      [   16.543569]  print_address_description+0x6b/0x290
      [   16.548306]  kasan_report+0x28a/0x370
      [   16.551993]  ? find_first_bit+0x1d/0x70
      [   16.555858]  find_first_bit+0x1d/0x70
      [   16.559625]  intel_gvt_init_cmd_parser+0x127/0x3c0 [i915]
      [   16.565060]  ? __lock_is_held+0x8f/0xf0
      [   16.568990]  ? intel_gvt_clean_cmd_parser+0x10/0x10 [i915]
      [   16.574514]  ? __hrtimer_init+0x5d/0xb0
      [   16.578445]  intel_gvt_init_device+0x2c3/0x690 [i915]
      [   16.583537]  ? unregister_module_notifier+0x20/0x20
      [   16.588515]  intel_gvt_init+0x89/0x100 [i915]
      [   16.592962]  i915_driver_load+0x1992/0x1c70 [i915]
      [   16.597846]  ? __i915_printk+0x210/0x210 [i915]
      [   16.602410]  ? wait_for_completion+0x280/0x280
      [   16.606883]  ? lock_downgrade+0x2c0/0x2c0
      [   16.610923]  ? __pm_runtime_resume+0x46/0x90
      [   16.615238]  ? acpi_dev_found+0x76/0x80
      [   16.619162]  ? i915_pci_remove+0x30/0x30 [i915]
      [   16.623733]  local_pci_probe+0x74/0xe0
      [   16.627518]  pci_device_probe+0x208/0x310
      [   16.631561]  ? pci_device_remove+0x100/0x100
      [   16.635871]  ? __list_add_valid+0x29/0xa0
      [   16.639919]  driver_probe_device+0x40b/0x6b0
      [   16.644223]  ? driver_probe_device+0x6b0/0x6b0
      [   16.648696]  __driver_attach+0x11d/0x130
      [   16.652649]  bus_for_each_dev+0xe7/0x160
      [   16.656600]  ? subsys_dev_iter_exit+0x10/0x10
      [   16.660987]  ? __list_add_valid+0x29/0xa0
      [   16.665028]  bus_add_driver+0x31d/0x3a0
      [   16.668893]  driver_register+0xc6/0x170
      [   16.672758]  ? 0xffffffffc0ad8000
      [   16.676108]  do_one_initcall+0x9c/0x206
      [   16.679984]  ? initcall_blacklisted+0x150/0x150
      [   16.684545]  ? do_init_module+0x35/0x33b
      [   16.688494]  ? kasan_unpoison_shadow+0x31/0x40
      [   16.692968]  ? kasan_kmalloc+0xa6/0xd0
      [   16.696743]  ? do_init_module+0x35/0x33b
      [   16.700694]  ? kasan_unpoison_shadow+0x31/0x40
      [   16.705168]  ? __asan_register_globals+0x82/0xa0
      [   16.709819]  do_init_module+0xe7/0x33b
      [   16.713597]  load_module+0x4481/0x4ce0
      [   16.717397]  ? module_frob_arch_sections+0x20/0x20
      [   16.722228]  ? vfs_read+0x13b/0x190
      [   16.725742]  ? kernel_read+0x74/0xa0
      [   16.729351]  ? get_user_arg_ptr.isra.17+0x70/0x70
      [   16.734099]  ? SYSC_finit_module+0x175/0x1b0
      [   16.738399]  SYSC_finit_module+0x175/0x1b0
      [   16.742524]  ? SYSC_init_module+0x1e0/0x1e0
      [   16.746741]  ? __fget+0x157/0x240
      [   16.750090]  ? trace_hardirqs_on_thunk+0x1a/0x1c
      [   16.754747]  entry_SYSCALL_64_fastpath+0x23/0x9a
      [   16.759397] RIP: 0033:0x7f8fbc837499
      [   16.762996] RSP: 002b:00007ffead76c138 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      [   16.770618] RAX: ffffffffffffffda RBX: 0000000000000012 RCX: 00007f8fbc837499
      [   16.777800] RDX: 0000000000000000 RSI: 000056484e67b080 RDI: 0000000000000012
      [   16.784979] RBP: 00007ffead76b140 R08: 0000000000000000 R09: 0000000000000021
      [   16.792164] R10: 0000000000000012 R11: 0000000000000246 R12: 000056484e67b460
      [   16.799345] R13: 00007ffead76b120 R14: 0000000000000005 R15: 0000000000000000
      [   16.808052] The buggy address belongs to the page:
      [   16.812876] page:00000000dc4b8c1e count:0 mapcount:0 mapping:          (null) index:0x0
      [   16.820934] flags: 0x17ffffc0000000()
      [   16.824621] raw: 0017ffffc0000000 0000000000000000 0000000000000000 00000000ffffffff
      [   16.832416] raw: ffffea000d85b3e0 ffffea000d85b3e0 0000000000000000 0000000000000000
      [   16.840208] page dumped because: kasan: bad access detected
      [   16.847318] Memory state around the buggy address:
      [   16.852143]  ffff8803616cf400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   16.859427]  ffff8803616cf480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
      [   16.866708] >ffff8803616cf500: f1 f1 04 f4 f4 f4 f3 f3 f3 f3 00 00 00 00 00 00
      [   16.873988]                          ^
      [   16.877770]  ffff8803616cf580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   16.885042]  ffff8803616cf600: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
      [   16.892312] ==================================================================
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      65e74392
  8. 22 12月, 2017 1 次提交
    • Z
      drm/i915/gvt: cleanup usage for typed mmio reg vs. offset · 90551a12
      Zhenyu Wang 提交于
      We had previous hack that tried to accept either i915_reg_t or offset
      value to access vGPU virtual/shadow regs which broke that purpose to
      be type safe in context. This one trys to explicitly separate the usage
      of typed mmio reg with real offset.
      
      Old vgpu_vreg(offset) helper is used only for offset now with new
      vgpu_vreg_t(reg) is used for i915_reg_t only. Convert left usage
      of that to new helper.
      
      Also fixed left KASAN warning issues caused by previous hack.
      
      v2: rebase, fixup against recent mmio switch change
      Reviewed-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      90551a12
  9. 18 12月, 2017 1 次提交
  10. 21 11月, 2017 1 次提交
  11. 16 11月, 2017 9 次提交
  12. 27 10月, 2017 1 次提交
  13. 08 9月, 2017 2 次提交
    • F
      drm/i915/gvt: Refine error handling for perform_bb_shadow · 1e3197d6
      fred gao 提交于
      fix the wrong return type and return error once the unknown
      command is scanned.
      
      v2:
      - separate this error handle from healthy rating code. (Zhenyu)
      Signed-off-by: Nfred gao <fred.gao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      1e3197d6
    • F
      drm/i915/gvt: Separate cmd scan from request allocation · 0a53bc07
      fred gao 提交于
      Currently i915 request structure and shadow ring buffer are allocated
      before command scan, so it will have to restore to previous states once
      any error happens afterwards in the long dispatch_workload path.
      
      This patch is to introduce a reserved ring buffer created at the beginning
      of vGPU initialization. Workload will be coped to this reserved buffer and
      be scanned first, the i915 request and shadow ring buffer are only
      allocated after the result of scan is successful.
      
      To balance the memory usage and buffer alloc time, the coming bigger ring
      buffer will be reallocated and kept until more bigger buffer is coming.
      
      v2:
      - use kmalloc for the smaller ring buffer, realloc if required. (Zhenyu)
      
      v3:
      - remove the dynamically allocated ring buffer. (Zhenyu)
      
      v4:
      - code style polish.
      - kfree previous allocated buffer once kmalloc failed. (Zhenyu)
      Signed-off-by: Nfred gao <fred.gao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      0a53bc07
  14. 23 8月, 2017 1 次提交
  15. 10 8月, 2017 2 次提交
  16. 11 7月, 2017 1 次提交
  17. 08 6月, 2017 2 次提交
    • X
      drm/i915/gvt: Delete gvt_dbg_cmd() in cmd_parser_exec() · 089f93c3
      Xiong Zhang 提交于
      Since cmd message have been recorded in trace, gvt_dbg_cmd isn't
      necessary. This will reduce much of dmesg as gvt_dbg_cmd is repeated
      on each workload.
      Signed-off-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      089f93c3
    • C
      drm/i915/gvt: rewrite the trace gvt:gvt_command using trace style approach · ffc19776
      Changbin Du 提交于
      The gvt:gvt_command trace involve unnecessary overhead even this trace is
      not enabled. We need improve it.
      
      The kernel trace infrastructure provide a full api to define a trace event.
      We should leverage them if possible. And one important thing is that a trace
      point should store raw data but not format string.
      
      This patch include two part work:
      1) Refactor the gvt_command trace definition, including:
        o only store raw trace data.
        o use __dynamic_array() to declare a variable size buffer.
        o use __print_array() to format raw cmd data.
        o rename vm_id as vgpu_id.
      
      2) Improve the trace invoking, including:
        o remove the cycles calculation for handler. We can get this data
          by any perf tool.
        o do not make a backup for raw cmd data which just doesn't make sense.
      
      With this patch, this trace has no overhead if it is not enabled. And we are
      trace style now.
      
      The final output example:
        gvt workload 0-211   [000] ...1   120.555964: gvt_command: vgpu1 ring 0: buf_type 0, ip_gma e161e880, raw cmd {0x4000000}
        gvt workload 0-211   [000] ...1   120.556014: gvt_command: vgpu1 ring 0: buf_type 0, ip_gma e161e884, raw cmd {0x7a000004,0x1004000,0xe1511018,0x0,0x7d,0x0}
        gvt workload 0-211   [000] ...1   120.556062: gvt_command: vgpu1 ring 0: buf_type 0, ip_gma e161e89c, raw cmd {0x7a000004,0x140000,0x0,0x0,0x0,0x0}
        gvt workload 0-211   [000] ...1   120.556110: gvt_command: vgpu1 ring 0: buf_type 0, ip_gma e161e8b4, raw cmd {0x10400002,0xe1511018,0x0,0x7d}
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      ffc19776
  18. 12 4月, 2017 2 次提交
  19. 29 3月, 2017 3 次提交
  20. 17 3月, 2017 3 次提交
  21. 08 3月, 2017 1 次提交
  22. 14 2月, 2017 1 次提交
    • T
      drm/i915: Emit to ringbuffer directly · 73dec95e
      Tvrtko Ursulin 提交于
      This removes the usage of intel_ring_emit in favour of
      directly writing to the ring buffer.
      
      intel_ring_emit was preventing the compiler for optimising
      fetch and increment of the current ring buffer pointer and
      therefore generating very verbose code for every write.
      
      It had no useful purpose since all ringbuffer operations
      are started and ended with intel_ring_begin and
      intel_ring_advance respectively, with no bail out in the
      middle possible, so it is fine to increment the tail in
      intel_ring_begin and let the code manage the pointer
      itself.
      
      Useless instruction removal amounts to approximately
      two and half kilobytes of saved text on my build.
      
      Not sure if this has any measurable performance
      implications but executing a ton of useless instructions
      on fast paths cannot be good.
      
      v2:
       * Change return from intel_ring_begin to error pointer by
         popular demand.
       * Move tail increment to intel_ring_advance to enable some
         error checking.
      
      v3:
       * Move tail advance back into intel_ring_begin.
       * Rebase and tidy.
      
      v4:
       * Complete rebase after a few months since v3.
      
      v5:
       * Remove unecessary cast and fix !debug compile. (Chris Wilson)
      
      v6:
       * Make intel_ring_offset take request as well.
       * Fix recording of request postfix plus a sprinkle of asserts.
         (Chris Wilson)
      
      v7:
       * Use intel_ring_offset to get the postfix. (Chris Wilson)
       * Convert GVT code as well.
      
      v8:
       * Rename *out++ to *cs++.
      
      v9:
       * Fix GVT out to cs conversion in GVT.
      
      v10:
       * Rebase for new intel_ring_begin in selftests.
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170214113242.29241-1-tvrtko.ursulin@linux.intel.com
      73dec95e