Re: [PATCH] drm/qxl: prevent memory leak
Thanks for your reply. Best regards! On 2023/11/6 17:49, Maxime Ripard wrote: Hi, On Wed, Nov 01, 2023 at 12:58:17PM +1000, Dave Airlie wrote: On Wed, 22 Mar 2023 at 19:04, Zongmin Zhou wrote: The allocated memory for qdev->dumb_heads should be released in qxl_destroy_monitors_object before qxl suspend. otherwise,qxl_create_monitors_object will be called to reallocate memory for qdev->dumb_heads after qxl resume, it will cause memory leak. Signed-off-by: Zongmin Zhou Sorry for nobody picking up on this, qxl isn't really well staffed, Reviewed-by: Dave Airlie Could one of the misc maintainers pick this up? I just applied it to drm-misc-fixes Maxime
Re: [RESEND PATCH] drm/qxl: prevent memory leak
On Tue, 2023-08-01 at 10:53 +0800, Zongmin Zhou wrote: > The allocated memory for qdev->dumb_heads should be released > in qxl_destroy_monitors_object before qxl suspend. > otherwise,qxl_create_monitors_object will be called to > reallocate memory for qdev->dumb_heads after qxl resume, > it will cause memory leak. > > Signed-off-by: Zongmin Zhou > --- > drivers/gpu/drm/qxl/qxl_display.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/qxl/qxl_display.c > b/drivers/gpu/drm/qxl/qxl_display.c > index 6492a70e3c39..404b0483bb7c 100644 > --- a/drivers/gpu/drm/qxl/qxl_display.c > +++ b/drivers/gpu/drm/qxl/qxl_display.c > @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct > qxl_device *qdev) > if (!qdev->monitors_config_bo) > return 0; > > + kfree(qdev->dumb_heads); > + qdev->dumb_heads = NULL; > + > qdev->monitors_config = NULL; > qdev->ram_header->monitors_config = 0; > Friendly ping... Hello, I sent this patch a few months ago. Could you please help me review it as well and see if there are any issues? I'm looking forward to your reply. Thanks
[RESEND PATCH] drm/qxl: prevent memory leak
The allocated memory for qdev->dumb_heads should be released in qxl_destroy_monitors_object before qxl suspend. otherwise,qxl_create_monitors_object will be called to reallocate memory for qdev->dumb_heads after qxl resume, it will cause memory leak. Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 6492a70e3c39..404b0483bb7c 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) if (!qdev->monitors_config_bo) return 0; + kfree(qdev->dumb_heads); + qdev->dumb_heads = NULL; + qdev->monitors_config = NULL; qdev->ram_header->monitors_config = 0; -- 2.34.1
Re: [PATCH] drm/probe_helper: fix the warning reported when calling drm_kms_helper_poll_disable during suspend
On Wed, 2023-04-26 at 16:10 +0300, Dmitry Baryshkov wrote: > On Wed, 26 Apr 2023 at 12:09, zongmin zhou > wrote: > > > > On Sun, 2023-04-23 at 22:51 +0200, Janne Grunau wrote: > > > On 2023-04-20 23:07:01 +0300, Dmitry Baryshkov wrote: > > > > On Thu, 20 Apr 2023 at 23:01, Janne Grunau > > > > wrote: > > > > > > > > > > On 2023-03-28 10:31:29 +0800, Zongmin Zhou wrote: > > > > > > When drivers call drm_kms_helper_poll_disable from > > > > > > their device suspend implementation without enabled output > > > > > > polling before, > > > > > > following warning will be reported,due to work->func not be > > > > > > initialized: > > > > > > > > > > we see the same warning with the wpork in progress kms driver > > > > > for > > > > > apple > > > > > silicon SoCs. The connectors do not need to polled so the > > > > > driver > > > > > never > > > > > calls drm_kms_helper_poll_init(). > > > > > > > > > > > [ 55.141361] WARNING: CPU: 3 PID: 372 at > > > > > > kernel/workqueue.c:3066 __flush_work+0x22f/0x240 > > > > > > [ 55.141382] Modules linked in: nls_iso8859_1 > > > > > > snd_hda_codec_generic ledtrig_audio snd_hda_intel > > > > > > snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec > > > > > > snd_hda_core > > > > > > snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event > > > > > > snd_rawmidi > > > > > > snd_seq intel_rapl_msr intel_rapl_common bochs > > > > > > drm_vram_helper > > > > > > drm_ttm_helper snd_seq_device nfit ttm crct10dif_pclmul > > > > > > snd_timer ghash_clmulni_intel binfmt_misc sha512_ssse3 > > > > > > aesni_intel drm_kms_helper joydev input_leds syscopyarea > > > > > > crypto_simd snd cryptd sysfillrect sysimgblt mac_hid > > > > > > serio_raw > > > > > > soundcore qemu_fw_cfg sch_fq_codel msr parport_pc ppdev lp > > > > > > parport drm ramoops reed_solomon pstore_blk pstore_zone > > > > > > efi_pstore virtio_rng ip_tables x_tables autofs4 > > > > > > hid_generic > > > > > > usbhid hid ahci virtio_net i2c_i801 crc32_pclmul psmouse > > > > > > virtio_scsi libahci i2c_smbus lpc_ich xhci_pci net_failover > > > > > > virtio_blk xhci_pci_renesas failover > > > > > > [ 55.141430] CPU: 3 PID: 372 Comm: kworker/u16:9 Not > > > > > > tainted > > > > > > 6.2.0-rc6+ #16 > > > > > > [ 55.141433] Hardware name: QEMU Standard PC (Q35 + ICH9, > > > > > > 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org > > > > > > 04/01/2014 > > > > > > [ 55.141435] Workqueue: events_unbound async_run_entry_fn > > > > > > [ 55.141441] RIP: 0010:__flush_work+0x22f/0x240 > > > > > > [ 55.141444] Code: 8b 43 28 48 8b 53 30 89 c1 e9 f9 fe ff > > > > > > ff > > > > > > 4c 89 f7 e8 b5 95 d9 00 e8 00 53 08 00 45 31 ff e9 11 ff ff > > > > > > ff > > > > > > 0f 0b e9 0a ff ff ff <0f> 0b 45 31 ff e9 00 ff ff ff e8 e2 > > > > > > 54 > > > > > > d8 00 66 90 90 90 90 90 90 > > > > > > [ 55.141446] RSP: 0018:ff59221940833c18 EFLAGS: 00010246 > > > > > > [ 55.141449] RAX: RBX: > > > > > > RCX: > > > > > > 9b72bcbe > > > > > > [ 55.141450] RDX: 0001 RSI: 0001 > > > > > > RDI: > > > > > > ff3ea01e4265e330 > > > > > > [ 55.141451] RBP: ff59221940833c90 R08: > > > > > > R09: > > > > > > 8080808080808080 > > > > > > [ 55.141453] R10: ff3ea01e42b3caf4 R11: 000f > > > > > > R12: > > > > > > ff3ea01e4265e330 > > > > > > [ 55.141454] R13: 0001 R14: ff3ea01e505e5e80 > > > > > > R15: > > > > > > 0001 > > > > > > [ 55.141455] FS: () > > > > > > GS:ff3ea01fb7cc() knlGS: > > > > > > [ 55.141456] CS: 0010 DS: ES: CR0: > > > > &g
Re: [PATCH] drm/probe_helper: fix the warning reported when calling drm_kms_helper_poll_disable during suspend
On Sun, 2023-04-23 at 22:51 +0200, Janne Grunau wrote: > On 2023-04-20 23:07:01 +0300, Dmitry Baryshkov wrote: > > On Thu, 20 Apr 2023 at 23:01, Janne Grunau wrote: > > > > > > On 2023-03-28 10:31:29 +0800, Zongmin Zhou wrote: > > > > When drivers call drm_kms_helper_poll_disable from > > > > their device suspend implementation without enabled output > > > > polling before, > > > > following warning will be reported,due to work->func not be > > > > initialized: > > > > > > we see the same warning with the wpork in progress kms driver for > > > apple > > > silicon SoCs. The connectors do not need to polled so the driver > > > never > > > calls drm_kms_helper_poll_init(). > > > > > > > [ 55.141361] WARNING: CPU: 3 PID: 372 at > > > > kernel/workqueue.c:3066 __flush_work+0x22f/0x240 > > > > [ 55.141382] Modules linked in: nls_iso8859_1 > > > > snd_hda_codec_generic ledtrig_audio snd_hda_intel > > > > snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core > > > > snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi > > > > snd_seq intel_rapl_msr intel_rapl_common bochs drm_vram_helper > > > > drm_ttm_helper snd_seq_device nfit ttm crct10dif_pclmul > > > > snd_timer ghash_clmulni_intel binfmt_misc sha512_ssse3 > > > > aesni_intel drm_kms_helper joydev input_leds syscopyarea > > > > crypto_simd snd cryptd sysfillrect sysimgblt mac_hid serio_raw > > > > soundcore qemu_fw_cfg sch_fq_codel msr parport_pc ppdev lp > > > > parport drm ramoops reed_solomon pstore_blk pstore_zone > > > > efi_pstore virtio_rng ip_tables x_tables autofs4 hid_generic > > > > usbhid hid ahci virtio_net i2c_i801 crc32_pclmul psmouse > > > > virtio_scsi libahci i2c_smbus lpc_ich xhci_pci net_failover > > > > virtio_blk xhci_pci_renesas failover > > > > [ 55.141430] CPU: 3 PID: 372 Comm: kworker/u16:9 Not tainted > > > > 6.2.0-rc6+ #16 > > > > [ 55.141433] Hardware name: QEMU Standard PC (Q35 + ICH9, > > > > 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org > > > > 04/01/2014 > > > > [ 55.141435] Workqueue: events_unbound async_run_entry_fn > > > > [ 55.141441] RIP: 0010:__flush_work+0x22f/0x240 > > > > [ 55.141444] Code: 8b 43 28 48 8b 53 30 89 c1 e9 f9 fe ff ff > > > > 4c 89 f7 e8 b5 95 d9 00 e8 00 53 08 00 45 31 ff e9 11 ff ff ff > > > > 0f 0b e9 0a ff ff ff <0f> 0b 45 31 ff e9 00 ff ff ff e8 e2 54 > > > > d8 00 66 90 90 90 90 90 90 > > > > [ 55.141446] RSP: 0018:ff59221940833c18 EFLAGS: 00010246 > > > > [ 55.141449] RAX: RBX: RCX: > > > > 9b72bcbe > > > > [ 55.141450] RDX: 0001 RSI: 0001 RDI: > > > > ff3ea01e4265e330 > > > > [ 55.141451] RBP: ff59221940833c90 R08: R09: > > > > 8080808080808080 > > > > [ 55.141453] R10: ff3ea01e42b3caf4 R11: 000f R12: > > > > ff3ea01e4265e330 > > > > [ 55.141454] R13: 0001 R14: ff3ea01e505e5e80 R15: > > > > 0001 > > > > [ 55.141455] FS: () > > > > GS:ff3ea01fb7cc() knlGS: > > > > [ 55.141456] CS: 0010 DS: ES: CR0: > > > > 80050033 > > > > [ 55.141458] CR2: 563543ad1546 CR3: 00010ee82005 CR4: > > > > 00771ee0 > > > > [ 55.141464] DR0: DR1: DR2: > > > > > > > > [ 55.141465] DR3: DR6: fffe0ff0 DR7: > > > > 0400 > > > > [ 55.141466] PKRU: 5554 > > > > [ 55.141467] Call Trace: > > > > [ 55.141469] > > > > [ 55.141472] ? pcie_wait_cmd+0xdf/0x220 > > > > [ 55.141478] ? mptcp_seq_show+0xe0/0x180 > > > > [ 55.141484] __cancel_work_timer+0x124/0x1b0 > > > > [ 55.141487] cancel_delayed_work_sync+0x17/0x20 > > > > [ 55.141490] drm_kms_helper_poll_disable+0x26/0x40 > > > > [drm_kms_helper] > > > > [ 55.141516] drm_mode_config_helper_suspend+0x25/0x90 > > > > [drm_kms_helper] > > > > [ 55.141531] ? __pm_runtime_resume+0x64/0x90 > > > > [ 55.141536] bochs_pm_suspend+0x16/0x20 [bochs] > > > > [ 55.141540] pci_pm_suspend+0
[RESEND PATCH] drm/qxl: prevent memory leak
The allocated memory for qdev->dumb_heads should be released in qxl_destroy_monitors_object before qxl suspend. otherwise,qxl_create_monitors_object will be called to reallocate memory for qdev->dumb_heads after qxl resume, it will cause memory leak. Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 6492a70e3c39..404b0483bb7c 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) if (!qdev->monitors_config_bo) return 0; + kfree(qdev->dumb_heads); + qdev->dumb_heads = NULL; + qdev->monitors_config = NULL; qdev->ram_header->monitors_config = 0; -- 2.34.1
Re: [PATCH] drm/probe_helper: fix the warning reported when calling drm_kms_helper_poll_disable during suspend
On Thu, 2023-04-20 at 23:07 +0300, Dmitry Baryshkov wrote: > On Thu, 20 Apr 2023 at 23:01, Janne Grunau wrote: > > > > On 2023-03-28 10:31:29 +0800, Zongmin Zhou wrote: > > > When drivers call drm_kms_helper_poll_disable from > > > their device suspend implementation without enabled output > > > polling before, > > > following warning will be reported,due to work->func not be > > > initialized: > > > > we see the same warning with the wpork in progress kms driver for > > apple > > silicon SoCs. The connectors do not need to polled so the driver > > never > > calls drm_kms_helper_poll_init(). > > > > > [ 55.141361] WARNING: CPU: 3 PID: 372 at > > > kernel/workqueue.c:3066 __flush_work+0x22f/0x240 > > > [ 55.141382] Modules linked in: nls_iso8859_1 > > > snd_hda_codec_generic ledtrig_audio snd_hda_intel > > > snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core > > > snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi > > > snd_seq intel_rapl_msr intel_rapl_common bochs drm_vram_helper > > > drm_ttm_helper snd_seq_device nfit ttm crct10dif_pclmul snd_timer > > > ghash_clmulni_intel binfmt_misc sha512_ssse3 aesni_intel > > > drm_kms_helper joydev input_leds syscopyarea crypto_simd snd > > > cryptd sysfillrect sysimgblt mac_hid serio_raw soundcore > > > qemu_fw_cfg sch_fq_codel msr parport_pc ppdev lp parport drm > > > ramoops reed_solomon pstore_blk pstore_zone efi_pstore virtio_rng > > > ip_tables x_tables autofs4 hid_generic usbhid hid ahci virtio_net > > > i2c_i801 crc32_pclmul psmouse virtio_scsi libahci i2c_smbus > > > lpc_ich xhci_pci net_failover virtio_blk xhci_pci_renesas > > > failover > > > [ 55.141430] CPU: 3 PID: 372 Comm: kworker/u16:9 Not tainted > > > 6.2.0-rc6+ #16 > > > [ 55.141433] Hardware name: QEMU Standard PC (Q35 + ICH9, > > > 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org > > > 04/01/2014 > > > [ 55.141435] Workqueue: events_unbound async_run_entry_fn > > > [ 55.141441] RIP: 0010:__flush_work+0x22f/0x240 > > > [ 55.141444] Code: 8b 43 28 48 8b 53 30 89 c1 e9 f9 fe ff ff 4c > > > 89 f7 e8 b5 95 d9 00 e8 00 53 08 00 45 31 ff e9 11 ff ff ff 0f 0b > > > e9 0a ff ff ff <0f> 0b 45 31 ff e9 00 ff ff ff e8 e2 54 d8 00 66 > > > 90 90 90 90 90 90 > > > [ 55.141446] RSP: 0018:ff59221940833c18 EFLAGS: 00010246 > > > [ 55.141449] RAX: RBX: RCX: > > > 9b72bcbe > > > [ 55.141450] RDX: 0001 RSI: 0001 RDI: > > > ff3ea01e4265e330 > > > [ 55.141451] RBP: ff59221940833c90 R08: R09: > > > 8080808080808080 > > > [ 55.141453] R10: ff3ea01e42b3caf4 R11: 000f R12: > > > ff3ea01e4265e330 > > > [ 55.141454] R13: 0001 R14: ff3ea01e505e5e80 R15: > > > 0001 > > > [ 55.141455] FS: () > > > GS:ff3ea01fb7cc() knlGS: > > > [ 55.141456] CS: 0010 DS: ES: CR0: 80050033 > > > [ 55.141458] CR2: 563543ad1546 CR3: 00010ee82005 CR4: > > > 00771ee0 > > > [ 55.141464] DR0: DR1: DR2: > > > > > > [ 55.141465] DR3: DR6: fffe0ff0 DR7: > > > 0400 > > > [ 55.141466] PKRU: 5554 > > > [ 55.141467] Call Trace: > > > [ 55.141469] > > > [ 55.141472] ? pcie_wait_cmd+0xdf/0x220 > > > [ 55.141478] ? mptcp_seq_show+0xe0/0x180 > > > [ 55.141484] __cancel_work_timer+0x124/0x1b0 > > > [ 55.141487] cancel_delayed_work_sync+0x17/0x20 > > > [ 55.141490] drm_kms_helper_poll_disable+0x26/0x40 > > > [drm_kms_helper] > > > [ 55.141516] drm_mode_config_helper_suspend+0x25/0x90 > > > [drm_kms_helper] > > > [ 55.141531] ? __pm_runtime_resume+0x64/0x90 > > > [ 55.141536] bochs_pm_suspend+0x16/0x20 [bochs] > > > [ 55.141540] pci_pm_suspend+0x8b/0x1b0 > > > [ 55.141545] ? __pfx_pci_pm_suspend+0x10/0x10 > > > [ 55.141547] dpm_run_callback+0x4c/0x160 > > > [ 55.141550] __device_suspend+0x14c/0x4c0 > > > [ 55.141553] async_suspend+0x24/0xa0 > > > [ 55.141555] async_run_entry_fn+0x34/0x120 > > > [ 55.141557] process_one_work+0x21a/0x3f0 > > > [ 55.141560] worker_thread+0x4e/0x3c0 > > > [ 55.141563] ? __pfx_worker_threa
[PATCH] drm/probe_helper: fix the warning reported when calling drm_kms_helper_poll_disable during suspend
When drivers call drm_kms_helper_poll_disable from their device suspend implementation without enabled output polling before, following warning will be reported,due to work->func not be initialized: [ 55.141361] WARNING: CPU: 3 PID: 372 at kernel/workqueue.c:3066 __flush_work+0x22f/0x240 [ 55.141382] Modules linked in: nls_iso8859_1 snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq intel_rapl_msr intel_rapl_common bochs drm_vram_helper drm_ttm_helper snd_seq_device nfit ttm crct10dif_pclmul snd_timer ghash_clmulni_intel binfmt_misc sha512_ssse3 aesni_intel drm_kms_helper joydev input_leds syscopyarea crypto_simd snd cryptd sysfillrect sysimgblt mac_hid serio_raw soundcore qemu_fw_cfg sch_fq_codel msr parport_pc ppdev lp parport drm ramoops reed_solomon pstore_blk pstore_zone efi_pstore virtio_rng ip_tables x_tables autofs4 hid_generic usbhid hid ahci virtio_net i2c_i801 crc32_pclmul psmouse virtio_scsi libahci i2c_smbus lpc_ich xhci_pci net_failover virtio_blk xhci_pci_renesas failover [ 55.141430] CPU: 3 PID: 372 Comm: kworker/u16:9 Not tainted 6.2.0-rc6+ #16 [ 55.141433] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 55.141435] Workqueue: events_unbound async_run_entry_fn [ 55.141441] RIP: 0010:__flush_work+0x22f/0x240 [ 55.141444] Code: 8b 43 28 48 8b 53 30 89 c1 e9 f9 fe ff ff 4c 89 f7 e8 b5 95 d9 00 e8 00 53 08 00 45 31 ff e9 11 ff ff ff 0f 0b e9 0a ff ff ff <0f> 0b 45 31 ff e9 00 ff ff ff e8 e2 54 d8 00 66 90 90 90 90 90 90 [ 55.141446] RSP: 0018:ff59221940833c18 EFLAGS: 00010246 [ 55.141449] RAX: RBX: RCX: 9b72bcbe [ 55.141450] RDX: 0001 RSI: 0001 RDI: ff3ea01e4265e330 [ 55.141451] RBP: ff59221940833c90 R08: R09: 8080808080808080 [ 55.141453] R10: ff3ea01e42b3caf4 R11: 000f R12: ff3ea01e4265e330 [ 55.141454] R13: 0001 R14: ff3ea01e505e5e80 R15: 0001 [ 55.141455] FS: () GS:ff3ea01fb7cc() knlGS: [ 55.141456] CS: 0010 DS: ES: CR0: 80050033 [ 55.141458] CR2: 563543ad1546 CR3: 00010ee82005 CR4: 00771ee0 [ 55.141464] DR0: DR1: DR2: [ 55.141465] DR3: DR6: fffe0ff0 DR7: 0400 [ 55.141466] PKRU: 5554 [ 55.141467] Call Trace: [ 55.141469] [ 55.141472] ? pcie_wait_cmd+0xdf/0x220 [ 55.141478] ? mptcp_seq_show+0xe0/0x180 [ 55.141484] __cancel_work_timer+0x124/0x1b0 [ 55.141487] cancel_delayed_work_sync+0x17/0x20 [ 55.141490] drm_kms_helper_poll_disable+0x26/0x40 [drm_kms_helper] [ 55.141516] drm_mode_config_helper_suspend+0x25/0x90 [drm_kms_helper] [ 55.141531] ? __pm_runtime_resume+0x64/0x90 [ 55.141536] bochs_pm_suspend+0x16/0x20 [bochs] [ 55.141540] pci_pm_suspend+0x8b/0x1b0 [ 55.141545] ? __pfx_pci_pm_suspend+0x10/0x10 [ 55.141547] dpm_run_callback+0x4c/0x160 [ 55.141550] __device_suspend+0x14c/0x4c0 [ 55.141553] async_suspend+0x24/0xa0 [ 55.141555] async_run_entry_fn+0x34/0x120 [ 55.141557] process_one_work+0x21a/0x3f0 [ 55.141560] worker_thread+0x4e/0x3c0 [ 55.141563] ? __pfx_worker_thread+0x10/0x10 [ 55.141565] kthread+0xf2/0x120 [ 55.141568] ? __pfx_kthread+0x10/0x10 [ 55.141570] ret_from_fork+0x29/0x50 [ 55.141575] [ 55.141575] ---[ end trace ]--- Fixes: a4e771729a51 ("drm/probe_helper: sort out poll_running vs poll_enabled") Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/drm_probe_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 8127be134c39..ac72b18e2257 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -855,7 +855,8 @@ void drm_kms_helper_poll_disable(struct drm_device *dev) if (dev->mode_config.poll_running) drm_kms_helper_disable_hpd(dev); - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); + if (dev->mode_config.poll_enabled) + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); dev->mode_config.poll_running = false; } -- 2.34.1 No virus found Checked by Hillstone Network AntiVirus
[PATCH] drm/qxl: prevent memory leak
The allocated memory for qdev->dumb_heads should be released in qxl_destroy_monitors_object before qxl suspend. otherwise,qxl_create_monitors_object will be called to reallocate memory for qdev->dumb_heads after qxl resume, it will cause memory leak. Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 6492a70e3c39..404b0483bb7c 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev) if (!qdev->monitors_config_bo) return 0; + kfree(qdev->dumb_heads); + qdev->dumb_heads = NULL; + qdev->monitors_config = NULL; qdev->ram_header->monitors_config = 0; -- 2.34.1 No virus found Checked by Hillstone Network AntiVirus
[RESEND PATCH] drm/qxl: drop set_prod_notify parameter from qxl_ring_create
Since qxl_io_reset(qdev) will be called immediately after qxl_ring_create() been called, and parameter like notify_on_prod will be set to default value. So the call to qxl_ring_init_hdr() before becomes meaningless. Signed-off-by: Zongmin Zhou Suggested-by: Ming Xie --- drivers/gpu/drm/qxl/qxl_cmd.c | 8 drivers/gpu/drm/qxl/qxl_drv.h | 2 -- drivers/gpu/drm/qxl/qxl_kms.c | 4 +--- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 7b00c955cd82..63aa96a69752 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -53,17 +53,11 @@ void qxl_ring_free(struct qxl_ring *ring) kfree(ring); } -void qxl_ring_init_hdr(struct qxl_ring *ring) -{ - ring->ring->header.notify_on_prod = ring->n_elements; -} - struct qxl_ring * qxl_ring_create(struct qxl_ring_header *header, int element_size, int n_elements, int prod_notify, - bool set_prod_notify, wait_queue_head_t *push_event) { struct qxl_ring *ring; @@ -77,8 +71,6 @@ qxl_ring_create(struct qxl_ring_header *header, ring->n_elements = n_elements; ring->prod_notify = prod_notify; ring->push_event = push_event; - if (set_prod_notify) - qxl_ring_init_hdr(ring); spin_lock_init(&ring->lock); return ring; } diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 47c169673088..432758ad39a3 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -277,10 +277,8 @@ struct qxl_ring *qxl_ring_create(struct qxl_ring_header *header, int element_size, int n_elements, int prod_notify, -bool set_prod_notify, wait_queue_head_t *push_event); void qxl_ring_free(struct qxl_ring *ring); -void qxl_ring_init_hdr(struct qxl_ring *ring); int qxl_check_idle(struct qxl_ring *ring); static inline uint64_t diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 9bf6d4cc98d4..dc3828db1991 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c @@ -194,7 +194,6 @@ int qxl_device_init(struct qxl_device *qdev, sizeof(struct qxl_command), QXL_COMMAND_RING_SIZE, qdev->io_base + QXL_IO_NOTIFY_CMD, -false, &qdev->display_event); if (!qdev->command_ring) { DRM_ERROR("Unable to create command ring\n"); @@ -207,7 +206,6 @@ int qxl_device_init(struct qxl_device *qdev, sizeof(struct qxl_command), QXL_CURSOR_RING_SIZE, qdev->io_base + QXL_IO_NOTIFY_CURSOR, - false, &qdev->cursor_event); if (!qdev->cursor_ring) { @@ -219,7 +217,7 @@ int qxl_device_init(struct qxl_device *qdev, qdev->release_ring = qxl_ring_create( &(qdev->ram_header->release_ring_hdr), sizeof(uint64_t), - QXL_RELEASE_RING_SIZE, 0, true, + QXL_RELEASE_RING_SIZE, 0, NULL); if (!qdev->release_ring) { -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus
[PATCH] drm/qxl: drop set_prod_notify parameter from qxl_ring_create
Since qxl_io_reset(qdev) will be called immediately after qxl_ring_create() been called, and parameter like notify_on_prod will be set to default value. So the call to qxl_ring_init_hdr() before becomes meaningless. Signed-off-by: Zongmin Zhou Suggested-by: Ming Xie --- drivers/gpu/drm/qxl/qxl_cmd.c | 8 drivers/gpu/drm/qxl/qxl_drv.h | 2 -- drivers/gpu/drm/qxl/qxl_kms.c | 4 +--- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 7b00c955cd82..63aa96a69752 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -53,17 +53,11 @@ void qxl_ring_free(struct qxl_ring *ring) kfree(ring); } -void qxl_ring_init_hdr(struct qxl_ring *ring) -{ - ring->ring->header.notify_on_prod = ring->n_elements; -} - struct qxl_ring * qxl_ring_create(struct qxl_ring_header *header, int element_size, int n_elements, int prod_notify, - bool set_prod_notify, wait_queue_head_t *push_event) { struct qxl_ring *ring; @@ -77,8 +71,6 @@ qxl_ring_create(struct qxl_ring_header *header, ring->n_elements = n_elements; ring->prod_notify = prod_notify; ring->push_event = push_event; - if (set_prod_notify) - qxl_ring_init_hdr(ring); spin_lock_init(&ring->lock); return ring; } diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 47c169673088..432758ad39a3 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -277,10 +277,8 @@ struct qxl_ring *qxl_ring_create(struct qxl_ring_header *header, int element_size, int n_elements, int prod_notify, -bool set_prod_notify, wait_queue_head_t *push_event); void qxl_ring_free(struct qxl_ring *ring); -void qxl_ring_init_hdr(struct qxl_ring *ring); int qxl_check_idle(struct qxl_ring *ring); static inline uint64_t diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 9bf6d4cc98d4..dc3828db1991 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c @@ -194,7 +194,6 @@ int qxl_device_init(struct qxl_device *qdev, sizeof(struct qxl_command), QXL_COMMAND_RING_SIZE, qdev->io_base + QXL_IO_NOTIFY_CMD, -false, &qdev->display_event); if (!qdev->command_ring) { DRM_ERROR("Unable to create command ring\n"); @@ -207,7 +206,6 @@ int qxl_device_init(struct qxl_device *qdev, sizeof(struct qxl_command), QXL_CURSOR_RING_SIZE, qdev->io_base + QXL_IO_NOTIFY_CURSOR, - false, &qdev->cursor_event); if (!qdev->cursor_ring) { @@ -219,7 +217,7 @@ int qxl_device_init(struct qxl_device *qdev, qdev->release_ring = qxl_ring_create( &(qdev->ram_header->release_ring_hdr), sizeof(uint64_t), - QXL_RELEASE_RING_SIZE, 0, true, + QXL_RELEASE_RING_SIZE, 0, NULL); if (!qdev->release_ring) { -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus
[PATCH] drm/qxl: fix the suspend/resume issue on qxl device
From: Zongmin Zhou Details: Currently, when trying to suspend and resume with qxl deviceï¼ there are some error messages after resuming, eventually caused to black screen and can't be recovered. The first error message: [ 64.668577][C3] [drm] driver is in bug mode This error is due to guest qxl driver will call qxl_reinit_memslots(qdev) during system resume, but didn't call qxl_io_reset(qdev) before this, Then will cause the QXL_IO_MEMSLOT_ADD operation to fail on QEMU, qxl->guest_bug flag will be setï¼As a result, the QXL device can't communicate with guest qxl driver through the IO port. after fix the first error,can success to resume and login to desktop, but shortly after that will observe the second error message : [ 353.095343][ T863] qxl :00:02.0: object_init failed for (262144, 0x0001) [ 353.096660][ T863] [drm:qxl_gem_object_create [qxl]] *ERROR* Failed to allocate GEM object (260852, 1, 4096, -12) [ 353.097277][ T863] [drm:qxl_alloc_ioctl [qxl]] *ERROR* qxl_alloc_ioctl: failed to create gem ret=-12 [ 368.197538][ T863] qxl :00:02.0: object_init failed for (3149824, 0x0001) [ 368.197541][ T863] [drm:qxl_alloc_bo_reserved [qxl]] *ERROR* failed to allocate VRAM BO The problem is caused by calling qxl_ring_init_hdr(qdev->release_ring) in qxl_drm_resume() function. When do QXL_IO_RESET,QEMU will call init_qxl_ram(), so params like prod,cons,notify_on_cons and notify_on_prod will be set to default value. Ring push/pop actions for release_ring can be performed normally. But call qxl_ring_init_hdr(qdev->release_ring) will eventually set notify_on_prod to number of QXL_RELEASE_RING_SIZE, affect the value of notify in qxl_push_free_res() function always be false, QEMU will no longer send events of QXL_INTERRUPT_DISPLAY to the guest qxl driverï¼so qxl_ring_pop() will never been called anymoreï¼ and can't do dma_fence_signal(),result to ttm_bo_wait_ctx(bo, ctx) always return EBUSY,fail to call qxl_bo_create(). Test scenario: 1) start virtual machine with qemu command "-device qxl-vga" 2) click suspend botton to enter suspend mode 3) resume and observe the error message in kernel logs,screen will be black Let's fix this by reset io and remove the qxl_ring_init_hdr calling. Signed-off-by: Zongmin Zhou Suggested-by: Ming Xie --- drivers/gpu/drm/qxl/qxl_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index 1cb6f0c224bb..3044ca948ce2 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -194,7 +194,6 @@ static int qxl_drm_resume(struct drm_device *dev, bool thaw) qdev->ram_header->int_mask = QXL_INTERRUPT_MASK; if (!thaw) { qxl_reinit_memslots(qdev); - qxl_ring_init_hdr(qdev->release_ring); } qxl_create_monitors_object(qdev); @@ -220,6 +219,7 @@ static int qxl_pm_resume(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct qxl_device *qdev = to_qxl(drm_dev); pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); @@ -227,6 +227,7 @@ static int qxl_pm_resume(struct device *dev) return -EIO; } + qxl_io_reset(qdev); return qxl_drm_resume(drm_dev, false); } -- 2.25.1 Content-type: Text/plain No virus found Checked by Hillstone Network AntiVirus
[PATCH] drm/amdgpu: fixup bad vram size on gmc v8
Some boards(like RX550) seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes boards reporting bogus amounts of vram. after add this patch,the maximum GPU VRAM size is 64GB, otherwise only 64GB vram size will be used. Signed-off-by: Zongmin Zhou --- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 492ebed2915b..63b890f1e8af 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -515,10 +515,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev) static int gmc_v8_0_mc_init(struct amdgpu_device *adev) { int r; + u32 tmp; adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); if (!adev->gmc.vram_width) { - u32 tmp; int chansize, numchan; /* Get VRAM informations */ @@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.vram_width = numchan * chansize; } /* size in MB on si */ - adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; - adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; + tmp = RREG32(mmCONFIG_MEMSIZE); + /* some boards may have garbage in the upper 16 bits */ + if (tmp & 0x) { + DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); + if (tmp & 0x) + tmp &= 0x; + } + adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; + adev->gmc.real_vram_size = adev->gmc.mc_vram_size; if (!(adev->flags & AMD_IS_APU)) { r = amdgpu_device_resize_fb_bar(adev); -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus