Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1504475imm; Wed, 8 Aug 2018 19:15:52 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwiTE3ALIHOA/fY/+TxiKnOGdf85gs5b3YGYRvDhw9xuV5QBzrD29nURxegHS7pmCDJvDKE X-Received: by 2002:a62:c0a:: with SMTP id u10-v6mr230380pfi.43.1533780952697; Wed, 08 Aug 2018 19:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533780952; cv=none; d=google.com; s=arc-20160816; b=x75uAH5P8gBvYH2gBoHXEk/kJkfcsIziO3XPwxElBM07bNstEDT9XEo9x0Ugvi56Jh 0qIoW/xcZO5mYdKVi2HtecdKClRfJNSpOnN7r3DwIyu0XaTYAOeHLtCMLZEYeYjG95W7 8OBCKQ2Ohpgkvopu4DYFwNI2I87iGGqjT1O3ouvoXYQP1t4zcsOhtT2UnJRyXik3YYD1 atVrZBXfOfhVfaI4EBThI1V8ayvjCif6OxsPAfFqIZrXYBZS2/FPAgbKBK3DcWZgLLVj KVmarbOoMYCLlgz8LQ1BF7MSFztKrg2VYl8nwc2DrJlAzMl2GNpUh0gpSVFd31lpMOnK /ZCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=xnc7hcf0HxkdZmO+HpfsgY0hVTpTWdSn+HqbGOKucj8=; b=njUU0LhqGl2f33joVh6xJuhMKi1MK/4X+qKRgNG0Oe86g6+PnoWpIOuO6jWqw24cgV HG5CLYpk4Wyb8LWmRao+qUjln2AwLy3qmkIzmT3vS9XDDtYr6QDKTVNo4T4m9ONExmJy 88acp9djW3kxNq3QNPWsICCVulmMg227G1c+AYr1c6KrJ7rFXoWjuJU4JsFxHXHLL+ef u9DUWEy36nuEfEd4vv9HpNhknlYpK57UYDNrPhJ5rE8q99uPgDY/sjFIDCUsVajIUOpN 5raYQWecJZW1j7tIIsXjzkfspiUVROSyMhKNfKTLYW6mUXHW9KGVuMqyrS3yuzegyYbt dK3Q== 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 h2-v6si5953919pgj.550.2018.08.08.19.15.38; Wed, 08 Aug 2018 19:15:52 -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 S1727623AbeHIEg5 (ORCPT + 99 others); Thu, 9 Aug 2018 00:36:57 -0400 Received: from mga07.intel.com ([134.134.136.100]:12721 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725757AbeHIEg5 (ORCPT ); Thu, 9 Aug 2018 00:36:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2018 19:14:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,213,1531810800"; d="scan'208";a="71346413" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP; 08 Aug 2018 19:14:30 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.78]) by linux.intel.com (Postfix) with ESMTP id 5A5425801BD; Wed, 8 Aug 2018 19:14:28 -0700 (PDT) From: Zhang Yi To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, pbonzini@redhat.com, dan.j.williams@intel.com, jack@suse.cz, hch@lst.de, yu.c.zhang@intel.com Cc: linux-mm@kvack.org, rkrcmar@redhat.com, yi.z.zhang@intel.com, Zhang Yi Subject: [PATCH V3 2/4] mm: introduce memory type MEMORY_DEVICE_DEV_DAX Date: Thu, 9 Aug 2018 18:53:08 +0800 Message-Id: <01aaca83694c3b0093fcb2f48af1dff0b147a4b2.1533811181.git.yi.z.zhang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, NVDIMM pages will be marked 'PageReserved'. However, unlike other reserved PFNs, pages on NVDIMM shall still behave like normal ones in many cases, i.e. when used as backend memory of KVM guest. This patch introduces a new memory type, MEMORY_DEVICE_DEV_DAX. And set this flag while dax driver hotplug the device memory. Signed-off-by: Zhang Yi Signed-off-by: Zhang Yu --- drivers/dax/pmem.c | 1 + include/linux/memremap.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c index fd49b24..fb3f363 100644 --- a/drivers/dax/pmem.c +++ b/drivers/dax/pmem.c @@ -111,6 +111,7 @@ static int dax_pmem_probe(struct device *dev) return rc; dax_pmem->pgmap.ref = &dax_pmem->ref; + dax_pmem->pgmap.type = MEMORY_DEVICE_DEV_DAX; addr = devm_memremap_pages(dev, &dax_pmem->pgmap); if (IS_ERR(addr)) return PTR_ERR(addr); diff --git a/include/linux/memremap.h b/include/linux/memremap.h index f91f9e7..cd07ca8 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -53,11 +53,19 @@ struct vmem_altmap { * wakeup event whenever a page is unpinned and becomes idle. This * wakeup is used to coordinate physical address space management (ex: * fs truncate/hole punch) vs pinned pages (ex: device dma). + * + * MEMORY_DEVICE_DEV_DAX: + * Device memory that support raw access to persistent memory. Without need + * of an intervening filesystem, it could be directed mapped via an mmap + * capable character device. Together with the type MEMORY_DEVICE_FS_DAX, + * we could distinguish the persistent memory pages from normal ZONE_DEVICE + * pages. */ enum memory_type { MEMORY_DEVICE_PRIVATE = 1, MEMORY_DEVICE_PUBLIC, MEMORY_DEVICE_FS_DAX, + MEMORY_DEVICE_DEV_DAX, }; /* -- 2.7.4