Received: by 10.223.176.46 with SMTP id f43csp2440263wra; Thu, 25 Jan 2018 09:52:56 -0800 (PST) X-Google-Smtp-Source: AH8x226HwIEzyAnfOxBEKjwQKBqPxBmsOZk+BJ1CcxWjZX5BRmjkg+n9X5rqOKzg7m7bR2AHAgY1 X-Received: by 2002:a17:902:5417:: with SMTP id d23-v6mr11810587pli.330.1516902776484; Thu, 25 Jan 2018 09:52:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516902776; cv=none; d=google.com; s=arc-20160816; b=XQvNHjBczZmZg63GA4cO1bqqaFViRGXwbG7i3Slbs1jgArWs+CzRHIA4jsrpZ/qlBM WGC8ZT4vaItEoxvBBOTQuQY9USmdEtxZprUQwn9z2zbSyXJpsHM8z58mnVrIJb/41SZB RtVcnfOjYD7a4mDMStcs/Z8NsBCH6pIt6TQuZGc9si+w+yuvshn8Mlw5yEmuBNjEdyfb DXi5rISEIGHGiikZWUJvoNSXRZCRJc2kpKflo9tVt2Yt3vdRBBN3WouBreUTxHotgk4y sHVUDXn905HwRMwkga5EXIo2DU/jsqRk2jvuQFE1YaZzr3aAyrqZMsl1FW4ak1hOsXHu 55uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=I+LZEwn7VVBh+ankcUWNt0iePJ+2Y79JD/qHEZI6+C4=; b=AqKXPCu0/wMT8O2Uq1SOmqIzhnUO1lxDNPgBFkoNkDD4AWGEUM1GIaJbLmGpLs6aWh NpNkPWmotrCz/E02aJnEIziqnLENqADbqSbfeKl7/Dj8+9I2K87at3nodVtaCzw3Q/xc 7S2sn7FTEZLcPv06EnalGvmBg66PCdDgg/ECX2USqaXwAkYGxWVtXHUbCZSUo5OnBwDU mKGiFhhU27lDLCbxhpOJbAkPVIMrgVFEC7NBPvAiqs8JZhx/SNQC1Ubh6AbreSVVrQ5J g6HDw3UTGmGFqbXKCpy4nJlQJbHhdsOaz3U+4sGyCDx8IAYWnU3yXiy9I8yJLRjTVsgA uFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Gog4s9lU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si2297405plu.181.2018.01.25.09.52.42; Thu, 25 Jan 2018 09:52:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Gog4s9lU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751267AbeAYRu4 (ORCPT + 99 others); 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 Received: by mail-wr0-f193.google.com with SMTP id 100so8545951wrb.7 for ; Thu, 25 Jan 2018 09:50:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=I+LZEwn7VVBh+ankcUWNt0iePJ+2Y79JD/qHEZI6+C4=; b=Gog4s9lUv7qhHcheMBIbnVENpmETVDM4rN0ndJYo5fiRjVNoCFq+uRnMDA2+eK84w/ 9XEjBB+xz/yTrOQ1xmXi6wwfkwZy7zYWgCzkhaPI/1OIVOTuMRKDN3AHdksQO3WT1ckr KPDo34KS4/Ym55SCxcJKm08UXxC1tRUp/V0A50Nykd3ulwjUwRVx3Nn77xsYtYoP4U62 0WWySdyi8UBEy8zJ+w8cl9vAAoRAGKeGw5Eg7osoSiH19qs/dBIPse40wPa6dTWwoV9n 7gCkKSjJDUmllZF32jHa2nHfS2K5M77ogJK285+aIao8lxfmF5v/3x3XdwbMLpWJHCI/ YGuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=I+LZEwn7VVBh+ankcUWNt0iePJ+2Y79JD/qHEZI6+C4=; b=aHMWdXScb8ePck5JzqSKXMnhGyQWPHUmKXj/9dusFGyzw0Cute2TxwhxoyBnDuNBcI PvQLLe72OPCOz+TWaRYDLIIEQq0DH39DKODcZsAUzwpLygg8elX+vVa8IX7hidNnXOCZ Bbd/3/LiztGxY2C9KxjpC6uAEyoLT2kCxsRT7WBSiHCR5o15PBHUsedAG1xxMpzbjzRj c7RtLolRB0iPQf1DgIg0lVHC3RjTVEwmPpwXgFt2TqrDJV4IE0yUJRtSvVka3g21HYul pp8p/JESxIIxIsWGp0IdiwQOfCuNBVC8bHRiaYbo+4ME65yObb6jjO+mvlqtv8PGMXVn ZzuA== X-Gm-Message-State: AKwxytcNgBhZnSrnkUM6vY12ANe9+cwjZeNF5ieIW5HHNIElQdVi6bBU XgDhtsWzZljhwW5EAXdHGEVhcQ== X-Received: by 10.223.161.68 with SMTP id r4mr6355674wrr.243.1516902653359; Thu, 25 Jan 2018 09:50:53 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id s2sm1939739wmf.0.2018.01.25.09.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 09:50:52 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eelfk-0001L8-Tv; Thu, 25 Jan 2018 10:50:48 -0700 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 Precedence: bulk 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