From: Michal Kalderon <mkalderon@marvell.com>
To: Gal Pressman <galpress@amazon.com>
Cc: Ariel Elior <aelior@marvell.com>, "jgg@ziepe.ca" <jgg@ziepe.ca>,
"dledford@redhat.com" <dledford@redhat.com>,
"bmt@zurich.ibm.com" <bmt@zurich.ibm.com>,
"sleybo@amazon.com" <sleybo@amazon.com>,
"leon@kernel.org" <leon@kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Ariel Elior <aelior@marvell.com>
Subject: RE: [PATCH v7 rdma-next 2/7] RDMA/core: Create mmap database and cookie helper functions
Date: Mon, 26 Aug 2019 15:30:32 +0000 [thread overview]
Message-ID: <MN2PR18MB3182E3EEF6AD329B853E28C1A1A10@MN2PR18MB3182.namprd18.prod.outlook.com> (raw)
In-Reply-To: <MN2PR18MB31820859BDBA0B87D0830935A1A60@MN2PR18MB3182.namprd18.prod.outlook.com>
> From: linux-rdma-owner@vger.kernel.org <linux-rdma-
> owner@vger.kernel.org> On Behalf Of Michal Kalderon
>
> > From: Gal Pressman <galpress@amazon.com>
> > Sent: Thursday, August 22, 2019 11:35 AM
> >
> > On 20/08/2019 15:18, Michal Kalderon wrote:
>
> > >
> > > +void rdma_user_mmap_entry_free(struct kref *kref) {
> > > + struct rdma_user_mmap_entry *entry =
> > > + container_of(kref, struct rdma_user_mmap_entry, ref);
> > > + unsigned long i, npages = (u32)DIV_ROUND_UP(entry->length,
> > PAGE_SIZE);
> > > + struct ib_ucontext *ucontext = entry->ucontext;
> > > +
> > > + /* need to erase all entries occupied... */
> > > + for (i = 0; i < npages; i++) {
> > > + xa_erase(&ucontext->mmap_xa, entry->mmap_page + i);
> > > +
> > > + ibdev_dbg(ucontext->device,
> > > + "mmap: obj[0x%p] key[%#llx] addr[%#llx] len[%#llx]
> > npages[%#lx] removed\n",
> > > + entry->obj, rdma_user_mmap_get_key(entry),
> > > + entry->address, entry->length, npages);
> > > +
> > > + if (ucontext->device->ops.mmap_free)
> > > + ucontext->device->ops.mmap_free(entry);
> > > + }
> >
> > Should this loop be surrounded with a lock? What happens with
> > concurrent insertions?
> This is a good point, thanks for catching it.
Gal, after revisiting this, I think there is no need for a lock, the xa_erase is safe
When run concurrently with the insertions under xa_lock, and if an entry is erased
During the insert there is no harm.
Thanks,
Michal
>
> >
next prev parent reply other threads:[~2019-08-26 15:30 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 12:18 [PATCH v7 rdma-next 0/7] RDMA/qedr: Use the doorbell overflow recovery mechanism for RDMA Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 1/7] RDMA/core: Move core content from ib_uverbs to ib_core Michal Kalderon
2019-08-20 12:58 ` Jason Gunthorpe
2019-08-20 21:30 ` Michal Kalderon
2019-08-21 16:30 ` Michal Kalderon
2019-08-20 14:08 ` Gal Pressman
2019-08-20 21:32 ` Michal Kalderon
2019-08-21 6:06 ` Gal Pressman
2019-08-21 7:56 ` Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 2/7] RDMA/core: Create mmap database and cookie helper functions Michal Kalderon
2019-08-20 13:21 ` Jason Gunthorpe
2019-08-20 21:23 ` [EXT] " Michal Kalderon
2019-08-21 16:47 ` Michal Kalderon
2019-08-21 16:51 ` Jason Gunthorpe
2019-08-21 17:14 ` Michal Kalderon
2019-08-21 17:37 ` Jason Gunthorpe
2019-08-26 11:53 ` Michal Kalderon
2019-08-26 12:01 ` Gal Pressman
2019-08-22 8:35 ` Gal Pressman
2019-08-25 8:36 ` Michal Kalderon
2019-08-25 10:39 ` Gal Pressman
2019-08-26 8:41 ` Michal Kalderon
2019-08-26 15:30 ` Michal Kalderon [this message]
2019-08-20 12:18 ` [PATCH v7 rdma-next 3/7] RDMA/efa: Use the common mmap_xa helpers Michal Kalderon
2019-08-22 13:18 ` Gal Pressman
2019-08-25 8:41 ` Michal Kalderon
2019-08-25 10:45 ` Gal Pressman
2019-08-26 8:42 ` Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 4/7] RDMA/siw: " Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 5/7] RDMA/qedr: Use the common mmap API Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 6/7] RDMA/qedr: Add doorbell overflow recovery support Michal Kalderon
2019-08-20 12:18 ` [PATCH v7 rdma-next 7/7] RDMA/qedr: Add iWARP doorbell " Michal Kalderon
2019-08-20 18:31 ` [PATCH v7 rdma-next 0/7] RDMA/qedr: Use the doorbell overflow recovery mechanism for RDMA Gal Pressman
2019-08-21 8:03 ` Michal Kalderon
2019-08-21 10:15 ` Gal Pressman
2019-08-21 10:32 ` Michal Kalderon
2019-08-21 10:41 ` Gal Pressman
2019-08-21 12:25 ` Gal Pressman
2019-08-21 16:23 ` Gal Pressman
2019-08-21 16:27 ` Michal Kalderon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN2PR18MB3182E3EEF6AD329B853E28C1A1A10@MN2PR18MB3182.namprd18.prod.outlook.com \
--to=mkalderon@marvell.com \
--cc=aelior@marvell.com \
--cc=bmt@zurich.ibm.com \
--cc=dledford@redhat.com \
--cc=galpress@amazon.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sleybo@amazon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).