Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 08/17] drm/i915: Protect the obj->vma.list during iteration
Date: Tue, 19 Nov 2019 12:36:23 +0200	[thread overview]
Message-ID: <87a78sxie0.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20191119100929.2628356-8-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Take the obj->vma.lock to prevent modifications to the list as we
> iterate, to avoid the dreaded the NULL pointer.
>
> <1>[  347.820823] BUG: kernel NULL pointer dereference, address: 0000000000000150
> <1>[  347.820856] #PF: supervisor read access in kernel mode
> <1>[  347.820874] #PF: error_code(0x0000) - not-present page
> <6>[  347.820892] PGD 0 P4D 0
> <4>[  347.820908] Oops: 0000 [#1] PREEMPT SMP NOPTI
> <4>[  347.820926] CPU: 3 PID: 1303 Comm: gem_persistent_ Tainted: G     U            5.4.0-rc7-CI-CI_DRM_7352+ #1
> <4>[  347.820956] Hardware name:  /NUC6CAYB, BIOS AYAPLCEL.86A.0049.2018.0508.1356 05/08/2018
> <4>[  347.821132] RIP: 0010:i915_gem_object_flush_write_domain+0xd9/0x1d0 [i915]
> <4>[  347.821157] Code: 0f 84 e9 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 75 11 e9 ed 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 74 26 48 8b 83 b0 00 00 00 <48> 8b b8 50 01 00 00 e8 fb 20 fb ff 48 8b 83 30 03 00 00 49 39 c4
> <4>[  347.821210] RSP: 0018:ffffc90000a1f8f8 EFLAGS: 00010202
> <4>[  347.821229] RAX: 0000000000000000 RBX: ffffc900008479a0 RCX: 0000000000000018
> <4>[  347.821252] RDX: 0000000000000000 RSI: 000000000000000d RDI: ffff888275a090b0
> <4>[  347.821274] RBP: ffff8882673c8040 R08: ffff88825991b8d0 R09: 0000000000000000
> <4>[  347.821297] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8882673c8280
> <4>[  347.821319] R13: ffff8882673c8368 R14: 0000000000000000 R15: ffff888266a54000
> <4>[  347.821343] FS:  00007f75865f4240(0000) GS:ffff888277b80000(0000) knlGS:0000000000000000
> <4>[  347.821368] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> <4>[  347.821389] CR2: 0000000000000150 CR3: 000000025aee0000 CR4: 00000000003406e0
> <4>[  347.821411] Call Trace:
> <4>[  347.821555]  i915_gem_object_prepare_read+0xea/0x2a0 [i915]
> <4>[  347.821706]  intel_engine_cmd_parser+0x5ce/0xe90 [i915]
> <4>[  347.821834]  ? __i915_sw_fence_complete+0x1a0/0x250 [i915]
> <4>[  347.821990]  i915_gem_do_execbuffer+0xb4c/0x2550 [i915]
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_object.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 63bd3ff84f5e..458945e1823e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -279,10 +279,12 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
>  
>  	switch (obj->write_domain) {
>  	case I915_GEM_DOMAIN_GTT:
> +		spin_lock(&obj->vma.lock);
>  		for_each_ggtt_vma(vma, obj) {
>  			if (i915_vma_unset_ggtt_write(vma))
>  				intel_gt_flush_ggtt_writes(vma->vm->gt);
>  		}
> +		spin_unlock(&obj->vma.lock);
>  
>  		intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
>  		break;
> -- 
> 2.24.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 08/17] drm/i915: Protect the obj->vma.list during iteration
Date: Tue, 19 Nov 2019 12:36:23 +0200	[thread overview]
Message-ID: <87a78sxie0.fsf@gaia.fi.intel.com> (raw)
Message-ID: <20191119103623.khpEq49-fxukZWTxRF5O51Q0jmOlUCKziJb6m_viOAo@z> (raw)
In-Reply-To: <20191119100929.2628356-8-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Take the obj->vma.lock to prevent modifications to the list as we
> iterate, to avoid the dreaded the NULL pointer.
>
> <1>[  347.820823] BUG: kernel NULL pointer dereference, address: 0000000000000150
> <1>[  347.820856] #PF: supervisor read access in kernel mode
> <1>[  347.820874] #PF: error_code(0x0000) - not-present page
> <6>[  347.820892] PGD 0 P4D 0
> <4>[  347.820908] Oops: 0000 [#1] PREEMPT SMP NOPTI
> <4>[  347.820926] CPU: 3 PID: 1303 Comm: gem_persistent_ Tainted: G     U            5.4.0-rc7-CI-CI_DRM_7352+ #1
> <4>[  347.820956] Hardware name:  /NUC6CAYB, BIOS AYAPLCEL.86A.0049.2018.0508.1356 05/08/2018
> <4>[  347.821132] RIP: 0010:i915_gem_object_flush_write_domain+0xd9/0x1d0 [i915]
> <4>[  347.821157] Code: 0f 84 e9 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 75 11 e9 ed 00 00 00 48 8b 80 e0 fd ff ff f6 c4 40 74 26 48 8b 83 b0 00 00 00 <48> 8b b8 50 01 00 00 e8 fb 20 fb ff 48 8b 83 30 03 00 00 49 39 c4
> <4>[  347.821210] RSP: 0018:ffffc90000a1f8f8 EFLAGS: 00010202
> <4>[  347.821229] RAX: 0000000000000000 RBX: ffffc900008479a0 RCX: 0000000000000018
> <4>[  347.821252] RDX: 0000000000000000 RSI: 000000000000000d RDI: ffff888275a090b0
> <4>[  347.821274] RBP: ffff8882673c8040 R08: ffff88825991b8d0 R09: 0000000000000000
> <4>[  347.821297] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8882673c8280
> <4>[  347.821319] R13: ffff8882673c8368 R14: 0000000000000000 R15: ffff888266a54000
> <4>[  347.821343] FS:  00007f75865f4240(0000) GS:ffff888277b80000(0000) knlGS:0000000000000000
> <4>[  347.821368] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> <4>[  347.821389] CR2: 0000000000000150 CR3: 000000025aee0000 CR4: 00000000003406e0
> <4>[  347.821411] Call Trace:
> <4>[  347.821555]  i915_gem_object_prepare_read+0xea/0x2a0 [i915]
> <4>[  347.821706]  intel_engine_cmd_parser+0x5ce/0xe90 [i915]
> <4>[  347.821834]  ? __i915_sw_fence_complete+0x1a0/0x250 [i915]
> <4>[  347.821990]  i915_gem_do_execbuffer+0xb4c/0x2550 [i915]
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_object.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 63bd3ff84f5e..458945e1823e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -279,10 +279,12 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
>  
>  	switch (obj->write_domain) {
>  	case I915_GEM_DOMAIN_GTT:
> +		spin_lock(&obj->vma.lock);
>  		for_each_ggtt_vma(vma, obj) {
>  			if (i915_vma_unset_ggtt_write(vma))
>  				intel_gt_flush_ggtt_writes(vma->vm->gt);
>  		}
> +		spin_unlock(&obj->vma.lock);
>  
>  		intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
>  		break;
> -- 
> 2.24.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-11-19 10:36 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 10:09 [PATCH 01/17] drm/i915/gem: Manually dump the debug trace on GEM_BUG_ON Chris Wilson
2019-11-19 10:09 ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 02/17] drm/i915/gt: Close race between engine_park and intel_gt_retire_requests Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 03/17] drm/i915/gt: Unlock engine-pm after queuing the kernel context switch Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 04/17] drm/i915/gt: Make intel_ring_unpin() safe for concurrent pint Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 16:46   ` Mika Kuoppala
2019-11-19 16:46     ` [Intel-gfx] " Mika Kuoppala
2019-11-19 10:09 ` [PATCH 05/17] drm/i915: Mark up the calling context for intel_wakeref_put() Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 06/17] drm/i915/gem: Merge GGTT vma flush into a single loop Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:48   ` Mika Kuoppala
2019-11-19 10:48     ` [Intel-gfx] " Mika Kuoppala
2019-11-19 11:17     ` Chris Wilson
2019-11-19 11:17       ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 07/17] drm/i915/gt: Only wait for register chipset flush if active Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:36   ` Mika Kuoppala
2019-11-19 10:36     ` [Intel-gfx] " Mika Kuoppala
2019-11-19 10:09 ` [PATCH 08/17] drm/i915: Protect the obj->vma.list during iteration Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:36   ` Mika Kuoppala [this message]
2019-11-19 10:36     ` Mika Kuoppala
2019-11-19 10:09 ` [PATCH 09/17] drm/i915: Wait until the intel_wakeref idle callback is complete Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 16:12   ` Mika Kuoppala
2019-11-19 16:12     ` [Intel-gfx] " Mika Kuoppala
2019-11-19 16:35     ` Chris Wilson
2019-11-19 16:35       ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 10/17] drm/i915/gt: Declare timeline.lock to be irq-free Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 11/17] drm/i915/gt: Move new timelines to the end of active_list Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 12/17] drm/i915/gt: Schedule next retirement worker first Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 13/17] drm/i915/gt: Flush the requests after wedging on suspend Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 14/17] drm/i915/selftests: Force bonded submission to overlap Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 15/17] drm/i915/selftests: Flush the active callbacks Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 16/17] drm/i915/selftests: Be explicit in ERR_PTR handling Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 10:09 ` [PATCH 17/17] drm/i915/selftests: Exercise rc6 handling Chris Wilson
2019-11-19 10:09   ` [Intel-gfx] " Chris Wilson
2019-11-19 15:24   ` Andi Shyti
2019-11-19 15:24     ` [Intel-gfx] " Andi Shyti
2019-11-19 15:27     ` Chris Wilson
2019-11-19 15:27       ` [Intel-gfx] " Chris Wilson
2019-11-19 10:51 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/17] drm/i915/gem: Manually dump the debug trace on GEM_BUG_ON Patchwork
2019-11-19 10:51   ` [Intel-gfx] " Patchwork
2019-11-19 11:35 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-19 11:35   ` [Intel-gfx] " Patchwork
2019-11-19 14:48 ` ✓ Fi.CI.IGT: " Patchwork
2019-11-19 14:48   ` [Intel-gfx] " Patchwork
2019-11-19 16:23 ` [PATCH 01/17] " Mika Kuoppala
2019-11-19 16:23   ` [Intel-gfx] " Mika Kuoppala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a78sxie0.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox