From patchwork Mon Oct 22 20:13:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 10652419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 488F813BF for ; Mon, 22 Oct 2018 20:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3213528EC3 for ; Mon, 22 Oct 2018 20:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2632F28ED4; Mon, 22 Oct 2018 20:18:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B551A28EC4 for ; Mon, 22 Oct 2018 20:18:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AB2EA2117CEB5; Mon, 22 Oct 2018 13:18:42 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=dave.hansen@linux.intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 600DD2117CEAF for ; Mon, 22 Oct 2018 13:18:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2018 13:18:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,413,1534834800"; d="scan'208";a="80062767" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by fmsmga007.fm.intel.com with ESMTP; 22 Oct 2018 13:18:40 -0700 Subject: [PATCH 3/9] dax: add more kmem device infrastructure To: linux-kernel@vger.kernel.org From: Dave Hansen Date: Mon, 22 Oct 2018 13:13:22 -0700 References: <20181022201317.8558C1D8@viggo.jf.intel.com> In-Reply-To: <20181022201317.8558C1D8@viggo.jf.intel.com> Message-Id: <20181022201322.6C8A7B2A@viggo.jf.intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.lendacky@amd.com, mhocko@suse.com, linux-nvdimm@lists.01.org, Dave Hansen , ying.huang@intel.com, linux-mm@kvack.org, zwisler@kernel.org, fengguang.wu@intel.com, akpm@linux-foundation.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The previous patch is a simple copy of the pmem driver. This makes it easy while this is in development to keep the pmem and kmem code in sync. This actually adds some necessary infrastructure for the new driver to compile. Cc: Dan Williams Cc: Dave Jiang Cc: Ross Zwisler Cc: Vishal Verma Cc: Tom Lendacky Cc: Andrew Morton Cc: Michal Hocko Cc: linux-nvdimm@lists.01.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Huang Ying Cc: Fengguang Wu --- b/drivers/dax/kmem.c | 10 +++++----- b/include/uapi/linux/ndctl.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff -puN drivers/dax/kmem.c~dax-kmem-try-again-2018-2-header drivers/dax/kmem.c --- a/drivers/dax/kmem.c~dax-kmem-try-again-2018-2-header 2018-10-22 13:12:22.000930392 -0700 +++ b/drivers/dax/kmem.c 2018-10-22 13:12:22.005930392 -0700 @@ -27,7 +27,7 @@ static struct dax_kmem *to_dax_kmem(stru static void dax_kmem_percpu_release(struct percpu_ref *ref) { - struct dax_kmem *dax_kmem = to_dax_pmem(ref); + struct dax_kmem *dax_kmem = to_dax_kmem(ref); dev_dbg(dax_kmem->dev, "trace\n"); complete(&dax_kmem->cmp); @@ -36,7 +36,7 @@ static void dax_kmem_percpu_release(stru static void dax_kmem_percpu_exit(void *data) { struct percpu_ref *ref = data; - struct dax_kmem *dax_kmem = to_dax_pmem(ref); + struct dax_kmem *dax_kmem = to_dax_kmem(ref); dev_dbg(dax_kmem->dev, "trace\n"); wait_for_completion(&dax_kmem->cmp); @@ -46,7 +46,7 @@ static void dax_kmem_percpu_exit(void *d static void dax_kmem_percpu_kill(void *data) { struct percpu_ref *ref = data; - struct dax_kmem *dax_kmem = to_dax_pmem(ref); + struct dax_kmem *dax_kmem = to_dax_kmem(ref); dev_dbg(dax_kmem->dev, "trace\n"); percpu_ref_kill(ref); @@ -142,11 +142,11 @@ static struct nd_device_driver dax_kmem_ .drv = { .name = "dax_kmem", }, - .type = ND_DRIVER_DAX_PMEM, + .type = ND_DRIVER_DAX_KMEM, }; module_nd_driver(dax_kmem_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Intel Corporation"); -MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM); +MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_KMEM); diff -puN include/uapi/linux/ndctl.h~dax-kmem-try-again-2018-2-header include/uapi/linux/ndctl.h --- a/include/uapi/linux/ndctl.h~dax-kmem-try-again-2018-2-header 2018-10-22 13:12:22.002930392 -0700 +++ b/include/uapi/linux/ndctl.h 2018-10-22 13:12:22.005930392 -0700 @@ -197,6 +197,7 @@ static inline const char *nvdimm_cmd_nam #define ND_DEVICE_NAMESPACE_PMEM 5 /* PMEM namespace (may alias with BLK) */ #define ND_DEVICE_NAMESPACE_BLK 6 /* BLK namespace (may alias with PMEM) */ #define ND_DEVICE_DAX_PMEM 7 /* Device DAX interface to pmem */ +#define ND_DEVICE_DAX_KMEM 8 /* Normal kernel-managed system memory */ enum nd_driver_flags { ND_DRIVER_DIMM = 1 << ND_DEVICE_DIMM, @@ -206,6 +207,7 @@ enum nd_driver_flags { ND_DRIVER_NAMESPACE_PMEM = 1 << ND_DEVICE_NAMESPACE_PMEM, ND_DRIVER_NAMESPACE_BLK = 1 << ND_DEVICE_NAMESPACE_BLK, ND_DRIVER_DAX_PMEM = 1 << ND_DEVICE_DAX_PMEM, + ND_DRIVER_DAX_KMEM = 1 << ND_DEVICE_DAX_KMEM, }; enum {