linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/qxl: properly handle device init failures
@ 2021-02-08 10:41 Gerd Hoffmann
  2021-02-08 17:07 ` Tong Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2021-02-08 10:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gerd Hoffmann, Tong Zhang, Dave Airlie, David Airlie,
	Daniel Vetter, open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, open list

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

Cc: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 3 +++
 drivers/gpu/drm/qxl/qxl_kms.c     | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index c326412136c5..ec50d2cfd4e1 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -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;
 
diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index 66d74aaaee06..4dc5ad13f12c 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -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;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/qxl: properly handle device init failures
  2021-02-08 10:41 [PATCH] drm/qxl: properly handle device init failures Gerd Hoffmann
@ 2021-02-08 17:07 ` Tong Zhang
  2021-02-09 12:16   ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Tong Zhang @ 2021-02-08 17:07 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: dri-devel, Dave Airlie, David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, open list

Does this patch fix an issue raised previously? Or should they be used together?
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2466541.html 

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

Best,
- Tong

> On Feb 8, 2021, at 5:41 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> Specifically do not try release resources which where
> not allocated in the first place.
> 
> Cc: Tong Zhang <ztong0001@gmail.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> drivers/gpu/drm/qxl/qxl_display.c | 3 +++
> drivers/gpu/drm/qxl/qxl_kms.c     | 4 ++++
> 2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index c326412136c5..ec50d2cfd4e1 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -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;
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
> index 66d74aaaee06..4dc5ad13f12c 100644
> --- a/drivers/gpu/drm/qxl/qxl_kms.c
> +++ b/drivers/gpu/drm/qxl/qxl_kms.c
> @@ -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;
> -- 
> 2.29.2
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/qxl: properly handle device init failures
  2021-02-08 17:07 ` Tong Zhang
@ 2021-02-09 12:16   ` Gerd Hoffmann
  2021-02-09 16:24     ` Tong Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2021-02-09 12:16 UTC (permalink / raw)
  To: Tong Zhang
  Cc: dri-devel, Dave Airlie, David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, open list

On Mon, Feb 08, 2021 at 12:07:01PM -0500, Tong Zhang wrote:
> Does this patch fix an issue raised previously? Or should they be used together?
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/qxl: properly handle device init failures
  2021-02-09 12:16   ` Gerd Hoffmann
@ 2021-02-09 16:24     ` Tong Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Tong Zhang @ 2021-02-09 16:24 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: dri-devel, Dave Airlie, David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU,
	open list:DRM DRIVER FOR QXL VIRTUAL GPU, open list

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

> On Feb 9, 2021, at 7:16 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> On Mon, Feb 08, 2021 at 12:07:01PM -0500, Tong Zhang wrote:
>> Does this patch fix an issue raised previously? Or should they be used together?
>> https://www.mail-archive.com/linux-kernel@vger.kernel.org/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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-09 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 10:41 [PATCH] drm/qxl: properly handle device init failures Gerd Hoffmann
2021-02-08 17:07 ` Tong Zhang
2021-02-09 12:16   ` Gerd Hoffmann
2021-02-09 16:24     ` Tong Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).