From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C244AC43141 for ; Fri, 29 Nov 2019 21:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93F5D2464D for ; Fri, 29 Nov 2019 21:47:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="P515JTdy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727212AbfK2Vro (ORCPT ); Fri, 29 Nov 2019 16:47:44 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6093 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfK2Vro (ORCPT ); Fri, 29 Nov 2019 16:47:44 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 29 Nov 2019 13:47:46 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 29 Nov 2019 13:47:42 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 29 Nov 2019 13:47:42 -0800 Received: from [10.2.169.205] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 29 Nov 2019 21:47:41 +0000 Subject: Re: [PATCH v2 17/19] powerpc: book3s64: convert to pin_user_pages() and put_user_page() To: Jan Kara CC: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko , Mike Kravetz , Paul Mackerras , Shuah Khan , Vlastimil Babka , , , , , , , , , , , , , LKML References: <20191125231035.1539120-1-jhubbard@nvidia.com> <20191125231035.1539120-18-jhubbard@nvidia.com> <20191129112315.GB1121@quack2.suse.cz> From: John Hubbard X-Nvconfidentiality: public Message-ID: Date: Fri, 29 Nov 2019 13:44:53 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191129112315.GB1121@quack2.suse.cz> 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=1575064066; bh=tMvn6asqZgJ/8yczcC9lnf1pHEf7TJzCvRVZqLzUEIk=; 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=P515JTdy70KP3oimNK/fSAtObgW4JDQsh/LN+dj31w7qtgH6JUdGJYKS3j5J8enBM oN04vymJSqszX58P75QNc1cW3k/Ll0LB9zwNlmlBWaR7zw2qd7/o9t2Cy3EugW3wgY XBlQyEsBEMcfywkDPj201lclcvfOCs5gFzs/O+2QmSmHzciD31eTMBkNB0W6VGXEOL BbnrGM91l0GAwjLm+XJmL4eoGQAce5JVCz6FfueQA4/sc24hO2mmz2R1mloKHyP2Ej 3q1StOVbP0t0OEBFEGay8puwUyC8jwyLEftGIYNcVrkaz5szmNasFETh2Ir0Xi5Q1g 8xDwDUM/1ii9A== Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On 11/29/19 3:23 AM, Jan Kara wrote: > On Mon 25-11-19 15:10:33, John Hubbard wrote: >> 1. Convert from get_user_pages() to pin_user_pages(). >> >> 2. As required by pin_user_pages(), release these pages via >> put_user_page(). In this case, do so via put_user_pages_dirty_lock(). >> >> That has the side effect of calling set_page_dirty_lock(), instead >> of set_page_dirty(). This is probably more accurate. > > Maybe more accurate but it doesn't work for mm_iommu_unpin(). As I'm > checking mm_iommu_unpin() gets called from RCU callback which is executed > interrupt context and you cannot lock pages from such context. So you need > to queue work from the RCU callback and then do the real work from the > workqueue... > > Honza ah yes, fixed locally. (In order to avoid distracting people during the merge window, I won't post any more versions of the series until the merge window is over, unless a maintainer tells me that any of these patches are desired for 5.5.) With that, we are back to a one-line diff for this part: @@ -215,7 +214,7 @@ static void mm_iommu_unpin(struct mm_iommu_table_group_mem_t *mem) if (mem->hpas[i] & MM_IOMMU_TABLE_GROUP_PAGE_DIRTY) SetPageDirty(page); - put_page(page); + put_user_page(page); mem->hpas[i] = 0; } } btw, I'm also working on your feedback for patch 17 (mm/gup: track FOLL_PIN pages [1]), from a few days earlier, it's not being ignored, I'm just trying to avoid distracting people during the merge window. [1] https://lore.kernel.org/r/20191121093941.GA18190@quack2.suse.cz thanks, -- John Hubbard NVIDIA