Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp270093imm; Tue, 21 Aug 2018 19:20:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYntzOek76YFieBAe4QjwCH7f6Awk/bswbnmJ07nEOrJ/tVoKilPbT9tzNLSPCE3H2JzbNa X-Received: by 2002:a63:8c5:: with SMTP id 188-v6mr2222316pgi.75.1534904458922; Tue, 21 Aug 2018 19:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534904458; cv=none; d=google.com; s=arc-20160816; b=D5BtKoFVzSv4S1pKJaw+IYXBtBK7HgLGByj/e4mnSpb5GHyKb3VcqwNSFIlnSCXmy9 CRWSufFFuu1jekxoXu6lgHpmmHmssRkcgBoRJ6pMTAXTABt10gGN0CS1TH9WZoos9c7Q 9P7jduREon9VBAuMVGXa+P0f9Dfe64GuuDawI8mM+Ak9J4zDM8BlQXDNCF0MnwNeuK3u ou3NQlCyr5qAZFgw4aJag9jOHoCTu7Sh0GzMolP6KaqFmZ2W3PpbF5Nx3NV+RCNYVpkg 9oz0Qdn1WADc/YSfCCJlTkP8Jy+V3L78X1TiVnETXSZy7EnLj5o3Z6W0Upn8XYMgCrMI VqOg== 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=JwWIqrnfqvRtRk9oqwaC6IStXdXj/6nsmHZH6RgulUQ=; b=yYzxLBViRmX3VWwkAW9WMvLOQ+a/usIn/HwxC6ZvJGBFUjDwMgRHtbNlU/jWhIcjm4 /TfOgkwUqHSRFXAWhLTKkATJmwAlyF2+LAIZkPHCVzYPNPQkTAX14oT/5JbKTvg2InIz /oAlcYXpJiVYxBB2LY6HZ9z7JxGw8v3rrxWvO3xrz1BeYjKBgeCsdSI6xxLosUVAtWZQ Dc3E9Vg/YKpYpIiS/YcN/0eNCN+MgIZ8gBhZPisADvw4ZLEz6BOlc2amhogzRav38rEL 9KE+cAkXaHuYucdOcJqr9ZZVayORKDsRmKVqJ6KHx6YU5FRCYP3lbZctJFZhbBxEj1Uo pgiw== 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 e14-v6si456565pgj.413.2018.08.21.19.20.44; Tue, 21 Aug 2018 19:20:58 -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 S1727777AbeHVFkj (ORCPT + 99 others); Wed, 22 Aug 2018 01:40:39 -0400 Received: from mga09.intel.com ([134.134.136.24]:42432 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbeHVFkj (ORCPT ); Wed, 22 Aug 2018 01:40:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2018 19:17:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,272,1531810800"; d="scan'208";a="256952715" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 21 Aug 2018 19:17:36 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.163]) by linux.intel.com (Postfix) with ESMTP id DCEA55802E1; Tue, 21 Aug 2018 19:17:34 -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 V4 2/4] mm: introduce memory type MEMORY_DEVICE_DEV_DAX Date: Wed, 22 Aug 2018 18:56:29 +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