On 05/11/2019 21:54, Jason Gunthorpe wrote: >> static int qp_mmap_entries_setup(struct efa_qp *qp, >> struct efa_dev *dev, >> struct efa_ucontext *ucontext, >> struct efa_com_create_qp_params *params, >> struct efa_ibv_create_qp_resp *resp) >> { >> - /* >> - * Once an entry is inserted it might be mmapped, hence cannot be >> - * cleaned up until dealloc_ucontext. >> - */ >> - resp->sq_db_mmap_key = >> - mmap_entry_insert(dev, ucontext, qp, >> - dev->db_bar_addr + resp->sq_db_offset, >> - PAGE_SIZE, EFA_MMAP_IO_NC); >> - if (resp->sq_db_mmap_key == EFA_MMAP_INVALID) >> + size_t length; >> + u64 address; >> + >> + address = dev->db_bar_addr + resp->sq_db_offset; >> + qp->sq_db_mmap_entry = >> + efa_user_mmap_entry_insert(&ucontext->ibucontext, >> + address, >> + PAGE_SIZE, EFA_MMAP_IO_NC, >> + &resp->sq_db_mmap_key); > > I'm still confused how this is OK for the lifetime, 'sq_db_offset' > comes from the device, does the device prevent re-use of the same > db_offset until the ucontext is closed? If so that deserves a comment > in here. The device prevents reuse of the DB offset until the UAR is deallocated (during ucontext close). Same applies for the RQ DB and LLQ offset.