diff mbox

drm/i915/lvds: Only act on lid notify when the device is on

Message ID 20110421220803.10321.68968.stgit@localhost6.localdomain6 (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Williamson April 21, 2011, 10:08 p.m. UTC
If we're using vga switcheroo, the device may be turned off
and poking at it can cause an oops.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 drivers/gpu/drm/i915/intel_lvds.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Chris Wilson April 22, 2011, 5:58 a.m. UTC | #1
On Thu, 21 Apr 2011 16:08:14 -0600, Alex Williamson <alex.williamson@redhat.com> wrote:
> If we're using vga switcheroo, the device may be turned off
> and poking at it can cause an oops.

I'm unfamiliar with what actually happens here after it is turned off. Can
you post an OOPS for an example?
-Chris
Dave Airlie April 22, 2011, 6:13 a.m. UTC | #2
On Fri, Apr 22, 2011 at 3:58 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Thu, 21 Apr 2011 16:08:14 -0600, Alex Williamson <alex.williamson@redhat.com> wrote:
>> If we're using vga switcheroo, the device may be turned off
>> and poking at it can cause an oops.
>
> I'm unfamiliar with what actually happens here after it is turned off. Can
> you post an OOPS for an example?

The device will be in D3, so I'm guessing we read back some register
and get 0xFFFFFFFF,
and later fail.

Dave.
Chris Wilson April 22, 2011, 6:26 a.m. UTC | #3
On Fri, 22 Apr 2011 16:13:27 +1000, Dave Airlie <airlied@gmail.com> wrote:
> On Fri, Apr 22, 2011 at 3:58 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > On Thu, 21 Apr 2011 16:08:14 -0600, Alex Williamson <alex.williamson@redhat.com> wrote:
> >> If we're using vga switcheroo, the device may be turned off
> >> and poking at it can cause an oops.
> >
> > I'm unfamiliar with what actually happens here after it is turned off. Can
> > you post an OOPS for an example?
> 
> The device will be in D3, so I'm guessing we read back some register
> and get 0xFFFFFFFF,
> and later fail.

That's sounds reasonable. A bit of explanation does wonders if I (or
anyone else reading through the history *or* code) ever encounter
similar bug reports.

Is anyone else concerned by the acpi_lid_notifier never being decoupled
when the module is unloaded? And the randomness of int_lvds_connector?

I love our code, every time you read it you find another bug.
-Chris
Alex Williamson April 23, 2011, 2:42 p.m. UTC | #4
On Fri, 2011-04-22 at 06:58 +0100, Chris Wilson wrote:
> On Thu, 21 Apr 2011 16:08:14 -0600, Alex Williamson <alex.williamson@redhat.com> wrote:
> > If we're using vga switcheroo, the device may be turned off
> > and poking at it can cause an oops.
> 
> I'm unfamiliar with what actually happens here after it is turned off. Can
> you post an OOPS for an example?

See below.  Thanks,

Alex

[  941.024073] BUG: unable to handle kernel NULL pointer dereference at 0000000000000230
[  941.024598] IP: [<ffffffffa0098415>] intel_dp_link_down+0x133/0x16f [i915]
[  941.025026] PGD 0 
[  941.025026] Oops: 0000 [#1] SMP 
[  941.025026] last sysfs file: /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map
[  941.025026] CPU 0 
[  941.025026] Modules linked in: netconsole configfs ftdi_sio usbserial ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat bridge stp llc sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipv6 kvm_intel kvm uinput nouveau asus_switcheroo ttm snd_hda_codec_hdmi arc4 snd_hda_codec_realtek ecb snd_hda_intel snd_hda_codec iwlagn mac80211 snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore cfg80211 uvcvideo videodev btusb bluetooth v4l2_compat_ioctl32 asus_laptop pcspkr serio_raw sparse_keymap joydev atl1c rfkill iTCO_wdt iTCO_vendor_support snd_page_alloc wmi microcode i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: configfs]
[  941.025026] 
[  941.025026] Pid: 1907, comm: kworker/0:2 Tainted: G        W   2.6.39-rc4+ #1 ASUSTeK Computer Inc.         UL30VT              /UL30VT    
[  941.025026] RIP: 0010:[<ffffffffa0098415>]  [<ffffffffa0098415>] intel_dp_link_down+0x133/0x16f [i915]
[  941.025026] RSP: 0018:ffff880136de1990  EFLAGS: 00010286
[  941.025026] RAX: 00000000ffffffff RBX: ffff880135dabc00 RCX: 0000000000002052
[  941.025026] RDX: 0000000000000000 RSI: ffff880136de1980 RDI: 0000000000000001
[  941.025026] RBP: ffff880136de19c0 R08: ffff880135db3800 R09: 0000000000000000
[  941.025026] R10: ffffffff81ca5ee0 R11: 0000000000000040 R12: ffff880133a10000
[  941.025026] R13: 0000000000000000 R14: ffff880135db3800 R15: 0000000000000000
[  941.025026] FS:  0000000000000000(0000) GS:ffff88013fc00000(0000) knlGS:0000000000000000
[  941.025026] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  941.025026] CR2: 0000000000000230 CR3: 0000000001a03000 CR4: 00000000000406f0
[  941.025026] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  941.025026] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  941.025026] Process kworker/0:2 (pid: 1907, threadinfo ffff880136de0000, task ffff88013646ae00)
[  941.025026] Stack:
[  941.025026]  0000000000000003 ffff880135dabc00 ffff880135db3800 0000000000000003
[  941.025026]  00000000ffffffff ffff880135e0b030 ffff880136de19f0 ffffffffa0098a9b
[  941.025026]  ffff880135e0b000 ffff880135db3800 ffff880135dabc00 ffff880135db3c01
[  941.025026] Call Trace:
[  941.025026]  [<ffffffffa0098a9b>] intel_dp_dpms+0x4b/0xc6 [i915]
[  941.025026]  [<ffffffffa0066271>] drm_encoder_disable+0x21/0x23 [drm_kms_helper]
[  941.025026]  [<ffffffffa0066ab7>] drm_crtc_helper_set_mode+0x1db/0x3ea [drm_kms_helper]
[  941.025026]  [<ffffffff8107b952>] ? arch_local_irq_save+0x18/0x1e
[  941.025026]  [<ffffffffa0066d23>] drm_helper_resume_force_mode+0x5d/0x122 [drm_kms_helper]
[  941.025026]  [<ffffffff8147510e>] ? _cond_resched+0xe/0x22
[  941.025026]  [<ffffffffa009525d>] intel_lid_notify+0x8d/0xa2 [i915]
[  941.025026]  [<ffffffff8147993b>] notifier_call_chain+0x37/0x63
[  941.025026]  [<ffffffff8106dc6d>] __blocking_notifier_call_chain+0x4b/0x60
[  941.025026]  [<ffffffff8106dc96>] blocking_notifier_call_chain+0x14/0x16
[  941.025026]  [<ffffffff81298be8>] acpi_lid_send_state+0x86/0xaf
[  941.025026]  [<ffffffff81298c6a>] acpi_button_notify+0x3b/0xab
[  941.025026]  [<ffffffff81272951>] ? acpi_os_wait_events_complete+0x23/0x23
[  941.025026]  [<ffffffff8127594d>] acpi_device_notify+0x19/0x1b
[  941.025026]  [<ffffffff81281e4f>] acpi_ev_notify_dispatch+0x67/0x7e
[  941.025026]  [<ffffffff8127297a>] acpi_os_execute_deferred+0x29/0x36
[  941.025026]  [<ffffffff8106482f>] process_one_work+0x18f/0x28a
[  941.025026]  [<ffffffff81065a9e>] worker_thread+0xfd/0x181
[  941.025026]  [<ffffffff810659a1>] ? manage_workers.clone.16+0x172/0x172
[  941.025026]  [<ffffffff81069076>] kthread+0x82/0x8a
[  941.025026]  [<ffffffff8147dee4>] kernel_thread_helper+0x4/0x10
[  941.025026]  [<ffffffff81068ff4>] ? kthread_worker_fn+0x14b/0x14b
[  941.025026]  [<ffffffff8147dee0>] ? gs_change+0x13/0x13
[  941.025026] Code: 8b 7c 24 18 e8 3c f3 ff ff a9 00 00 00 40 74 2a 4c 8b 7b 30 8b 73 60 49 8d 7c 24 18 41 81 e5 ff ff ff bf 44 89 ea e8 e1 f2 ff ff 
[  941.025026]  8b b7 30 02 00 00 4c 89 f7 e8 b7 42 ff ff 8b 73 60 44 89 ea 
[  941.025026] RIP  [<ffffffffa0098415>] intel_dp_link_down+0x133/0x16f [i915]
[  941.025026]  RSP <ffff880136de1990>
[  941.025026] CR2: 0000000000000230
[  941.064863] ---[ end trace 704c59211af95870 ]---
[  941.065579] BUG: unable to handle kernel paging request at fffffffffffffff8
[  941.066242] IP: [<ffffffff810692d1>] kthread_data+0x10/0x16
[  941.066251] PGD 1a05067 PUD 1a06067 PMD 0 
[  941.066257] Oops: 0000 [#2] SMP 
[  941.066261] last sysfs file: /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map
[  941.066265] CPU 0 
[  941.066267] Modules linked in: netconsole configfs ftdi_sio usbserial ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat bridge stp llc sunrpc cpufreq_ondemand acpi_cpufreq freq_table mperf ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipv6 kvm_intel kvm uinput nouveau asus_switcheroo ttm snd_hda_codec_hdmi arc4 snd_hda_codec_realtek ecb snd_hda_intel snd_hda_codec iwlagn mac80211 snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore cfg80211 uvcvideo videodev btusb bluetooth v4l2_compat_ioctl32 asus_laptop pcspkr serio_raw sparse_keymap joydev atl1c rfkill iTCO_wdt iTCO_vendor_support snd_page_alloc wmi microcode i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: configfs]
[  941.066330] 
[  941.066335] Pid: 1907, comm: kworker/0:2 Tainted: G      D W   2.6.39-rc4+ #1 ASUSTeK Computer Inc.         UL30VT              /UL30VT    
[  941.066342] RIP: 0010:[<ffffffff810692d1>]  [<ffffffff810692d1>] kthread_data+0x10/0x16
[  941.066350] RSP: 0018:ffff880136de1568  EFLAGS: 00010096
[  941.066354] RAX: 0000000000000000 RBX: ffff88013fc13a80 RCX: ffff88013646ae00
[  941.066358] RDX: 0000000000008eb0 RSI: 0000000000000000 RDI: ffff88013646ae00
[  941.066362] RBP: ffff880136de1568 R08: ffffffff8104c5ab R09: 00000000fffffff8
[  941.066367] R10: ffffffff81a29580 R11: ffff88013646ae00 R12: 0000000000000000
[  941.066371] R13: ffff880136de1698 R14: 0000000000000000 R15: ffff88013646b1b8
[  941.066376] FS:  0000000000000000(0000) GS:ffff88013fc00000(0000) knlGS:0000000000000000
[  941.066380] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  941.066384] CR2: fffffffffffffff8 CR3: 0000000001a03000 CR4: 00000000000406f0
[  941.066388] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  941.066393] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  941.066398] Process kworker/0:2 (pid: 1907, threadinfo ffff880136de0000, task ffff88013646ae00)
[  941.066401] Stack:
[  941.066403]  ffff880136de1598 ffffffff81065def ffffffff81a29580 ffff88013fc13a80
[  941.066409]  0000000000000000 ffff880136de1698 ffff880136de1658 ffffffff81474a02
[  941.066415]  ffffffff81a29580 0000000000000246 0000000000013a80 0000000000013a80
[  941.066420] Call Trace:
[  941.066428]  [<ffffffff81065def>] wq_worker_sleeping+0x1a/0x83
[  941.066434]  [<ffffffff81474a02>] schedule+0x199/0x6b6
[  941.066441]  [<ffffffff8106d614>] ? switch_task_namespaces+0x4b/0x64
[  941.066448]  [<ffffffff81051fc1>] do_exit+0x714/0x716
[  941.066455]  [<ffffffff814777e7>] oops_end+0xbf/0xc7
[  941.066461]  [<ffffffff8103253c>] no_context+0x1f9/0x208
[  941.066467]  [<ffffffff810326dd>] __bad_area_nosemaphore+0x192/0x1b5
[  941.066473]  [<ffffffff81041b95>] ? update_stats_wait_end.clone.74+0x6a/0xac
[  941.066479]  [<ffffffff81032713>] bad_area_nosemaphore+0x13/0x15
[  941.066484]  [<ffffffff81479731>] do_page_fault+0x187/0x35a
[  941.066489]  [<ffffffff81040ea8>] ? mmdrop+0x1a/0x2a
[  941.066495]  [<ffffffff8104130c>] ? finish_task_switch+0x89/0xa8
[  941.066502]  [<ffffffff8103cc9e>] ? need_resched+0x23/0x2d
[  941.066504]  [<ffffffff8107b952>] ? arch_local_irq_save+0x18/0x1e
[  941.066504]  [<ffffffff814765d2>] ? _raw_spin_lock_irqsave+0x12/0x2f
[  941.066504]  [<ffffffff8105b388>] ? lock_timer_base.clone.20+0x2b/0x50
[  941.066504]  [<ffffffff81476627>] ? _raw_spin_unlock_irqrestore+0x17/0x19
[  941.066504]  [<ffffffff8105b424>] ? try_to_del_timer_sync+0x77/0x85
[  941.066504]  [<ffffffff81476cd5>] page_fault+0x25/0x30
[  941.066504]  [<ffffffffa0098415>] ? intel_dp_link_down+0x133/0x16f [i915]
[  941.066504]  [<ffffffffa0098a9b>] intel_dp_dpms+0x4b/0xc6 [i915]
[  941.066504]  [<ffffffffa0066271>] drm_encoder_disable+0x21/0x23 [drm_kms_helper]
[  941.066504]  [<ffffffffa0066ab7>] drm_crtc_helper_set_mode+0x1db/0x3ea [drm_kms_helper]
[  941.066504]  [<ffffffff8107b952>] ? arch_local_irq_save+0x18/0x1e
[  941.066504]  [<ffffffffa0066d23>] drm_helper_resume_force_mode+0x5d/0x122 [drm_kms_helper]
[  941.066504]  [<ffffffff8147510e>] ? _cond_resched+0xe/0x22
[  941.066504]  [<ffffffffa009525d>] intel_lid_notify+0x8d/0xa2 [i915]
[  941.066504]  [<ffffffff8147993b>] notifier_call_chain+0x37/0x63
[  941.066504]  [<ffffffff8106dc6d>] __blocking_notifier_call_chain+0x4b/0x60
[  941.066504]  [<ffffffff8106dc96>] blocking_notifier_call_chain+0x14/0x16
[  941.066504]  [<ffffffff81298be8>] acpi_lid_send_state+0x86/0xaf
[  941.066504]  [<ffffffff81298c6a>] acpi_button_notify+0x3b/0xab
[  941.066504]  [<ffffffff81272951>] ? acpi_os_wait_events_complete+0x23/0x23
[  941.066504]  [<ffffffff8127594d>] acpi_device_notify+0x19/0x1b
[  941.066504]  [<ffffffff81281e4f>] acpi_ev_notify_dispatch+0x67/0x7e
[  941.066504]  [<ffffffff8127297a>] acpi_os_execute_deferred+0x29/0x36
[  941.066504]  [<ffffffff8106482f>] process_one_work+0x18f/0x28a
[  941.066504]  [<ffffffff81065a9e>] worker_thread+0xfd/0x181
[  941.066504]  [<ffffffff810659a1>] ? manage_workers.clone.16+0x172/0x172
[  941.066504]  [<ffffffff81069076>] kthread+0x82/0x8a
[  941.066504]  [<ffffffff8147dee4>] kernel_thread_helper+0x4/0x10
[  941.066504]  [<ffffffff81068ff4>] ? kthread_worker_fn+0x14b/0x14b
[  941.066504]  [<ffffffff8147dee0>] ? gs_change+0x13/0x13
[  941.066504] Code: 5c 60 81 e8 0a 7c fd ff 48 8b 85 68 ff ff ff 48 81 c4 a0 00 00 00 5b 41 5c c9 c3 55 48 89 e5 0f 1f 44 00 00 48 8b 87 60 03 00 00 
[  941.066504]  8b 40 f8 c9 c3 55 48 89 e5 0f 1f 44 00 00 48 3b 3d 19 e5 c3 
[  941.066504] RIP  [<ffffffff810692d1>] kthread_data+0x10/0x16
[  941.066504]  RSP <ffff880136de1568>
[  941.066504] CR2: fffffffffffffff8
[  941.066504] ---[ end trace 704c59211af95871 ]---
[  941.066504] Fixing recursive fault but reboot is needed!
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index a562bd2..67cb076 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -539,6 +539,9 @@  static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
 	struct drm_device *dev = dev_priv->dev;
 	struct drm_connector *connector = dev_priv->int_lvds_connector;
 
+	if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
+		return NOTIFY_OK;
+
 	/*
 	 * check and update the status of LVDS connector after receiving
 	 * the LID nofication event.