Skip to content

Commit 83762cb

Browse files
committed
dax: Kill DEV_DAX_PMEM_COMPAT
The /sys/class/dax compatibility option has shipped in the kernel for 4 years now which should be sufficient time for tools to abandon the old ABI in favor of the /sys/bus/dax device-model. Delete it now and see if anyone screams. Since this compatibility option shipped there has been more reports of users being surprised by the compat ABI than surprised by the "new", so the compat infrastructure has outlived its usefulness. Recall that /sys/bus/dax device-model is required for the dax kmem driver which allows PMEM to be used as "System RAM". The following projects were known to have a dependency on /sys/class/dax and have dropped their dependency as of the listed version: - ndctl (including libndctl, daxctl, and libdaxctl): v64+ - fio: v3.13+ - pmdk: v1.5.2+ As further evidence this option is no longer needed some distributions have already stopped enabling CONFIG_DEV_DAX_PMEM_COMPAT. Cc: Ira Weiny <[email protected]> Cc: Dave Jiang <[email protected]> Reported-by: Vishal Verma <[email protected]> Acked-by: Dave Hansen <[email protected]> Reviewed-by: Jane Chu <[email protected]> Link: https://lore.kernel.org/r/163701116195.3784476.726128179293466337.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent fa55b7d commit 83762cb

File tree

15 files changed

+36
-209
lines changed

15 files changed

+36
-209
lines changed

Documentation/ABI/obsolete/sysfs-class-dax

Lines changed: 0 additions & 22 deletions
This file was deleted.

drivers/dax/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,4 @@ config DEV_DAX_KMEM
7070

7171
Say N if unsure.
7272

73-
config DEV_DAX_PMEM_COMPAT
74-
tristate "PMEM DAX: support the deprecated /sys/class/dax interface"
75-
depends on m && DEV_DAX_PMEM=m
76-
default DEV_DAX_PMEM
77-
help
78-
Older versions of the libdaxctl library expect to find all
79-
device-dax instances under /sys/class/dax. If libdaxctl in
80-
your distribution is older than v58 say M, otherwise say N.
81-
8273
endif

drivers/dax/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
obj-$(CONFIG_DAX) += dax.o
33
obj-$(CONFIG_DEV_DAX) += device_dax.o
44
obj-$(CONFIG_DEV_DAX_KMEM) += kmem.o
5+
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
56

67
dax-y := super.o
78
dax-y += bus.o
89
device_dax-y := device.o
10+
dax_pmem-y := pmem.o
911

10-
obj-y += pmem/
1112
obj-y += hmem/

drivers/dax/bus.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "dax-private.h"
1111
#include "bus.h"
1212

13-
static struct class *dax_class;
14-
1513
static DEFINE_MUTEX(dax_bus_lock);
1614

1715
#define DAX_NAME_LEN 30
@@ -1343,10 +1341,7 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)
13431341

13441342
inode = dax_inode(dax_dev);
13451343
dev->devt = inode->i_rdev;
1346-
if (data->subsys == DEV_DAX_BUS)
1347-
dev->bus = &dax_bus_type;
1348-
else
1349-
dev->class = dax_class;
1344+
dev->bus = &dax_bus_type;
13501345
dev->parent = parent;
13511346
dev->type = &dev_dax_type;
13521347

@@ -1445,22 +1440,10 @@ EXPORT_SYMBOL_GPL(dax_driver_unregister);
14451440

14461441
int __init dax_bus_init(void)
14471442
{
1448-
int rc;
1449-
1450-
if (IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)) {
1451-
dax_class = class_create(THIS_MODULE, "dax");
1452-
if (IS_ERR(dax_class))
1453-
return PTR_ERR(dax_class);
1454-
}
1455-
1456-
rc = bus_register(&dax_bus_type);
1457-
if (rc)
1458-
class_destroy(dax_class);
1459-
return rc;
1443+
return bus_register(&dax_bus_type);
14601444
}
14611445

14621446
void __exit dax_bus_exit(void)
14631447
{
14641448
bus_unregister(&dax_bus_type);
1465-
class_destroy(dax_class);
14661449
}

drivers/dax/bus.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,15 @@ struct dax_region *alloc_dax_region(struct device *parent, int region_id,
1616
struct range *range, int target_node, unsigned int align,
1717
unsigned long flags);
1818

19-
enum dev_dax_subsys {
20-
DEV_DAX_BUS = 0, /* zeroed dev_dax_data picks this by default */
21-
DEV_DAX_CLASS,
22-
};
23-
2419
struct dev_dax_data {
2520
struct dax_region *dax_region;
2621
struct dev_pagemap *pgmap;
27-
enum dev_dax_subsys subsys;
2822
resource_size_t size;
2923
int id;
3024
};
3125

3226
struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data);
3327

34-
/* to be deleted when DEV_DAX_CLASS is removed */
35-
struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys);
36-
3728
struct dax_device_driver {
3829
struct device_driver drv;
3930
struct list_head ids;
@@ -49,10 +40,6 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
4940
void dax_driver_unregister(struct dax_device_driver *dax_drv);
5041
void kill_dev_dax(struct dev_dax *dev_dax);
5142

52-
#if IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
53-
int dev_dax_probe(struct dev_dax *dev_dax);
54-
#endif
55-
5643
/*
5744
* While run_dax() is potentially a generic operation that could be
5845
* defined in include/linux/dax.h we don't want to grow any users

drivers/dax/device.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
433433
inode = dax_inode(dax_dev);
434434
cdev = inode->i_cdev;
435435
cdev_init(cdev, &dax_fops);
436-
if (dev->class) {
437-
/* for the CONFIG_DEV_DAX_PMEM_COMPAT case */
438-
cdev->owner = dev->parent->driver->owner;
439-
} else
440-
cdev->owner = dev->driver->owner;
436+
cdev->owner = dev->driver->owner;
441437
cdev_set_parent(cdev, &dev->kobj);
442438
rc = cdev_add(cdev, dev->devt, 1);
443439
if (rc)

drivers/dax/pmem/core.c renamed to drivers/dax/pmem.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#include <linux/memremap.h>
44
#include <linux/module.h>
55
#include <linux/pfn_t.h>
6-
#include "../../nvdimm/pfn.h"
7-
#include "../../nvdimm/nd.h"
8-
#include "../bus.h"
6+
#include "../nvdimm/pfn.h"
7+
#include "../nvdimm/nd.h"
8+
#include "bus.h"
99

10-
struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
10+
static struct dev_dax *__dax_pmem_probe(struct device *dev)
1111
{
1212
struct range range;
1313
int rc, id, region_id;
@@ -63,7 +63,6 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
6363
.dax_region = dax_region,
6464
.id = id,
6565
.pgmap = &pgmap,
66-
.subsys = subsys,
6766
.size = range_len(&range),
6867
};
6968
dev_dax = devm_create_dev_dax(&data);
@@ -73,7 +72,32 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
7372

7473
return dev_dax;
7574
}
76-
EXPORT_SYMBOL_GPL(__dax_pmem_probe);
75+
76+
static int dax_pmem_probe(struct device *dev)
77+
{
78+
return PTR_ERR_OR_ZERO(__dax_pmem_probe(dev));
79+
}
80+
81+
static struct nd_device_driver dax_pmem_driver = {
82+
.probe = dax_pmem_probe,
83+
.drv = {
84+
.name = "dax_pmem",
85+
},
86+
.type = ND_DRIVER_DAX_PMEM,
87+
};
88+
89+
static int __init dax_pmem_init(void)
90+
{
91+
return nd_driver_register(&dax_pmem_driver);
92+
}
93+
module_init(dax_pmem_init);
94+
95+
static void __exit dax_pmem_exit(void)
96+
{
97+
driver_unregister(&dax_pmem_driver.drv);
98+
}
99+
module_exit(dax_pmem_exit);
77100

78101
MODULE_LICENSE("GPL v2");
79102
MODULE_AUTHOR("Intel Corporation");
103+
MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);

drivers/dax/pmem/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
33
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem_core.o
4-
obj-$(CONFIG_DEV_DAX_PMEM_COMPAT) += dax_pmem_compat.o
54

65
dax_pmem-y := pmem.o
76
dax_pmem_core-y := core.o

drivers/dax/pmem/compat.c

Lines changed: 0 additions & 72 deletions
This file was deleted.

drivers/dax/pmem/pmem.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,4 @@
77
#include <linux/nd.h>
88
#include "../bus.h"
99

10-
static int dax_pmem_probe(struct device *dev)
11-
{
12-
return PTR_ERR_OR_ZERO(__dax_pmem_probe(dev, DEV_DAX_BUS));
13-
}
1410

15-
static struct nd_device_driver dax_pmem_driver = {
16-
.probe = dax_pmem_probe,
17-
.drv = {
18-
.name = "dax_pmem",
19-
},
20-
.type = ND_DRIVER_DAX_PMEM,
21-
};
22-
23-
static int __init dax_pmem_init(void)
24-
{
25-
return nd_driver_register(&dax_pmem_driver);
26-
}
27-
module_init(dax_pmem_init);
28-
29-
static void __exit dax_pmem_exit(void)
30-
{
31-
driver_unregister(&dax_pmem_driver.drv);
32-
}
33-
module_exit(dax_pmem_exit);
34-
35-
MODULE_LICENSE("GPL v2");
36-
MODULE_AUTHOR("Intel Corporation");
37-
#if !IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
38-
/* For compat builds, don't load this module by default */
39-
MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);
40-
#endif

tools/testing/nvdimm/Kbuild

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ obj-$(CONFIG_DAX) += dax.o
3535
endif
3636
obj-$(CONFIG_DEV_DAX) += device_dax.o
3737
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
38-
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem_core.o
39-
obj-$(CONFIG_DEV_DAX_PMEM_COMPAT) += dax_pmem_compat.o
4038

4139
nfit-y := $(ACPI_SRC)/core.o
4240
nfit-y += $(ACPI_SRC)/intel.o
@@ -67,12 +65,8 @@ device_dax-y += dax-dev.o
6765
device_dax-y += device_dax_test.o
6866
device_dax-y += config_check.o
6967

70-
dax_pmem-y := $(DAX_SRC)/pmem/pmem.o
68+
dax_pmem-y := $(DAX_SRC)/pmem.o
7169
dax_pmem-y += dax_pmem_test.o
72-
dax_pmem_core-y := $(DAX_SRC)/pmem/core.o
73-
dax_pmem_core-y += dax_pmem_core_test.o
74-
dax_pmem_compat-y := $(DAX_SRC)/pmem/compat.o
75-
dax_pmem_compat-y += dax_pmem_compat_test.o
7670
dax_pmem-y += config_check.o
7771

7872
libnvdimm-y := $(NVDIMM_SRC)/core.o

tools/testing/nvdimm/dax_pmem_compat_test.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

tools/testing/nvdimm/dax_pmem_core_test.c

Lines changed: 0 additions & 8 deletions
This file was deleted.

tools/testing/nvdimm/test/ndtest.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,10 +1054,6 @@ static __init int ndtest_init(void)
10541054
libnvdimm_test();
10551055
device_dax_test();
10561056
dax_pmem_test();
1057-
dax_pmem_core_test();
1058-
#ifdef CONFIG_DEV_DAX_PMEM_COMPAT
1059-
dax_pmem_compat_test();
1060-
#endif
10611057

10621058
nfit_test_setup(ndtest_resource_lookup, NULL);
10631059

tools/testing/nvdimm/test/nfit.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,10 +3300,6 @@ static __init int nfit_test_init(void)
33003300
acpi_nfit_test();
33013301
device_dax_test();
33023302
dax_pmem_test();
3303-
dax_pmem_core_test();
3304-
#ifdef CONFIG_DEV_DAX_PMEM_COMPAT
3305-
dax_pmem_compat_test();
3306-
#endif
33073303

33083304
nfit_test_setup(nfit_test_lookup, nfit_test_evaluate_dsm);
33093305

0 commit comments

Comments
 (0)