[Intel-gfx] [PATCH] drm/i915/selftests: Yet another forgotten mock_i915->mm initialiser

Matthew Auld matthew.william.auld at gmail.com
Fri Nov 10 23:18:41 UTC 2017


On 10 November 2017 at 22:58, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Move all of the i915->mm initialisation to a private function that can
> be reused by the mock i915 device to save forgetting any more steps.
>
> For example,
> <7>[ 1542.046332] [IGT] drv_selftest: starting subtest mock_objects
> <4>[ 1542.123924] Setting dangerous option mock_selftests - tainting kernel
> <6>[ 1542.167941] i915: Performing mock selftests with st_random_seed=0x246f5ab5 st_timeout=1000
> <4>[ 1542.178012] INFO: trying to register non-static key.
> <4>[ 1542.178027] the code is fine but needs lockdep annotation.
> <4>[ 1542.178032] turning off the locking correctness validator.
> <4>[ 1542.178041] CPU: 3 PID: 6008 Comm: kworker/3:7 Tainted: G     U          4.14.0-rc8-CI-CI_DRM_3332+ #1
> <4>[ 1542.178049] Hardware name:                  /NUC6CAYB, BIOS AYAPLCEL.86A.0040.2017.0619.1722 06/19/2017
> <4>[ 1542.178144] Workqueue: events __i915_gem_free_work [i915]
> <4>[ 1542.178152] Call Trace:
> <4>[ 1542.178163]  dump_stack+0x68/0x9f
> <4>[ 1542.178170]  register_lock_class+0x3fd/0x580
> <4>[ 1542.178177]  ? unwind_next_frame+0x14/0x20
> <4>[ 1542.178184]  ? __save_stack_trace+0x73/0xd0
> <4>[ 1542.178191]  __lock_acquire+0xa4/0x1b00
> <4>[ 1542.178254]  ? __i915_gem_free_work+0x28/0xa0 [i915]
> <4>[ 1542.178261]  ? __lock_acquire+0x4ab/0x1b00
> <4>[ 1542.178268]  lock_acquire+0xb0/0x200
> <4>[ 1542.178273]  ? lock_acquire+0xb0/0x200
> <4>[ 1542.178336]  ? __i915_gem_free_work+0x28/0xa0 [i915]
> <4>[ 1542.178344]  _raw_spin_lock+0x32/0x50
> <4>[ 1542.178405]  ? __i915_gem_free_work+0x28/0xa0 [i915]
> <4>[ 1542.178468]  __i915_gem_free_work+0x28/0xa0 [i915]
> <4>[ 1542.178476]  process_one_work+0x221/0x650
> <4>[ 1542.178483]  worker_thread+0x4e/0x3c0
> <4>[ 1542.178489]  kthread+0x114/0x150
> <4>[ 1542.178494]  ? process_one_work+0x650/0x650
> <4>[ 1542.178499]  ? kthread_create_on_node+0x40/0x40
> <4>[ 1542.178506]  ret_from_fork+0x27/0x40
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c                  | 25 +++++++++++++++---------
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c |  8 +-------
>  2 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 80963c81c2ca..351247b49c79 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5233,6 +5233,21 @@ i915_gem_load_init_fences(struct drm_i915_private *dev_priv)
>         i915_gem_detect_bit_6_swizzle(dev_priv);
>  }
>
> +static void i915_gem_init_mm(struct drm_i915_private *i915)
> +{
> +       spin_lock_init(&i915->mm.obj_lock);
> +       spin_lock_init(&i915->mm.free_lock);
> +
> +       init_llist_head(&i915->mm.free_list);
> +
> +       INIT_LIST_HEAD(&i915->mm.unbound_list);
> +       INIT_LIST_HEAD(&i915->mm.bound_list);
> +       INIT_LIST_HEAD(&i915->mm.fence_list);
> +       INIT_LIST_HEAD(&i915->mm.userfault_list);
> +
> +       INIT_WORK(&i915->mm.free_work, __i915_gem_free_work);
> +}
> +
>  int
>  i915_gem_load_init(struct drm_i915_private *dev_priv)
>  {
> @@ -5274,15 +5289,7 @@ i915_gem_load_init(struct drm_i915_private *dev_priv)
>         if (err)
>                 goto err_priorities;
>
> -       INIT_WORK(&dev_priv->mm.free_work, __i915_gem_free_work);
> -
> -       spin_lock_init(&dev_priv->mm.obj_lock);
> -       spin_lock_init(&dev_priv->mm.free_lock);
> -       init_llist_head(&dev_priv->mm.free_list);
> -       INIT_LIST_HEAD(&dev_priv->mm.unbound_list);
> -       INIT_LIST_HEAD(&dev_priv->mm.bound_list);
> -       INIT_LIST_HEAD(&dev_priv->mm.fence_list);
> -       INIT_LIST_HEAD(&dev_priv->mm.userfault_list);
> +       i915_gem_init_mm(dev_priv);
>
>         INIT_DELAYED_WORK(&dev_priv->gt.retire_work,
>                           i915_gem_retire_work_handler);
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index d2bf2729c331..2df47239e8a0 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -179,9 +179,8 @@ struct drm_i915_private *mock_gem_device(void)
>                 I915_GTT_PAGE_SIZE_64K |
>                 I915_GTT_PAGE_SIZE_2M;
>
> -       spin_lock_init(&i915->mm.object_stat_lock);
I think we still need this, no?


More information about the Intel-gfx mailing list