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=-14.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 E3DC7C00A89 for ; Fri, 30 Oct 2020 23:58:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 479F820796 for ; Fri, 30 Oct 2020 23:58:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="N23witbR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 479F820796 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A5F236B0036; Fri, 30 Oct 2020 19:58:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A10086B005C; Fri, 30 Oct 2020 19:58:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FF1E6B005D; Fri, 30 Oct 2020 19:58:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 5E9DF6B0036 for ; Fri, 30 Oct 2020 19:58:33 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0610A181AEF1D for ; Fri, 30 Oct 2020 23:58:33 +0000 (UTC) X-FDA: 77430258906.23.crate22_3a184252729a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id DAC2237606 for ; Fri, 30 Oct 2020 23:58:32 +0000 (UTC) X-HE-Tag: crate22_3a184252729a X-Filterd-Recvd-Size: 6677 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 23:58:31 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 30 Oct 2020 16:58:35 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 30 Oct 2020 23:58:27 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.177) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 30 Oct 2020 23:58:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=maTwlTzxRNDaby9CyLbUp/8zEbQhxFgJwTyk5VKi6C5ylSJjbXXuBY752oN7O/IKNiTP2NXTlvInP1ms9Mfyjr7ou33SHVACc3keuvremToNCNtmAm4OqVFAESLe0moffCw37w7unWt9GKlM6QwkK+VSUlR7Ls8nWZo43q2C1fkqbP5brDeCgVQeCaWkQuC03xcL+ftPxyvU3J1lPS9DeAOEHypDl4YDFBSCPs41JkbSYpOKgz2ZJTtBrUyJXLCZmWSy+Qe7DuWkYTmTsVW9Pw9C/D7gH0syS0WBUsQ8CU35zI8fkEinEo69T/fUSs7SgrN9E/fi/ALB0qkbwU7mKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=le+oC+ouFVQ+Q+T0FMCKkZXqbaT0vc0sKLpgA6wQ32M=; b=BSd3j7GqCI1KbfNyKMwf/ARw7NSHFskH11jQJAOZrCO6yhC6zSyGYsYyuHeD1/8fSWYsN0XCRjmAPPI6i1Ze5aFyHiZbJes0OnZtagZhY82H2Yyv+PpWbvJlh7j+ULZFZ1MA/t20suxCX+ymRcr3+nsrx+HsvjHGThKJVBOBlJgKhKGUIvPRHqZ2vRkICebwS90VyfOjkGo+RvdJBMfYXFB05UAVo1aYkqzqJoMq/qzoSZgGRRCTHGKc14U1rfxdvdaOo03Pdf6loAjl/PpBWjSorOtIdqwFzp0UKBTmAAlq5vsJyB43hX73OlYQlmdXu4rSZOHmvbZJGSIri84HYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM5PR1201MB2488.namprd12.prod.outlook.com (2603:10b6:3:e1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 23:58:26 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::cdbe:f274:ad65:9a78]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::cdbe:f274:ad65:9a78%7]) with mapi id 15.20.3499.027; Fri, 30 Oct 2020 23:58:26 +0000 Date: Fri, 30 Oct 2020 20:58:25 -0300 From: Jason Gunthorpe To: Ira Weiny CC: Andrew Morton , , "Aneesh Kumar K.V" , Claudio Imbrenda , Jan Kara , John Hubbard Subject: Re: [PATCH rc] mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages() Message-ID: <20201030235825.GR2620339@nvidia.com> References: <0-v1-976effcd4468+d4-gup_cma_fix_jgg@nvidia.com> <20201030205026.GC971338@iweiny-DESK2.sc.intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20201030205026.GC971338@iweiny-DESK2.sc.intel.com> X-ClientProxiedBy: MN2PR20CA0065.namprd20.prod.outlook.com (2603:10b6:208:235::34) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (156.34.48.30) by MN2PR20CA0065.namprd20.prod.outlook.com (2603:10b6:208:235::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 23:58:26 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kYeHp-00E7fp-F7; Fri, 30 Oct 2020 20:58:25 -0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1604102315; bh=le+oC+ouFVQ+Q+T0FMCKkZXqbaT0vc0sKLpgA6wQ32M=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Date: From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:X-ClientProxiedBy:MIME-Version: X-MS-Exchange-MessageSentRepresentingType; b=N23witbRcqwIorWr45yjScv51DjZ5YNUwFlP1ck2Mc/QIVVWei1QjWpcCCK5Cj+Ok jq8737/hhSMskITF2RGsAxuNU0+z5HR0beWgg11mNjVm0TVCUOkhU0eT8FNhUaHLBV resc2R8/oFUcq7NDjQqsXj4aYBXq97uV0ZHHgbGPahx0uLj2qLcaapvHxFd7I/lMw7 2VRCd9nZQt8A5/a7H+5wfVznkI9v/vk4EAOTTaNYvdBBHTZPszlyDVFLXdREWk8w5f D6U6M2lIixjOvtJQMgirh4SCoTtjquH1SxiAQY21OgJPD7WiBojLUR0f64snksHnUK git4TbMtEWjnw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 30, 2020 at 01:50:26PM -0700, Ira Weiny wrote: > On Fri, Oct 30, 2020 at 01:32:28PM -0300, Jason Gunthorpe wrote: > > When FOLL_PIN is passed to __get_user_pages() the page list must be put > > back using unpin_user_pages() otherwise the page pin reference persists in > > a corrupted state. > > > > Cc: > > Cc: Aneesh Kumar K.V > > Fixes: 3faa52c03f44 ("mm/gup: track FOLL_PIN pages") > > Signed-off-by: Jason Gunthorpe > > mm/gup.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > I don't have any way to test CMA stuff, this was noticed by inspection. > > > > diff --git a/mm/gup.c b/mm/gup.c > > index 1bb349e5ed212a..2e26757f3c9276 100644 > > +++ b/mm/gup.c > > @@ -1630,8 +1630,11 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm, > > /* > > * drop the above get_user_pages reference. > > */ > > I wonder if that comment should be deleted/modified? It does not seem to apply > any longer. It is still basically right, the 'above' is just a bit vauge.. Don't want to touch extra stuff for a stable patch. > Also, looks like there is another place this occurs right before the call to > check_and_migrate_cma_pages() in __gup_longterm_locked() > > 1730 if (check_dax_vmas(vmas_tmp, rc)) { > 1731 for (i = 0; i < rc; i++) > 1732 put_page(pages[i]); > 1733 rc = -EOPNOTSUPP; > 1734 goto out; > 1735 } Oh, yes! I will update this in v2 - good eyes > And since we now have 2 places should this be a helper? I have another patch that deletes check_dax_vmas() and this code https://github.com/jgunthorpe/linux/commit/48ee608271e124e4a89353b9694502372c1b2df0 Does it look OK to you? I was going to check it again and post next week Thus for this stable patch let's just leave it simple? Thanks, Jason