Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4260829ybb; Mon, 23 Mar 2020 17:11:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvP9vHq3IfQ2SBF7/TWwwJIX/FbbytOgeD/Wdo3JAzVKRp6hNTx7Ifbouk+04+0yqjX08k6 X-Received: by 2002:a9d:171a:: with SMTP id i26mr2211021ota.170.1585008673100; Mon, 23 Mar 2020 17:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585008673; cv=none; d=google.com; s=arc-20160816; b=HFH6TroHj+gPnBFjP+++WEdhd+aSjrkJVKw7DpbifpdzXm/8h/SP4Z5CnVl/JjVL4p zySs7Ai594N6tluFDmqpX2QL+KL6Gu/V6azuerb3NGKfkjr74SUPiWMtXp2pn3i9FGTr xnvYRmnOvjcqJ2P7dX8vuZxC64rUgLzfxdEC7U5PIDDRAdlR8zc2KRbVbnRYKf0oVhfC 9SK34gaW2ze9sdjLd+Gx9ozuvuRcXht4D78YOf173QRDKyEDoqXfT7jZZU59I494pUE9 +P0W+9adAcoXoXxmfmGjVb0hX0YMWIqq/Lal8Av8sx6diT29iVtO0m/GrevPPHTMLlex 9W1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=/JOFOQ7RSmS5Mw7k9tL/F1dfVkycjMgk6Qz5dof1dzM=; b=Xm9QUbaEuseLrMqabm0YacwCy6py/6GSebBaPhl25yqBiO0PVDkPYiRpgFm/Oy7Iti uDcFKqXzbhTdPb0P7VBFwZBPCriLhRkoKZLTry3Y1foYVRUArt0a/eM3jUaaes7L032v iubk/aGErsjkk9mjpp/MC5urtL4HbzlNo+D+7MGhO/2054YvsH1vSDr/mA31yDmxMSlG /R2CyQVGUsg8SSDpxpaDyn0b/2xqRfLLapgPUOPrSDOg2IE+t8SAu1P8RQ4e4iPCI+lN Nk+TsuXjVfTMrC7SBpnTN3EwUWhO+2SJhZOY6FiE2SWcc9TGRDnCqX3fdZSwpPxnLDzg ENDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si5833768otk.276.2020.03.23.17.10.59; Mon, 23 Mar 2020 17:11:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727398AbgCXAKj (ORCPT + 99 others); Mon, 23 Mar 2020 20:10:39 -0400 Received: from mga06.intel.com ([134.134.136.31]:27945 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbgCXAKi (ORCPT ); Mon, 23 Mar 2020 20:10:38 -0400 IronPort-SDR: 4+csJKFgyxk/L73xPjEN+LMqjU/3yH+3AMRD0A8zBMMB6X6qZo8TIrzwNy15eAK+7+amIPKy0G iuofBx593wMA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 17:10:38 -0700 IronPort-SDR: B+kpyitPx/n7Zb9g0kUHAXGHfUrwQuJx+43OeoEyejezJiIvvlLYEtlqTgyG1WGtb1wmPZulSO Ij1jHCK6WKfQ== X-IronPort-AV: E=Sophos;i="5.72,298,1580803200"; d="scan'208";a="246362736" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 17:10:38 -0700 Subject: [PATCH 00/12] device-dax: Support sub-dividing soft-reserved ranges From: Dan Williams To: linux-mm@kvack.org Cc: David Hildenbrand , Jason Gunthorpe , Ira Weiny , Bjorn Helgaas , Michael Ellerman , Vishal Verma , Ben Skeggs , Paul Mackerras , Logan Gunthorpe , Christoph Hellwig , Dave Hansen , Pavel Tatashin , Joao Martins , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, jmoyer@redhat.com Date: Mon, 23 Mar 2020 16:54:31 -0700 Message-ID: <158500767138.2088294.17131646259803932461.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The device-dax facility allows an address range to be directly mapped through a chardev, or turned around and hotplugged to the core kernel page allocator as System-RAM. It is the baseline mechanism for converting persistent memory (pmem) to be used as another volatile memory pool i.e. the current Memory Tiering hot topic on linux-mm. In the case of pmem the nvdimm-namespace-label mechanism can sub-divide it, but that labeling mechanism is not available / applicable to soft-reserved ("EFI specific purpose") memory [1]. This series provides a sysfs-mechanism for the daxctl utility to enable provisioning of volatile-soft-reserved memory ranges. The motivations for this facility are: 1/ Allow performance differentiated memory ranges to be split between kernel-managed and directly-accessed use cases. 2/ Allow physical memory to be provisioned along performance relevant address boundaries. For example, divide a memory-side cache [2] along cache-color boundaries. 3/ Parcel out soft-reserved memory to VMs using device-dax as a security / permissions boundary [3]. Specifically I have seen people (ab)using memmap=nn!ss (mark System-RAM as Peristent Memory) just to get the device-dax interface on custom address ranges. The baseline for this series is today's next/master + "[PATCH v2 0/6] Manual definition of Soft Reserved memory devices" [4]. Big thanks to Joao for the early testing and feedback on this series! Given the dependencies on the memremap_pages() reworks in Andrew's tree and the proximity to v5.7 this is clearly v5.8 material. The patches in most need of a second opinion are the memremap_pages() reworks to switch from 'struct resource' to 'struct range' and allow for an array of ranges to be mapped at once. [1]: https://lore.kernel.org/r/157309097008.1579826.12818463304589384434.stgit@dwillia2-desk3.amr.corp.intel.com/ [2]: https://lore.kernel.org/r/154899811738.3165233.12325692939590944259.stgit@dwillia2-desk3.amr.corp.intel.com/ [3]: https://lore.kernel.org/r/20200110190313.17144-1-joao.m.martins@oracle.com/ [4]: http://lore.kernel.org/r/158489354353.1457606.8327903161927980740.stgit@dwillia2-desk3.amr.corp.intel.com/ --- Dan Williams (12): device-dax: Drop the dax_region.pfn_flags attribute device-dax: Move instance creation parameters to 'struct dev_dax_data' device-dax: Make pgmap optional for instance creation device-dax: Kill dax_kmem_res device-dax: Add an allocation interface for device-dax instances device-dax: Introduce seed devices drivers/base: Make device_find_child_by_name() compatible with sysfs inputs device-dax: Add resize support mm/memremap_pages: Convert to 'struct range' mm/memremap_pages: Support multiple ranges per invocation device-dax: Add dis-contiguous resource support device-dax: Introduce 'mapping' devices arch/powerpc/kvm/book3s_hv_uvmem.c | 14 - drivers/base/core.c | 2 drivers/dax/bus.c | 877 ++++++++++++++++++++++++++++++-- drivers/dax/bus.h | 28 + drivers/dax/dax-private.h | 36 + drivers/dax/device.c | 97 ++-- drivers/dax/hmem/hmem.c | 18 - drivers/dax/kmem.c | 170 +++--- drivers/dax/pmem/compat.c | 2 drivers/dax/pmem/core.c | 22 + drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 drivers/nvdimm/badrange.c | 26 - drivers/nvdimm/claim.c | 13 drivers/nvdimm/nd.h | 3 drivers/nvdimm/pfn_devs.c | 13 drivers/nvdimm/pmem.c | 27 + drivers/nvdimm/region.c | 21 - drivers/pci/p2pdma.c | 12 include/linux/memremap.h | 9 include/linux/range.h | 6 mm/memremap.c | 297 ++++++----- tools/testing/nvdimm/dax-dev.c | 22 + tools/testing/nvdimm/test/iomap.c | 2 23 files changed, 1318 insertions(+), 403 deletions(-)