Received: by 2002:a25:4b06:0:0:0:0:0 with SMTP id y6csp329593yba; Fri, 8 May 2020 12:22:10 -0700 (PDT) X-Google-Smtp-Source: APiQypIPFWiWnyuFKwzOkokaoGKygBRpy2xCc83G55OC1CDtvM6bMsXLxkSwmieI4XrxpDI5QcRf X-Received: by 2002:a05:6402:1cac:: with SMTP id cz12mr3402819edb.373.1588965730263; Fri, 08 May 2020 12:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588965730; cv=none; d=google.com; s=arc-20160816; b=Q5MfDzv2koXTyUbUqALna0AYpqqbqvAmU1FLloygCBcjeobyu5+/d428SEcguSJCPu VqiylZgneFyAMtRMWDDs4P7gz1YMhZzyeABd15suAamBETnQScB/qTP5ELJFMlI8z+w+ Y5ALbmwAsZfdJiWZKKaLPFJA258ngK/oZAeogx4ujfQnoco+fTdCMpGY8hCGLvxfMCXb yZ1bZ6CcHTr60UdPpPRDbqMEsIzfEivN+RIO42eOJWsE9+1JhO0fG5DH9aHFN2GjUIe/ YhBAbLRMvO11d3eJPlUQZFjupvsmAm+nug7rTGiGX5U0PieMZnbRYyDQ3RbRJDI8U1I6 sSYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=jFq2mixtkzI32ozqz5hLHkzp0Ygs10xUW1B28WBNaLs=; b=wtY8VqZcIbAUlJxFdB/AA4FK0VrtibbbaSqeZn1mxnu1jw29c37iDp6XHrCh8RbjQ5 rHRWVQaanqObllIJZYYR6Y4zUixVhwl/xnx3xFvbR6+HT1u0bPpaPn0nEp61+kVBaBsh YSR5Hn2o8dzeYYumidZ/oe0mB9IHPIRKItv8sBHFcrQtZ6RvZAHtyk2opvrzUgdkNywg xgzV1ZzatyAwdBkv9lstDGwbhRHg5vUv37JkZ7XLubVh3d5F0+6jj+3MmCL/zPCiW0NI SlVg+ehbEr99fotR9sJWxvCNpBTh6DFfPKW0IiD5cnpfwXYDzgHBNoU0s7/U4GJfBHzq pbxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=f1uSc3RO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si1363127edi.111.2020.05.08.12.21.44; Fri, 08 May 2020 12:22:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=f1uSc3RO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbgEHTUW (ORCPT + 99 others); Fri, 8 May 2020 15:20:22 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:17039 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbgEHTUW (ORCPT ); Fri, 8 May 2020 15:20:22 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 08 May 2020 12:20:09 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 08 May 2020 12:20:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 08 May 2020 12:20:22 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 8 May 2020 19:20:20 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 8 May 2020 19:20:20 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 08 May 2020 12:20:20 -0700 From: Ralph Campbell To: , , , , CC: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , "Ben Skeggs" , Andrew Morton , Shuah Khan , Ralph Campbell Subject: [PATCH 0/6] nouveau/hmm: add support for mapping large pages Date: Fri, 8 May 2020 12:20:03 -0700 Message-ID: <20200508192009.15302-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1588965609; bh=jFq2mixtkzI32ozqz5hLHkzp0Ygs10xUW1B28WBNaLs=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Type: Content-Transfer-Encoding; b=f1uSc3ROHwcanB7L/tnLl4h20hmLEQD3keM9GdJxSJn+hErrBRjoEQ9pNFoFKAS3y KXQ272lLCVcvsmn3Xh+CZ8PGvmLztkdvTO9AW7DTZ8K26htGWFfd4Z3lL/AsL0Gqmk a2fyv9afMBkOOvcCPRVcP6FGdddhhrTMTn57sAbBgvBbXHlMkrCpzSzLoZNADRGtOO T2pwhT2QsojXnT8v9nFgKvI91dK5M0SVdfBW0Oflirjs3is2qdNCUgrI1BH++cbcyW YRWzjzSYUGCu/H/jdIfvhJ/DeCELi/J6Udl7WwSWZelaLryvmfp4l417C4xxGZ98PL aKtDXj0RDipAw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hmm_range_fault() returns an array of page frame numbers and flags for how the pages are mapped in the requested process' page tables. The PFN can be used to get the struct page with hmm_pfn_to_page() and the page size order can be determined with compound_order(page) but if the page is larger than order 0 (PAGE_SIZE), there is no indication that the page is mapped using a larger page size. To be fully general, hmm_range_fault() would need to return the mapping size to handle cases like a 1GB compound page being mapped with 2MB PMD entries. However, the most common case is the mapping size the same as the underlying compound page size. This series adds a new output flag to indicate this so that callers know it is safe to use a large device page table mapping if one is available. Nouveau and the HMM tests are updated to use the new flag. Note that this series depends on a patch queued in Ben Skeggs' nouveau tree ("nouveau/hmm: map pages after migration") and the patches queued in Jason's HMM tree. There is also a patch outstanding ("nouveau/hmm: fix nouveau_dmem_chunk allocations") that is independent of the above and could be applied before or after. Ralph Campbell (6): nouveau/hmm: map pages after migration nouveau: make nvkm_vmm_ctor() and nvkm_mmu_ptp_get() static nouveau/hmm: fault one page at a time mm/hmm: add output flag for compound page mapping nouveau/hmm: support mapping large sysmem pages hmm: add tests for HMM_PFN_COMPOUND flag drivers/gpu/drm/nouveau/nouveau_dmem.c | 46 ++- drivers/gpu/drm/nouveau/nouveau_dmem.h | 2 + drivers/gpu/drm/nouveau/nouveau_svm.c | 288 +++++++++--------- drivers/gpu/drm/nouveau/nouveau_svm.h | 5 + .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 6 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/priv.h | 2 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 12 +- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | 3 - .../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c | 29 +- include/linux/hmm.h | 4 +- lib/test_hmm.c | 2 + lib/test_hmm_uapi.h | 2 + mm/hmm.c | 10 +- tools/testing/selftests/vm/hmm-tests.c | 76 +++++ 14 files changed, 311 insertions(+), 176 deletions(-) --=20 2.20.1