regression caused by patch 6180bb446ab624b9ab8bf201ed251ca87f07b413
("dax: fix detection of dax support for non-persistent memory block
devices")
by Mikulas Patocka
Hi
The patch 6180bb446ab624b9ab8bf201ed251ca87f07b413 ("dax: fix detection of
dax support for non-persistent memory block devices") causes crash when
attempting to mount the ext4 filesystem on /dev/pmem0 ("mkfs.ext4
/dev/pmem0; mount -t ext4 /dev/pmem0 /mnt/test"). The device /dev/pmem0 is
emulated using the "memmap" kernel parameter.
The patch causes infinite recursion and double-fault exception:
__generic_fsdax_supported
bdev_dax_supported
__bdev_dax_supported
dax_supported
dax_dev->ops->dax_supported
generic_fsdax_supported
__generic_fsdax_supported
Mikulas
[ 17.500619] traps: PANIC: double fault, error_code: 0x0
[ 17.500619] double fault: 0000 [#1] PREEMPT SMP
[ 17.500620] CPU: 0 PID: 1326 Comm: mount Not tainted 5.9.0-rc1-bisect #10
[ 17.500620] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 17.500621] RIP: 0010:__generic_fsdax_supported+0x6a/0x500
[ 17.500622] Code: ff ff ff ff ff 7f 00 48 21 f3 48 01 c3 48 c1 e3 09 f6 c7 0e 0f 85 fa 01 00 00 48 85 ff 49 89 fd 74 11 be 00 10 00 00 4c 89 e7 <e8> b1 fe ff ff 84 c0 75 11 31 c0 48 83 c4 48 5b 5d 41 5c 41 5d 41
[ 17.500623] RSP: 0018:ffff88940b4fdff8 EFLAGS: 00010286
[ 17.500624] RAX: 0000000000000000 RBX: 00000007fffff000 RCX: 0000000000000000
[ 17.500625] RDX: 0000000000001000 RSI: 0000000000001000 RDI: ffff88940b34c300
[ 17.500625] RBP: 0000000000000000 R08: 0000000004000000 R09: 8080808080808080
[ 17.500626] R10: 0000000000000000 R11: fefefefefefefeff R12: ffff88940b34c300
[ 17.500626] R13: ffff88940b3dc000 R14: ffff88940badd000 R15: 0000000000000001
[ 17.500627] FS: 00000000f7c25780(0000) GS:ffff88940fa00000(0000) knlGS:0000000000000000
[ 17.500628] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
[ 17.500628] CR2: ffff88940b4fdfe8 CR3: 000000140bd15000 CR4: 00000000000006b0
[ 17.500628] Call Trace:
[ 17.500629] Modules linked in: uvesafb cfbfillrect cfbimgblt cn cfbcopyarea fb fbdev ipv6 tun autofs4 binfmt_misc configfs af_packet virtio_rng rng_core mousedev evdev pcspkr virtio_balloon button raid10 raid456 async_raid6_recov async_memcpy async_pq raid6_pq async_xor xor async_tx libcrc32c raid1 raid0 md_mod sd_mod t10_pi virtio_scsi virtio_net net_failover psmouse scsi_mod failover
[ 17.500638] ---[ end trace 3c877fcb5b865459 ]---
[ 17.500638] RIP: 0010:__generic_fsdax_supported+0x6a/0x500
[ 17.500639] Code: ff ff ff ff ff 7f 00 48 21 f3 48 01 c3 48 c1 e3 09 f6 c7 0e 0f 85 fa 01 00 00 48 85 ff 49 89 fd 74 11 be 00 10 00 00 4c 89 e7 <e8> b1 fe ff ff 84 c0 75 11 31 c0 48 83 c4 48 5b 5d 41 5c 41 5d 41
[ 17.500640] RSP: 0018:ffff88940b4fdff8 EFLAGS: 00010286
[ 17.500641] RAX: 0000000000000000 RBX: 00000007fffff000 RCX: 0000000000000000
[ 17.500641] RDX: 0000000000001000 RSI: 0000000000001000 RDI: ffff88940b34c300
[ 17.500642] RBP: 0000000000000000 R08: 0000000004000000 R09: 8080808080808080
[ 17.500642] R10: 0000000000000000 R11: fefefefefefefeff R12: ffff88940b34c300
[ 17.500643] R13: ffff88940b3dc000 R14: ffff88940badd000 R15: 0000000000000001
[ 17.500643] FS: 00000000f7c25780(0000) GS:ffff88940fa00000(0000) knlGS:0000000000000000
[ 17.500644] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
[ 17.500644] CR2: ffff88940b4fdfe8 CR3: 000000140bd15000 CR4: 00000000000006b0
[ 17.500645] Kernel panic - not syncing: Fatal exception in interrupt
[ 17.500941] Kernel Offset: disabled
1 year, 9 months
[RFC PATCH 0/4] fsdax: introduce fs query to support reflink
by Shiyang Ruan
This patchset is a try to resolve the problem of tracking shared page
for fsdax.
This patchset moves owner tracking from dax_assocaite_entry() to pmem
device, by introducing an interface ->memory_failure() of struct
pagemap. The interface is called by memory_failure() in mm, and
implemented by pmem device. Then pmem device find the filesystem
which the damaged page located in, and call ->storage_lost() to track
files or metadata assocaited with this page. Finally we are able to
try to fix the damaged data in filesystem and do other necessary
processing, such as killing processes who are using the files
affected.
The call trace is like this:
memory_failure()
pgmap->ops->memory_failure() => pmem_pgmap_memory_failure()
bdev->bd_super->storage_lost() => xfs_fs_storage_lost()
xfs_rmap_query_range()
xfs_storage_lost_helper()
mf_recover_controller->recover_fn => \
memory_failure_dev_pagemap_kill_procs()
The collect_procs() and kill_procs() are moved into a callback which
is passed from memory_failure() to xfs_storage_lost_helper(). So we
can call it when a file assocaited is found, instead of creating a
file list and iterate it.
The fsdax & reflink support for XFS is not contained in this patchset.
(Rebased on v5.9-rc2)
==
Shiyang Ruan (4):
fs: introduce ->storage_lost() for memory-failure
pagemap: introduce ->memory_failure()
mm, fsdax: refactor dax handler in memory-failure
fsdax: remove useless (dis)associate functions
block/genhd.c | 12 ++++
drivers/nvdimm/pmem.c | 31 ++++++++++
fs/dax.c | 64 ++------------------
fs/xfs/xfs_super.c | 80 ++++++++++++++++++++++++
include/linux/dax.h | 5 +-
include/linux/fs.h | 1 +
include/linux/genhd.h | 2 +
include/linux/memremap.h | 3 +
include/linux/mm.h | 14 +++++
mm/memory-failure.c | 127 ++++++++++++++++++++++++---------------
10 files changed, 229 insertions(+), 110 deletions(-)
--
2.28.0
1 year, 9 months
[PATCH] acpi/nfit: Use kobj_to_dev() instead
by Wang Qing
Use kobj_to_dev() instead of container_of()
Signed-off-by: Wang Qing <wangqing(a)vivo.com>
---
drivers/acpi/nfit/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index fa4500f..3bb350b
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1382,7 +1382,7 @@ static bool ars_supported(struct nvdimm_bus *nvdimm_bus)
static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
if (a == &dev_attr_scrub.attr && !ars_supported(nvdimm_bus))
@@ -1667,7 +1667,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
struct attribute *a, int n)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct nvdimm *nvdimm = to_nvdimm(dev);
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
--
2.7.4
1 year, 9 months
[PATCH v2 0/7] mm/memory_hotplug: selective merging of system ram resources
by David Hildenbrand
Some add_memory*() users add memory in small, contiguous memory blocks.
Examples include virtio-mem, hyper-v balloon, and the XEN balloon.
This can quickly result in a lot of memory resources, whereby the actual
resource boundaries are not of interest (e.g., it might be relevant for
DIMMs, exposed via /proc/iomem to user space). We really want to merge
added resources in this scenario where possible.
Resources are effectively stored in a list-based tree. Having a lot of
resources not only wastes memory, it also makes traversing that tree more
expensive, and makes /proc/iomem explode in size (e.g., requiring
kexec-tools to manually merge resources when creating a kdump header. The
current kexec-tools resource count limit does not allow for more than
~100GB of memory with a memory block size of 128MB on x86-64).
Let's allow to selectively merge system ram resources by specifying a
new flag for add_memory*(). Patch #5 contains a /proc/iomem example. Only
tested with virtio-mem.
v1 -> v2:
- I had another look at v1 after vacation and didn't like it - it felt like
a hack. So I want forward and added a proper flag to add_memory*(), and
introduce a clean (non-racy) way to mark System RAM resources mergeable.
- "kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED"
-- Clean that flag up, felt wrong in the PnP section
- "mm/memory_hotplug: prepare passing flags to add_memory() and friends"
-- Previously sent in other context - decided to keep Wei's ack
- "mm/memory_hotplug: MEMHP_MERGE_RESOURCE to specify merging of System
RAM resources"
-- Cleaner approach to get the job done by using proper flags and only
merging the single, specified resource
- "virtio-mem: try to merge system ram resources"
"xen/balloon: try to merge system ram resources"
"hv_balloon: try to merge system ram resources"
-- Use the new flag MEMHP_MERGE_RESOURCE, much cleaner
RFC -> v1:
- Switch from rather generic "merge_child_mem_resources()" where a resource
name has to be specified to "merge_system_ram_resources().
- Smaller comment/documentation/patch description changes/fixes
David Hildenbrand (7):
kernel/resource: make release_mem_region_adjustable() never fail
kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED
mm/memory_hotplug: prepare passing flags to add_memory() and friends
mm/memory_hotplug: MEMHP_MERGE_RESOURCE to specify merging of System
RAM resources
virtio-mem: try to merge system ram resources
xen/balloon: try to merge system ram resources
hv_balloon: try to merge system ram resources
arch/powerpc/platforms/powernv/memtrace.c | 2 +-
.../platforms/pseries/hotplug-memory.c | 2 +-
drivers/acpi/acpi_memhotplug.c | 2 +-
drivers/base/memory.c | 2 +-
drivers/dax/kmem.c | 2 +-
drivers/hv/hv_balloon.c | 2 +-
drivers/s390/char/sclp_cmd.c | 2 +-
drivers/virtio/virtio_mem.c | 3 +-
drivers/xen/balloon.c | 2 +-
include/linux/ioport.h | 12 +-
include/linux/memory_hotplug.h | 19 ++-
kernel/kexec_file.c | 2 +-
kernel/resource.c | 109 ++++++++++++++----
mm/memory_hotplug.c | 48 +++-----
14 files changed, 141 insertions(+), 68 deletions(-)
--
2.26.2
1 year, 9 months
[PATCH v3 0/7] mm/memory_hotplug: selective merging of system ram resources
by David Hildenbrand
Some add_memory*() users add memory in small, contiguous memory blocks.
Examples include virtio-mem, hyper-v balloon, and the XEN balloon.
This can quickly result in a lot of memory resources, whereby the actual
resource boundaries are not of interest (e.g., it might be relevant for
DIMMs, exposed via /proc/iomem to user space). We really want to merge
added resources in this scenario where possible.
Resources are effectively stored in a list-based tree. Having a lot of
resources not only wastes memory, it also makes traversing that tree more
expensive, and makes /proc/iomem explode in size (e.g., requiring
kexec-tools to manually merge resources when creating a kdump header. The
current kexec-tools resource count limit does not allow for more than
~100GB of memory with a memory block size of 128MB on x86-64).
Let's allow to selectively merge system ram resources by specifying a
new flag for add_memory*(). Patch #5 contains a /proc/iomem example. Only
tested with virtio-mem.
v2 -> v3:
- "mm/memory_hotplug: prepare passing flags to add_memory() and friends"
-- Use proper __bitwise type for flags
-- Use "MHP_NONE" for empty flags
- Rebased to latest -next, added rb's
v1 -> v2:
- I had another look at v1 after vacation and didn't like it - it felt like
a hack. So I want forward and added a proper flag to add_memory*(), and
introduce a clean (non-racy) way to mark System RAM resources mergeable.
- "kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED"
-- Clean that flag up, felt wrong in the PnP section
- "mm/memory_hotplug: prepare passing flags to add_memory() and friends"
-- Previously sent in other context - decided to keep Wei's ack
- "mm/memory_hotplug: MEMHP_MERGE_RESOURCE to specify merging of System
RAM resources"
-- Cleaner approach to get the job done by using proper flags and only
merging the single, specified resource
- "virtio-mem: try to merge system ram resources"
"xen/balloon: try to merge system ram resources"
"hv_balloon: try to merge system ram resources"
-- Use the new flag MEMHP_MERGE_RESOURCE, much cleaner
RFC -> v1:
- Switch from rather generic "merge_child_mem_resources()" where a resource
name has to be specified to "merge_system_ram_resources().
- Smaller comment/documentation/patch description changes/fixes
David Hildenbrand (7):
kernel/resource: make release_mem_region_adjustable() never fail
kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED
mm/memory_hotplug: prepare passing flags to add_memory() and friends
mm/memory_hotplug: MEMHP_MERGE_RESOURCE to specify merging of System
RAM resources
virtio-mem: try to merge system ram resources
xen/balloon: try to merge system ram resources
hv_balloon: try to merge system ram resources
arch/powerpc/platforms/powernv/memtrace.c | 2 +-
.../platforms/pseries/hotplug-memory.c | 2 +-
drivers/acpi/acpi_memhotplug.c | 3 +-
drivers/base/memory.c | 3 +-
drivers/dax/kmem.c | 2 +-
drivers/hv/hv_balloon.c | 2 +-
drivers/s390/char/sclp_cmd.c | 2 +-
drivers/virtio/virtio_mem.c | 3 +-
drivers/xen/balloon.c | 2 +-
include/linux/ioport.h | 12 +-
include/linux/memory_hotplug.h | 23 +++-
kernel/kexec_file.c | 2 +-
kernel/resource.c | 109 ++++++++++++++----
mm/memory_hotplug.c | 47 +++-----
14 files changed, 146 insertions(+), 68 deletions(-)
--
2.26.2
1 year, 9 months
[PATCH] libnvdimm: Fix dereference of pointer ndns before it is null checked
by Jing Xiangfeng
In current code, the pointer ndns is being dereferenced on the
initialization of pointer parent_uuid before ndns is null check. This
could lead to a potential null pointer dereference. Fix this by
dereferencing ndns after ndns has been null pointer sanity checked.
Signed-off-by: Jing Xiangfeng <jingxiangfeng(a)huawei.com>
---
drivers/nvdimm/pfn_devs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index 3e11ef8d3f5b..c443994f81f3 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -452,7 +452,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
unsigned long align, start_pad;
struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
struct nd_namespace_common *ndns = nd_pfn->ndns;
- const u8 *parent_uuid = nd_dev_to_uuid(&ndns->dev);
+ const u8 *parent_uuid;
if (!pfn_sb || !ndns)
return -ENODEV;
@@ -472,6 +472,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
return -ENODEV;
pfn_sb->checksum = cpu_to_le64(checksum);
+ parent_uuid = nd_dev_to_uuid(&ndns->dev);
if (memcmp(pfn_sb->parent_uuid, parent_uuid, 16) != 0)
return -ENODEV;
--
2.17.1
1 year, 9 months
[SPAM] Low-Cost Loans for SMEs & Investment Funding.
by Nicholas Toms
Dear sir/ma
My name is Nicholas Toms, an investment portfolio manager with ACLL . We offer the right loan Investment funding with low
interest to finance your business or project ranging from US$1M to US$2BIllion.
Kindly contact me for more details as I am open to questions.
Sincerely,
Nicholas Toms
1 year, 9 months
[GIT PULL] libnvdimm fix for v5.9-rc5
by Verma, Vishal L
Hi Linus, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
tags/libnvdimm-fix-v5.9-rc5
...to receive another fix for detection of DAX support for block
devices. The previous fix in this area (merged in -rc3) was incomplete,
and this should finally address all the problems.
---
The following changes since commit c2affe920b0e0669650943ac086215cf6519be34:
dax: do not print error message for non-persistent memory block device (2020-08-20 11:43:18 -0600)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git tags/libnvdimm-fix-v5.9-rc5
for you to fetch changes up to 6180bb446ab624b9ab8bf201ed251ca87f07b413:
dax: fix detection of dax support for non-persistent memory block devices (2020-09-03 12:28:03 -0600)
----------------------------------------------------------------
libnvdimm fix for v5.9-rc5
Fix decetion of dax support for block devices. Previous fixes in this
area, which only affected printing of debug messages, had an incorrect
condition for detection of dax. This fix should finally do the right thing.
----------------------------------------------------------------
Coly Li (1):
dax: fix detection of dax support for non-persistent memory block devices
drivers/dax/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 32642634c1bb..e5767c83ea23 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -100,7 +100,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
return false;
}
- if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) {
+ if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) {
pr_debug("%s: error: dax unsupported by block device\n",
bdevname(bdev, buf));
return false;
1 year, 9 months
[PATCH] powerpc/papr_scm: Fix warning triggered by perf_stats_show()
by Vaibhav Jain
A warning is reported by the kernel in case perf_stats_show() returns
an error code. The warning is of the form below:
papr_scm ibm,persistent-memory:ibm,pmemory@44100001:
Failed to query performance stats, Err:-10
dev_attr_show: perf_stats_show+0x0/0x1c0 [papr_scm] returned bad count
fill_read_buffer: dev_attr_show+0x0/0xb0 returned bad count
On investigation it looks like that the compiler is silently truncating the
return value of drc_pmem_query_stats() from 'long' to 'int', since the
variable used to store the return code 'rc' is an 'int'. This
truncated value is then returned back as a 'ssize_t' back from
perf_stats_show() to 'dev_attr_show()' which thinks of it as a large
unsigned number and triggers this warning..
To fix this we update the type of variable 'rc' from 'int' to
'ssize_t' that prevents the compiler from truncating the return value
of drc_pmem_query_stats() and returning correct signed value back from
perf_stats_show().
Fixes: 2d02bf835e573 ('powerpc/papr_scm: Fetch nvdimm performance
stats from PHYP')
Signed-off-by: Vaibhav Jain <vaibhav(a)linux.ibm.com>
---
arch/powerpc/platforms/pseries/papr_scm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index a88a707a608aa..9f00b61676ab9 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -785,7 +785,8 @@ static int papr_scm_ndctl(struct nvdimm_bus_descriptor *nd_desc,
static ssize_t perf_stats_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int index, rc;
+ int index;
+ ssize_t rc;
struct seq_buf s;
struct papr_scm_perf_stat *stat;
struct papr_scm_perf_stats *stats;
--
2.26.2
1 year, 9 months