Re: [GIT PULL v4 00/21] libnd: non-volatile memory device support

From: Williams, Dan J
Date: Thu May 28 2015 - 01:21:37 EST


On Thu, 2015-05-28 at 03:01 +0200, Rafael J. Wysocki wrote:
> >> And how much time is it going to take to rebase it, actually?
> >>
> >> If all is so clean as you're suggesting, a "git rebase" should be
> >> sufficient for that really. Is it not the case?
> >
> > Of course the rebase is trivial, it's the testing that has gone into
> > the baseline being forfeited for no good reason that I take issue.
> >
> >> I do believe that having a clean history in the repository is
> >> important, especially for big new and complicated features like this
> >> one.
> >
> > Sure, in the general case, but this is one extra commit for
> > autogenerated acpica history.
> >
> >> For the same reason I don't believe that rushing such features in no
> >> matter what is the right approach.
> >>
> >> If Jens decides to pull it regardless, it's his call, but I wouldn't
> >> do that if I were him.
> >
> > I'm not going to push code around your objection. I understand and
> > agree with the general policy, but in this specific case I believe an
> > exception is warranted. If you still don't ack the approach I'll
> > proceed with the rebase.
>
> Please do a rebase, then. I don't think it's an unreasonable request.
>

So, first, the bad news... right on queue the acpica baseline throws me
this unrelated to libnd splat:

------------[ cut here ]------------
WARNING: CPU: 26 PID: 1 at kernel/locking/lockdep.c:3002 lockdep_init_map+0x462

DEBUG_LOCKS_WARN_ON(1)
Modules linked in:
CPU: 26 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc3+ #34
ffffffff81cb0f60 ffff880360c83bc8 ffffffff818a274f 0000000000002355
ffff880360c83c18 ffff880360c83c08 ffffffff81061d6a ffff8803581141f0
ffff8803511e6908 ffff8803581141f0 0000000000000000 0000000000001000
Call Trace:
[<ffffffff818a274f>] dump_stack+0x4c/0x65
[<ffffffff81061d6a>] warn_slowpath_common+0x8a/0xc0
[<ffffffff81061de6>] warn_slowpath_fmt+0x46/0x50
[<ffffffff810bd5c2>] lockdep_init_map+0x462/0x560
[<ffffffff8128e232>] ? __kernfs_new_node+0x62/0xe0
[<ffffffff81291006>] __kernfs_create_file+0x76/0xd0
[<ffffffff812919da>] sysfs_add_file_mode_ns+0x9a/0x1d0
[<ffffffff8129268e>] internal_create_group+0xee/0x2a0
[<ffffffff8129296a>] sysfs_create_groups+0x4a/0xa0
[<ffffffff81591c3d>] device_add+0x30d/0x640
[<ffffffff81fb1b86>] ? perf_workqueue_init+0x66/0x66
[<ffffffff8117a66f>] pmu_dev_alloc+0x8f/0xd0
[<ffffffff81fb1bd3>] perf_event_sysfs_init+0x4d/0x95
[<ffffffff810002fc>] do_one_initcall+0xbc/0x1f0
[<ffffffff81f8e1cf>] kernel_init_freeable+0x1b1/0x23e
[<ffffffff81f8d8eb>] ? initcall_blacklist+0xb6/0xb6
[<ffffffff81891f90>] ? rest_init+0x150/0x150
[<ffffffff81891f9e>] kernel_init+0xe/0xf0
[<ffffffff818adf12>] ret_from_fork+0x42/0x70
[<ffffffff81891f90>] ? rest_init+0x150/0x150
---[ end trace 36f5d28ae115ea20 ]---

Luckily that seems to be the only immediate breakage as our unit tests
pass, and we already had good lockdep coverage of libnd plus nfit driver
on the previous baseline.

The good news is that upstream, since our old baseline, has fixed a
sysfs bug that we were relying on for our namespace-device
size-attribute permission settings (fix below). Also, moving the
baseline seems to have shaken another 0day report loose (although this
sparse report was equally valid on the old baseline).

The changes on top of the rebase are small enough to include inline.
I've also posted the latest tree to nvdimm.git/libnd-for-next. Given
this is now based on the acpica bits for 4.2 is it still suitable to go
through the block tree?

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index c31d0ae87293..34f879808ada 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -895,7 +895,7 @@ static u64 to_interleave_offset(u64 offset, struct nfit_blk_mmio *mmio)

static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw)
{
- struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
+ struct nfit_blk_mmio __iomem *mmio = &nfit_blk->mmio[DCR];
u64 offset = nfit_blk->stat_offset + mmio->size * bw;

if (mmio->num_lines)
@@ -908,7 +908,7 @@ static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
resource_size_t dpa, unsigned int len, unsigned int write)
{
u64 cmd, offset;
- struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
+ struct nfit_blk_mmio __iomem *mmio = &nfit_blk->mmio[DCR];

enum {
BCW_OFFSET_MASK = (1ULL << 48)-1,
@@ -959,9 +959,9 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk, void *iobuf,
}

if (write)
- memcpy(mmio->base + offset, iobuf + copied, c);
+ memcpy_fromio(mmio->base + offset, iobuf + copied, c);
else
- memcpy(iobuf + copied, mmio->base + offset, c);
+ memcpy_toio(iobuf + copied, mmio->base + offset, c);

copied += c;
len -= c;
@@ -1036,7 +1036,7 @@ static void nfit_spa_unmap(struct acpi_nfit_desc *acpi_desc,
mutex_unlock(&acpi_desc->spa_map_mutex);
}

-static void *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc,
+static void __iomem *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc,
struct acpi_nfit_system_address *spa)
{
resource_size_t start = spa->address;
@@ -1092,16 +1092,16 @@ static void *__nfit_spa_map(struct acpi_nfit_desc *acpi_desc,
* when all region devices referencing the same mapping are disabled /
* unbound.
*/
-static void *nfit_spa_map(struct acpi_nfit_desc *acpi_desc,
+static void __iomem *nfit_spa_map(struct acpi_nfit_desc *acpi_desc,
struct acpi_nfit_system_address *spa)
{
- struct nfit_spa_mapping *spa_map;
+ void __iomem *iomem;

mutex_lock(&acpi_desc->spa_map_mutex);
- spa_map = __nfit_spa_map(acpi_desc, spa);
+ iomem = __nfit_spa_map(acpi_desc, spa);
mutex_unlock(&acpi_desc->spa_map_mutex);

- return spa_map;
+ return iomem;
}

static int nfit_blk_init_interleave(struct nfit_blk_mmio *mmio,
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h
index 880e7b3a9da0..e462214f94cd 100644
--- a/drivers/acpi/nfit.h
+++ b/drivers/acpi/nfit.h
@@ -115,7 +115,7 @@ enum nd_blk_mmio_selector {

struct nfit_blk {
struct nfit_blk_mmio {
- void *base;
+ void __iomem *base;
u64 size;
u64 base_offset;
u32 line_size;
@@ -135,7 +135,7 @@ struct nfit_spa_mapping {
struct acpi_nfit_system_address *spa;
struct list_head list;
struct kref kref;
- void *iomem;
+ void __iomem *iomem;
};

static inline struct nfit_spa_mapping *to_spa_map(struct kref *kref)
diff --git a/drivers/block/nd/namespace_devs.c b/drivers/block/nd/namespace_devs.c
index 8e75c881bc7b..d3042662f4b6 100644
--- a/drivers/block/nd/namespace_devs.c
+++ b/drivers/block/nd/namespace_devs.c
@@ -1101,7 +1101,7 @@ static umode_t nd_namespace_attr_visible(struct kobject *kobj, struct attribute

if (is_namespace_pmem(dev) || is_namespace_blk(dev)) {
if (a == &dev_attr_size.attr)
- return S_IWUSR;
+ return S_IWUSR | S_IRUGO;

if (is_namespace_pmem(dev) && a == &dev_attr_sector_size.attr)
return 0;

===

The following changes since commit f3b6ced236259a87829b829e8e542ff53bfb9a4f:

ACPICA: Fix for ill-formed GUID strings for NFIT tables. (2015-05-25 23:42:34 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm libnd-for-next

for you to fetch changes up to 9872c2c54572cd7e7410b4eac293efb58ace2fc3:

libnd: Non-Volatile Devices (2015-05-27 23:36:01 -0400)

----------------------------------------------------------------
Dan Williams (18):
e820, efi: add ACPI 6.0 persistent memory types
libnd, nfit: initial libnd infrastructure and NFIT support
libnd: control character device and libnd bus sysfs attributes
libnd, nfit: dimm/memory-devices
libnd: control (ioctl) messages for libnd bus and dimm devices
libnd, nd_dimm: dimm driver and base libnd device-driver infrastructure
libnd, nfit: regions (block-data-window, persistent memory, volatile memory)
libnd: support for legacy (non-aliasing) nvdimms
libnd, nd_pmem: add libnd support to the pmem driver
libnd, nfit: add interleave-set state-tracking infrastructure
libnd: namespace indices: read and validate
libnd: pmem label sets and namespace instantiation.
libnd: blk labels and namespace instantiation
libnd: write pmem label set
libnd: write blk label set
libnd: infrastructure for btt devices
nfit-test: manufactured NFITs for interface development
libnd: Non-Volatile Devices

Ross Zwisler (2):
pmem: Dynamically allocate partition numbers
libnd, nfit, nd_blk: driver for BLK-mode access persistent memory

Vishal Verma (1):
nd_btt: atomic sector updates

Documentation/blockdev/btt.txt | 273 ++++++
Documentation/blockdev/libnd.txt | 804 ++++++++++++++++++
MAINTAINERS | 39 +-
arch/arm64/kernel/efi.c | 1 +
arch/ia64/kernel/efi.c | 4 +
arch/x86/Kconfig | 4 +
arch/x86/boot/compressed/eboot.c | 4 +
arch/x86/include/uapi/asm/e820.h | 1 +
arch/x86/kernel/e820.c | 28 +-
arch/x86/kernel/pmem.c | 92 +-
arch/x86/platform/efi/efi.c | 3 +
drivers/acpi/Kconfig | 27 +
drivers/acpi/Makefile | 1 +
drivers/acpi/nfit.c | 1474 ++++++++++++++++++++++++++++++++
drivers/acpi/nfit.h | 160 ++++
drivers/block/Kconfig | 13 +-
drivers/block/Makefile | 2 +-
drivers/block/nd/Kconfig | 101 +++
drivers/block/nd/Makefile | 29 +
drivers/block/nd/blk.c | 252 ++++++
drivers/block/nd/btt.c | 1438 +++++++++++++++++++++++++++++++
drivers/block/nd/btt.h | 186 ++++
drivers/block/nd/btt_devs.c | 443 ++++++++++
drivers/block/nd/bus.c | 770 +++++++++++++++++
drivers/block/nd/core.c | 472 ++++++++++
drivers/block/nd/dimm.c | 115 +++
drivers/block/nd/dimm_devs.c | 516 +++++++++++
drivers/block/nd/label.c | 922 ++++++++++++++++++++
drivers/block/nd/label.h | 143 ++++
drivers/block/nd/namespace_devs.c | 1702 +++++++++++++++++++++++++++++++++++++
drivers/block/nd/nd-private.h | 111 +++
drivers/block/nd/nd.h | 257 ++++++
drivers/block/{ => nd}/pmem.c | 107 ++-
drivers/block/nd/region.c | 189 ++++
drivers/block/nd/region_devs.c | 667 +++++++++++++++
drivers/block/nd/test/Makefile | 5 +
drivers/block/nd/test/iomap.c | 151 ++++
drivers/block/nd/test/nfit.c | 1171 +++++++++++++++++++++++++
drivers/block/nd/test/nfit_test.h | 28 +
include/linux/efi.h | 3 +-
include/linux/libnd.h | 129 +++
include/linux/nd.h | 98 +++
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/ndctl.h | 199 +++++
44 files changed, 13046 insertions(+), 89 deletions(-)
create mode 100644 Documentation/blockdev/btt.txt
create mode 100644 Documentation/blockdev/libnd.txt
create mode 100644 drivers/acpi/nfit.c
create mode 100644 drivers/acpi/nfit.h
create mode 100644 drivers/block/nd/Kconfig
create mode 100644 drivers/block/nd/Makefile
create mode 100644 drivers/block/nd/blk.c
create mode 100644 drivers/block/nd/btt.c
create mode 100644 drivers/block/nd/btt.h
create mode 100644 drivers/block/nd/btt_devs.c
create mode 100644 drivers/block/nd/bus.c
create mode 100644 drivers/block/nd/core.c
create mode 100644 drivers/block/nd/dimm.c
create mode 100644 drivers/block/nd/dimm_devs.c
create mode 100644 drivers/block/nd/label.c
create mode 100644 drivers/block/nd/label.h
create mode 100644 drivers/block/nd/namespace_devs.c
create mode 100644 drivers/block/nd/nd-private.h
create mode 100644 drivers/block/nd/nd.h
rename drivers/block/{ => nd}/pmem.c (70%)
create mode 100644 drivers/block/nd/region.c
create mode 100644 drivers/block/nd/region_devs.c
create mode 100644 drivers/block/nd/test/Makefile
create mode 100644 drivers/block/nd/test/iomap.c
create mode 100644 drivers/block/nd/test/nfit.c
create mode 100644 drivers/block/nd/test/nfit_test.h
create mode 100644 include/linux/libnd.h
create mode 100644 include/linux/nd.h
create mode 100644 include/uapi/linux/ndctl.h