Skip to contentSkip to conversation

radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh()

PATCH In review Sergey Senozhatsky 3 participants 4 messages Dec 12, 2013 – Dec 15, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh()

Since ec39f64bba radeon_hwmon_init() is using hwmon_device_register_with_groups(), which sets rdev' as a device private driver_data, while hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh() are still waiting for drm_device'. fix them by using dev_get_drvdata():

BUG: unable to handle kernel paging request at 0000000000001e28
IP: [<ffffffffa02ae8b4>] hwmon_attributes_visible+0x18/0x3d [radeon]
PGD 15057e067 PUD 151a8e067 PMD 0 
Oops: 0000 [#1] PREEMPT SMP 
Call Trace:
 [<ffffffff81163ba7>] internal_create_group+0x114/0x1d9
 [<ffffffff81163c7a>] sysfs_create_group+0xe/0x10
 [<ffffffff81163ec7>] sysfs_create_groups+0x22/0x5f
 [<ffffffff812ceed8>] device_add+0x34f/0x501
 [<ffffffff812cf09f>] device_register+0x15/0x18
 [<ffffffff81317e5e>] hwmon_device_register_with_groups+0xb5/0xed
 [<ffffffffa02aec00>] radeon_hwmon_init+0x56/0x7c [radeon]
 [<ffffffffa02b020b>] radeon_pm_init+0x134/0x7e5 [radeon]
 [<ffffffff810f5c7c>] ? kmem_cache_alloc+0x63/0xe3
 [<ffffffffa0284ed1>] radeon_modeset_init+0x75f/0x8ed [radeon]
 [<ffffffffa02671b6>] radeon_driver_load_kms+0xc6/0x187 [radeon]
 [<ffffffffa021cb33>] drm_dev_register+0xf9/0x1b4 [drm]
 [<ffffffffa021ddf2>] drm_get_pci_dev+0x98/0x129 [drm]
 [<ffffffff810f602e>] ? kfree+0x10a/0x166
 [<ffffffffa0264345>] ? radeon_pci_probe+0x91/0xac [radeon]
 [<ffffffffa0264357>] radeon_pci_probe+0xa3/0xac [radeon]
 [<ffffffff8125b90c>] pci_device_probe+0x6e/0xcf
 [<ffffffff812d13e4>] driver_probe_device+0x98/0x1c4
 [<ffffffff812d15a4>] __driver_attach+0x5c/0x7e
 [<ffffffff812d1548>] ? __device_attach+0x38/0x38
 [<ffffffff812cfac9>] bus_for_each_dev+0x7b/0x85
 [<ffffffff812d0f69>] driver_attach+0x19/0x1b
 [<ffffffff812d0c27>] bus_add_driver+0x104/0x1ce
 [<ffffffff812d1b23>] driver_register+0x89/0xc5
 [<ffffffff8125b033>] __pci_register_driver+0x58/0x5b
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa021df09>] drm_pci_init+0x86/0xea [drm]
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa037f097>] radeon_init+0x97/0x1000 [radeon]
 [<ffffffff81000290>] do_one_initcall+0x7f/0x117
 [<ffffffff810323bc>] ? set_memory_nx+0x3b/0x3d
 [<ffffffff810a002a>] load_module+0x1583/0x1bb4
 [<ffffffff8109d602>] ? store_uevent+0x35/0x35
 [<ffffffff8106121a>] ? finish_task_switch+0x3b/0x10c
 [<ffffffff813e818b>] ? preempt_schedule_irq+0x5d/0x99
 [<ffffffff813ecdf7>] ? retint_restore_args+0x13/0x13
 [<ffffffff810a06fb>] SyS_init_module+0xa0/0xaf
 [<ffffffff813ed7e6>] tracesys+0xd4/0xd9

---

 drivers/gpu/drm/radeon/radeon_pm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +2 -4
index dc75bb6..984097b 100644
@@ -552,8 +552,7 @@ static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev,
 					     struct device_attribute *attr,
 					     char *buf)
 {
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 	int hyst = to_sensor_dev_attr(attr)->index;
 	int temp;
 
@@ -580,8 +579,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 					struct attribute *attr, int index)
 {
 	struct device *dev = container_of(kobj, struct device, kobj);
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 
 	/* Skip limit attributes if DPM is not enabled */
 	if (rdev->pm.pm_method != PM_METHOD_DPM &&
#1 lore raw

Fix is already queued in my next -fixes pull. Thanks!

Alex

Quoted 94 lines

-----Original Message-----
From: Sergey Senozhatsky [mailto:[email protected]]
Sent: Thursday, December 12, 2013 6:26 PM
To: Deucher, Alexander
Cc: David Airlie; Jerome Glisse; [email protected]; linux- [email protected]
Subject: [PATCH] radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh()

Since ec39f64bba radeon_hwmon_init() is using hwmon_device_register_with_groups(), which sets rdev' as a device private driver_data, while hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh() are still waiting for drm_device'. fix them by using dev_get_drvdata():

BUG: unable to handle kernel paging request at 0000000000001e28
IP: [<ffffffffa02ae8b4>] hwmon_attributes_visible+0x18/0x3d [radeon]
PGD 15057e067 PUD 151a8e067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Call Trace:
 [<ffffffff81163ba7>] internal_create_group+0x114/0x1d9
 [<ffffffff81163c7a>] sysfs_create_group+0xe/0x10
 [<ffffffff81163ec7>] sysfs_create_groups+0x22/0x5f
 [<ffffffff812ceed8>] device_add+0x34f/0x501
 [<ffffffff812cf09f>] device_register+0x15/0x18
 [<ffffffff81317e5e>] hwmon_device_register_with_groups+0xb5/0xed
 [<ffffffffa02aec00>] radeon_hwmon_init+0x56/0x7c [radeon]
 [<ffffffffa02b020b>] radeon_pm_init+0x134/0x7e5 [radeon]
 [<ffffffff810f5c7c>] ? kmem_cache_alloc+0x63/0xe3
 [<ffffffffa0284ed1>] radeon_modeset_init+0x75f/0x8ed [radeon]
 [<ffffffffa02671b6>] radeon_driver_load_kms+0xc6/0x187 [radeon]
 [<ffffffffa021cb33>] drm_dev_register+0xf9/0x1b4 [drm]
 [<ffffffffa021ddf2>] drm_get_pci_dev+0x98/0x129 [drm]
 [<ffffffff810f602e>] ? kfree+0x10a/0x166
 [<ffffffffa0264345>] ? radeon_pci_probe+0x91/0xac [radeon]
 [<ffffffffa0264357>] radeon_pci_probe+0xa3/0xac [radeon]
 [<ffffffff8125b90c>] pci_device_probe+0x6e/0xcf
 [<ffffffff812d13e4>] driver_probe_device+0x98/0x1c4
 [<ffffffff812d15a4>] __driver_attach+0x5c/0x7e
 [<ffffffff812d1548>] ? __device_attach+0x38/0x38
 [<ffffffff812cfac9>] bus_for_each_dev+0x7b/0x85
 [<ffffffff812d0f69>] driver_attach+0x19/0x1b
 [<ffffffff812d0c27>] bus_add_driver+0x104/0x1ce
 [<ffffffff812d1b23>] driver_register+0x89/0xc5
 [<ffffffff8125b033>] __pci_register_driver+0x58/0x5b
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa021df09>] drm_pci_init+0x86/0xea [drm]
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa037f097>] radeon_init+0x97/0x1000 [radeon]
 [<ffffffff81000290>] do_one_initcall+0x7f/0x117
 [<ffffffff810323bc>] ? set_memory_nx+0x3b/0x3d
 [<ffffffff810a002a>] load_module+0x1583/0x1bb4
 [<ffffffff8109d602>] ? store_uevent+0x35/0x35
 [<ffffffff8106121a>] ? finish_task_switch+0x3b/0x10c
 [<ffffffff813e818b>] ? preempt_schedule_irq+0x5d/0x99
 [<ffffffff813ecdf7>] ? retint_restore_args+0x13/0x13
 [<ffffffff810a06fb>] SyS_init_module+0xa0/0xaf
 [<ffffffff813ed7e6>] tracesys+0xd4/0xd9

---

 drivers/gpu/drm/radeon/radeon_pm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +2 -4
index dc75bb6..984097b 100644
@@ -552,8 +552,7 @@ static ssize_t
 radeon_hwmon_show_temp_thresh(struct device *dev,
 					     struct device_attribute *attr,
 					     char *buf)
 {
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 	int hyst = to_sensor_dev_attr(attr)->index;
 	int temp;
@@ -580,8 +579,7 @@ static umode_t hwmon_attributes_visible(struct
 kobject *kobj,
 					struct attribute *attr, int index)
 {
 	struct device *dev = container_of(kobj, struct device, kobj);
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 
 	/* Skip limit attributes if DPM is not enabled */

if (rdev->pm.pm_method != PM_METHOD_DPM &&

#2 lore raw
Quoted 2 lines · Alexander

Fix is already queued in my next -fixes pull. Thanks!

Nice. Thanks!

	-ss
Quoted 98 lines

Alex

Quoted 94 lines

-----Original Message-----
From: Sergey Senozhatsky [mailto:[email protected]]
Sent: Thursday, December 12, 2013 6:26 PM
To: Deucher, Alexander
Cc: David Airlie; Jerome Glisse; [email protected]; linux- [email protected]
Subject: [PATCH] radeon_pm: fix oops in hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh()

Since ec39f64bba radeon_hwmon_init() is using hwmon_device_register_with_groups(), which sets rdev' as a device private driver_data, while hwmon_attributes_visible() and radeon_hwmon_show_temp_thresh() are still waiting for drm_device'. fix them by using dev_get_drvdata():

BUG: unable to handle kernel paging request at 0000000000001e28
IP: [<ffffffffa02ae8b4>] hwmon_attributes_visible+0x18/0x3d [radeon]
PGD 15057e067 PUD 151a8e067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Call Trace:
 [<ffffffff81163ba7>] internal_create_group+0x114/0x1d9
 [<ffffffff81163c7a>] sysfs_create_group+0xe/0x10
 [<ffffffff81163ec7>] sysfs_create_groups+0x22/0x5f
 [<ffffffff812ceed8>] device_add+0x34f/0x501
 [<ffffffff812cf09f>] device_register+0x15/0x18
 [<ffffffff81317e5e>] hwmon_device_register_with_groups+0xb5/0xed
 [<ffffffffa02aec00>] radeon_hwmon_init+0x56/0x7c [radeon]
 [<ffffffffa02b020b>] radeon_pm_init+0x134/0x7e5 [radeon]
 [<ffffffff810f5c7c>] ? kmem_cache_alloc+0x63/0xe3
 [<ffffffffa0284ed1>] radeon_modeset_init+0x75f/0x8ed [radeon]
 [<ffffffffa02671b6>] radeon_driver_load_kms+0xc6/0x187 [radeon]
 [<ffffffffa021cb33>] drm_dev_register+0xf9/0x1b4 [drm]
 [<ffffffffa021ddf2>] drm_get_pci_dev+0x98/0x129 [drm]
 [<ffffffff810f602e>] ? kfree+0x10a/0x166
 [<ffffffffa0264345>] ? radeon_pci_probe+0x91/0xac [radeon]
 [<ffffffffa0264357>] radeon_pci_probe+0xa3/0xac [radeon]
 [<ffffffff8125b90c>] pci_device_probe+0x6e/0xcf
 [<ffffffff812d13e4>] driver_probe_device+0x98/0x1c4
 [<ffffffff812d15a4>] __driver_attach+0x5c/0x7e
 [<ffffffff812d1548>] ? __device_attach+0x38/0x38
 [<ffffffff812cfac9>] bus_for_each_dev+0x7b/0x85
 [<ffffffff812d0f69>] driver_attach+0x19/0x1b
 [<ffffffff812d0c27>] bus_add_driver+0x104/0x1ce
 [<ffffffff812d1b23>] driver_register+0x89/0xc5
 [<ffffffff8125b033>] __pci_register_driver+0x58/0x5b
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa021df09>] drm_pci_init+0x86/0xea [drm]
 [<ffffffffa037f000>] ? 0xffffffffa037efff
 [<ffffffffa037f097>] radeon_init+0x97/0x1000 [radeon]
 [<ffffffff81000290>] do_one_initcall+0x7f/0x117
 [<ffffffff810323bc>] ? set_memory_nx+0x3b/0x3d
 [<ffffffff810a002a>] load_module+0x1583/0x1bb4
 [<ffffffff8109d602>] ? store_uevent+0x35/0x35
 [<ffffffff8106121a>] ? finish_task_switch+0x3b/0x10c
 [<ffffffff813e818b>] ? preempt_schedule_irq+0x5d/0x99
 [<ffffffff813ecdf7>] ? retint_restore_args+0x13/0x13
 [<ffffffff810a06fb>] SyS_init_module+0xa0/0xaf
 [<ffffffff813ed7e6>] tracesys+0xd4/0xd9

---

 drivers/gpu/drm/radeon/radeon_pm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +2 -4
index dc75bb6..984097b 100644
@@ -552,8 +552,7 @@ static ssize_t
 radeon_hwmon_show_temp_thresh(struct device *dev,
 					     struct device_attribute *attr,
 					     char *buf)
 {
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 	int hyst = to_sensor_dev_attr(attr)->index;
 	int temp;
@@ -580,8 +579,7 @@ static umode_t hwmon_attributes_visible(struct
 kobject *kobj,
 					struct attribute *attr, int index)
 {
 	struct device *dev = container_of(kobj, struct device, kobj);
-	struct drm_device *ddev = dev_get_drvdata(dev);
-	struct radeon_device *rdev = ddev->dev_private;
+	struct radeon_device *rdev = dev_get_drvdata(dev);
 
 	/* Skip limit attributes if DPM is not enabled */

if (rdev->pm.pm_method != PM_METHOD_DPM &&

#3 lore raw
In reply to Deucher, Alexander
Quoted 1 line · Alexander

Fix is already queued in my next -fixes pull. Thanks!

I just hit this too so +1.

Btw, if Linus cuts -rc4 tonight and your pull request doesn't make it in before then, we probably should warn people using radeon and testing -rcs that they need this fix too.

Dunno, just a heads-up I think.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--