Received: by 10.223.176.46 with SMTP id f43csp2273012wra; Sun, 21 Jan 2018 15:56:43 -0800 (PST) X-Google-Smtp-Source: AH8x226rEL3A/idz0tt0fvPnOP9H+Q1RPi+EIHsW1FB7pJEFLDP8wNhDWd7c0sD2UiO9O/5TX7+s X-Received: by 10.99.115.89 with SMTP id d25mr5548904pgn.218.1516579003526; Sun, 21 Jan 2018 15:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516579003; cv=none; d=google.com; s=arc-20160816; b=i1UV8t9FRv491OzWh62oJa2xhqWy9K8uUO9R5jDyezBq9jEP7E4pk+07gJpAUYHkFy axXGpwb/Iv+hRbh/6JWKSKLM/uS30q9j3MdNYH147RWishBP3xrvIy90z9FegMFaqsMv bhK2M6tKFQM7gBN/IFl8U32bVAREkbVl6ktLnewIFUaTWxDPBo61hkqWCdotlJJfGykM INa585dl6Ki4dt8SCU6mLJuxElv9uBAWc5sdHBPngLCyevZnxHhf9VwvbvPGIrGMax9D jxYhXewGfIX89s54hqZpLh70fJ16eg/B5ObTlXBKmY3qzFFmSd9rP39cTRkiVQ8LBpfq 8jMQ== 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:arc-authentication-results; bh=0Qywu0CP/2O6mVRIJG7vWcUm9ZeeWRYd6r3RR6YVt6I=; b=yV1fUWJ110RRfqn09NTQuqPl/XIHAfzpEFAjNuzrWxXepj9d3iLyHVz0K8PfS4mymg f+vCc1q0oxIDvpaa7Y2J3qD0N9C2sBrXOcdwTWmRzfzrJmWI+Ws++QDnySRx2CibpS1I igpk8fFsWgRyGXvIp+bFKBeaFpHihmkENODOmCGJKqP0IKze3pT0tCZO24FCu84CC1ZD ALKP452bR7PCf4Tp3l27jayK8tjFFprXH//XB/LXsRFqcrpR2y62HZQZYPRwrrTNqp9U NNLvpVOIebdoYRbDrNHgtsWFPv7K7zlxmTe69+SgxrlbWBd8Z3cR6me6QBAB8hoH0mI1 HlXA== ARC-Authentication-Results: i=1; mx.google.com; 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 o22si14336080pfi.277.2018.01.21.15.56.28; Sun, 21 Jan 2018 15:56:43 -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; 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 S1750981AbeAUX4E (ORCPT + 99 others); Sun, 21 Jan 2018 18:56:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:50964 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbeAUX4D (ORCPT ); Sun, 21 Jan 2018 18:56:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0A4D4ABB4; Sun, 21 Jan 2018 23:56:01 +0000 (UTC) Date: Sun, 21 Jan 2018 15:48:28 -0800 From: Davidlohr Bueso To: Al Viro Cc: starvik@axis.com, jesper.nilsson@axis.com, akpm@linux-foundation.org, linux-cris-kernel@axis.com, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] arch/cris: use get_user_pages_fast() Message-ID: <20180121234828.fro77k4pr2b364y6@linux-n805> References: <20180121225929.11782-1-dave@stgolabs.net> <20180121233943.GO13338@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180121233943.GO13338@ZenIV.linux.org.uk> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 21 Jan 2018, Al Viro wrote: >On Sun, Jan 21, 2018 at 02:59:29PM -0800, Davidlohr Bueso wrote: >> Since we currently hold mmap_sem across both gup calls (and >> nothing more), we can substitute it with two _fast() >> alternatives and possibly avoid grabbing the lock. >> >> This was found while adding mmap_sem wrappers, and was also >> previously reported by Al: https://lkml.org/lkml/2017/11/17/777 > >See commit 9a949e8ff92246c0753b2805c2a001cb991fffe5 >Author: Al Viro >Date: Sat Nov 18 14:37:46 2017 -0500 > > cris: switch to get_user_pages_fast() > > no point holding ->mmap_sem over both calls. > > Signed-off-by: Al Viro Serves me for developing on Linus' tree, cool. Now, regarding the other two which are technically bugs (not holding mmap_sem under gup), you mention I don't see those in next, so I'm assuming you didn't get to them. - mthca_map_user_db(): I came to the same conclusion and tempted to send out the same idea of unlocking the mutex for gup_fast() so we can take mmap_sem if needed. - ia64's store_virtual_to_phys() is a sysfs attribute and holds no (other) locks. How about we just convert it as well? diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index 85bba43e7d5d..658a8e06a69b 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c @@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, u64 virt_addr=simple_strtoull(buf, NULL, 16); int ret; - ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL); + ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); if (ret<=0) { #ifdef ERR_INJ_DEBUG printk("Virtual address %lx is not existing.\n",virt_addr); Thanks, Davidlohr