Skip to contentSkip to conversation

drm/qxl: properly handle device init failures

PATCH In review Gerd Hoffmann 2 participants 5 messages Feb 8, 2021 – Feb 9, 2021

Subsystems (4)
lore
Share & tools
lore

Gerd Hoffmann

author maintainer
#0 lore raw

PATCH 1/1 drm/qxl: properly handle device init failures

Specifically do not try release resources which where not allocated in the first place.

---
 drivers/gpu/drm/qxl/qxl_display.c | 3 +++
 drivers/gpu/drm/qxl/qxl_kms.c     | 4 ++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +3 -0
index c326412136c5..ec50d2cfd4e1 100644
@@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
 {
 	int ret;
 
+	if (!qdev->monitors_config_bo)
+		return 0;
+
 	qdev->monitors_config = NULL;
 	qdev->ram_header->monitors_config = 0;
 
drivers/gpu/drm/qxl/qxl_kms.c +4 -0
index 66d74aaaee06..4dc5ad13f12c 100644
@@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev)
 {
 	int cur_idx;
 
+	/* check if qxl_device_init() was successful (gc_work is initialized last) */
+	if (!qdev->gc_work.func)
+		return;
+
 	for (cur_idx = 0; cur_idx < 3; cur_idx++) {
 		if (!qdev->current_release_bo[cur_idx])
 			continue;
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Does this patch fix an issue raised previously? Or should they be used together?
https://www.mail-archive.com/[email protected]/msg2466541.html <https://www.mail-archive.com/[email protected]/msg2466541.html>

IMHO using this patch alone won’t fix the issue --

Best,
- Tong

Quoted 44 lines · Gerd Hoffmann

Specifically do not try release resources which where not allocated in the first place.

---
drivers/gpu/drm/qxl/qxl_display.c | 3 +++
drivers/gpu/drm/qxl/qxl_kms.c | 4 ++++

2 files changed, 7 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +3 -0
index c326412136c5..ec50d2cfd4e1 100644
@@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
 {
 	int ret;
 
+	if (!qdev->monitors_config_bo)
+		return 0;
+
 	qdev->monitors_config = NULL;
 	qdev->ram_header->monitors_config = 0;
 
drivers/gpu/drm/qxl/qxl_kms.c +4 -0
index 66d74aaaee06..4dc5ad13f12c 100644
@@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev)
 {
 	int cur_idx;
 
+	/* check if qxl_device_init() was successful (gc_work is initialized last) */
+	if (!qdev->gc_work.func)
+		return;
+
 	for (cur_idx = 0; cur_idx < 3; cur_idx++) {
 		if (!qdev->current_release_bo[cur_idx])
 			continue;
Signature · 1 line
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Gerd Hoffmann

Does this patch fix an issue raised previously? Or should they be used together?
https://www.mail-archive.com/[email protected]/msg2466541.html

IMHO using this patch alone won’t fix the issue --

Best,
- Tong

Quoted 44 lines · Gerd Hoffmann

Specifically do not try release resources which where not allocated in the first place.

---
drivers/gpu/drm/qxl/qxl_display.c | 3 +++
drivers/gpu/drm/qxl/qxl_kms.c | 4 ++++

2 files changed, 7 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +3 -0
index c326412136c5..ec50d2cfd4e1 100644
@@ -1183,6 +1183,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
 {
 	int ret;
 
+	if (!qdev->monitors_config_bo)
+		return 0;
+
 	qdev->monitors_config = NULL;
 	qdev->ram_header->monitors_config = 0;
 
drivers/gpu/drm/qxl/qxl_kms.c +4 -0
index 66d74aaaee06..4dc5ad13f12c 100644
@@ -288,6 +288,10 @@ void qxl_device_fini(struct qxl_device *qdev)
 {
 	int cur_idx;
 
+	/* check if qxl_device_init() was successful (gc_work is initialized last) */
+	if (!qdev->gc_work.func)
+		return;
+
 	for (cur_idx = 0; cur_idx < 3; cur_idx++) {
 		if (!qdev->current_release_bo[cur_idx])
 			continue;
Signature · 1 line
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#3 lore raw
Quoted 4 lines · Tong Zhang

Does this patch fix an issue raised previously? Or should they be used together?
https://www.mail-archive.com/[email protected]/msg2466541.html

IMHO using this patch alone won’t fix the issue

This patch on top of drm-misc-next fixes the initialization error issue reported by you in my testing.

take care,
Gerd

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#4 lore raw

Hi Gerd,
I tested the patch on drm-misc-next and it fixed the issue. Thanks,
- Tong

Quoted 6 lines · Gerd Hoffmann
Quoted 3 lines · Tong Zhang

Does this patch fix an issue raised previously? Or should they be used together?
https://www.mail-archive.com/[email protected]/msg2466541.html

Quoted 8 lines
Quoted 1 line

IMHO using this patch alone won’t fix the issue

This patch on top of drm-misc-next fixes the initialization error issue reported by you in my testing.

take care,
Gerd

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel