From patchwork Mon Nov 4 22:21:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 11226671 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75E74112B for ; Mon, 4 Nov 2019 22:21:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4210920650 for ; Mon, 4 Nov 2019 22:21:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="ROUZwCJb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4210920650 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 75DF46B0007; Mon, 4 Nov 2019 17:21:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 70CF06B0008; Mon, 4 Nov 2019 17:21:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FBC16B000A; Mon, 4 Nov 2019 17:21:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 49BD46B0007 for ; Mon, 4 Nov 2019 17:21:48 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 0E8118249980 for ; Mon, 4 Nov 2019 22:21:48 +0000 (UTC) X-FDA: 76120018296.14.meat30_fa37e0e7f127 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,rcampbell@nvidia.com,:jglisse@redhat.com:jhubbard@nvidia.com:hch@lst.de:jgg@mellanox.com:shuah@kernel.org:linux-rdma@vger.kernel.org::linux-kernel@vger.kernel.org:linux-kselftest@vger.kernel.org:rcampbell@nvidia.com,RULES_HIT:30012:30054:30056:30064:30067:30070,0,RBL:216.228.121.65:@nvidia.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: meat30_fa37e0e7f127 X-Filterd-Recvd-Size: 5027 Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 Nov 2019 22:21:47 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 04 Nov 2019 14:21:52 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 04 Nov 2019 14:21:46 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 04 Nov 2019 14:21:46 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 4 Nov 2019 22:21:43 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 4 Nov 2019 22:21:43 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 04 Nov 2019 14:21:43 -0800 From: Ralph Campbell To: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , "Shuah Khan" CC: , , , , "Ralph Campbell" Subject: [PATCH v4 0/2] HMM tests and minor fixes Date: Mon, 4 Nov 2019 14:21:39 -0800 Message-ID: <20191104222141.5173-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1572906112; bh=G+Ekoe8mXGHR3C2DvduazW+151IOXJUz9ALxPQbuuy4=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Type: Content-Transfer-Encoding; b=ROUZwCJbG6A0ph9k3PlpXG9qReSnA5cIEuRxCBfJsG+4ChPC0pYQUinR2OyIf8Hf0 Sard2c0b6cv1sGm1WoSiAxvK8McW27/SPh8gSo8N2CkyA6EfUmqcm1MfgwJe4ORABp pt3DFmQey6vGCVVvam9l11rU/a5c5koyjFyK1Oyhu4uKrsaV83zelb0MSLmAb3wy9r 5X0Yvc61FG/kfnq7J7RzSKp6zhQ3UkbenfVb5YzkdgFX2slVvL5wY7yztihULyZ/v9 cV6GBOsr9FmnP7YJLBlLgIUfYdNDw8cl6GKCn8u++ZvMrkrpI+movNiN54LWQNug6M /NUnPxKnm5e+w== 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: These changes are based on Jason's rdma/hmm branch (5.4.0-rc5). Patch 1 was previously posted here [1] but was dropped from that orginal series. Hopefully, the tests will reduce concerns about edge conditions. I'm sure more tests could be usefully added but I thought this was a good starting point. Changes since v3: patch 1: Unchanged except rebased on Jason's latest hmm (bbe3329e354d3ab5dc18). patch 2: Is now part of Jason's tree. patch 3 (now 2): Major changes to incorporate Jason's review feedback. * drivers/char/hmm_dmirror.c driver moved to lib/test_hmm.c * XArray used instead of "page tables". * platform device driver removed. * remove redundant copyright. Changes since v2: patch 1: Removed hmm_range_needs_fault() and just use hmm_range_need_fault(). Updated the change log to include that it fixes a bug where hmm_range_fault() incorrectly returned an error when no fault is requested. patch 2: Removed the confusing change log wording about DMA. Changed hmm_range_fault() to return the PFN of the zero page like any other page. patch 3: Adjusted the test code to match the new zero page behavior. Changes since v1: Rebased to Jason's rdma/hmm branch (5.4.0-rc1). Cleaned up locking for the test driver's page tables. Incorporated Christoph Hellwig's comments. [1] https://lore.kernel.org/linux-mm/20190726005650.2566-6-rcampbell@nvidia.com/ Ralph Campbell (2): mm/hmm: make full use of walk_page_range() mm/hmm/test: add self tests for HMM MAINTAINERS | 3 + include/uapi/linux/test_hmm.h | 59 ++ lib/Kconfig.debug | 11 + lib/Makefile | 1 + lib/test_hmm.c | 1306 ++++++++++++++++++++++++ mm/hmm.c | 121 ++- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 3 + tools/testing/selftests/vm/config | 2 + tools/testing/selftests/vm/hmm-tests.c | 1295 +++++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests | 16 + tools/testing/selftests/vm/test_hmm.sh | 97 ++ 12 files changed, 2852 insertions(+), 63 deletions(-) create mode 100644 include/uapi/linux/test_hmm.h create mode 100644 lib/test_hmm.c create mode 100644 tools/testing/selftests/vm/hmm-tests.c create mode 100755 tools/testing/selftests/vm/test_hmm.sh