[PATCH] drm: fix missing modeset lock from sysfs path

Jens Axboe axboe at fb.com
Mon Sep 28 12:48:22 PDT 2015


Hi,

Running 4.3-rc on a new laptop, and I notice that I get these whenever
powertop --auto-tune is run:

[14954.927920] ------------[ cut here ]------------
[14954.927926] WARNING: CPU: 1 PID: 14297 at drivers/gpu/drm/drm_atomic.c:889 drm_atomic_get_property+0x232/0x2b0()
[14954.927927] Modules linked in: msr drbg ctr ccm cmac uvcvideo hid_generic videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev usbhid btusb btintel arc4 iwlmvm mac80211 joydev snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_temp_thermal snd_hda_codec_hdmi intel_powerclamp kvm_intel dell_laptop dell_wmi dcdbas snd_hda_intel hid_multitouch kvm sparse_keymap iwlwifi snd_hda_codec snd_hwdep snd_hda_core aesni_intel aes_x86_64 glue_helper ehci_pci lrw gf128mul xhci_pci ablk_helper cfg80211 cryptd xhci_hcd ehci_hcd snd_pcm int3403_thermal snd_seq_midi bnep snd_seq_midi_event rfcomm snd_rawmidi bluetooth snd_seq snd_timer snd_seq_device processor_thermal_device snd intel_soc_dts_iosf iosf_mbi i2c_hid hid i2c_designware_platform i2c_designware_core int3402_thermal int3400_thermal int340x_thermal_zone acpi_thermal_rel soundcore binfmt_misc nls_iso8859_1 nls_cp437 fuse vfat fat
[14954.927963] CPU: 1 PID: 14297 Comm: powertop Tainted: G     U  W       4.3.0-rc3+ #177
[14954.927964] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A05 07/14/2015
[14954.927965]  ffffffff81a7c2db ffff8800032e3c88 ffffffff812923a9 0000000000000000
[14954.927967]  ffff8800032e3cc0 ffffffff81050aa6 ffff880215577028 ffff88021551df80
[14954.927968]  ffff880215577000 ffff880133e2ea80 ffff88020ea59000 ffff8800032e3cd0
[14954.927970] Call Trace:
[14954.927974]  [<ffffffff812923a9>] dump_stack+0x4b/0x72
[14954.927976]  [<ffffffff81050aa6>] warn_slowpath_common+0x86/0xc0
[14954.927978]  [<ffffffff81050b9a>] warn_slowpath_null+0x1a/0x20
[14954.927980]  [<ffffffff813950e2>] drm_atomic_get_property+0x232/0x2b0
[14954.927982]  [<ffffffff8138312c>] drm_object_property_get_value+0x6c/0x70
[14954.927984]  [<ffffffff8138117f>] dpms_show+0x2f/0x70
[14954.927987]  [<ffffffff81449a30>] dev_attr_show+0x20/0x50
[14954.927989]  [<ffffffff811dfb23>] sysfs_kf_seq_show+0xa3/0x140
[14954.927990]  [<ffffffff811de520>] kernfs_seq_show+0x20/0x30
[14954.927993]  [<ffffffff8119312d>] seq_read+0xcd/0x370
[14954.927994]  [<ffffffff811decf7>] kernfs_fop_read+0x107/0x160
[14954.927996]  [<ffffffff81170668>] __vfs_read+0x28/0xd0
[14954.927999]  [<ffffffff8125ce63>] ? security_file_permission+0xa3/0xc0
[14954.928001]  [<ffffffff81170ba3>] ? rw_verify_area+0x53/0xf0
[14954.928002]  [<ffffffff81170cc6>] vfs_read+0x86/0x130
[14954.928004]  [<ffffffff81171a66>] SyS_read+0x46/0xa0
[14954.928007]  [<ffffffff8160bd57>] entry_SYSCALL_64_fastpath+0x12/0x6a
[14954.928008] ---[ end trace b1d297c2aeff3470 ]---

Looks like we're missing a modeset lock/unlock around the property
retrieval from the sysfs path. Below patch works for me.

Signed-off-by: Jens Axboe <axboe at fb.com>

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 0f6cd33b531f..2b62166f6b2a 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -239,9 +239,12 @@ static ssize_t dpms_show(struct device *device,
 	uint64_t dpms_status;
 	int ret;
 
+	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
 	ret = drm_object_property_get_value(&connector->base,
 					    dev->mode_config.dpms_property,
 					    &dpms_status);
+	drm_modeset_unlock(&dev->mode_config.connection_mutex);
+
 	if (ret)
 		return 0;
 

-- 
Jens Axboe



More information about the dri-devel mailing list