Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1593041imm; Fri, 7 Sep 2018 03:00:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbUGS1bbXHhfgjjY2hnCHGhcwIkOXqw05ZsJNUGjSzmH7xuHWjFh7WTg3tdiUKmhdqQiWCs X-Received: by 2002:a62:959a:: with SMTP id c26-v6mr7666590pfk.234.1536314427283; Fri, 07 Sep 2018 03:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536314427; cv=none; d=google.com; s=arc-20160816; b=N6/gdGCP4Nfy3Y8zTavywKDnJJX8UOeYz6fPU6STXYJ0fCj2fnKaoX3MGfgXXpyE9a xN3WL7cLPsjC50wOOizUlQWe7xBv23bFkFi+uegQ0YlCDwFLxdGGLiEVa72jerkSCTS9 Z8JwcycCLHOVEOaJCxWX/u6lm2Lc2aKQ60ch854kTJzAsjD19Cam24ow+uOOlgsEVsU3 jTmu4IcycUNGe20B4+khkP4TFjCFNxndVjMSe5PW9EaCeDWoVcJULS1LIxjOq62RS/1O h4tjPU9i0I738YlnDl2hHFJ5chIqO51hMprSOHYaO7s5jFn1OZ2YpI9mPHtYV6xwACda Xj8g== 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; bh=JwWIqrnfqvRtRk9oqwaC6IStXdXj/6nsmHZH6RgulUQ=; b=XamO46CKmPKSR6zF0dx3tY62VE5aO+7AlBQjJYZjgOB6aCC5LMqV+4Egd6/v8ty6DY tE0Y+DA4KqgAQqUtHpGs2UiOOGyIXHfnbdcgxg4GqCs6RaSo/Svzxh4LcZZX8Rvfj5sE rGTgdLWHq/6xlxrUK75Bx4bwPnb4XyU6SbpM0+QGftj13KVsu82PdpusKUZg9Z8wUzAJ p394410KmqtDxjfQ7idK60nHBlJfyis8OIOVcwvEjDYvqs6OVS6rBhRZXnTfEae1ofk2 OqoNp8/u/iWtS8mAH4QGaaEQUnQg7gXCBAz3CvPKc752Uj+e6ffpfynLuL0WJTWW46t2 GM0Q== 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 a9-v6si8065193pgj.224.2018.09.07.03.00.11; Fri, 07 Sep 2018 03:00:27 -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 S1728353AbeIGOEj (ORCPT + 99 others); Fri, 7 Sep 2018 10:04:39 -0400 Received: from mga06.intel.com ([134.134.136.31]:23986 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728297AbeIGOEj (ORCPT ); Fri, 7 Sep 2018 10:04:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2018 02:24:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,341,1531810800"; d="scan'208";a="72355804" Received: from linux.intel.com ([10.54.29.200]) by orsmga006.jf.intel.com with ESMTP; 07 Sep 2018 02:24:35 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.163]) by linux.intel.com (Postfix) with ESMTP id 06B1D5803DA; Fri, 7 Sep 2018 02:24:32 -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, dave.jiang@intel.com, yu.c.zhang@intel.com, pagupta@redhat.com, david@redhat.com, jack@suse.cz, hch@lst.de Cc: linux-mm@kvack.org, rkrcmar@redhat.com, jglisse@redhat.com, yi.z.zhang@intel.com, Zhang Yi Subject: [PATCH V5 2/4] mm: introduce memory type MEMORY_DEVICE_DEV_DAX Date: Sat, 8 Sep 2018 02:03:39 +0800 Message-Id: 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 Reviewed-by: Jan Kara --- 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