From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Davidlohr Bueso <dave-h16yJtLeMjHk1uMJSBkQmQ@public.gmane.org>,
roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Davidlohr Bueso <dbueso-l3A5Bk7waGM@public.gmane.org>
Subject: Re: [PATCH] IB/mthca: Fix how mthca_map_user_db() calls gup
Date: Thu, 25 Jan 2018 11:53:30 -0700 [thread overview]
Message-ID: <20180125185330.GH10706@ziepe.ca> (raw)
In-Reply-To: <1516903584.27592.183.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Thu, Jan 25, 2018 at 01:06:24PM -0500, Doug Ledford wrote:
> On Thu, 2018-01-25 at 10:50 -0700, Jason Gunthorpe wrote:
> > On Thu, Jan 25, 2018 at 11:34:23AM -0500, Doug Ledford wrote:
> > > > - Should I be wrong about no callers already holding mmap_sem,
> > > > I still think calling gup without the mutex makes sense for
> > > > improved paralellism. Now, if callers can hold the mmap_sem,
> > > > it's wrong to do copy_from_user right before calling mthca_map_user_db.
> > >
> > > So, if I understand you correctly, we (well, you and Al would be more
> > > correct, we haven't looked into the situation yet, so Mellanox people
> > > that worked on this in the day might now, or someone taking the time to
> > > research it could find out) don't have a clear understanding of all the
> > > conditions this function is called under, and so we actually don't know
> > > what the best way forward is to fix it?
> >
> > I looked at it enough to be confident that mthca_map_user_db is never
> > called with mmap_sem held.
> >
> > Also pretty confident that mthca_unmap_user_db is never called with
> > mmap_sem.
> >
> > So how about just grabbing mmap_sem around the call to get_user_pages
> > and no other changes?
>
> Since the original post was referred to an ABBA deadlock, wouldn't we
> have to drop db_tab->mutex, then grab both in the proper order?
I had understood that was only a concern because Davidlohr was having
trouble proving the callchain didn't include mmap_sem already..
I can see the call chain all ends on verbs ops, and I know verbs ops
with ucontext's are never called under mmap_sem by the core code..
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-25 18:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 20:54 [PATCH] IB/mthca: Fix how mthca_map_user_db() calls gup Davidlohr Bueso
[not found] ` <20180123205459.432-1-dave-h16yJtLeMjHk1uMJSBkQmQ@public.gmane.org>
2018-01-25 16:34 ` Doug Ledford
2018-01-25 17:50 ` Jason Gunthorpe
2018-01-25 18:06 ` Doug Ledford
[not found] ` <1516903584.27592.183.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-01-25 18:53 ` Jason Gunthorpe [this message]
[not found] ` <20180125185330.GH10706-uk2M96/98Pc@public.gmane.org>
2018-01-25 19:27 ` Davidlohr Bueso
2018-01-26 15:44 ` Doug Ledford
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=20180125185330.GH10706@ziepe.ca \
--to=jgg-uk2m96/98pc@public.gmane.org \
--cc=dave-h16yJtLeMjHk1uMJSBkQmQ@public.gmane.org \
--cc=dbueso-l3A5Bk7waGM@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
/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