[Intel-gfx] [PATCH v3] drm/i915: Fix recursive calls to unmap

Dave Airlie airlied at gmail.com
Wed Nov 2 20:29:53 CET 2011


On Mon, Oct 31, 2011 at 3:16 AM, Ben Widawsky <ben at bwidawsk.net> wrote:
> After the ILK vt-d workaround patches it became clear that we had
> introduced a bug.  Chris tracked down the issue to recursive calls to
> unmap. This happens because we try to optimize waiting on requests by
> calling retire requests after the wait, which may drop the last
> reference on an object and end up freeing the object (and then unmap the
> object from the gtt).
>
> The solution here is to add a new flag to the call chain which gives the
> routines the information they need to possibly defer actions which may
> cause us to recurse. A macro has been defined to replace i915_gpu_idle
> which defaults to the old behavior.
>
> Kudos to Chris for tracking this one down.

So this fixes the non-VTd case, the VT-d case still hits a recursion
here, for posterity its below.

Dave.

BUG: unable to handle kernel paging request at 959cba80
IP: [<c1032653>] cpuacct_charge+0x4e/0x7a
*pdpt = 0000000033426001 *pde = 0000000000000000
Thread overran stack, or stack corrupted
Oops: 0000 [#1] SMP
last sysfs file:
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/charge_full
Modules linked in: netconsole aes_i586 aes_generic fuse ipt_REJECT
nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT
nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter
ip6_tables ipv6 ext3 jbd dm_mirror dm_region_hash dm_log uinput
rtc_cmos tpm_infineon tpm_tis tpm tpm_bios ac battery sg joydev
serio_raw arc4 intel_ips ecb iTCO_wdt iTCO_vendor_support iwlagn
iwlcore mac80211 cfg80211 snd_hda_codec_hdmi snd_hda_codec_idt
snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm
snd_timer snd soundcore snd_page_alloc e1000e ext4 mbcache jbd2 crc16
sr_mod cdrom sd_mod crc_t10dif firewire_ohci firewire_core crc_itu_t
ahci libata usb_storage scsi_mod i915 drm_kms_helper drm i2c_algo_bit
button i2c_core video output [last unloaded: scsi_wait_scan]

Pid: 3129, comm: Xorg Not tainted 2.6.32-dael6 #23 Hewlett-Packard HP
EliteBook 2540p/7008
EIP: 0060:[<c1032653>] EFLAGS: 00213086 CPU: 2
EIP is at cpuacct_charge+0x4e/0x7a
EAX: c15905b8 EBX: 0122af07 ECX: f512a02c EDX: f743bcc0
ESI: 00000000 EDI: f512a000 EBP: f344e014 ESP: f344e004
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process Xorg (pid: 3129, ti=f344d000 task=f512a000 task.ti=f344e000)
Stack:
 f512a02c 0122af07 00000000 f512a02c f344e058 c1032b38 3ae624ba 00000001
<0> f344e030 0000001d 00000002 f344e070 3aaacaad 0122af07 00000000 3ae624ba
<0> 00000001 f512a000 c5689ef4 f512a02c 00000002 f344e070 c103376e 00000000
Call Trace:
 [<c1032b38>] update_curr+0x1a7/0x1eb
 [<c103376e>] task_tick_fair+0x21/0xfd
 [<c103bf09>] scheduler_tick+0xa3/0x1fa
 [<c104bf78>] update_process_times+0x37/0x43
 [<c1063b22>] tick_sched_timer+0x6d/0x9b
 [<c105a704>] __run_hrtimer+0xb7/0x106
 [<c1063ab5>] ? tick_sched_timer+0x0/0x9b
 [<c105a940>] hrtimer_interrupt+0xde/0x1f3
 [<c1021340>] smp_apic_timer_interrupt+0x69/0x7c
 [<c13117e7>] apic_timer_interrupt+0x2f/0x34
 [<c106007b>] ? second_overflow+0xd9/0x14a
 [<c1310ea8>] ? _spin_unlock_irqrestore+0x40/0x48
 [<c1192dd1>] __iommu_flush_iotlb+0x17d/0x198
 [<c1193b20>] iommu_flush_iotlb_psi+0x7f/0xae
 [<c1193db5>] intel_unmap_sg+0xc3/0xe1
 [<c1193cf2>] ? intel_unmap_sg+0x0/0xe1
 [<c11fbe44>] intel_gtt_unmap_memory+0x34/0x4f
 [<c11fabb0>] ? intel_gtt_clear_range+0x26/0x42
 [<f95e719f>] i915_gem_gtt_unbind_object+0x7f/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e22cc>] i915_gem_wait_request+0x488/0x492 [i915]
 [<c117dcab>] ? __sg_free_table+0x47/0x5e
 [<c1057751>] ? autoremove_wake_function+0x0/0x2f
 [<f95e2352>] i915_gem_gpu_idle+0x7c/0x95 [i915]
 [<f95e71be>] i915_gem_gtt_unbind_object+0x9e/0xc5 [i915]
 [<f95e3b30>] i915_gem_object_unbind+0xac/0x119 [i915]
 [<f95e3bb5>] i915_gem_free_object_tail+0x18/0xcb [i915]
 [<f95e3ca0>] i915_gem_free_object+0x38/0x3c [i915]
 [<f83d440f>] ? drm_gem_object_free+0x0/0x24 [drm]
 [<f83d4431>] drm_gem_object_free+0x22/0x24 [drm]
 [<c1175baf>] kref_put+0x39/0x42
 [<f95e12da>] i915_gem_object_move_to_inactive+0xad/0xb1 [i915]
 [<f95e1426>] i915_gem_retire_requests_ring+0x148/0x173 [i915]
 [<f95e2fa4>] i915_gem_busy_ioctl+0xe4/0x111 [i915]
 [<f83d3233>] drm_ioctl+0x26b/0x327 [drm]
 [<f95e2ec0>] ? i915_gem_busy_ioctl+0x0/0x111 [i915]
 [<c1032677>] ? cpuacct_charge+0x72/0x7a
 [<c1141274>] ? file_has_perm+0x7f/0x88
 [<f83d2fc8>] ? drm_ioctl+0x0/0x327 [drm]
 [<c10f07b5>] vfs_ioctl+0x18/0x71
 [<c10f0d3d>] do_vfs_ioctl+0x486/0x4c4
 [<c1141432>] ? selinux_file_ioctl+0x3e/0x41
 [<c10f0dbc>] sys_ioctl+0x41/0x61
 [<c1007ff8>] sysenter_do_call+0x12/0x38
 <IRQ>



More information about the Intel-gfx mailing list