[PATCH] device-dax: Add a 'resource' attribute
by Vishal Verma
device-dax based devices were missing a 'resource' attribute to indicate
the physical address range contributed by the device in question. This
information is desirable to userspace tooling that may want to use the
dax device as system-ram, and wants to selectively hotplug and online
the memory blocks associated with a given device.
Without this, the tooling would have to parse /proc/iomem for the memory
ranges contributed by dax devices, which can be a workaround, but it is
far easier to provide this information in the sysfs hierarchy.
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
drivers/dax/bus.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 2109cfe80219..2f3c42ca416a 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -295,6 +295,22 @@ static ssize_t target_node_show(struct device *dev,
}
static DEVICE_ATTR_RO(target_node);
+static unsigned long long dev_dax_resource(struct dev_dax *dev_dax)
+{
+ struct dax_region *dax_region = dev_dax->region;
+
+ return dax_region->res.start;
+}
+
+static ssize_t resource_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct dev_dax *dev_dax = to_dev_dax(dev);
+
+ return sprintf(buf, "%#llx\n", dev_dax_resource(dev_dax));
+}
+static DEVICE_ATTR_RO(resource);
+
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -313,6 +329,8 @@ static umode_t dev_dax_visible(struct kobject *kobj, struct attribute *a, int n)
if (a == &dev_attr_target_node.attr && dev_dax_target_node(dev_dax) < 0)
return 0;
+ if (a == &dev_attr_resource.attr)
+ return 0400;
return a->mode;
}
@@ -320,6 +338,7 @@ static struct attribute *dev_dax_attributes[] = {
&dev_attr_modalias.attr,
&dev_attr_size.attr,
&dev_attr_target_node.attr,
+ &dev_attr_resource.attr,
NULL,
};
--
2.20.1
1 year, 7 months
[PATCH RFC 00/10] RDMA/FS DAX truncate proposal
by ira.weiny@intel.com
From: Ira Weiny <ira.weiny(a)intel.com>
... V1,000,000 ;-)
Pre-requisites:
John Hubbard's put_user_pages() patch series.[1]
Jan Kara's ext4_break_layouts() fixes[2]
Based on the feedback from LSFmm and the LWN article which resulted. I've
decided to take a slightly different tack on this problem.
The real issue is that there is no use case for a user to have RDMA pinn'ed
memory which is then truncated. So really any solution we present which:
A) Prevents file system corruption or data leaks
...and...
B) Informs the user that they did something wrong
Should be an acceptable solution.
Because this is slightly new behavior. And because this is gonig to be
specific to DAX (because of the lack of a page cache) we have made the user
"opt in" to this behavior.
The following patches implement the following solution.
1) The user has to opt in to allowing GUP pins on a file with a layout lease
(now made visible).
2) GUP will fail (EPERM) if a layout lease is not taken
3) Any truncate or hole punch operation on a GUP'ed DAX page will fail.
4) The user has the option of holding the layout lease to receive a SIGIO for
notification to the original thread that another thread has tried to delete
their data. Furthermore this indicates that if the user needs to GUP the
file again they will need to retake the Layout lease before doing so.
NOTE: If the user releases the layout lease or if it has been broken by another
operation further GUP operations on the file will fail without re-taking the
lease. This means that if a user would like to register pieces of a file and
continue to register other pieces later they would be advised to keep the
layout lease, get a SIGIO notification, and retake the lease.
NOTE2: Truncation of pages which are not actively pinned will succeed. Similar
to accessing an mmap to this area GUP pins of that memory may fail.
A general overview follows for background.
It should be noted that one solution for this problem is to use RDMA's On
Demand Paging (ODP). There are 2 big reasons this may not work.
1) The hardware being used for RDMA may not support ODP
2) ODP may be detrimental to the over all network (cluster or cloud)
performance
Therefore, in order to support RDMA to File system pages without On Demand
Paging (ODP) a number of things need to be done.
1) GUP "longterm" users need to inform the other subsystems that they have
taken a pin on a page which may remain pinned for a very "long time".[3]
2) Any page which is "controlled" by a file system needs to have special
handling. The details of the handling depends on if the page is page cache
fronted or not.
2a) A page cache fronted page which has been pinned by GUP long term can use a
bounce buffer to allow the file system to write back snap shots of the page.
This is handled by the FS recognizing the GUP long term pin and making a copy
of the page to be written back.
NOTE: this patch set does not address this path.
2b) A FS "controlled" page which is not page cache fronted is either easier
to deal with or harder depending on the operation the filesystem is trying
to do.
2ba) [Hard case] If the FS operation _is_ a truncate or hole punch the
FS can no longer use the pages in question until the pin has been
removed. This patch set presents a solution to this by introducing
some reasonable restrictions on user space applications.
2bb) [Easy case] If the FS operation is _not_ a truncate or hole punch
then there is nothing which need be done. Data is Read or Written
directly to the page. This is an easy case which would currently work
if not for GUP long term pins being disabled. Therefore this patch set
need not change access to the file data but does allow for GUP pins
after 2ba above is dealt with.
This patch series and presents a solution for problem 2ba)
[1] https://github.com/johnhubbard/linux/tree/gup_dma_core
[2] ext4/dev branch:
- https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/log/?h=dev
Specific patches:
[2a] ext4: wait for outstanding dio during truncate in nojournal mode
- https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=...
[2b] ext4: do not delete unlinked inode from orphan list on failed truncate
- https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=...
[2c] ext4: gracefully handle ext4_break_layouts() failure during truncate
- https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?h=...
[3] The definition of long time is debatable but it has been established
that RDMAs use of pages, minutes or hours after the pin is the extreme case
which makes this problem most severe.
Ira Weiny (10):
fs/locks: Add trace_leases_conflict
fs/locks: Export F_LAYOUT lease to user space
mm/gup: Pass flags down to __gup_device_huge* calls
mm/gup: Ensure F_LAYOUT lease is held prior to GUP'ing pages
fs/ext4: Teach ext4 to break layout leases
fs/ext4: Teach dax_layout_busy_page() to operate on a sub-range
fs/ext4: Fail truncate if pages are GUP pinned
fs/xfs: Teach xfs to use new dax_layout_busy_page()
fs/xfs: Fail truncate if pages are GUP pinned
mm/gup: Remove FOLL_LONGTERM DAX exclusion
fs/Kconfig | 1 +
fs/dax.c | 38 ++++++---
fs/ext4/ext4.h | 2 +-
fs/ext4/extents.c | 6 +-
fs/ext4/inode.c | 26 +++++--
fs/locks.c | 97 ++++++++++++++++++++---
fs/xfs/xfs_file.c | 24 ++++--
fs/xfs/xfs_inode.h | 5 +-
fs/xfs/xfs_ioctl.c | 15 +++-
fs/xfs/xfs_iops.c | 14 +++-
fs/xfs/xfs_pnfs.c | 14 ++--
include/linux/dax.h | 9 ++-
include/linux/fs.h | 2 +-
include/linux/mm.h | 2 +
include/trace/events/filelock.h | 35 +++++++++
include/uapi/asm-generic/fcntl.h | 3 +
mm/gup.c | 129 ++++++++++++-------------------
mm/huge_memory.c | 12 +++
18 files changed, 299 insertions(+), 135 deletions(-)
--
2.20.1
1 year, 7 months
[linux-nvdimm:libnvdimm-for-next 4/15] drivers/nvdimm/virtio_pmem.c:61:9: sparse: sparse: incompatible types in comparison expression (different base types):
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
head: 3b6047778c09037615e7b919c922081ef1a37a7f
commit: 5990fce9c50eae1261a52df1488d04a47f4cfca7 [4/15] virtio-pmem: Add virtio pmem driver
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
git checkout 5990fce9c50eae1261a52df1488d04a47f4cfca7
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/nvdimm/virtio_pmem.c:61:9: sparse: sparse: incompatible types in comparison expression (different base types):
>> drivers/nvdimm/virtio_pmem.c:61:9: sparse: restricted __le64 *
>> drivers/nvdimm/virtio_pmem.c:61:9: sparse: unsigned long long *
drivers/nvdimm/virtio_pmem.c:63:9: sparse: sparse: incompatible types in comparison expression (different base types):
drivers/nvdimm/virtio_pmem.c:63:9: sparse: restricted __le64 *
drivers/nvdimm/virtio_pmem.c:63:9: sparse: unsigned long long *
vim +61 drivers/nvdimm/virtio_pmem.c
31
32 static int virtio_pmem_probe(struct virtio_device *vdev)
33 {
34 struct nd_region_desc ndr_desc = {};
35 int nid = dev_to_node(&vdev->dev);
36 struct nd_region *nd_region;
37 struct virtio_pmem *vpmem;
38 struct resource res;
39 int err = 0;
40
41 if (!vdev->config->get) {
42 dev_err(&vdev->dev, "%s failure: config access disabled\n",
43 __func__);
44 return -EINVAL;
45 }
46
47 vpmem = devm_kzalloc(&vdev->dev, sizeof(*vpmem), GFP_KERNEL);
48 if (!vpmem) {
49 err = -ENOMEM;
50 goto out_err;
51 }
52
53 vpmem->vdev = vdev;
54 vdev->priv = vpmem;
55 err = init_vq(vpmem);
56 if (err) {
57 dev_err(&vdev->dev, "failed to initialize virtio pmem vq's\n");
58 goto out_err;
59 }
60
> 61 virtio_cread(vpmem->vdev, struct virtio_pmem_config,
62 start, &vpmem->start);
63 virtio_cread(vpmem->vdev, struct virtio_pmem_config,
64 size, &vpmem->size);
65
66 res.start = vpmem->start;
67 res.end = vpmem->start + vpmem->size - 1;
68 vpmem->nd_desc.provider_name = "virtio-pmem";
69 vpmem->nd_desc.module = THIS_MODULE;
70
71 vpmem->nvdimm_bus = nvdimm_bus_register(&vdev->dev,
72 &vpmem->nd_desc);
73 if (!vpmem->nvdimm_bus) {
74 dev_err(&vdev->dev, "failed to register device with nvdimm_bus\n");
75 err = -ENXIO;
76 goto out_vq;
77 }
78
79 dev_set_drvdata(&vdev->dev, vpmem->nvdimm_bus);
80
81 ndr_desc.res = &res;
82 ndr_desc.numa_node = nid;
83 ndr_desc.flush = async_pmem_flush;
84 set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
85 set_bit(ND_REGION_ASYNC, &ndr_desc.flags);
86 nd_region = nvdimm_pmem_region_create(vpmem->nvdimm_bus, &ndr_desc);
87 if (!nd_region) {
88 dev_err(&vdev->dev, "failed to create nvdimm region\n");
89 err = -ENXIO;
90 goto out_nd;
91 }
92 nd_region->provider_data = dev_to_virtio(nd_region->dev.parent->parent);
93 return 0;
94 out_nd:
95 nvdimm_bus_unregister(vpmem->nvdimm_bus);
96 out_vq:
97 vdev->config->del_vqs(vdev);
98 out_err:
99 return err;
100 }
101
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
1 year, 7 months
[linux-nvdimm:libnvdimm-for-next 5/15] drivers/s390//block/dcssblk.c:681:22: error: too few arguments to function 'alloc_dax'
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
head: 3b6047778c09037615e7b919c922081ef1a37a7f
commit: fee8be32c5bab110c34884dfc4a68dd0105d2607 [5/15] libnvdimm: add dax_dev sync flag
config: s390-debug_defconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout fee8be32c5bab110c34884dfc4a68dd0105d2607
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/s390//block/dcssblk.c: In function 'dcssblk_add_store':
>> drivers/s390//block/dcssblk.c:681:22: error: too few arguments to function 'alloc_dax'
dev_info->dax_dev = alloc_dax(dev_info, dev_info->gd->disk_name,
^~~~~~~~~
In file included from drivers/s390//block/dcssblk.c:23:0:
include/linux/dax.h:43:20: note: declared here
struct dax_device *alloc_dax(void *private, const char *host,
^~~~~~~~~
vim +/alloc_dax +681 drivers/s390//block/dcssblk.c
b2300b9efe Hongjie Yang 2008-10-10 542
b2300b9efe Hongjie Yang 2008-10-10 543 /*
^1da177e4c Linus Torvalds 2005-04-16 544 * device attribute for adding devices
^1da177e4c Linus Torvalds 2005-04-16 545 */
^1da177e4c Linus Torvalds 2005-04-16 546 static ssize_t
e404e274f6 Yani Ioannou 2005-05-17 547 dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
^1da177e4c Linus Torvalds 2005-04-16 548 {
b2300b9efe Hongjie Yang 2008-10-10 549 int rc, i, j, num_of_segments;
^1da177e4c Linus Torvalds 2005-04-16 550 struct dcssblk_dev_info *dev_info;
b2300b9efe Hongjie Yang 2008-10-10 551 struct segment_info *seg_info, *temp;
^1da177e4c Linus Torvalds 2005-04-16 552 char *local_buf;
^1da177e4c Linus Torvalds 2005-04-16 553 unsigned long seg_byte_size;
^1da177e4c Linus Torvalds 2005-04-16 554
^1da177e4c Linus Torvalds 2005-04-16 555 dev_info = NULL;
b2300b9efe Hongjie Yang 2008-10-10 556 seg_info = NULL;
^1da177e4c Linus Torvalds 2005-04-16 557 if (dev != dcssblk_root_dev) {
^1da177e4c Linus Torvalds 2005-04-16 558 rc = -EINVAL;
^1da177e4c Linus Torvalds 2005-04-16 559 goto out_nobuf;
^1da177e4c Linus Torvalds 2005-04-16 560 }
b2300b9efe Hongjie Yang 2008-10-10 561 if ((count < 1) || (buf[0] == '\0') || (buf[0] == '\n')) {
b2300b9efe Hongjie Yang 2008-10-10 562 rc = -ENAMETOOLONG;
b2300b9efe Hongjie Yang 2008-10-10 563 goto out_nobuf;
b2300b9efe Hongjie Yang 2008-10-10 564 }
b2300b9efe Hongjie Yang 2008-10-10 565
^1da177e4c Linus Torvalds 2005-04-16 566 local_buf = kmalloc(count + 1, GFP_KERNEL);
^1da177e4c Linus Torvalds 2005-04-16 567 if (local_buf == NULL) {
^1da177e4c Linus Torvalds 2005-04-16 568 rc = -ENOMEM;
^1da177e4c Linus Torvalds 2005-04-16 569 goto out_nobuf;
^1da177e4c Linus Torvalds 2005-04-16 570 }
b2300b9efe Hongjie Yang 2008-10-10 571
^1da177e4c Linus Torvalds 2005-04-16 572 /*
^1da177e4c Linus Torvalds 2005-04-16 573 * parse input
^1da177e4c Linus Torvalds 2005-04-16 574 */
b2300b9efe Hongjie Yang 2008-10-10 575 num_of_segments = 0;
3a9f9183bd Ameen Ali 2015-02-24 576 for (i = 0; (i < count && (buf[i] != '\0') && (buf[i] != '\n')); i++) {
42cfc6b590 Martin Schwidefsky 2015-08-19 577 for (j = i; j < count &&
42cfc6b590 Martin Schwidefsky 2015-08-19 578 (buf[j] != ':') &&
b2300b9efe Hongjie Yang 2008-10-10 579 (buf[j] != '\0') &&
42cfc6b590 Martin Schwidefsky 2015-08-19 580 (buf[j] != '\n'); j++) {
b2300b9efe Hongjie Yang 2008-10-10 581 local_buf[j-i] = toupper(buf[j]);
b2300b9efe Hongjie Yang 2008-10-10 582 }
b2300b9efe Hongjie Yang 2008-10-10 583 local_buf[j-i] = '\0';
b2300b9efe Hongjie Yang 2008-10-10 584 if (((j - i) == 0) || ((j - i) > 8)) {
^1da177e4c Linus Torvalds 2005-04-16 585 rc = -ENAMETOOLONG;
b2300b9efe Hongjie Yang 2008-10-10 586 goto seg_list_del;
^1da177e4c Linus Torvalds 2005-04-16 587 }
b2300b9efe Hongjie Yang 2008-10-10 588
b2300b9efe Hongjie Yang 2008-10-10 589 rc = dcssblk_load_segment(local_buf, &seg_info);
b2300b9efe Hongjie Yang 2008-10-10 590 if (rc < 0)
b2300b9efe Hongjie Yang 2008-10-10 591 goto seg_list_del;
^1da177e4c Linus Torvalds 2005-04-16 592 /*
^1da177e4c Linus Torvalds 2005-04-16 593 * get a struct dcssblk_dev_info
^1da177e4c Linus Torvalds 2005-04-16 594 */
b2300b9efe Hongjie Yang 2008-10-10 595 if (num_of_segments == 0) {
b2300b9efe Hongjie Yang 2008-10-10 596 dev_info = kzalloc(sizeof(struct dcssblk_dev_info),
b2300b9efe Hongjie Yang 2008-10-10 597 GFP_KERNEL);
^1da177e4c Linus Torvalds 2005-04-16 598 if (dev_info == NULL) {
^1da177e4c Linus Torvalds 2005-04-16 599 rc = -ENOMEM;
^1da177e4c Linus Torvalds 2005-04-16 600 goto out;
^1da177e4c Linus Torvalds 2005-04-16 601 }
^1da177e4c Linus Torvalds 2005-04-16 602 strcpy(dev_info->segment_name, local_buf);
b2300b9efe Hongjie Yang 2008-10-10 603 dev_info->segment_type = seg_info->segment_type;
b2300b9efe Hongjie Yang 2008-10-10 604 INIT_LIST_HEAD(&dev_info->seg_list);
b2300b9efe Hongjie Yang 2008-10-10 605 }
b2300b9efe Hongjie Yang 2008-10-10 606 list_add_tail(&seg_info->lh, &dev_info->seg_list);
b2300b9efe Hongjie Yang 2008-10-10 607 num_of_segments++;
b2300b9efe Hongjie Yang 2008-10-10 608 i = j;
b2300b9efe Hongjie Yang 2008-10-10 609
b2300b9efe Hongjie Yang 2008-10-10 610 if ((buf[j] == '\0') || (buf[j] == '\n'))
b2300b9efe Hongjie Yang 2008-10-10 611 break;
b2300b9efe Hongjie Yang 2008-10-10 612 }
b2300b9efe Hongjie Yang 2008-10-10 613
b2300b9efe Hongjie Yang 2008-10-10 614 /* no trailing colon at the end of the input */
b2300b9efe Hongjie Yang 2008-10-10 615 if ((i > 0) && (buf[i-1] == ':')) {
b2300b9efe Hongjie Yang 2008-10-10 616 rc = -ENAMETOOLONG;
b2300b9efe Hongjie Yang 2008-10-10 617 goto seg_list_del;
b2300b9efe Hongjie Yang 2008-10-10 618 }
b2300b9efe Hongjie Yang 2008-10-10 619 strlcpy(local_buf, buf, i + 1);
b2300b9efe Hongjie Yang 2008-10-10 620 dev_info->num_of_segments = num_of_segments;
b2300b9efe Hongjie Yang 2008-10-10 621 rc = dcssblk_is_continuous(dev_info);
b2300b9efe Hongjie Yang 2008-10-10 622 if (rc < 0)
b2300b9efe Hongjie Yang 2008-10-10 623 goto seg_list_del;
b2300b9efe Hongjie Yang 2008-10-10 624
b2300b9efe Hongjie Yang 2008-10-10 625 dev_info->start = dcssblk_find_lowest_addr(dev_info);
b2300b9efe Hongjie Yang 2008-10-10 626 dev_info->end = dcssblk_find_highest_addr(dev_info);
b2300b9efe Hongjie Yang 2008-10-10 627
ef283688f5 Kees Cook 2014-06-10 628 dev_set_name(&dev_info->dev, "%s", dev_info->segment_name);
^1da177e4c Linus Torvalds 2005-04-16 629 dev_info->dev.release = dcssblk_release_segment;
521b3d790c Sebastian Ott 2012-10-01 630 dev_info->dev.groups = dcssblk_dev_attr_groups;
^1da177e4c Linus Torvalds 2005-04-16 631 INIT_LIST_HEAD(&dev_info->lh);
^1da177e4c Linus Torvalds 2005-04-16 632 dev_info->gd = alloc_disk(DCSSBLK_MINORS_PER_DISK);
^1da177e4c Linus Torvalds 2005-04-16 633 if (dev_info->gd == NULL) {
^1da177e4c Linus Torvalds 2005-04-16 634 rc = -ENOMEM;
b2300b9efe Hongjie Yang 2008-10-10 635 goto seg_list_del;
^1da177e4c Linus Torvalds 2005-04-16 636 }
^1da177e4c Linus Torvalds 2005-04-16 637 dev_info->gd->major = dcssblk_major;
^1da177e4c Linus Torvalds 2005-04-16 638 dev_info->gd->fops = &dcssblk_devops;
^1da177e4c Linus Torvalds 2005-04-16 639 dev_info->dcssblk_queue = blk_alloc_queue(GFP_KERNEL);
^1da177e4c Linus Torvalds 2005-04-16 640 dev_info->gd->queue = dev_info->dcssblk_queue;
^1da177e4c Linus Torvalds 2005-04-16 641 dev_info->gd->private_data = dev_info;
c5411dba58 Heiko Carstens 2008-02-05 642 blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
e1defc4ff0 Martin K. Petersen 2009-05-22 643 blk_queue_logical_block_size(dev_info->dcssblk_queue, 4096);
8b904b5b6b Bart Van Assche 2018-03-07 644 blk_queue_flag_set(QUEUE_FLAG_DAX, dev_info->dcssblk_queue);
b2300b9efe Hongjie Yang 2008-10-10 645
^1da177e4c Linus Torvalds 2005-04-16 646 seg_byte_size = (dev_info->end - dev_info->start + 1);
^1da177e4c Linus Torvalds 2005-04-16 647 set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
93098bf015 Hongjie Yang 2008-12-25 648 pr_info("Loaded %s with total size %lu bytes and capacity %lu "
93098bf015 Hongjie Yang 2008-12-25 649 "sectors\n", local_buf, seg_byte_size, seg_byte_size >> 9);
^1da177e4c Linus Torvalds 2005-04-16 650
^1da177e4c Linus Torvalds 2005-04-16 651 dev_info->save_pending = 0;
^1da177e4c Linus Torvalds 2005-04-16 652 dev_info->is_shared = 1;
^1da177e4c Linus Torvalds 2005-04-16 653 dev_info->dev.parent = dcssblk_root_dev;
^1da177e4c Linus Torvalds 2005-04-16 654
^1da177e4c Linus Torvalds 2005-04-16 655 /*
^1da177e4c Linus Torvalds 2005-04-16 656 *get minor, add to list
^1da177e4c Linus Torvalds 2005-04-16 657 */
^1da177e4c Linus Torvalds 2005-04-16 658 down_write(&dcssblk_devices_sem);
b2300b9efe Hongjie Yang 2008-10-10 659 if (dcssblk_get_segment_by_name(local_buf)) {
04f64b5756 Gerald Schaefer 2008-08-21 660 rc = -EEXIST;
b2300b9efe Hongjie Yang 2008-10-10 661 goto release_gd;
04f64b5756 Gerald Schaefer 2008-08-21 662 }
^1da177e4c Linus Torvalds 2005-04-16 663 rc = dcssblk_assign_free_minor(dev_info);
b2300b9efe Hongjie Yang 2008-10-10 664 if (rc)
b2300b9efe Hongjie Yang 2008-10-10 665 goto release_gd;
^1da177e4c Linus Torvalds 2005-04-16 666 sprintf(dev_info->gd->disk_name, "dcssblk%d",
d0591485e1 Gerald Schaefer 2009-06-12 667 dev_info->gd->first_minor);
^1da177e4c Linus Torvalds 2005-04-16 668 list_add_tail(&dev_info->lh, &dcssblk_devices);
^1da177e4c Linus Torvalds 2005-04-16 669
^1da177e4c Linus Torvalds 2005-04-16 670 if (!try_module_get(THIS_MODULE)) {
^1da177e4c Linus Torvalds 2005-04-16 671 rc = -ENODEV;
b2300b9efe Hongjie Yang 2008-10-10 672 goto dev_list_del;
^1da177e4c Linus Torvalds 2005-04-16 673 }
^1da177e4c Linus Torvalds 2005-04-16 674 /*
^1da177e4c Linus Torvalds 2005-04-16 675 * register the device
^1da177e4c Linus Torvalds 2005-04-16 676 */
^1da177e4c Linus Torvalds 2005-04-16 677 rc = device_register(&dev_info->dev);
^1da177e4c Linus Torvalds 2005-04-16 678 if (rc)
521b3d790c Sebastian Ott 2012-10-01 679 goto put_dev;
^1da177e4c Linus Torvalds 2005-04-16 680
7a2765f6e8 Dan Williams 2017-01-26 @681 dev_info->dax_dev = alloc_dax(dev_info, dev_info->gd->disk_name,
7a2765f6e8 Dan Williams 2017-01-26 682 &dcssblk_dax_ops);
7a2765f6e8 Dan Williams 2017-01-26 683 if (!dev_info->dax_dev) {
7a2765f6e8 Dan Williams 2017-01-26 684 rc = -ENOMEM;
7a2765f6e8 Dan Williams 2017-01-26 685 goto put_dev;
7a2765f6e8 Dan Williams 2017-01-26 686 }
7a2765f6e8 Dan Williams 2017-01-26 687
521b3d790c Sebastian Ott 2012-10-01 688 get_device(&dev_info->dev);
fef912bf86 Hannes Reinecke 2018-09-28 689 device_add_disk(&dev_info->dev, dev_info->gd, NULL);
436d1bc7fe Christian Borntraeger 2007-12-04 690
^1da177e4c Linus Torvalds 2005-04-16 691 switch (dev_info->segment_type) {
^1da177e4c Linus Torvalds 2005-04-16 692 case SEG_TYPE_SR:
^1da177e4c Linus Torvalds 2005-04-16 693 case SEG_TYPE_ER:
^1da177e4c Linus Torvalds 2005-04-16 694 case SEG_TYPE_SC:
^1da177e4c Linus Torvalds 2005-04-16 695 set_disk_ro(dev_info->gd,1);
^1da177e4c Linus Torvalds 2005-04-16 696 break;
^1da177e4c Linus Torvalds 2005-04-16 697 default:
^1da177e4c Linus Torvalds 2005-04-16 698 set_disk_ro(dev_info->gd,0);
^1da177e4c Linus Torvalds 2005-04-16 699 break;
^1da177e4c Linus Torvalds 2005-04-16 700 }
^1da177e4c Linus Torvalds 2005-04-16 701 up_write(&dcssblk_devices_sem);
^1da177e4c Linus Torvalds 2005-04-16 702 rc = count;
^1da177e4c Linus Torvalds 2005-04-16 703 goto out;
^1da177e4c Linus Torvalds 2005-04-16 704
521b3d790c Sebastian Ott 2012-10-01 705 put_dev:
^1da177e4c Linus Torvalds 2005-04-16 706 list_del(&dev_info->lh);
1312f40e11 Al Viro 2006-03-12 707 blk_cleanup_queue(dev_info->dcssblk_queue);
^1da177e4c Linus Torvalds 2005-04-16 708 dev_info->gd->queue = NULL;
^1da177e4c Linus Torvalds 2005-04-16 709 put_disk(dev_info->gd);
b2300b9efe Hongjie Yang 2008-10-10 710 list_for_each_entry(seg_info, &dev_info->seg_list, lh) {
b2300b9efe Hongjie Yang 2008-10-10 711 segment_unload(seg_info->segment_name);
b2300b9efe Hongjie Yang 2008-10-10 712 }
^1da177e4c Linus Torvalds 2005-04-16 713 put_device(&dev_info->dev);
^1da177e4c Linus Torvalds 2005-04-16 714 up_write(&dcssblk_devices_sem);
^1da177e4c Linus Torvalds 2005-04-16 715 goto out;
b2300b9efe Hongjie Yang 2008-10-10 716 dev_list_del:
^1da177e4c Linus Torvalds 2005-04-16 717 list_del(&dev_info->lh);
b2300b9efe Hongjie Yang 2008-10-10 718 release_gd:
1312f40e11 Al Viro 2006-03-12 719 blk_cleanup_queue(dev_info->dcssblk_queue);
^1da177e4c Linus Torvalds 2005-04-16 720 dev_info->gd->queue = NULL;
^1da177e4c Linus Torvalds 2005-04-16 721 put_disk(dev_info->gd);
b2300b9efe Hongjie Yang 2008-10-10 722 up_write(&dcssblk_devices_sem);
b2300b9efe Hongjie Yang 2008-10-10 723 seg_list_del:
b2300b9efe Hongjie Yang 2008-10-10 724 if (dev_info == NULL)
b2300b9efe Hongjie Yang 2008-10-10 725 goto out;
b2300b9efe Hongjie Yang 2008-10-10 726 list_for_each_entry_safe(seg_info, temp, &dev_info->seg_list, lh) {
b2300b9efe Hongjie Yang 2008-10-10 727 list_del(&seg_info->lh);
b2300b9efe Hongjie Yang 2008-10-10 728 segment_unload(seg_info->segment_name);
b2300b9efe Hongjie Yang 2008-10-10 729 kfree(seg_info);
b2300b9efe Hongjie Yang 2008-10-10 730 }
^1da177e4c Linus Torvalds 2005-04-16 731 kfree(dev_info);
^1da177e4c Linus Torvalds 2005-04-16 732 out:
^1da177e4c Linus Torvalds 2005-04-16 733 kfree(local_buf);
^1da177e4c Linus Torvalds 2005-04-16 734 out_nobuf:
^1da177e4c Linus Torvalds 2005-04-16 735 return rc;
^1da177e4c Linus Torvalds 2005-04-16 736 }
^1da177e4c Linus Torvalds 2005-04-16 737
:::::: The code at line 681 was first introduced by commit
:::::: 7a2765f6e82063f348ebce78c28eceff741689d4 dcssblk: add dax_operations support
:::::: TO: Dan Williams <dan.j.williams(a)intel.com>
:::::: CC: Dan Williams <dan.j.williams(a)intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
1 year, 7 months
[linux-nvdimm:libnvdimm-for-next 6/15] drivers/md/dm-table.c:897:9: error: implicit declaration of function 'dax_synchronous'; did you mean 'device_synchronous'?
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
head: 3b6047778c09037615e7b919c922081ef1a37a7f
commit: 38887edec2472179cc79bb45034731f5f816f064 [6/15] dm: enable synchronous dax
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 38887edec2472179cc79bb45034731f5f816f064
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/md/dm-table.c: In function 'device_synchronous':
>> drivers/md/dm-table.c:897:9: error: implicit declaration of function 'dax_synchronous'; did you mean 'device_synchronous'? [-Werror=implicit-function-declaration]
return dax_synchronous(dev->dax_dev);
^~~~~~~~~~~~~~~
device_synchronous
drivers/md/dm-table.c: In function 'dm_table_set_restrictions':
>> drivers/md/dm-table.c:1925:4: error: implicit declaration of function 'set_dax_synchronous'; did you mean 'device_synchronous'? [-Werror=implicit-function-declaration]
set_dax_synchronous(t->md->dax_dev);
^~~~~~~~~~~~~~~~~~~
device_synchronous
cc1: some warnings being treated as errors
vim +897 drivers/md/dm-table.c
892
893 /* Check devices support synchronous DAX */
894 static int device_synchronous(struct dm_target *ti, struct dm_dev *dev,
895 sector_t start, sector_t len, void *data)
896 {
> 897 return dax_synchronous(dev->dax_dev);
898 }
899
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
1 year, 7 months
Re: dev_pagemap related cleanups v2
by Christoph Hellwig
On Wed, Jun 19, 2019 at 03:19:23PM -0300, Jason Gunthorpe wrote:
> > Just make sure that when you backmerge v5.2-rc5 you have a clear
> > reason in the merge commit message about why you needed to do it.
> > While needless rebasing is top of the pet peeve list, second place, as
> > I found out, is mystery merges without explanations.
>
> Yes, I always describe the merge commits. Linus also particular about
> having *good reasons* for merges.
>
> This is why I can't fix the hmm.git to have rc5 until I have patches
> to apply..
>
> Probbaly I will just put CH's series on rc5 and merge it with the
> cover letter as the merge message. This avoid both rebasing and gives
> purposeful merges.
Fine with me. My series right now is on top of the rdma/hmm branch.
There is a trivial conflict that is solved by doing so, as my series
removes documentation that is fixed up there a bit. There is another
trivial conflict with your pending series as they remove code next to
each other in hmm.git.
1 year, 7 months
[PATCH v2] libnvdimm: Enable unit test infrastructure compile checks
by Dan Williams
The infrastructure to mock core libnvdimm routines for unit testing
purposes is prone to bitrot relative to refactoring of that core.
Arrange for the unit test core to be built when CONFIG_COMPILE_TEST=y.
This does not result in a functional unit test environment, it is only a
helper for 0day to catch unit test build regressions.
Note that there are a few x86isms in the implementation, so this does
not bother compile testing this architectures other than 64-bit x86.
Cc: Jérôme Glisse <jglisse(a)redhat.com>
Cc: Jason Gunthorpe <jgg(a)mellanox.com>
Reported-by: Christoph Hellwig <hch(a)lst.de>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
Changes since v1:
- 0day reports this fails to compile on !x86 which is not surprising.
Just disable non-x86 builds.
drivers/nvdimm/Kconfig | 11 +++++++++++
drivers/nvdimm/Makefile | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 54500798f23a..f6623e807fb2 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -118,4 +118,15 @@ config NVDIMM_KEYS
depends on ENCRYPTED_KEYS
depends on (LIBNVDIMM=ENCRYPTED_KEYS) || LIBNVDIMM=m
+config NVDIMM_TEST_BUILD
+ bool "Build the unit test core"
+ depends on COMPILE_TEST && X86_64
+ default COMPILE_TEST
+ help
+ Build the core of the unit test infrastructure. The result of
+ this build is non-functional for unit test execution, but it
+ otherwise helps catch build errors induced by changes to the
+ core devm_memremap_pages() implementation and other
+ infrastructure.
+
endif
diff --git a/drivers/nvdimm/Makefile b/drivers/nvdimm/Makefile
index 6f2a088afad6..40080c120363 100644
--- a/drivers/nvdimm/Makefile
+++ b/drivers/nvdimm/Makefile
@@ -28,3 +28,7 @@ libnvdimm-$(CONFIG_BTT) += btt_devs.o
libnvdimm-$(CONFIG_NVDIMM_PFN) += pfn_devs.o
libnvdimm-$(CONFIG_NVDIMM_DAX) += dax_devs.o
libnvdimm-$(CONFIG_NVDIMM_KEYS) += security.o
+
+TOOLS := ../../tools
+TEST_SRC := $(TOOLS)/testing/nvdimm/test
+obj-$(CONFIG_NVDIMM_TEST_BUILD) := $(TEST_SRC)/iomap.o
1 year, 7 months
Re: dev_pagemap related cleanups v2
by Dan Williams
On Wed, Jun 19, 2019 at 9:37 AM Jason Gunthorpe <jgg(a)ziepe.ca> wrote:
>
> On Wed, Jun 19, 2019 at 11:40:32AM +0200, Christoph Hellwig wrote:
> > On Tue, Jun 18, 2019 at 12:47:10PM -0700, Dan Williams wrote:
> > > > Git tree:
> > > >
> > > > git://git.infradead.org/users/hch/misc.git hmm-devmem-cleanup.2
> > > >
> > > > Gitweb:
> > > >
> > > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hmm-devme...
> >
> > >
> > > Attached is my incremental fixups on top of this series, with those
> > > integrated you can add:
> >
> > I've folded your incremental bits in and pushed out a new
> > hmm-devmem-cleanup.3 to the repo above. Let me know if I didn't mess
> > up anything else. I'll wait for a few more comments and Jason's
> > planned rebase of the hmm branch before reposting.
>
> I said I wouldn't rebase the hmm.git (as it needs to go to DRM, AMD
> and RDMA git trees)..
>
> Instead I will merge v5.2-rc5 to the tree before applying this series.
>
> I've understood this to be Linus's prefered workflow.
>
> So, please send the next iteration of this against either
> plainv5.2-rc5 or v5.2-rc5 merged with hmm.git and I'll sort it out.
Just make sure that when you backmerge v5.2-rc5 you have a clear
reason in the merge commit message about why you needed to do it.
While needless rebasing is top of the pet peeve list, second place, as
I found out, is mystery merges without explanations.
1 year, 7 months
[PATCH] libnvdimm: Enable unit test infrastructure compile checks
by Dan Williams
The infrastructure to mock core libnvdimm routines for unit testing
purposes is prone to bitrot relative to refactoring of that core.
Arrange for the unit test core to be built when CONFIG_COMPILE_TEST=y.
This does not result in a functional unit test environment, it is only a
helper for 0day to catch unit test build regressions.
Cc: Jérôme Glisse <jglisse(a)redhat.com>
Cc: Jason Gunthorpe <jgg(a)mellanox.com>
Reported-by: Christoph Hellwig <hch(a)lst.de>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
drivers/nvdimm/Kconfig | 11 +++++++++++
drivers/nvdimm/Makefile | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 54500798f23a..57d3a6c3ac70 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -118,4 +118,15 @@ config NVDIMM_KEYS
depends on ENCRYPTED_KEYS
depends on (LIBNVDIMM=ENCRYPTED_KEYS) || LIBNVDIMM=m
+config NVDIMM_TEST_BUILD
+ bool "Build the unit test core"
+ depends on COMPILE_TEST
+ default COMPILE_TEST
+ help
+ Build the core of the unit test infrastructure. The result of
+ this build is non-functional for unit test execution, but it
+ otherwise helps catch build errors induced by changes to the
+ core devm_memremap_pages() implementation and other
+ infrastructure.
+
endif
diff --git a/drivers/nvdimm/Makefile b/drivers/nvdimm/Makefile
index 6f2a088afad6..40080c120363 100644
--- a/drivers/nvdimm/Makefile
+++ b/drivers/nvdimm/Makefile
@@ -28,3 +28,7 @@ libnvdimm-$(CONFIG_BTT) += btt_devs.o
libnvdimm-$(CONFIG_NVDIMM_PFN) += pfn_devs.o
libnvdimm-$(CONFIG_NVDIMM_DAX) += dax_devs.o
libnvdimm-$(CONFIG_NVDIMM_KEYS) += security.o
+
+TOOLS := ../../tools
+TEST_SRC := $(TOOLS)/testing/nvdimm/test
+obj-$(CONFIG_NVDIMM_TEST_BUILD) := $(TEST_SRC)/iomap.o
1 year, 7 months
dev_pagemap related cleanups v2
by Christoph Hellwig
Hi Dan, Jérôme and Jason,
below is a series that cleans up the dev_pagemap interface so that
it is more easily usable, which removes the need to wrap it in hmm
and thus allowing to kill a lot of code
Note: this series is on top of the rdma/hmm branch + the dev_pagemap
releas fix series from Dan that went into 5.2-rc5.
Git tree:
git://git.infradead.org/users/hch/misc.git hmm-devmem-cleanup.2
Gitweb:
http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hmm-devme...
Changes since v1:
- rebase
- also switch p2pdma to the internal refcount
- add type checking for pgmap->type
- rename the migrate method to migrate_to_ram
- cleanup the altmap_valid flag
- various tidbits from the reviews
1 year, 7 months