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: 10652429 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 8233714BB for ; Mon, 22 Oct 2018 20:18:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD2928EC3 for ; Mon, 22 Oct 2018 20:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 612CC28EDD; Mon, 22 Oct 2018 20:18:49 +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=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E20F328EC3 for ; Mon, 22 Oct 2018 20:18:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE34D6B000A; Mon, 22 Oct 2018 16:18:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C9CAC6B000D; Mon, 22 Oct 2018 16:18:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE73B6B000E; Mon, 22 Oct 2018 16:18:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 69D746B000A for ; Mon, 22 Oct 2018 16:18:42 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id z10-v6so516384pfd.5 for ; Mon, 22 Oct 2018 13:18:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :from:date:references:in-reply-to:message-id; bh=uDFvyPwMa2M3G8GTkGgaZXlnqs96uduHzBsjUTjyVTU=; b=WnnjL+f1Ml6jiOn6X/9uUmvmEf0L96cd+dvtn3e3BFx28+IF70NXb5gTgqsD0KgoTW B0WE+YgT5Z6Sdj9zUQCsXFgfs3jn5G5TUMinYlfH0VpEuSM7Lhhue+IZuAsh/2vhGIY1 iMg35JGmCk/RRuXEIteXzKUDgsv4PYep7RGsypKuEP/1gm6GWXWFs5vW6k3PI3lXx86s G+qntItxTrqj750zXPjnOqyU0LalgLtGWIubDfCYLOmw10Rch0rMCzBmlX7BRjHx8UhG 6Mxqt8SS0ly9yrgKKAzjIIsj9IKphcJjZWemFLai7q2g2c0Wzzj3Hu6Q6qoOUwpOzthg cEtg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: ABuFfojfiVZ9mu0Xd6r+as1wgZmNXdoYXET4Qasi8Diw3nAuwAVfAiBM Qookt0S1Owp6NLNclZdAOsa9GTFVmJSWtmWgbsJdzsvF78W+aFOTnJHzribx0Z/DpfE/c929kVu D06Hmb801dlmO5gTOI0XOsnK/jWc/r6xdHt18r8fXaIhD5W/xP9Jesla+KuF1ZdOmiw== X-Received: by 2002:a62:1407:: with SMTP id 7-v6mr46035922pfu.28.1540239522075; Mon, 22 Oct 2018 13:18:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV62oHC5L+4Th0BJ59oYUzo6Ps3gpoFX9IQjLNYUzkIpYSnyVm45zbqnW/p+oVJ83yAW1bEUf X-Received: by 2002:a62:1407:: with SMTP id 7-v6mr46035887pfu.28.1540239521197; Mon, 22 Oct 2018 13:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540239521; cv=none; d=google.com; s=arc-20160816; b=ZVHJeemighTLCyYKV5jFjnNmlHWNet6aXilToMvR3qsTLNToAhfUohbkyJWQaUuIKm SkjLb6ewHYAAamXhMkKBGpA2kU6LoWqglr3nj98xpJyxNrVWd2Y8naTUUY/o3yitVsFW BWw7JO4U41ZBqeEY34dnLRk77hlBGFApWoTLKywWTvZMdQWdOyt6i9yw+cx5N0U8jDgC iArBuxWwoiVu+OeLs1b8PlOhqxgdF38u0pHqnhvXKpLGbyJP6RZlZEvMzdGw1YUIFBqi sEuwTkLUWRFpEHvJAFKWY7hQ+LgdpkqnbDcbvCTDiuHNdHGIWQbUQDlKGriBWpzsLmd9 MOTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:in-reply-to:references:date:from:cc:to:subject; bh=uDFvyPwMa2M3G8GTkGgaZXlnqs96uduHzBsjUTjyVTU=; b=l3dhcXMibyyvbqZFdpBODT6tcbz7NwbSy5G+z10aExRVKOJHFmxUQCLIY0EjkWY7gp FQNXj2Bf8V8Ty4Lic/Nyft0ZD5AcJoVht6be3CjgE1GtmPMGYuXyqQmbieVMc+BOq5ib yrpJV5+OoMV+Kd68Zye3u5nAEcRbnTGwUoQtM2ugLoFpIrW5xX8y8Ae1A6K1/UnqkbAr Hj3ZfDIyNOuKrjzjb+ph7D4002j0EuBuH2chXWdrDlP46Cpn4w4qyZHLiRBpE9ar46OE biDXpvHMilK+xrtiwDD9b27t4Om3Q5lmjjtPk9njwHP2qbdf2t/jno0tIhYYQTk2o7ua bHVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id m17-v6si35751470pgj.155.2018.10.22.13.18.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 13:18:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave.hansen@linux.intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dave.hansen@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2018 13:18:40 -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 Cc: Dave Hansen ,dan.j.williams@intel.com,dave.jiang@intel.com,zwisler@kernel.org,vishal.l.verma@intel.com,thomas.lendacky@amd.com,akpm@linux-foundation.org,mhocko@suse.com,linux-nvdimm@lists.01.org,linux-mm@kvack.org,ying.huang@intel.com,fengguang.wu@intel.com 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-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 {