[openib-general] Re: [PATCH] Ref count user doorbell pages in mthca
Roland Dreier
roland at topspin.com
Thu Jun 16 13:54:54 PDT 2005
Michael> How does one close the context? I thought thats done by
Michael> closing the file descriptor, isnt that right? And if not
Michael> - why not? I think closing the file descriptor will kill
Michael> the vmas without work in mthca, avoiding this issue
Michael> altogether.
Closing a file descriptor does not unmap any mmaps done on that FD.
Michael> For hotswap we'll need a way to find and unmap all uars,
Michael> anyway, and I think the same shall be done when context
Michael> is closed by the application. IMO, when the app closes
Michael> the context, all resources shall go.
That's not the usual semantics of mmap() vs. closing a file.
Michael> What lock prevents the reference count from going to 0,
Michael> and driver deciding to kill the uar object, when at the
Michael> same time vma (by vm_ops) has a pointer to this object
Michael> and is calling kref_get?
If the reference count is going to 0, then either:
- there are no vmas left and the file is already closed so we don't
have to wory about racing with mmap()
or
- the context's file descriptor is already be closed, so mmap() can't
happen. We're going through vm_ops->close(), which is protected by
the usual mm locking (page_table_lock?).
- R.
More information about the general
mailing list