From patchwork Wed Oct 23 19:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 11207403 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 8D18C913 for ; Wed, 23 Oct 2019 19:55:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4A9C6222CB for ; Wed, 23 Oct 2019 19:55:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="VzM9m/nR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A9C6222CB 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 6F1276B0003; Wed, 23 Oct 2019 15:55:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A9C66B0006; Wed, 23 Oct 2019 15:55:25 -0400 (EDT) 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 590786B0007; Wed, 23 Oct 2019 15:55:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 39ED36B0003 for ; Wed, 23 Oct 2019 15:55:25 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id CDC3D83E3 for ; Wed, 23 Oct 2019 19:55:24 +0000 (UTC) X-FDA: 76076103768.15.rake33_4c4b8a129200d X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,rcampbell@nvidia.com,:jglisse@redhat.com:jhubbard@nvidia.com:hch@lst.de:jgg@mellanox.com:linux-rdma@vger.kernel.org::linux-kernel@vger.kernel.org:rcampbell@nvidia.com,RULES_HIT:30012:30054:30056:30064: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:26,LUA_SUMMARY:none X-HE-Tag: rake33_4c4b8a129200d X-Filterd-Recvd-Size: 4675 Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Oct 2019 19:55:24 +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 ; Wed, 23 Oct 2019 12:55:27 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 23 Oct 2019 12:55:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 23 Oct 2019 12:55:22 -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; Wed, 23 Oct 2019 19:55:17 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 23 Oct 2019 19:55:17 +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 ; Wed, 23 Oct 2019 12:55:17 -0700 From: Ralph Campbell To: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe CC: , , , Ralph Campbell Subject: [PATCH v3 0/3] HMM tests and minor fixes Date: Wed, 23 Oct 2019 12:55:12 -0700 Message-ID: <20191023195515.13168-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=1571860527; bh=pKsqywyqkPUWdC01GQUc5JE3JAYljHqFpxxgzuwg5Ig=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Type: Content-Transfer-Encoding; b=VzM9m/nRhsUN+U0kVN1J6xlUJ+TUD0ZT40vMiAjmyzZQKCCfLs6vn3GbAgUDkcEZQ 0rLM2QdgwPTibNN38mym9vKUICrJ0g/hjQDEFEMuMM/QRULteFtF9YBC9NiRGWMrY/ gZWTikGFvoXHp6TctNP+dkKMQIxHcR7usLwoW+MepWuGUlmFhTajxDw9OP8N6FKfc4 b9hB9lWTb8oBcdukIeua+CWrtoWhD9F9S1EEcmRBlbomo5VO2eyLpiQDVvMVg8nyNY 617gBwTBE6cZMwx4FH9LPQeGJgT0vrmqdNyWCqRFgkmMbvfh9D2WIq6nZcPnkw75pD AJz33oCCmeh7A== 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-rc1). 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 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 (3): mm/hmm: make full use of walk_page_range() mm/hmm: allow snapshot of the special zero page mm/hmm/test: add self tests for HMM MAINTAINERS | 3 + drivers/char/Kconfig | 11 + drivers/char/Makefile | 1 + drivers/char/hmm_dmirror.c | 1566 ++++++++++++++++++++++++ include/Kbuild | 1 + include/uapi/linux/hmm_dmirror.h | 74 ++ mm/hmm.c | 136 +- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 3 + tools/testing/selftests/vm/config | 3 + tools/testing/selftests/vm/hmm-tests.c | 1311 ++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests | 16 + tools/testing/selftests/vm/test_hmm.sh | 97 ++ 13 files changed, 3158 insertions(+), 65 deletions(-) create mode 100644 drivers/char/hmm_dmirror.c create mode 100644 include/uapi/linux/hmm_dmirror.h create mode 100644 tools/testing/selftests/vm/hmm-tests.c create mode 100755 tools/testing/selftests/vm/test_hmm.sh