Re: [PATCH v11 rdma-next 6/7] RDMA/qedr: Add doorbell overflow recovery support

Gal Pressman
2019-09-20T13:31:15Z

On 19/09/2019 21:02, Jason Gunthorpe wrote:
> On Thu, Sep 05, 2019 at 01:01:16PM +0300, Michal Kalderon wrote:
>
>> @@ -347,6 +360,9 @@ void qedr_mmap_free(struct rdma_user_mmap_entry *rdma_entry)
>> {
>> struct qedr_user_mmap_entry *entry = get_qedr_mmap_entry(rdma_entry);
>>
>> + if (entry->mmap_flag == QEDR_USER_MMAP_PHYS_PAGE)
>> + free_page((unsigned long)phys_to_virt(entry->address));
>> +
>
> While it isn't wrong it do it this way, we don't need this mmap_free()
> stuff for normal CPU pages. Those are refcounted and qedr can simply
> call free_page() during the teardown of the uobject that is using the
> this page. This is what other drivers already do.

This is pretty much what EFA does as well.
When we allocate pages for the user (CQ for example), we DMA map them and later
on mmap them to the user. We expect those pages to remain until the entry is
freed, how can we call free_page, who is holding a refcount on those except for
the driver?