Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp263551ybm; Tue, 26 May 2020 16:20:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkV2/ndd3UyEXE4dDd5T228JhDnUjcMCOGjwaXkHHheqYkUX8xz15JB5in2FYfJuPnd2E5 X-Received: by 2002:aa7:c5cb:: with SMTP id h11mr23070006eds.136.1590535227795; Tue, 26 May 2020 16:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590535227; cv=none; d=google.com; s=arc-20160816; b=bvsXwJQpG7oS8FDDKCjw8utk6wbkzPSWhblbAcxJhtQfZjUrurg4PJjnAAYovn0FlJ X+11pwWSSgIbngB7bpjh5YaOm7ilwRUscOfFhgzqkGd9X2KbuUaQFwbnTAOAXP0D0/Sh QXPoAcyLtEuHmEu1yhJI0tB8u7K8ybLTSIk3orDC8PPzwi7/xM9bcwTQGsn7wBThhGkH QyjIZAG8cBfcsTm9Y2Jc2lMaMa62QNYvP7+aqQsMCRoN3lHzUFQuPQBPO3ZaHgImGGOQ ZeGE39Y5vEipDaP/y1+iiJcjNo6va+07A0m4wTDuC4mDiqSMYhZKLrnmUvX6bQsQU2X0 aw3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=/XnNrvzb9RLbuq2lH//zFeUnFIDYaIiAnPILKTFB44A=; b=lC2pxcEcXhW2ihFYjy91aKqqDEWmMbcZu0atBQO4bYKs+I6JWmshwAFAzzLOn2GG43 bKsx53ee5oWqqTbAIJCHiyXduZFdsrem537FWqv07JBYp3JTNU7DuK7tq4JxcBtDd2TX EAnX2pz+yd7cEcwSvJl3u1wV8GtGtYX3vEgwSM2tvb8TKvV0P3PXShHI8B99R7RY/Rsn ZqB3MGAoDvcNyvw5TtTxgJqYXVOAog6NISXO+RJV/62JVG2tHGWBCJuDun6D9IVTHeWd Anh5TWhvJM/T/rS/ks0TtVEvNe7d3PmymZAKe4B5hWG2uckEwasnc3cmA2Q6IiRX9UKf XM+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZkEgKRfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si725148ejk.381.2020.05.26.16.20.05; Tue, 26 May 2020 16:20:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZkEgKRfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389703AbgEZTpU (ORCPT + 99 others); Tue, 26 May 2020 15:45:20 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:9690 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389360AbgEZTpU (ORCPT ); Tue, 26 May 2020 15:45:20 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 26 May 2020 12:43:56 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 26 May 2020 12:45:19 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 26 May 2020 12:45:19 -0700 Received: from [10.2.50.17] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 26 May 2020 19:45:18 +0000 Subject: Re: [PATCH 1/1] vfio/spapr_tce: convert get_user_pages() --> pin_user_pages() To: Souptick Joarder CC: LKML , Alex Williamson , Cornelia Huck , References: <20200523014347.193290-1-jhubbard@nvidia.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <40a4e26f-b89b-a3db-6936-f94b9bb4fc9d@nvidia.com> Date: Tue, 26 May 2020 12:45:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1590522236; bh=/XnNrvzb9RLbuq2lH//zFeUnFIDYaIiAnPILKTFB44A=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=ZkEgKRfrAfi9lRHILxBG7yG6OSKh6fkLuxThz66yrmzGY/6rYE2zNqc4TBJJtIwdz lghpnqH4YUsDN/NppuiFUu5Rgqo+2z8ZY/0gOSDjnwFPrMmGtdVgzAgRCsDk/58Y5q LdkVddbL8/CIz47hUA3EWTqnrdiwZOhfys7ris0SpU3jP21kg0ckJY34mOhoER+jP8 nlI0NxtieLK3p9p1Q1p7R+XlHR1Ux6wFyCIb8KpSEygIJYyg9PJKGNzu4RCNtrU5kj RnmV5uOG5VnTn9c2I79MRJfAg1g8eSdoONeVfapKgB9gfLt1LjkfjqmQOk1Mu8U+MG I14CdS/mnKs9Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-26 12:28, Souptick Joarder wrote: >> @@ -486,7 +486,7 @@ static int tce_iommu_use_page(unsigned long tce, unsigned long *hpa) >> struct page *page = NULL; >> enum dma_data_direction direction = iommu_tce_direction(tce); >> >> - if (get_user_pages_fast(tce & PAGE_MASK, 1, >> + if (pin_user_pages_fast(tce & PAGE_MASK, 1, >> direction != DMA_TO_DEVICE ? FOLL_WRITE : 0, >> &page) != 1) >> return -EFAULT; > > There are few places where nr_pages is passed as 1 to get_user_pages_fast(). > With similar conversion those will be changed to pin_user_pages_fast(). > > Does it make sense to add an inline like - pin_user_page_fast(), similar to > get_user_page_fast_only() ( now merged in linux-next) ? > Perhaps not *just* yet, IMHO. There are only two places so far: here, and dax_lock_page(). And we don't expect that many places, either, because pin_user_pages*(), unlike get_user_pages(), is more likely to operate on a bunch of pages at once. Although, that could change if we look into the remaining call sites and find more single-page cases that need a gup-to-pup conversion. get_user_pages*() has a few more situations (Case 4, in Documentation/core-api/pin_user_pages.rst: struct page manipulation) in which it operates on single pages. Those will remain get_user_pages*() calls, or perhaps change to get_user_page(). thanks, -- John Hubbard NVIDIA