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 02F9DC433DF for ; Thu, 4 Jun 2020 05:18:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA2C52074B for ; Thu, 4 Jun 2020 05:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="KR2S3mgS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA2C52074B 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 3B66D80010; Thu, 4 Jun 2020 01:18:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 367658000E; Thu, 4 Jun 2020 01:18:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 255FB80010; Thu, 4 Jun 2020 01:18:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 0AEEF8000E for ; Thu, 4 Jun 2020 01:18:33 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C740A181AEF0B for ; Thu, 4 Jun 2020 05:18:32 +0000 (UTC) X-FDA: 76890374064.19.shame04_84be1c654d856 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id A951F1AD1B9 for ; Thu, 4 Jun 2020 05:18:32 +0000 (UTC) X-HE-Tag: shame04_84be1c654d856 X-Filterd-Recvd-Size: 5210 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Jun 2020 05:18:31 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 03 Jun 2020 22:18:18 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 03 Jun 2020 22:18:30 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 03 Jun 2020 22:18:30 -0700 Received: from [10.2.89.40] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 4 Jun 2020 05:18:29 +0000 Subject: Re: [patch 004/131] mm/gup: refactor and de-duplicate gup_fast() code To: Linus Torvalds , Andrew Morton CC: Dave Airlie , Chris Wilson , Daniel Vetter , Jani Nikula , Joonas Lahtinen , , Linux-MM , , , Rodrigo Vivi , , Matthew Wilcox , "Chris Wilson" References: <20200603155549.e041363450869eaae4c7f05b@linux-foundation.org> <20200603225630.dODblpnlR%akpm@linux-foundation.org> X-Nvconfidentiality: public From: John Hubbard Message-ID: <7b99a389-f0d9-8e0f-e293-5d5f5f013f3a@nvidia.com> Date: Wed, 3 Jun 2020 22:18:28 -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: HQMAIL105.nvidia.com (172.20.187.12) 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=1591247899; bh=HE9Zz2oUiQ32alBT7IrwXwCncnz6zWItlgy43CPf7Os=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=KR2S3mgSXeB1Ngp41puWMBMgQCCDkNsNj5Nkt8aM80KTZ2TIyA05ZIh1v1/ioIZpx MHTQOuWV6w0QSmUhDV4qvqnJkl18vWT7CPZdiaasAmwM26YkSLdbMHzXz8LGlPG8yV ro4bV9MlZk1RR4DUmYJ+BT92s2RdH3dAaxXlQj3XU7o/9mxJw5G6qFI7GHKOHJMW4N ygCot/9oXLhvrFPkTH3iEMx6oaNM2QJkPtfe7OrHOz3qZ1xzFbyQa9iuwECHv/+S3t KVPKmUNSgQoUY0L8dMJCvuYs6gpVOR9YmnnBZXs4SUU/t3/fsFpmFeSje2A+Q0zJQz jIKNWk2W6wR6w== X-Rspamd-Queue-Id: A951F1AD1B9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 2020-06-03 21:31, Linus Torvalds wrote: > On Wed, Jun 3, 2020 at 8:19 PM Linus Torvalds > wrote: >> >> I have tried to fix it up, partly by editing the patches directly, and >> partly by then trying to fix up comments after-the-fact. > > The end result passes the smell test, boots for me, and looks like it > might work. > > But I don't have any good real-world test for this, and I hope and > assume that John has something GPU-related that actually uses the code > and cares. Presumably there was _something_ that triggered those > changes to de-duplicate that code? Yes: the Intel i915 driver required a pin_user_pages*() variant of the gup fast-only code. So the next 2 patches put the refactored code into use: 2170ecfa7688 drm/i915: convert get_user_pages() --> pin_user_pages() 104acc327648 mm/gup: introduce pin_user_pages_fast_only() > > So please give it a look. Because of how I edited the patches (and > Andrew edited them before me), what is attributed to John Hubbard > isn't really the same as the patch he originally wrote. > Looking at it now. I'm pleased to see that the fix is basically identical to a local fix that I was testing an hour ago. The only difference is the name and type of the local fast_flags variable. An unsigned long is larger than the API requires, but that is of course fine for now. As for testing, the original version of this the was part of a 4-part series [1] that ended up converting Intel i915 to use pin_user_pages*(). And Chris Wilson (+cc) was kind enough to run some drm/i915 CI tests on that and they passed at the time. Also, I have a set of xfstests and a few other things exercise a fair amount of get_user_pages*() and pin_user_pages*(). Running those now. But my run time testing is not set up for stress testing, and it's a very narrow look at things. But so far it looks promising. [1] https://lore.kernel.org/r/20200522051931.54191-1-jhubbard@nvidia.com thanks, -- John Hubbard NVIDIA