Amdgpu module is references even after unbinding the vtcon
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Thanks,
Christian.
Hi
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 12 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.
Quoted 3 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
No real clue, sorry.
But does it change if you use a shadow buffer on top of the amdgpu BO? Set prefer_shadow_fbdev = 1. [1] I once tried to run generic fbdev without prefer_shadow_fbdev and it never worked. I suspected that some reference counting got wrong, but could never pin it down. Maybe your issue is similar.
That said, generic fbdev is not so super-optimal for TTM-based drivers. I'm working on improving that, but it's not there yet.
Best regards
Thomas
[1] https://elixir.bootlin.com/linux/v6.0/source/include/drm/drm_mode_config.h#L890
Quoted 3 lines
Thanks,
Christian.
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 27 lines · Thomas Zimmermann
Hi
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Quoted 7 lines
No real clue, sorry.
But does it change if you use a shadow buffer on top of the amdgpu BO?
Setprefer_shadow_fbdev= 1. [1] I once tried to run generic fbdev
withoutprefer_shadow_fbdevand it never worked. I suspected that some reference counting got wrong, but could never pin it down. Maybe your issue is similar.
Is that equivalent to setting mode_config.prefer_shadow = 1? If so, we already do that.
Alex
Quoted 22 lines
That said, generic fbdev is not so super-optimal for TTM-based drivers. I'm working on improving that, but it's not there yet.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/v6.0/source/include/drm/drm_mode_config.h#L890Quoted 3 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Hi
Am 24.01.23 um 17:36 schrieb Alex Deucher:
Quoted 30 lines · Thomas Zimmermann
Quoted 29 lines
Hi
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
No real clue, sorry.
Quoted 8 lines
Quoted 5 lines
But does it change if you use a shadow buffer on top of the amdgpu BO?
Setprefer_shadow_fbdev= 1. [1] I once tried to run generic fbdev
withoutprefer_shadow_fbdevand it never worked. I suspected that some reference counting got wrong, but could never pin it down. Maybe your issue is similar.Is that equivalent to setting mode_config.prefer_shadow = 1? If so, we already do that.
Yes it is, unfortunately.
Best regards
Thomas
Quoted 25 lines
Alex
Quoted 22 lines
That said, generic fbdev is not so super-optimal for TTM-based drivers. I'm working on improving that, but it's not there yet.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/v6.0/source/include/drm/drm_mode_config.h#L890Quoted 3 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Am 24.01.23 um 17:15 schrieb Thomas Zimmermann:
Quoted 17 lines
Hi
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 14 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Quoted 7 lines
Quoted 1 line
Any idea how we could prevent that?
No real clue, sorry.
But does it change if you use a shadow buffer on top of the amdgpu BO? Set
prefer_shadow_fbdev= 1. [1] I once tried to run generic fbdev withoutprefer_shadow_fbdevand it never worked. I suspected that some reference counting got wrong, but could never pin it down. Maybe your issue is similar.That said, generic fbdev is not so super-optimal for TTM-based drivers. I'm working on improving that, but it's not there yet.
If I'm not completely mistaken this problem is unrelated to TTM and could happen with any generic fbdev based driver which supports DMA-buf.
Does VKMS could be used with generic fbdev as well? If yes I think I can stitch together a test case demonstrating the issue.
Regards,
Christian.
Quoted 11 lines
Best regards
Thomas[1] https://elixir.bootlin.com/linux/v6.0/source/include/drm/drm_mode_config.h#L890
Quoted 3 lines
Thanks,
Christian.
Hi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 12 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.
Quoted 3 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas
[1] https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87
[2] https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L160
Quoted 3 lines
Thanks,
Christian.
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we call drm_client_init() during fbdev setup [1], the refcnt for drm_kms_helper increases from 3 -> 4. When we unbind vtcon, refcnt for drm_kms_helper drops 4 -> 3, but the drm_client_release() [2] is not called. The drm_client_release() is called only when unloading the amdgpu driver.
Is this expected?
There is a comment for drm_client_release with regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.
Could this be relevant for our use case, although as Application/X/GDM are stopped at that point and no fd should be open.
Thank you,
BR,
Danijel
Quoted 66 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L16
0Quoted 3 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Am 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 10 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], the refcnt fordrm_kms_helperincreases from 3 -> 4. When we unbind vtcon, refcnt fordrm_kms_helperdrops 4 -> 3, but thedrm_client_release()[2] is not called. Thedrm_client_release()is called only when unloading the amdgpu driver.Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.
Quoted 74 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are stopped at that point and no fd should be open.
Thank you,
BR,
DanijelQuoted 63 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L16
0Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Hi
Am 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 9 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], the refcnt fordrm_kms_helperincreases from 3 -> 4. When we unbind vtcon, refcnt fordrm_kms_helperdrops 4 -> 3, but thedrm_client_release()[2] is not called. Thedrm_client_release()is called only when unloading the amdgpu driver.
Quoted 7 lines
Is this expected?
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are stopped at that point and no fd should be open.
This looks like the bug to me.
I'm not sure why the client code takes the module reference in the first place. Drivers invoke client interface directly. Shouldn't that imply that they have a module reference already?
Best regards
Thomas
Quoted 71 lines
Thank you,
BR,
DanijelQuoted 66 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L16
0Quoted 3 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Am 26.01.23 um 13:40 schrieb Thomas Zimmermann:
Quoted 18 lines
Hi
Am 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 15 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], the refcnt fordrm_kms_helperincreases from 3 -> 4. When we unbind vtcon, refcnt fordrm_kms_helperdrops 4 -> 3, but thedrm_client_release()[2] is not called. Thedrm_client_release()is called only when unloading the amdgpu driver.Is this expected?
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.
Quoted 5 lines
Quoted 1 line
Could this be relevant for our use case, although as Application/X/GDM are stopped at that point and no fd should be open.
This looks like the bug to me.
I'm not sure why the client code takes the module reference in the first place. Drivers invoke client interface directly. Shouldn't that imply that they have a module reference already?
It's not the client code who takes the module reference, it's the DMA-buf code.
As far as we have narrowed this down GDM/X is inspecting the existing configuring during startup, while doing so they export the BO initially created by fbdev with DMA-buf (probably to give it to EGL or something like this). This DMA-buf export is what's adding the module reference.
The problem is now that when GDM/X exits the DMA-buf should be destroyed again, but it isn't because obj->handle_count isn't zero because the drm_client interface keeps the handle around even after creating the DRM framebuffer object.
Regards,
Christian.
Quoted 78 lines
Best regards
ThomasQuoted 73 lines
Thank you,
BR,
DanijelQuoted 68 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L160
Quoted 3 lines
Thanks,
Christian.Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Hi
Am 26.01.23 um 13:45 schrieb Christian König:
Quoted 23 lines
Am 26.01.23 um 13:40 schrieb Thomas Zimmermann:
Quoted 22 lines
Hi
Am 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 9 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], the refcnt fordrm_kms_helperincreases from 3 -> 4. When we unbind vtcon, refcnt fordrm_kms_helperdrops 4 -> 3, but thedrm_client_release()[2] is not called. Thedrm_client_release()is called only when unloading the amdgpu driver.Quoted 7 lines
Is this expected?
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are stopped at that point and no fd should be open.
This looks like the bug to me.
Quoted 7 lines
Quoted 1 line
I'm not sure why the client code takes the module reference in the first place. Drivers invoke client interface directly. Shouldn't that imply that they have a module reference already?
It's not the client code who takes the module reference, it's the DMA-buf code.
As far as we have narrowed this down GDM/X is inspecting the existing configuring during startup, while doing so they export the BO initially created by fbdev with DMA-buf (probably to give it to EGL or something like this). This DMA-buf export is what's adding the module reference.
The problem is now that when GDM/X exits the DMA-buf should be destroyed again, but it isn't because
obj->handle_countisn't zero because thedrm_clientinterface keeps the handle around even after creating the DRM framebuffer object.
OK, thanks. I saw your patch to address the problem. Let me give it a test.
Best regards
Thomas
Quoted 81 lines
Regards,
Christian.Quoted 76 lines
Best regards
ThomasQuoted 71 lines
Thank you,
BR,
DanijelQuoted 66 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 16 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.Quoted 6 lines
At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the module.
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_client.c#L16
0Quoted 3 lines
Thanks,
Christian.Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
[AMD Official Use Only - General]
Hi Christian,
I have tested the proposed patch, the issue is not reproducible and everything else seems to work fine.
BR,
Danijel
Quoted 111 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 1:20 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconAm 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 6 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], therefcnt for
drm_kms_helperincreases from 3 -> 4.Quoted 1 line
When we unbind vtcon, refcnt for
drm_kms_helperdrops 4 -> 3, but the
drm_client_release()[2] is not called.Quoted 3 lines
The
drm_client_release()is called only when unloading the amdgpu driver.Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.Quoted 6 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are
stopped at that point and no fd should be open.
Quoted 39 lines
Thank you,
BR,
DanijelQuoted 34 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 20 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the
module.
Quoted 32 lines
Quoted 32 lines
Quoted 2 lines
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_cl
ient.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_cl
ient.c#L16
0Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Hi Danijel,
can you also double check that GDM/X is still capable of acquiring a DMA-buf file descriptor for the buffer (e.g. that we have a DMA-buf handle for it while they are started).
And that handover from fbdev to GDM/X is flicker free?
Thanks,
Christian.
Am 26.01.23 um 14:44 schrieb Slivka, Danijel:
Quoted 116 lines
[AMD Official Use Only - General]
Hi Christian,
I have tested the proposed patch, the issue is not reproducible and everything else seems to work fine.
BR,
DanijelQuoted 107 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 1:20 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconAm 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 6 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], therefcnt for
drm_kms_helperincreases from 3 -> 4.Quoted 1 line
When we unbind vtcon, refcnt for
drm_kms_helperdrops 4 -> 3, but the
drm_client_release()[2] is not called.Quoted 3 lines
The
drm_client_release()is called only when unloading the amdgpu driver.Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.Quoted 5 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are
stopped at that point and no fd should be open.
Quoted 38 lines
Thank you,
BR,
DanijelQuoted 34 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 20 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason idk) we now still have an exported DMA-buf and with it a reference to the
module.
Quoted 31 lines
Quoted 31 lines
Quoted 1 line
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_cl
ient.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_cl
ient.c#L16
0Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
[AMD Official Use Only - General]
I would also highly recommend this to be tested with another compositor (Like Weston/Sway etc)
Regards
Shashank
-----Original Message-----
From: Christian König <[email protected]>
Sent: 26 January 2023 15:12
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtcon
Hi Danijel,
can you also double check that GDM/X is still capable of acquiring a DMA-buf file descriptor for the buffer (e.g. that we have a DMA-buf handle for it while they are started).
And that handover from fbdev to GDM/X is flicker free?
Thanks,
Christian.
Am 26.01.23 um 14:44 schrieb Slivka, Danijel:
Quoted 125 lines
[AMD Official Use Only - General]
Hi Christian,
I have tested the proposed patch, the issue is not reproducible and everything else seems to work fine.
BR,
DanijelQuoted 116 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 1:20 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconAm 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 7 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], therefcnt for
drm_kms_helperincreases from 3 -> 4.Quoted 2 lines
When we unbind vtcon, refcnt for
drm_kms_helperdrops 4 -> 3, but the
drm_client_release()[2] is not called.Quoted 3 lines
The
drm_client_release()is called only when unloading the amdgpu driver.Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.Quoted 6 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are
stopped at that point and no fd should be open.
Quoted 40 lines
Thank you,
BR,
DanijelQuoted 36 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 22 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason
idk) we now still have an exported DMA-buf and with it a reference to themodule.
Quoted 33 lines
Quoted 33 lines
Quoted 1 line
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L16
0Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Oh, yeah. Very good point as well.
Christian.
Am 26.01.23 um 15:13 schrieb Sharma, Shashank:
Quoted 148 lines
[AMD Official Use Only - General]
I would also highly recommend this to be tested with another compositor (Like Weston/Sway etc)
Regards
Shashank
-----Original Message-----
From: Christian König <[email protected]>
Sent: 26 January 2023 15:12
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Danijel,
can you also double check that GDM/X is still capable of acquiring a DMA-buf file descriptor for the buffer (e.g. that we have a DMA-buf handle for it while they are started).
And that handover from fbdev to GDM/X is flicker free?
Thanks,
Christian.Am 26.01.23 um 14:44 schrieb Slivka, Danijel:
Quoted 125 lines
[AMD Official Use Only - General]
Hi Christian,
I have tested the proposed patch, the issue is not reproducible and everything else seems to work fine.
BR,
DanijelQuoted 116 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 1:20 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconAm 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 7 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], therefcnt for
drm_kms_helperincreases from 3 -> 4.Quoted 2 lines
When we unbind vtcon, refcnt for
drm_kms_helperdrops 4 -> 3, but the
drm_client_release()[2] is not called.Quoted 3 lines
The
drm_client_release()is called only when unloading the amdgpu driver.Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.Quoted 6 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. An exception
* is fbdev which cannot free the buffer if userspace has open file descriptors.Could this be relevant for our use case, although as Application/X/GDM are
stopped at that point and no fd should be open.
Quoted 40 lines
Thank you,
BR,
DanijelQuoted 36 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 22 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason
idk) we now still have an exported DMA-buf and with it a reference to themodule.
Quoted 33 lines
Quoted 33 lines
Quoted 1 line
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L16
0Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[AMD Official Use Only - General]
Hi Christian,
I was not able to check about the handover from fbdev to gdm as I was having issues with setting it up proper driver in the environment with display.
Regarding exporting DMA-buf, when the X starts it acquires file descriptor for the buffer with creating new handle and when closing the file descriptor it successfully releases the dma buffer that was exported as it is tha last handle on the underlying object.
BR,
Danijel
Quoted 152 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 3:12 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Danijel,
can you also double check that GDM/X is still capable of acquiring a DMA-buf file descriptor for the buffer (e.g. that we have a DMA-buf handle for it while they are started).
And that handover from fbdev to GDM/X is flicker free?
Thanks,
Christian.Am 26.01.23 um 14:44 schrieb Slivka, Danijel:
Quoted 5 lines
[AMD Official Use Only - General]
Hi Christian,
I have tested the proposed patch, the issue is not reproducible and
everything else seems to work fine.
Quoted 28 lines
BR,
DanijelQuoted 24 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, January 26, 2023 1:20 PM
To: Slivka, Danijel <[email protected]>; Thomas Zimmermann <[email protected]>
Cc: Deucher, Alexander <[email protected]>; dri-devel <dri- [email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconAm 26.01.23 um 10:49 schrieb Slivka, Danijel:
Quoted 7 lines
[AMD Official Use Only - General]
Hi Thomas,
I have checked what you mentioned.
When loading amdgpu we calldrm_client_init()during fbdev setup [1], therefcnt for
drm_kms_helperincreases from 3 -> 4.Quoted 2 lines
When we unbind vtcon, refcnt for
drm_kms_helperdrops 4 -> 3, but the
drm_client_release()[2] is not called.Quoted 1 line
The
drm_client_release()is called only when unloading the amdgpudriver.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Is this expected?
Yes, the client can't be released because it is possible that the vtcon is bound to this fbdev again.
Quoted 8 lines
Quoted 8 lines
Please test the handle work around I've send around internally. At least for me that approach seems to work.
Regards,
Christian.Quoted 2 lines
There is a comment for
drm_client_releasewith regards to fbdev :
* This function should only be called from the unregister callback. Anexception
Quoted 1 line
Quoted 1 line
Quoted 1 line
* is fbdev which cannot free the buffer if userspace has open file
descriptors.
Quoted 70 lines
Quoted 70 lines
Quoted 3 lines
Could this be relevant for our use case, although as Application/X/GDM are
stopped at that point and no fd should be open.
Quoted 40 lines
Thank you,
BR,
DanijelQuoted 36 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Wednesday, January 25, 2023 8:48 PM
To: Christian König <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Slivka, Danijel <[email protected]>; dri-devel <[email protected]>; Sharma, Shashank <[email protected]>
Subject: Re: Amdgpu module is references even after unbinding the vtconHi Christian
Am 24.01.23 um 15:12 schrieb Christian König:
Quoted 22 lines
Hi Thomas,
we ran into a problem with the general fbcon/fbdev implementation and though that you might have some idea.
What happens is the following:
1. We load amdgpu and get our normal fbcon.
2. fbcon allocates a dump BO as backing store for the console.
3. GDM/X/Applications start, new framebuffers are created BOs imported, exported etc...
4. Somehow X or GDM iterated over all the framebuffer objects the kernels knows about and export them as DMA-buf.
5. Application/X/GDM are stopped, handles closed, framebuffers released etc...
6. We unbind vtcon.At this point the amdgpu module usually has a reference count of 0 and can be unloaded, but since GDM/X/Whoever iterated over all the known framebuffers and exported them as DMA-buf (for whatever reason
idk) we now still have an exported DMA-buf and with it a reference to themodule.
Quoted 25 lines
Quoted 25 lines
Quoted 1 line
Any idea how we could prevent that?
Here's another stab in the dark.
The big difference between old-style fbdev and the new one is that the old fbdev setup (e.g., radeon) allocates a GEM object and puts together the fbdev data structures from the BO in a fairly hackish way. The new style uses an in-kernel client with a file to allocate the BO via dumb buffers; and holds a reference to the DRM module.
Maybe the reference comes from the in-kernel DRM client itself. [1] Check if the client resources get released [2] when you unbind vtcon.
Best regards
Thomas[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L87
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_
cl
ient.c#L16
0Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Thanks,
Christian.--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409Nürnberg,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Germany (HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev