diff mbox

drm/i915: Store device pointer in contexts for late tracepoint usafe

Message ID 1430813849-25117-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 5, 2015, 8:17 a.m. UTC
[ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
[ 1572.428892] Oops: 0000 [#1] SMP
[ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
[ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
[ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
[ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
[ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
[ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
[ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
[ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
[ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
[ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
[ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
[ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
[ 1572.504842] Stack:
[ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
[ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
[ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
[ 1572.525049] Call Trace:
[ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
[ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
[ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
[ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
[ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
[ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
[ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
[ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
[ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
[ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
[ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
[ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
[ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
[ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
[ 1572.602464]  RSP <ffff880035727ce8>
[ 1572.607911] CR2: 0000000000000000

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.h         | 1 +
 drivers/gpu/drm/i915/i915_gem_context.c | 4 ++--
 drivers/gpu/drm/i915/i915_trace.h       | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

Shuang He May 5, 2015, noon UTC | #1
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6317
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  276/276              276/276
ILK                                  302/302              302/302
SNB                                  316/316              316/316
IVB                                  342/342              342/342
BYT                                  286/286              286/286
BDW                                  318/318              318/318
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
Note: You need to pay more attention to line start with '*'
Daniel Vetter May 6, 2015, 11:16 a.m. UTC | #2
On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
> [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
> [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
> [ 1572.428892] Oops: 0000 [#1] SMP
> [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
> [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
> [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
> [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
> [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
> [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
> [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
> [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
> [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
> [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
> [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
> [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
> [ 1572.504842] Stack:
> [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
> [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
> [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
> [ 1572.525049] Call Trace:
> [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
> [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
> [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
> [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
> [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
> [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
> [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
> [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
> [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
> [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
> [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
> [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> [ 1572.602464]  RSP <ffff880035727ce8>
> [ 1572.607911] CR2: 0000000000000000
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Could we do an igt for this, maybe using the sysfs trace interface?
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.h         | 1 +
>  drivers/gpu/drm/i915/i915_gem_context.c | 4 ++--
>  drivers/gpu/drm/i915/i915_trace.h       | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 70906ac0665e..94e54c3e7cb6 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -822,6 +822,7 @@ struct intel_context {
>  	struct kref ref;
>  	int user_handle;
>  	uint8_t remap_slice;
> +	struct drm_i915_private *i915;
>  	struct drm_i915_file_private *file_priv;
>  	struct i915_ctx_hang_stats hang_stats;
>  	struct i915_hw_ppgtt *ppgtt;
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 454090a61e65..b4a34ae5bdbe 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -203,8 +203,7 @@ static void decouple_vma(struct intel_context *ctx)
>  
>  void i915_gem_context_free(struct kref *ctx_ref)
>  {
> -	struct intel_context *ctx = container_of(ctx_ref,
> -						 typeof(*ctx), ref);
> +	struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref);
>  
>  	trace_i915_context_free(ctx);
>  
> @@ -274,6 +273,7 @@ __create_hw_context(struct drm_device *dev,
>  
>  	kref_init(&ctx->ref);
>  	list_add_tail(&ctx->link, &dev_priv->context_list);
> +	ctx->i915 = dev_priv;
>  
>  	ctx->vma_ht_bits = 6;
>  	ctx->vma_ht_size = 1 << ctx->vma_ht_bits;
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index b9fadec3fa98..4709a49e6775 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -714,7 +714,7 @@ DECLARE_EVENT_CLASS(i915_context,
>  	TP_fast_assign(
>  			__entry->ctx = ctx;
>  			__entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
> -			__entry->dev = ctx->file_priv->dev_priv->dev->primary->index;
> +			__entry->dev = ctx->i915->dev->primary->index;
>  	),
>  
>  	TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson May 7, 2015, 9:57 a.m. UTC | #3
On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
> On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
> > [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
> > [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> > [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
> > [ 1572.428892] Oops: 0000 [#1] SMP
> > [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
> > [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
> > [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
> > [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
> > [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> > [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
> > [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
> > [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
> > [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
> > [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
> > [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
> > [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
> > [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> > [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
> > [ 1572.504842] Stack:
> > [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
> > [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
> > [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
> > [ 1572.525049] Call Trace:
> > [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
> > [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
> > [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
> > [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
> > [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
> > [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
> > [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
> > [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
> > [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
> > [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> > [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
> > [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> > [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
> > [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> > [ 1572.602464]  RSP <ffff880035727ce8>
> > [ 1572.607911] CR2: 0000000000000000
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Could we do an igt for this, maybe using the sysfs trace interface?

I wonder if it is as simple as:

tracefs=/sys/kernel/tracing

function set_tracing {
	for i in `find $tracefs/i915 -name enable`; do $i
		echo $1 > $i
	done
	echo $1 > $tracefs/enable
}

set_tracing 1

./gem_ctx_basic
./gem_foo_basic
./gem_bar_basic
./gem_baz_basic

set_tracing 0
-Chris
Jani Nikula June 29, 2015, 11:40 a.m. UTC | #4
On Thu, 07 May 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
>> On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
>> > [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
>> > [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> > [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
>> > [ 1572.428892] Oops: 0000 [#1] SMP
>> > [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
>> > [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
>> > [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
>> > [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
>> > [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> > [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
>> > [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
>> > [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
>> > [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
>> > [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
>> > [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
>> > [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
>> > [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> > [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
>> > [ 1572.504842] Stack:
>> > [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
>> > [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
>> > [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
>> > [ 1572.525049] Call Trace:
>> > [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
>> > [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
>> > [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
>> > [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
>> > [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
>> > [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
>> > [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
>> > [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
>> > [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
>> > [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>> > [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
>> > [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>> > [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
>> > [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> > [ 1572.602464]  RSP <ffff880035727ce8>
>> > [ 1572.607911] CR2: 0000000000000000
>> > 
>> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
>> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> 
>> Could we do an igt for this, maybe using the sysfs trace interface?
>
> I wonder if it is as simple as:
>
> tracefs=/sys/kernel/tracing
>
> function set_tracing {
> 	for i in `find $tracefs/i915 -name enable`; do $i
> 		echo $1 > $i
> 	done
> 	echo $1 > $tracefs/enable
> }
>
> set_tracing 1
>
> ./gem_ctx_basic
> ./gem_foo_basic
> ./gem_bar_basic
> ./gem_baz_basic
>
> set_tracing 0

Is the patch still valid? Dropping from my fixes queue, please resubmit
if needed.

BR,
Jani.




> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson June 29, 2015, 11:41 a.m. UTC | #5
On Mon, Jun 29, 2015 at 02:40:15PM +0300, Jani Nikula wrote:
> On Thu, 07 May 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
> >> On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
> >> > [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
> >> > [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >> > [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
> >> > [ 1572.428892] Oops: 0000 [#1] SMP
> >> > [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
> >> > [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
> >> > [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
> >> > [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
> >> > [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >> > [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
> >> > [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
> >> > [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
> >> > [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
> >> > [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
> >> > [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
> >> > [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
> >> > [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> >> > [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
> >> > [ 1572.504842] Stack:
> >> > [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
> >> > [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
> >> > [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
> >> > [ 1572.525049] Call Trace:
> >> > [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
> >> > [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
> >> > [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
> >> > [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
> >> > [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
> >> > [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
> >> > [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
> >> > [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
> >> > [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
> >> > [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> >> > [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
> >> > [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> >> > [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
> >> > [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >> > [ 1572.602464]  RSP <ffff880035727ce8>
> >> > [ 1572.607911] CR2: 0000000000000000
> >> > 
> >> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
> >> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >> 
> >> Could we do an igt for this, maybe using the sysfs trace interface?
> >
> > I wonder if it is as simple as:
> >
> > tracefs=/sys/kernel/tracing
> >
> > function set_tracing {
> > 	for i in `find $tracefs/i915 -name enable`; do $i
> > 		echo $1 > $i
> > 	done
> > 	echo $1 > $tracefs/enable
> > }
> >
> > set_tracing 1
> >
> > ./gem_ctx_basic
> > ./gem_foo_basic
> > ./gem_bar_basic
> > ./gem_baz_basic
> >
> > set_tracing 0
> 
> Is the patch still valid?

Yes.
-Chris
Jani Nikula June 29, 2015, 11:49 a.m. UTC | #6
On Mon, 29 Jun 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Mon, Jun 29, 2015 at 02:40:15PM +0300, Jani Nikula wrote:
>> On Thu, 07 May 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> > On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
>> >> On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
>> >> > [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
>> >> > [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> >> > [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
>> >> > [ 1572.428892] Oops: 0000 [#1] SMP
>> >> > [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
>> >> > [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
>> >> > [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
>> >> > [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
>> >> > [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> >> > [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
>> >> > [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
>> >> > [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
>> >> > [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
>> >> > [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
>> >> > [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
>> >> > [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
>> >> > [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> >> > [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
>> >> > [ 1572.504842] Stack:
>> >> > [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
>> >> > [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
>> >> > [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
>> >> > [ 1572.525049] Call Trace:
>> >> > [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
>> >> > [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
>> >> > [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
>> >> > [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
>> >> > [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
>> >> > [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
>> >> > [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
>> >> > [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
>> >> > [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
>> >> > [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>> >> > [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
>> >> > [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>> >> > [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
>> >> > [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>> >> > [ 1572.602464]  RSP <ffff880035727ce8>
>> >> > [ 1572.607911] CR2: 0000000000000000
>> >> > 
>> >> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
>> >> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> >> 
>> >> Could we do an igt for this, maybe using the sysfs trace interface?
>> >
>> > I wonder if it is as simple as:
>> >
>> > tracefs=/sys/kernel/tracing
>> >
>> > function set_tracing {
>> > 	for i in `find $tracefs/i915 -name enable`; do $i
>> > 		echo $1 > $i
>> > 	done
>> > 	echo $1 > $tracefs/enable
>> > }
>> >
>> > set_tracing 1
>> >
>> > ./gem_ctx_basic
>> > ./gem_foo_basic
>> > ./gem_bar_basic
>> > ./gem_baz_basic
>> >
>> > set_tracing 0
>> 
>> Is the patch still valid?
>
> Yes.

I could use some review here....


> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
Daniele Ceraolo Spurio July 9, 2015, 9:41 a.m. UTC | #7
On 29/06/2015 12:49, Jani Nikula wrote:
> On Mon, 29 Jun 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> On Mon, Jun 29, 2015 at 02:40:15PM +0300, Jani Nikula wrote:
>>> On Thu, 07 May 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>>>> On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
>>>>> On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
>>>>>> [ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
>>>>>> [ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>>>>>> [ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
>>>>>> [ 1572.428892] Oops: 0000 [#1] SMP
>>>>>> [ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
>>>>>> [ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
>>>>>> [ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
>>>>>> [ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
>>>>>> [ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>>>>>> [ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
>>>>>> [ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
>>>>>> [ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
>>>>>> [ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
>>>>>> [ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
>>>>>> [ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
>>>>>> [ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
>>>>>> [ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>>>>>> [ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
>>>>>> [ 1572.504842] Stack:
>>>>>> [ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
>>>>>> [ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
>>>>>> [ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
>>>>>> [ 1572.525049] Call Trace:
>>>>>> [ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
>>>>>> [ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
>>>>>> [ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
>>>>>> [ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
>>>>>> [ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
>>>>>> [ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
>>>>>> [ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
>>>>>> [ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
>>>>>> [ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
>>>>>> [ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>>>>>> [ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
>>>>>> [ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
>>>>>> [ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
>>>>>> [ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
>>>>>> [ 1572.602464]  RSP <ffff880035727ce8>
>>>>>> [ 1572.607911] CR2: 0000000000000000
>>>>>>
>>>>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
>>>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>>>
>>>>> Could we do an igt for this, maybe using the sysfs trace interface?
>>>>
>>>> I wonder if it is as simple as:
>>>>
>>>> tracefs=/sys/kernel/tracing
>>>>
>>>> function set_tracing {
>>>> 	for i in `find $tracefs/i915 -name enable`; do $i
>>>> 		echo $1 > $i
>>>> 	done
>>>> 	echo $1 > $tracefs/enable
>>>> }
>>>>
>>>> set_tracing 1
>>>>
>>>> ./gem_ctx_basic
>>>> ./gem_foo_basic
>>>> ./gem_bar_basic
>>>> ./gem_baz_basic
>>>>
>>>> set_tracing 0
>>>
>>> Is the patch still valid?
>>
>> Yes.
>
> I could use some review here....

I had to rebase the patch to apply it, but apart from that:
Tested-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

>
>
>> -Chris
>>
>> --
>> Chris Wilson, Intel Open Source Technology Centre
>
Daniel Vetter July 9, 2015, 3:19 p.m. UTC | #8
On Thu, Jul 09, 2015 at 10:41:36AM +0100, Ceraolo Spurio, Daniele wrote:
> On 29/06/2015 12:49, Jani Nikula wrote:
> >On Mon, 29 Jun 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >>On Mon, Jun 29, 2015 at 02:40:15PM +0300, Jani Nikula wrote:
> >>>On Thu, 07 May 2015, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >>>>On Wed, May 06, 2015 at 01:16:30PM +0200, Daniel Vetter wrote:
> >>>>>On Tue, May 05, 2015 at 09:17:29AM +0100, Chris Wilson wrote:
> >>>>>>[ 1572.417121] BUG: unable to handle kernel NULL pointer dereference at           (null)
> >>>>>>[ 1572.421010] IP: [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >>>>>>[ 1572.424970] PGD 1766a3067 PUD 1767a2067 PMD 0
> >>>>>>[ 1572.428892] Oops: 0000 [#1] SMP
> >>>>>>[ 1572.432787] Modules linked in: ipv6 dm_mod iTCO_wdt iTCO_vendor_support snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore serio_raw pcspkr lpc_ich i2c_i801 mfd_core battery ac acpi_cpufreq i915 button video drm_kms_helper drm
> >>>>>>[ 1572.441720] CPU: 2 PID: 18853 Comm: kworker/u8:0 Not tainted 4.0.0_kcloud_3f0360_20150429+ #588
> >>>>>>[ 1572.446298] Workqueue: i915 i915_gem_retire_work_handler [i915]
> >>>>>>[ 1572.450876] task: ffff880002f428f0 ti: ffff880035724000 task.ti: ffff880035724000
> >>>>>>[ 1572.455557] RIP: 0010:[<ffffffffa00b2514>]  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >>>>>>[ 1572.460423] RSP: 0018:ffff880035727ce8  EFLAGS: 00010286
> >>>>>>[ 1572.465262] RAX: ffff880073f1643c RBX: ffff880002da9058 RCX: ffff880073e5db40
> >>>>>>[ 1572.470179] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880035727ce8
> >>>>>>[ 1572.475107] RBP: ffff88007bb11a00 R08: 0000000000000000 R09: 0000000000000000
> >>>>>>[ 1572.480034] R10: 0000000000362200 R11: 0000000000000008 R12: 0000000000000000
> >>>>>>[ 1572.484952] R13: ffff880035727d78 R14: ffff880002dc1c98 R15: ffff880002dc1dc8
> >>>>>>[ 1572.489886] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
> >>>>>>[ 1572.494883] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> >>>>>>[ 1572.499859] CR2: 0000000000000000 CR3: 000000017572a000 CR4: 00000000001006e0
> >>>>>>[ 1572.504842] Stack:
> >>>>>>[ 1572.509834]  ffff88017b0090c0 ffff880073f16438 ffff880002da9058 ffff880073f1643c
> >>>>>>[ 1572.514904]  0000000000000246 ffff880100000000 ffff88007bb11a00 ffff880002ddeb10
> >>>>>>[ 1572.519985]  ffff8801759f79c0 ffffffffa0092ff0 0000000000000000 ffff88007bb11a00
> >>>>>>[ 1572.525049] Call Trace:
> >>>>>>[ 1572.530093]  [<ffffffffa0092ff0>] ? i915_gem_context_free+0xa8/0xc1 [i915]
> >>>>>>[ 1572.535227]  [<ffffffffa009b969>] ? i915_gem_request_free+0x4e/0x50 [i915]
> >>>>>>[ 1572.540347]  [<ffffffffa00b5533>] ? intel_execlists_retire_requests+0x14c/0x159 [i915]
> >>>>>>[ 1572.545500]  [<ffffffffa009d9ea>] ? i915_gem_retire_requests+0x9d/0xeb [i915]
> >>>>>>[ 1572.550664]  [<ffffffffa009dd8c>] ? i915_gem_retire_work_handler+0x4c/0x61 [i915]
> >>>>>>[ 1572.555825]  [<ffffffff8104ca7f>] ? process_one_work+0x1b2/0x31d
> >>>>>>[ 1572.560951]  [<ffffffff8104d278>] ? worker_thread+0x24d/0x339
> >>>>>>[ 1572.566033]  [<ffffffff8104d02b>] ? cancel_delayed_work_sync+0xa/0xa
> >>>>>>[ 1572.571140]  [<ffffffff81050b25>] ? kthread+0xce/0xd6
> >>>>>>[ 1572.576191]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> >>>>>>[ 1572.581228]  [<ffffffff8179b3c8>] ? ret_from_fork+0x58/0x90
> >>>>>>[ 1572.586259]  [<ffffffff81050a57>] ? kthread_create_on_node+0x162/0x162
> >>>>>>[ 1572.591318] Code: de 48 89 e7 e8 09 4d 00 e1 48 85 c0 74 27 48 89 68 10 48 8b 55 38 48 89 e7 48 89 50 18 48 8b 55 10 48 8b 12 48 8b 12 48 8b 52 38 <8b> 12 89 50 08 e8 95 4d 00 e1 48 83 c4 30 5b 5d 41 5c c3 41 55
> >>>>>>[ 1572.596981] RIP  [<ffffffffa00b2514>] ftrace_raw_event_i915_context+0x5d/0x70 [i915]
> >>>>>>[ 1572.602464]  RSP <ffff880035727ce8>
> >>>>>>[ 1572.607911] CR2: 0000000000000000
> >>>>>>
> >>>>>>Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90112#c23
> >>>>>>Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >>>>>
> >>>>>Could we do an igt for this, maybe using the sysfs trace interface?
> >>>>
> >>>>I wonder if it is as simple as:
> >>>>
> >>>>tracefs=/sys/kernel/tracing
> >>>>
> >>>>function set_tracing {
> >>>>	for i in `find $tracefs/i915 -name enable`; do $i
> >>>>		echo $1 > $i
> >>>>	done
> >>>>	echo $1 > $tracefs/enable
> >>>>}
> >>>>
> >>>>set_tracing 1
> >>>>
> >>>>./gem_ctx_basic
> >>>>./gem_foo_basic
> >>>>./gem_bar_basic
> >>>>./gem_baz_basic
> >>>>
> >>>>set_tracing 0
> >>>
> >>>Is the patch still valid?
> >>
> >>Yes.
> >
> >I could use some review here....
> 
> I had to rebase the patch to apply it, but apart from that:
> Tested-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Merged to -fixes, thanks.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 70906ac0665e..94e54c3e7cb6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -822,6 +822,7 @@  struct intel_context {
 	struct kref ref;
 	int user_handle;
 	uint8_t remap_slice;
+	struct drm_i915_private *i915;
 	struct drm_i915_file_private *file_priv;
 	struct i915_ctx_hang_stats hang_stats;
 	struct i915_hw_ppgtt *ppgtt;
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 454090a61e65..b4a34ae5bdbe 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -203,8 +203,7 @@  static void decouple_vma(struct intel_context *ctx)
 
 void i915_gem_context_free(struct kref *ctx_ref)
 {
-	struct intel_context *ctx = container_of(ctx_ref,
-						 typeof(*ctx), ref);
+	struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref);
 
 	trace_i915_context_free(ctx);
 
@@ -274,6 +273,7 @@  __create_hw_context(struct drm_device *dev,
 
 	kref_init(&ctx->ref);
 	list_add_tail(&ctx->link, &dev_priv->context_list);
+	ctx->i915 = dev_priv;
 
 	ctx->vma_ht_bits = 6;
 	ctx->vma_ht_size = 1 << ctx->vma_ht_bits;
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index b9fadec3fa98..4709a49e6775 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -714,7 +714,7 @@  DECLARE_EVENT_CLASS(i915_context,
 	TP_fast_assign(
 			__entry->ctx = ctx;
 			__entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
-			__entry->dev = ctx->file_priv->dev_priv->dev->primary->index;
+			__entry->dev = ctx->i915->dev->primary->index;
 	),
 
 	TP_printk("dev=%u, ctx=%p, ctx_vm=%p",