Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89fd915c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull libnvdimm from Dan Williams:
 "A rework of media error handling in the BTT driver and other updates.
  It has appeared in a few -next releases and collected some late-
  breaking build-error and warning fixups as a result.

  Summary:

   - Media error handling support in the Block Translation Table (BTT)
     driver is reworked to address sleeping-while-atomic locking and
     memory-allocation-context conflicts.

   - The dax_device lookup overhead for xfs and ext4 is moved out of the
     iomap hot-path to a mount-time lookup.

   - A new 'ecc_unit_size' sysfs attribute is added to advertise the
     read-modify-write boundary property of a persistent memory range.

   - Preparatory fix-ups for arm and powerpc pmem support are included
     along with other miscellaneous fixes"

* tag 'libnvdimm-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (26 commits)
  libnvdimm, btt: fix format string warnings
  libnvdimm, btt: clean up warning and error messages
  ext4: fix null pointer dereference on sbi
  libnvdimm, nfit: move the check on nd_reserved2 to the endpoint
  dax: fix FS_DAX=n BLOCK=y compilation
  libnvdimm: fix integer overflow static analysis warning
  libnvdimm, nd_blk: remove mmio_flush_range()
  libnvdimm, btt: rework error clearing
  libnvdimm: fix potential deadlock while clearing errors
  libnvdimm, btt: cache sector_size in arena_info
  libnvdimm, btt: ensure that flags were also unchanged during a map_read
  libnvdimm, btt: refactor map entry operations with macros
  libnvdimm, btt: fix a missed NVDIMM_IO_ATOMIC case in the write path
  libnvdimm, nfit: export an 'ecc_unit_size' sysfs attribute
  ext4: perform dax_device lookup at mount
  ext2: perform dax_device lookup at mount
  xfs: perform dax_device lookup at mount
  dax: introduce a fs_dax_get_by_bdev() helper
  libnvdimm, btt: check memory allocation failure
  libnvdimm, label: fix index block size calculation
  ...
parents 66c9457d 04c3c982
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -53,7 +53,6 @@ config X86
	select ARCH_HAS_FORTIFY_SOURCE
	select ARCH_HAS_FORTIFY_SOURCE
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_HAS_KCOV			if X86_64
	select ARCH_HAS_KCOV			if X86_64
	select ARCH_HAS_MMIO_FLUSH
	select ARCH_HAS_PMEM_API		if X86_64
	select ARCH_HAS_PMEM_API		if X86_64
	# Causing hangs/crashes, see the commit that added this change for details.
	# Causing hangs/crashes, see the commit that added this change for details.
	select ARCH_HAS_REFCOUNT		if BROKEN
	select ARCH_HAS_REFCOUNT		if BROKEN
+0 −2
Original line number Original line Diff line number Diff line
@@ -7,6 +7,4 @@


void clflush_cache_range(void *addr, unsigned int size);
void clflush_cache_range(void *addr, unsigned int size);


#define mmio_flush_range(addr, size) clflush_cache_range(addr, size)

#endif /* _ASM_X86_CACHEFLUSH_H */
#endif /* _ASM_X86_CACHEFLUSH_H */
+1 −1
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@ config ACPI_NFIT
	tristate "ACPI NVDIMM Firmware Interface Table (NFIT)"
	tristate "ACPI NVDIMM Firmware Interface Table (NFIT)"
	depends on PHYS_ADDR_T_64BIT
	depends on PHYS_ADDR_T_64BIT
	depends on BLK_DEV
	depends on BLK_DEV
	depends on ARCH_HAS_MMIO_FLUSH
	depends on ARCH_HAS_PMEM_API
	select LIBNVDIMM
	select LIBNVDIMM
	help
	help
	  Infrastructure to probe ACPI 6 compliant platforms for
	  Infrastructure to probe ACPI 6 compliant platforms for
+44 −6
Original line number Original line Diff line number Diff line
@@ -228,6 +228,10 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
	if (cmd == ND_CMD_CALL) {
	if (cmd == ND_CMD_CALL) {
		call_pkg = buf;
		call_pkg = buf;
		func = call_pkg->nd_command;
		func = call_pkg->nd_command;

		for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++)
			if (call_pkg->nd_reserved2[i])
				return -EINVAL;
	}
	}


	if (nvdimm) {
	if (nvdimm) {
@@ -1674,8 +1678,19 @@ static ssize_t range_index_show(struct device *dev,
}
}
static DEVICE_ATTR_RO(range_index);
static DEVICE_ATTR_RO(range_index);


static ssize_t ecc_unit_size_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct nd_region *nd_region = to_nd_region(dev);
	struct nfit_spa *nfit_spa = nd_region_provider_data(nd_region);

	return sprintf(buf, "%d\n", nfit_spa->clear_err_unit);
}
static DEVICE_ATTR_RO(ecc_unit_size);

static struct attribute *acpi_nfit_region_attributes[] = {
static struct attribute *acpi_nfit_region_attributes[] = {
	&dev_attr_range_index.attr,
	&dev_attr_range_index.attr,
	&dev_attr_ecc_unit_size.attr,
	NULL,
	NULL,
};
};


@@ -1804,6 +1819,7 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
		struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
		struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
		struct acpi_nfit_memory_map *memdev = memdev_from_spa(acpi_desc,
		struct acpi_nfit_memory_map *memdev = memdev_from_spa(acpi_desc,
				spa->range_index, i);
				spa->range_index, i);
		struct acpi_nfit_control_region *dcr = nfit_mem->dcr;


		if (!memdev || !nfit_mem->dcr) {
		if (!memdev || !nfit_mem->dcr) {
			dev_err(dev, "%s: failed to find DCR\n", __func__);
			dev_err(dev, "%s: failed to find DCR\n", __func__);
@@ -1811,13 +1827,13 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
		}
		}


		map->region_offset = memdev->region_offset;
		map->region_offset = memdev->region_offset;
		map->serial_number = nfit_mem->dcr->serial_number;
		map->serial_number = dcr->serial_number;


		map2->region_offset = memdev->region_offset;
		map2->region_offset = memdev->region_offset;
		map2->serial_number = nfit_mem->dcr->serial_number;
		map2->serial_number = dcr->serial_number;
		map2->vendor_id = nfit_mem->dcr->vendor_id;
		map2->vendor_id = dcr->vendor_id;
		map2->manufacturing_date = nfit_mem->dcr->manufacturing_date;
		map2->manufacturing_date = dcr->manufacturing_date;
		map2->manufacturing_location = nfit_mem->dcr->manufacturing_location;
		map2->manufacturing_location = dcr->manufacturing_location;
	}
	}


	/* v1.1 namespaces */
	/* v1.1 namespaces */
@@ -1835,6 +1851,28 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
			cmp_map_compat, NULL);
			cmp_map_compat, NULL);
	nd_set->altcookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);
	nd_set->altcookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);


	/* record the result of the sort for the mapping position */
	for (i = 0; i < nr; i++) {
		struct nfit_set_info_map2 *map2 = &info2->mapping[i];
		int j;

		for (j = 0; j < nr; j++) {
			struct nd_mapping_desc *mapping = &ndr_desc->mapping[j];
			struct nvdimm *nvdimm = mapping->nvdimm;
			struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
			struct acpi_nfit_control_region *dcr = nfit_mem->dcr;

			if (map2->serial_number == dcr->serial_number &&
			    map2->vendor_id == dcr->vendor_id &&
			    map2->manufacturing_date == dcr->manufacturing_date &&
			    map2->manufacturing_location
				    == dcr->manufacturing_location) {
				mapping->position = i;
				break;
			}
		}
	}

	ndr_desc->nd_set = nd_set;
	ndr_desc->nd_set = nd_set;
	devm_kfree(dev, info);
	devm_kfree(dev, info);
	devm_kfree(dev, info2);
	devm_kfree(dev, info2);
@@ -1930,7 +1968,7 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk,
			memcpy_flushcache(mmio->addr.aperture + offset, iobuf + copied, c);
			memcpy_flushcache(mmio->addr.aperture + offset, iobuf + copied, c);
		else {
		else {
			if (nfit_blk->dimm_flags & NFIT_BLK_READ_FLUSH)
			if (nfit_blk->dimm_flags & NFIT_BLK_READ_FLUSH)
				mmio_flush_range((void __force *)
				arch_invalidate_pmem((void __force *)
					mmio->addr.aperture + offset, c);
					mmio->addr.aperture + offset, c);


			memcpy(iobuf + copied, mmio->addr.aperture + offset, c);
			memcpy(iobuf + copied, mmio->addr.aperture + offset, c);
+12 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,8 @@ void dax_read_unlock(int id)
EXPORT_SYMBOL_GPL(dax_read_unlock);
EXPORT_SYMBOL_GPL(dax_read_unlock);


#ifdef CONFIG_BLOCK
#ifdef CONFIG_BLOCK
#include <linux/blkdev.h>

int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
		pgoff_t *pgoff)
		pgoff_t *pgoff)
{
{
@@ -59,6 +61,16 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
}
}
EXPORT_SYMBOL(bdev_dax_pgoff);
EXPORT_SYMBOL(bdev_dax_pgoff);


#if IS_ENABLED(CONFIG_FS_DAX)
struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
{
	if (!blk_queue_dax(bdev->bd_queue))
		return NULL;
	return fs_dax_get_by_host(bdev->bd_disk->disk_name);
}
EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
#endif

/**
/**
 * __bdev_dax_supported() - Check if the device supports dax for filesystem
 * __bdev_dax_supported() - Check if the device supports dax for filesystem
 * @sb: The superblock of the device
 * @sb: The superblock of the device
Loading