From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbeAYRu4 (ORCPT ); Thu, 25 Jan 2018 12:50:56 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40293 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105AbeAYRuy (ORCPT ); Thu, 25 Jan 2018 12:50:54 -0500 X-Google-Smtp-Source: AH8x226uIShOcuq8LBxSFxb0LETuzySyZmF9dnYIo7/LiTh70NKy8eITQMBVzUOUM2Kh2GEmn58ayg== Date: Thu, 25 Jan 2018 10:50:48 -0700 From: Jason Gunthorpe To: Doug Ledford Cc: Davidlohr Bueso , roland@purestorage.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] IB/mthca: Fix how mthca_map_user_db() calls gup Message-ID: <20180125175048.GG10706@ziepe.ca> References: <20180123205459.432-1-dave@stgolabs.net> <1516898063.27592.136.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516898063.27592.136.camel@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Jason