|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: “Backend has not unmapped grant” errors
On 29.08.22 16:39, Marek Marczykowski-Górecki wrote: On Mon, Aug 29, 2022 at 02:55:55PM +0200, Juergen Gross wrote:On 28.08.22 07:15, Demi Marie Obenour wrote:On Wed, Aug 24, 2022 at 08:11:56AM +0200, Juergen Gross wrote:On 24.08.22 02:20, Marek Marczykowski-Górecki wrote:On Tue, Aug 23, 2022 at 09:48:57AM +0200, Juergen Gross wrote:On 23.08.22 09:40, Demi Marie Obenour wrote: Thanks for the information. It helps a lot. The gui-agent(*) uses gntalloc to share framebuffers (they are allocated whenever an application within domU opens a window), then sends grant reference numbers over vchan to the gui-daemon (running in dom0 by default, but it can be also another domU). Then the gui-daemon(*) maps them. Later, when an application closes a window, the shared memory is unmapped, and gui-daemon is informed about it. Releasing grant refs is deferred by the kernel (until gui-daemon unmaps them). It may happen that unmapping on the gui-agent side will happen before gui-daemon maps them. We are modifying our GUI protocol to delay releasing grants on the user space side, to coordinate with gui-daemon (basically wait until gui-daemon confirms it unmapped them). This should fix the "normal" case. But if the gui-agent crashes just after sending grant refs, but before gui-daemon maps them, then the problem is still there. If they are immediately released by the kernel for others to use, we can hit the same issue again (for example blkfront using them, and then gui-daemon mapping them). I don't see race-free method for solving this with the current API. GUI daemon can notice when such situation happens (by checking if gui-agent is still alive after mapping grants), but that is too late already. The main difference compared to kernel drivers is the automatic release on crash (or other unclean exit). In case of kernel driver crash, either the whole VM goes down, or at least automatic release doesn't happen. Maybe gntalloc could have some flag (per open file? per allocated grant?) to _not_ release grant reference (aka leak it) in case of implicit unmap, instead of explicit release? Such explicit release would need to be added to the Linux gntshr API, as xengntshr_unshare() currently is just munmap()). I don't see many other options to avoid userspace crash (potentially) taking down PV device with it too... My idea would be to add a new ioctl() to the gntalloc driver allowing to specify a permanent name for a file. This would lead to: - the grants not to be dropped when the process is dying - in case grants with this name are existing, they are added to the file descriptor, resulting in them being under control of the new process - the permanent grants would need to be remove explicitly instead of cleaned up due to close() Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |