[PATCH 0/9] Allow persistent memory to be used like normal RAM
by Dave Hansen
Persistent memory is cool. But, currently, you have to rewrite
your applications to use it. Wouldn't it be cool if you could
just have it show up in your system like normal RAM and get to
it like a slow blob of memory? Well... have I got the patch
series for you!
This series adds a new "driver" to which pmem devices can be
attached. Once attached, the memory "owned" by the device is
hot-added to the kernel and managed like any other memory. On
systems with an HMAT (a new ACPI table), each socket (roughly)
will have a separate NUMA node for its persistent memory so
this newly-added memory can be selected by its unique NUMA
node.
This is highly RFC, and I really want the feedback from the
nvdimm/pmem folks about whether this is a viable long-term
perversion of their code and device mode. It's insufficiently
documented and probably not bisectable either.
Todo:
1. The device re-binding hacks are ham-fisted at best. We
need a better way of doing this, especially so the kmem
driver does not get in the way of normal pmem devices.
2. When the device has no proper node, we default it to
NUMA node 0. Is that OK?
3. We muck with the 'struct resource' code quite a bit. It
definitely needs a once-over from folks more familiar
with it than I.
4. Is there a better way to do this than starting with a
copy of pmem.c?
Here's how I set up a system to test this thing:
1. Boot qemu with lots of memory: "-m 4096", for instance
2. Reserve 512MB of physical memory. Reserving a spot a 2GB
physical seems to work: memmap=512M!0x0000000080000000
This will end up looking like a pmem device at boot.
3. When booted, convert fsdax device to "device dax":
ndctl create-namespace -fe namespace0.0 -m dax
4. In the background, the kmem driver will probably bind to the
new device.
5. Now, online the new memory sections. Perhaps:
grep ^MemTotal /proc/meminfo
for f in `grep -vl online /sys/devices/system/memory/*/state`; do
echo $f: `cat $f`
echo online > $f
grep ^MemTotal /proc/meminfo
done
Cc: Dan Williams <dan.j.williams(a)intel.com>
Cc: Dave Jiang <dave.jiang(a)intel.com>
Cc: Ross Zwisler <zwisler(a)kernel.org>
Cc: Vishal Verma <vishal.l.verma(a)intel.com>
Cc: Tom Lendacky <thomas.lendacky(a)amd.com>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Michal Hocko <mhocko(a)suse.com>
Cc: linux-nvdimm(a)lists.01.org
Cc: linux-kernel(a)vger.kernel.org
Cc: linux-mm(a)kvack.org
Cc: Huang Ying <ying.huang(a)intel.com>
Cc: Fengguang Wu <fengguang.wu(a)intel.com>
2 years, 4 months
[driver-core PATCH v7 0/9] Add NUMA aware async_schedule calls
by Alexander Duyck
This patch set provides functionality that will help to improve the
locality of the async_schedule calls used to provide deferred
initialization.
This patch set originally started out focused on just the one call to
async_schedule_domain in the nvdimm tree that was being used to defer the
device_add call however after doing some digging I realized the scope of
this was much broader than I had originally planned. As such I went
through and reworked the underlying infrastructure down to replacing the
queue_work call itself with a function of my own and opted to try and
provide a NUMA aware solution that would work for a broader audience.
In addition I have added several tweaks and/or clean-ups to the front of the
patch set. Patches 1 through 4 address a number of issues that actually were
causing the existing async_schedule calls to not show the performance that
they could due to either not scaling on a per device basis, or due to issues
that could result in a potential deadlock. For example, patch 4 addresses the
fact that we were calling async_schedule once per driver instead of once
per device, and as a result we would have still ended up with devices
being probed on a non-local node without addressing this first.
RFC->v1:
Dropped nvdimm patch to submit later.
It relies on code in libnvdimm development tree.
Simplified queue_work_near to just convert node into a CPU.
Split up drivers core and PM core patches.
v1->v2:
Renamed queue_work_near to queue_work_node
Added WARN_ON_ONCE if we use queue_work_node with per-cpu workqueue
v2->v3:
Added Acked-by for queue_work_node patch
Continued rename from _near to _node to be consistent with queue_work_node
Renamed async_schedule_near_domain to async_schedule_node_domain
Renamed async_schedule_near to async_schedule_node
Added kerneldoc for new async_schedule_XXX functions
Updated patch description for patch 4 to include data on potential gains
v3->v4
Added patch to consolidate use of need_parent_lock
Make asynchronous driver probing explicit about use of drvdata
v4->v5
Added patch to move async_synchronize_full to address deadlock
Added bit async_probe to act as mutex for probe/remove calls
Added back nvdimm patch as code it relies on is now in Linus's tree
Incorporated review comments on parent & device locking consolidation
Rebased on latest linux-next
v5->v6:
Drop the "This patch" or "This change" from start of patch descriptions.
Drop unnecessary parenthesis in first patch
Use same wording for "selecting a CPU" in comments added in first patch
Added kernel documentation for async_probe member of device
Fixed up comments for async_schedule calls in patch 2
Moved code related setting async driver out of device.h and into dd.c
Added Reviewed-by for several patches
v6->v7:
Fixed typo which had kernel doc refer to "lock" when I meant "unlock"
Dropped "bool X:1" to "u8 X:1" from patch description
Added async_driver to device_private structure to store driver
Dropped unecessary code shuffle from async_probe patch
Reordered patches to move fixes up to front
Added Reviewed-by for several patches
Updated cover page and patch descriptions throughout the set
---
Alexander Duyck (9):
driver core: Move async_synchronize_full call
driver core: Establish clear order of operations for deferred probe and remove
device core: Consolidate locking and unlocking of parent and device
driver core: Probe devices asynchronously instead of the driver
workqueue: Provide queue_work_node to queue work near a given NUMA node
async: Add support for queueing on specific NUMA node
driver core: Attach devices on CPU local to device node
PM core: Use new async_schedule_dev command
libnvdimm: Schedule device registration on node local to the device
drivers/base/base.h | 4 +
drivers/base/bus.c | 46 ++---------
drivers/base/dd.c | 182 +++++++++++++++++++++++++++++++++++++++------
drivers/base/power/main.c | 12 +--
drivers/nvdimm/bus.c | 11 ++-
include/linux/async.h | 82 ++++++++++++++++++++
include/linux/device.h | 3 +
include/linux/workqueue.h | 2
kernel/async.c | 53 +++++++------
kernel/workqueue.c | 84 +++++++++++++++++++++
10 files changed, 380 insertions(+), 99 deletions(-)
--
2 years, 4 months
[PATCH v5 00/12] ndctl: add security support
by Dave Jiang
The following series implements mechanisms that utilize the sysfs knobs
provided by the kernel in order to support the Intel DSM v1.8 spec
that provides security to NVDIMM. The following abilities are added:
1. display security state
2. enable/update passphrase
3. disable passphrase
4. freeze security
5. secure erase
6. overwrite
7. master passphrase enable/update
v5:
- Updated to match latest kernel interface (encrypted keys)
- Added overwrite support
- Added support for DSM v1.8 master passphrase operations
- Removed upcall related code
- Moved security state to enum (Dan)
- Change security output "security_state" to just "security". (Dan)
- Break out enable and update passphrase operation. (Dan)
- Security build can be compiled out when keyutils does not exist. (Dan)
- Move all keyutils related operations to libndctl. (Dan)
v4:
- Updated to match latest kernel interface.
- Added unit test for all security calls
v3:
- Added support to inject keys in order to update nvdimm security.
v2:
- Fixup the upcall util to match recent kernel updates for nvdimm security.
---
Dave Jiang (12):
ndctl: add support for display security state
ndctl: add passphrase update to ndctl
ndctl: add disable security support
ndctl: add support for freeze security
ndctl: add support for sanitize dimm
ndctl: add unit test for security ops (minus overwrite)
ndctl: setup modprobe rules
ndctl: add overwrite operation support
ndctl: add overwrite-wait support
ndctl: master phassphrase management support
ndctl: add master secure erase support
ndctl: documentation for security and key management
Documentation/ndctl/Makefile.am | 8
Documentation/ndctl/intel-nvdimm-security.txt | 129 ++++++
Documentation/ndctl/ndctl-disable-passphrase.txt | 29 +
Documentation/ndctl/ndctl-enable-passphrase.txt | 42 ++
Documentation/ndctl/ndctl-freeze-security.txt | 22 +
Documentation/ndctl/ndctl-list.txt | 8
Documentation/ndctl/ndctl-sanitize-dimm.txt | 44 ++
Documentation/ndctl/ndctl-update-passphrase.txt | 40 ++
Documentation/ndctl/ndctl-wait-overwrite.txt | 31 +
Makefile.am | 10
builtin.h | 6
configure.ac | 14 +
contrib/ndctl-loadkeys.sh | 24 +
contrib/nvdimm_modprobe.conf | 1
ndctl.spec.in | 2
ndctl/Makefile.am | 3
ndctl/dimm.c | 236 ++++++++++-
ndctl/lib/Makefile.am | 8
ndctl/lib/dimm.c | 203 +++++++++
ndctl/lib/keys.c | 472 ++++++++++++++++++++++
ndctl/lib/libndctl.sym | 19 +
ndctl/libndctl.h | 67 +++
ndctl/ndctl.c | 6
test/Makefile.am | 4
test/security.sh | 191 +++++++++
util/json.c | 31 +
26 files changed, 1637 insertions(+), 13 deletions(-)
create mode 100644 Documentation/ndctl/intel-nvdimm-security.txt
create mode 100644 Documentation/ndctl/ndctl-disable-passphrase.txt
create mode 100644 Documentation/ndctl/ndctl-enable-passphrase.txt
create mode 100644 Documentation/ndctl/ndctl-freeze-security.txt
create mode 100644 Documentation/ndctl/ndctl-sanitize-dimm.txt
create mode 100644 Documentation/ndctl/ndctl-update-passphrase.txt
create mode 100644 Documentation/ndctl/ndctl-wait-overwrite.txt
create mode 100755 contrib/ndctl-loadkeys.sh
create mode 100644 contrib/nvdimm_modprobe.conf
create mode 100644 ndctl/lib/keys.c
create mode 100755 test/security.sh
--
2 years, 4 months
[RFC v2 00/14] kunit: introduce KUnit, the Linux kernel unit testing framework
by Brendan Higgins
This patch set proposes KUnit, a lightweight unit testing and mocking
framework for the Linux kernel.
Unlike Autotest and kselftest, KUnit is a true unit testing framework;
it does not require installing the kernel on a test machine or in a VM
and does not require tests to be written in userspace running on a host
kernel. Additionally, KUnit is fast: From invocation to completion KUnit
can run several dozen tests in under a second. Currently, the entire
KUnit test suite for KUnit runs in under a second from the initial
invocation (build time excluded).
KUnit is heavily inspired by JUnit, Python's unittest.mock, and
Googletest/Googlemock for C++. KUnit provides facilities for defining
unit test cases, grouping related test cases into test suites, providing
common infrastructure for running tests, mocking, spying, and much more.
## What's so special about unit testing?
A unit test is supposed to test a single unit of code in isolation,
hence the name. There should be no dependencies outside the control of
the test; this means no external dependencies, which makes tests orders
of magnitudes faster. Likewise, since there are no external dependencies,
there are no hoops to jump through to run the tests. Additionally, this
makes unit tests deterministic: a failing unit test always indicates a
problem. Finally, because unit tests necessarily have finer granularity,
they are able to test all code paths easily solving the classic problem
of difficulty in exercising error handling code.
## Is KUnit trying to replace other testing frameworks for the kernel?
No. Most existing tests for the Linux kernel are end-to-end tests, which
have their place. A well tested system has lots of unit tests, a
reasonable number of integration tests, and some end-to-end tests. KUnit
is just trying to address the unit test space which is currently not
being addressed.
## More information on KUnit
There is a bunch of documentation near the end of this patch set that
describes how to use KUnit and best practices for writing unit tests.
For convenience I am hosting the compiled docs here:
https://google.github.io/kunit-docs/third_party/kernel/docs/
## Changes Since Last Version
- Updated patchset to apply cleanly on 4.19.
- Stripped down patchset to focus on just the core features (I dropped
mocking, spying, and the MMIO stuff for now; you can find these
patches here: https://kunit-review.googlesource.com/c/linux/+/1132),
as suggested by Rob.
- Cleaned up some of the commit messages and tweaked commit order a
bit based on suggestions.
--
2.19.1.568.g152ad8e336-goog
2 years, 4 months
Re: FAILED: patch "[PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry" failed to apply to 4.19-stable tree
by Matthew Wilcox
On Mon, Nov 26, 2018 at 11:40:20AM +0100, gregkh(a)linuxfoundation.org wrote:
>
> The patch below does not apply to the 4.19-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable(a)vger.kernel.org>.
The fix for 4.19 is rather more complex because we don't have the right information in the right places. Dan, does this look right to you?
diff --git a/fs/dax.c b/fs/dax.c
index 0fb270f0a0ef6..b8dd66f1951a6 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -227,7 +227,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot)
* Must be called with the i_pages lock held.
*/
static void *__get_unlocked_mapping_entry(struct address_space *mapping,
- pgoff_t index, void ***slotp, bool (*wait_fn)(void))
+ pgoff_t index, void ***slotp,
+ bool (*wait_fn)(struct address_space *mapping,
+ pgoff_t index, void *entry))
{
void *entry, **slot;
struct wait_exceptional_entry_queue ewait;
@@ -253,7 +255,7 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping,
prepare_to_wait_exclusive(wq, &ewait.wait,
TASK_UNINTERRUPTIBLE);
xa_unlock_irq(&mapping->i_pages);
- revalidate = wait_fn();
+ revalidate = wait_fn(mapping, index, entry);
finish_wait(wq, &ewait.wait);
xa_lock_irq(&mapping->i_pages);
if (revalidate)
@@ -261,7 +263,8 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping,
}
}
-static bool entry_wait(void)
+static bool entry_wait(struct address_space *mapping, unsigned long index,
+ void *entry)
{
schedule();
/*
@@ -393,12 +396,18 @@ static struct page *dax_busy_page(void *entry)
return NULL;
}
-static bool entry_wait_revalidate(void)
+static bool entry_wait_revalidate(struct address_space *mapping,
+ unsigned long index, void *entry)
{
rcu_read_unlock();
schedule();
rcu_read_lock();
+ /*
+ * We're not going to do anything with this entry; wake the next
+ * task in line
+ */
+ put_unlocked_mapping_entry(mapping, index, entry);
/*
* Tell __get_unlocked_mapping_entry() to take a break, we need
* to revalidate page->mapping after dropping locks
> ------------------ original commit in Linus's tree ------------------
>
> >From 25bbe21bf427a81b8e3ccd480ea0e1d940256156 Mon Sep 17 00:00:00 2001
> From: Matthew Wilcox <willy(a)infradead.org>
> Date: Fri, 16 Nov 2018 15:50:02 -0500
> Subject: [PATCH] dax: Avoid losing wakeup in dax_lock_mapping_entry
>
> After calling get_unlocked_entry(), you have to call
> put_unlocked_entry() to avoid subsequent waiters losing wakeups.
>
> Fixes: c2a7d2a11552 ("filesystem-dax: Introduce dax_lock_mapping_entry()")
> Cc: stable(a)vger.kernel.org
> Signed-off-by: Matthew Wilcox <willy(a)infradead.org>
>
> diff --git a/fs/dax.c b/fs/dax.c
> index cf2394e2bf4b..9bcce89ea18e 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -391,6 +391,7 @@ bool dax_lock_mapping_entry(struct page *page)
> rcu_read_unlock();
> entry = get_unlocked_entry(&xas);
> xas_unlock_irq(&xas);
> + put_unlocked_entry(&xas, entry);
> rcu_read_lock();
> continue;
> }
>
2 years, 4 months
fsdax memory error handling regression
by Williams, Dan J
Hi Willy,
I'm seeing the following warning with v4.20-rc1 and the "dax.sh" test
from the ndctl repository:
[ 69.962873] EXT4-fs (pmem0): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
[ 69.969522] EXT4-fs (pmem0): mounted filesystem with ordered data mode. Opts: dax
[ 70.028571] Injecting memory failure for pfn 0x208900 at process virtual address 0x7efe87b00000
[ 70.032384] Memory failure: 0x208900: Killing dax-pmd:7066 due to hardware memory corruption
[ 70.034420] Memory failure: 0x208900: recovery action for dax page: Recovered
[ 70.038878] WARNING: CPU: 37 PID: 7066 at fs/dax.c:464 dax_insert_entry+0x30b/0x330
[ 70.040675] Modules linked in: ebtable_nat(E) ebtable_broute(E) bridge(E) stp(E) llc(E) ip6table_mangle(E) ip6table_raw(E) ip6table_security(E) iptable_mangle(E) iptable_raw(E) iptable_security(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) ebtable_filter(E) ebtables(E) ip6table_filter(E) ip6_tables(E) crct10dif_pclmul(E) crc32_pclmul(E) dax_pmem(OE) crc32c_intel(E) device_dax(OE) ghash_clmulni_intel(E) nd_pmem(OE) nd_btt(OE) serio_raw(E) nd_e820(OE) nfit(OE) libnvdimm(OE) nfit_test_iomap(OE)
[ 70.049936] CPU: 37 PID: 7066 Comm: dax-pmd Tainted: G OE 4.19.0-rc5+ #2589
[ 70.051726] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[ 70.055215] RIP: 0010:dax_insert_entry+0x30b/0x330
[ 70.056769] Code: 84 b7 fe ff ff 48 81 e6 00 00 e0 ff e9 b2 fe ff ff 48 8b 3c 24 48 89 ee 31 d2 e8 10 eb ff ff 49 8b 7d 00 31 f6 e9 99 fe ff ff <0f> 0b e9 f8 fe ff ff 0f 0b e9 e2 fd ff ff e8 82 f1 f4 ff e9 9c fe
[ 70.062086] RSP: 0000:ffffc900086bfb20 EFLAGS: 00010082
[ 70.063726] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffea0008220000
[ 70.065755] RDX: 0000000000000000 RSI: 0000000000208800 RDI: 0000000000208800
[ 70.067784] RBP: ffff880327870bb0 R08: 0000000000208801 R09: 0000000000208a00
[ 70.069813] R10: 0000000000208801 R11: 0000000000000001 R12: ffff880327870bb8
[ 70.071837] R13: 0000000000000000 R14: 0000000004110003 R15: 0000000000000009
[ 70.073867] FS: 00007efe8859d540(0000) GS:ffff88033ea80000(0000) knlGS:0000000000000000
[ 70.076547] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 70.078294] CR2: 00007efe87a00000 CR3: 0000000334564003 CR4: 0000000000160ee0
[ 70.080326] Call Trace:
[ 70.081404] ? dax_iomap_pfn+0xb4/0x100
[ 70.082770] dax_iomap_pte_fault+0x648/0xd60
[ 70.084222] dax_iomap_fault+0x230/0xba0
[ 70.085596] ? lock_acquire+0x9e/0x1a0
[ 70.086940] ? ext4_dax_huge_fault+0x5e/0x200
[ 70.088406] ext4_dax_huge_fault+0x78/0x200
[ 70.089840] ? up_read+0x1c/0x70
[ 70.091071] __do_fault+0x1f/0x136
[ 70.092344] __handle_mm_fault+0xd2b/0x11c0
[ 70.093790] handle_mm_fault+0x198/0x3a0
[ 70.095166] __do_page_fault+0x279/0x510
[ 70.096546] do_page_fault+0x32/0x200
[ 70.097884] ? async_page_fault+0x8/0x30
[ 70.099256] async_page_fault+0x1e/0x30
I tried to get this test going on -next before the merge window, but
-next was not bootable for me. Bisection points to:
9f32d221301c dax: Convert dax_lock_mapping_entry to XArray
At first glance I think we need the old "always retry if we slept"
behavior. Otherwise this failure seems similar to the issue fixed by
Ross' change to always retry on any potential collision:
b1f382178d15 ext4: close race between direct IO and ext4_break_layouts()
I'll take a closer look tomorrow to see if that guess is plausible.
2 years, 4 months
[ndctl PATCH] ndctl: recover from failed namespace creation
by oceanhehy@gmail.com
From: Ocean He <hehy1(a)lenovo.com>
When namespace creation failure occurs, the consumed namespace (seed or 0th
idle) and pfn/dax seed would block next namespace creation. A recovery is
needed to handle this type failure.
A symptom example (section size is 128MB) based on kernel 4.19-rc2 and
ndctl v62:
# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
{
"dev":"namespace1.0",
"mode":"fsdax",
"map":"dev",
"size":"96.00 MiB (100.66 MB)",
"uuid":"ef9a0556-a610-40b5-8c71-43991765a2cc",
"raw_uuid":"177b22e2-b7e8-482f-a063-2b8de876d979",
"sector_size":512,
"blockdev":"pmem1",
"numa_node":1
}
# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
libndctl: ndctl_pfn_enable: pfn1.1: failed to enable
Error: namespace1.1: failed to enable
failed to create namespace: No such device or address
# ndctl destroy-namespace namespace1.0 -f
destroyed 1 namespace
# ndctl create-namespace -r region1 -s 128m -t pmem -m fsdax
failed to create namespace: Device or resource busy
Signed-off-by: Ocean He <hehy1(a)lenovo.com>
---
Additional information:
A kernel patch to fix this has been reviewed by Dan Williams, and he prefers
to handle it in ndctl directly.
https://www.spinics.net/lists/kernel/msg2901465.html
ndctl/namespace.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 510553c..76ee2ed 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -393,6 +393,8 @@ static int setup_namespace(struct ndctl_region *region,
try(ndctl_pfn, set_align, pfn, p->align);
try(ndctl_pfn, set_namespace, pfn, ndns);
rc = ndctl_pfn_enable(pfn);
+ if (rc)
+ ndctl_pfn_set_namespace(pfn, NULL);
} else if (p->mode == NDCTL_NS_MODE_DAX) {
struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
@@ -402,6 +404,8 @@ static int setup_namespace(struct ndctl_region *region,
try(ndctl_dax, set_align, dax, p->align);
try(ndctl_dax, set_namespace, dax, ndns);
rc = ndctl_dax_enable(dax);
+ if (rc)
+ ndctl_dax_set_namespace(dax, NULL);
} else if (p->mode == NDCTL_NS_MODE_SAFE) {
struct ndctl_btt *btt = ndctl_region_get_btt_seed(region);
@@ -783,7 +787,13 @@ static int namespace_create(struct ndctl_region *region)
return -ENODEV;
}
- return setup_namespace(region, ndns, &p);
+ rc = setup_namespace(region, ndns, &p);
+ if (rc) {
+ ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_RAW);
+ ndctl_namespace_delete(ndns);
+ }
+
+ return rc;
}
static int zero_info_block(struct ndctl_namespace *ndns)
--
1.8.3.1
2 years, 4 months
[ndctl PATCH] ndctl, build: Define HAVE_UUID
by Dan Williams
Attempts to build ndctl in an epel-6 environment fail with the following
messages:
In file included from util/filter.c:24:
./daxctl/libdaxctl.h:22: error: redefinition of typedef 'uuid_t'
./ndctl/libndctl.h:26: note: previous declaration of 'uuid_t' was here
Newer compilers discard the error since it sees the types are
compatible, but the definition should be coming from uuid.h when built
with libuuid. Arrange for an AC_DEFINE for the HAVE_UUID symbol when
libuuid is detected by PKG_CHECK_MODULES.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
configure.ac | 3 ++-
daxctl/libdaxctl.h | 2 +-
ndctl/libndctl.h | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index bb6b03324ea8..de5b84cec670 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,8 @@ AM_CONDITIONAL([ENABLE_POISON],
PKG_CHECK_MODULES([KMOD], [libkmod])
PKG_CHECK_MODULES([UDEV], [libudev])
-PKG_CHECK_MODULES([UUID], [uuid])
+PKG_CHECK_MODULES([UUID], [uuid],
+ [AC_DEFINE([HAVE_UUID], [1], [Define to 1 if using libuuid])])
PKG_CHECK_MODULES([JSON], [json-c])
AC_ARG_WITH([bash],
diff --git a/daxctl/libdaxctl.h b/daxctl/libdaxctl.h
index 21bc376ce629..1d13ea291f6f 100644
--- a/daxctl/libdaxctl.h
+++ b/daxctl/libdaxctl.h
@@ -16,7 +16,7 @@
#include <stdarg.h>
#include <unistd.h>
-#ifdef HAVE_LIBUUID
+#ifdef HAVE_UUID
#include <uuid/uuid.h>
#else
typedef unsigned char uuid_t[16];
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index 62cef9e82da3..c81cc032ebae 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -20,7 +20,7 @@
#include <errno.h>
#include <limits.h>
-#ifdef HAVE_LIBUUID
+#ifdef HAVE_UUID
#include <uuid/uuid.h>
#else
typedef unsigned char uuid_t[16];
2 years, 4 months
[PATCH 0/2] Two DAX fixes for 4.20
by Matthew Wilcox
These both fix race conditions in dax_lock_mapping_entry(). I've tagged
them both for 4.19 backport, which will fail and I'll do the equivalent
patch for it. Dan, do you want to take these through your tree?
Matthew Wilcox (2):
dax: Check page->mapping isn't NULL
dax: Don't access a freed inode
fs/dax.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
--
2.19.1
2 years, 4 months
[RFC PATCH v2 0/3] realize dax_operations for dm-snapshot
by Huaisheng Ye
From: Huaisheng Ye <yehs1(a)lenovo.com>
Changes
v1->v2:
Add NULL funtions for origin_dax_direct_access and
origin_dax_copy_from/to_iter in order to avoid building
error when CONFIG_DAX_DRIVER has NOT been enabled.
[v1]: https://lkml.org/lkml/2018/11/20/759
This series patches are used to realize the dax_operations for dm-snapshot
with persistent memory device.
Here are the steps about how to verify the function.
1. Configure the persistent memory to fs-dax mode and create namespace with ndctl;
2. find them in /dev;
# ndctl list
{
"dev":"namespace0.0",
"mode":"fsdax",
"map":"dev",
"size":132118478848,
"sector_size":512,
"blockdev":"pmem0",
"name":"yhs_pmem0",
"numa_node":0
},
3. create lv_pmem (here is 4G size) for testing;
# pvcreate /dev/pmem0
# vgcreate vg_pmem /dev/pmem0
# lvcreate -L 4G -n lv_pmem vg_pmem
4. create filesystem (ext2 or ext4) to /dev/pmem0
# mkfs.ext2 -b 4096 /dev/vg_pmem/lv_pmem
5. mount pmem with DAX way;
# mkdir /mnt/lv_pmem
# mount -o dax /dev/vg_pmem/lv_pmem /mnt/lv_pmem/
6. cp some files to /mnt/lv_pmem;
# cp linear_table03.log /mnt/lv_pmem/
# cp test0.log /mnt/lv_pmem/
7. create snapshot for test (here I limit it to 1G size);
# lvcreate -L 1G -n snap_pmem -s /dev/vg_pmem/lv_pmem
8. modify the files copied with vim or copy more other new files;
# vim /mnt/lv_pmem/test0.log
9. umount the pmem device;
# umount /mnt/lv_pmem/
10.merge the snapshot back to origin;
# lvconvert --merge /dev/vg_pmem/snap_pmem
11.mount pmem device again for checking the content of files;
# mount -o dax /dev/vg_pmem/lv_pmem /mnt/lv_pmem/
Huaisheng Ye (3):
dm: enable dax_operations for dm-snapshot
dm: expand hc_map in mapped_device for lack of map
dm: expand valid types for dm-ioctl
drivers/md/dm-core.h | 1 +
drivers/md/dm-ioctl.c | 4 +++-
drivers/md/dm-snap.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
drivers/md/dm.c | 15 +++++++++++++++
4 files changed, 68 insertions(+), 3 deletions(-)
--
1.8.3.1
2 years, 4 months