From 37876df61f279099334e0108bac9d28ee9789052 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 8 Aug 2015 14:02:36 +0100 Subject: [PATCH] drm/i915: Remove the failed context from the fpriv->context_idr If we encounter an allocation failure during ppggt creation (trivial even with 16Gib+ RAM!), we need to remove the dead context from the fpriv->context_idr along with the references. gem_exec_ctx: page allocation failure: order:0, mode:0x8004 CPU: 3 PID: 27272 Comm: gem_exec_ctx Tainted: G W 4.2.0-rc5+ #37 0000000000000000 ffff880086ff7a78 ffffffff816b947a ffff88041ed90038 0000000000008004 ffff880086ff7b08 ffffffff8114b1a5 ffff880086ff7ac8 ffffffff8108d848 0000000000000000 ffffffff81ce84b8 0000000000000000 Call Trace: [] dump_stack+0x45/0x57 [] warn_alloc_failed+0xd5/0x120 [] ? __wake_up+0x48/0x60 [] __alloc_pages_nodemask+0x73d/0x8e0 [] ? i915_gem_execbuffer2+0x148/0x240 [i915] [] __setup_page_dma+0x30/0x110 [i915] [] gen8_ppgtt_init+0x31/0x2f0 [i915] [] i915_ppgtt_init+0x30/0x80 [i915] [] i915_ppgtt_create+0x48/0xc0 [i915] [] i915_gem_create_context+0x1c2/0x390 [i915] [] i915_gem_context_create_ioctl+0x5b/0xa0 [i915] leading to an oops in i915_gem_context_close. Also note that this benchmark should not be running out of memory in the first place... Testcase: igt/benchmark/gem_exec_ctx -b create # ppgtt >= 2 Signed-off-by: Chris Wilson Reviewed-by: Mika Kuoppala Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index b77a8f78c35a..8e893b354bcc 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -287,6 +287,7 @@ err_unpin: if (is_global_default_ctx && ctx->legacy_hw_ctx.rcs_state) i915_gem_object_ggtt_unpin(ctx->legacy_hw_ctx.rcs_state); err_destroy: + idr_remove(&file_priv->context_idr, ctx->user_handle); i915_gem_context_unreference(ctx); return ERR_PTR(ret); } -- 2.11.0