lkml.org 
[lkml]   [2018]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 7/8] device-dax: Add support for a dax override driver
Date
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)
{

\
 
 \ /
  Last update: 2018-11-08 00:43    [W:0.086 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site