LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Williams, Dan J" <dan.j.williams@intel.com>
To: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [PATCH 7/8] device-dax: Add support for a dax override driver
Date: Wed, 7 Nov 2018 23:42:35 +0000	[thread overview]
Message-ID: <3501c074cf14f6a671632c6a6aaffe77cc5b9512.camel@intel.com> (raw)
In-Reply-To: <154095560594.3271337.11620109886861134971.stgit@dwillia2-desk3.amr.corp.intel.com>

On Tue, 2018-10-30 at 20:13 -0700, Dan Williams wrote:
> Introduce the 'new_id' concept for enabling a custom device-driver attach
> policy for dax-bus drivers. The intended use is to have a mechanism for
> hot-plugging device-dax ranges into the page allocator on-demand. With
> this in place the default policy of using device-dax for performance
> differentiated memory can be overridden by user-space policy that can
> arrange for the memory range to be managed as 'System RAM' with
> user-defined NUMA and other performance attributes.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/dax/bus.c    |  145 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  drivers/dax/bus.h    |   10 +++
>  drivers/dax/device.c |   11 ++--
>  3 files changed, 156 insertions(+), 10 deletions(-)
> 
> 

Here's an incremental fixup for the string matching in this patch, I'll
send a v2 if other review comments come in:

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 178d76504f79..17af6fbc3be5 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -39,7 +39,7 @@ static struct dax_id *__dax_match_id(struct dax_device_driver *dax_drv,
 	lockdep_assert_held(&dax_bus_lock);
 
 	list_for_each_entry(dax_id, &dax_drv->ids, list)
-		if (strcmp(dax_id->dev_name, dev_name) == 0)
+		if (sysfs_streq(dax_id->dev_name, dev_name))
 			return dax_id;
 	return NULL;
 }
@@ -60,6 +60,7 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
 {
 	struct dax_device_driver *dax_drv = to_dax_drv(drv);
 	unsigned int region_id, id;
+	char devname[DAX_NAME_LEN];
 	struct dax_id *dax_id;
 	ssize_t rc = count;
 	int fields;
@@ -67,8 +68,8 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
 	fields = sscanf(buf, "dax%d.%d", &region_id, &id);
 	if (fields != 2)
 		return -EINVAL;
-
-	if (strlen(buf) + 1 > DAX_NAME_LEN)
+	sprintf(devname, "dax%d.%d", region_id, id);
+	if (!sysfs_streq(buf, devname))
 		return -EINVAL;
 
 	mutex_lock(&dax_bus_lock);
@@ -99,7 +100,6 @@ static ssize_t new_id_store(struct device_driver *drv, const char *buf,
 }
 static DRIVER_ATTR_WO(new_id);
 
-
 static ssize_t remove_id_store(struct device_driver *drv, const char *buf,
 		size_t count)
 {



  reply	other threads:[~2018-11-07 23:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  3:12 [PATCH 0/8] Introduce a device-dax bus-based device-model Dan Williams
2018-10-31  3:12 ` [PATCH 1/8] device-dax: Kill dax_region ida Dan Williams
2018-10-31  3:13 ` [PATCH 2/8] device-dax: Kill dax_region base Dan Williams
2018-10-31  3:13 ` [PATCH 3/8] device-dax: Remove multi-resource infrastructure Dan Williams
2018-10-31  3:13 ` [PATCH 4/8] device-dax: Start defining a dax bus model Dan Williams
2018-10-31  3:13 ` [PATCH 5/8] device-dax: Introduce bus + driver model Dan Williams
2018-10-31  3:13 ` [PATCH 6/8] device-dax: Move resource pinning+mapping into the common driver Dan Williams
2018-10-31  3:13 ` [PATCH 7/8] device-dax: Add support for a dax override driver Dan Williams
2018-11-07 23:42   ` Williams, Dan J [this message]
2018-10-31  3:13 ` [PATCH 8/8] device-dax: Add /sys/class/dax backwards compatibility Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3501c074cf14f6a671632c6a6aaffe77cc5b9512.camel@intel.com \
    --to=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --subject='Re: [PATCH 7/8] device-dax: Add support for a dax override driver' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).