Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-12 Thread Dave Chinner
On Tue, Apr 12, 2022 at 07:06:40PM -0700, Dan Williams wrote: > On Tue, Apr 12, 2022 at 5:04 PM Dave Chinner wrote: > > On Mon, Apr 11, 2022 at 12:09:03AM +0800, Shiyang Ruan wrote: > > > Introduce xfs_notify_failure.c to handle failure related works, such as > > > implement ->notify_failure(), re

[PATCH v2 12/12] device-core: Enable multi-subsystem device_lock() lockdep validation

2022-04-12 Thread Dan Williams
While device_set_lock_class() allows device_lock() to take a nested lock per the requirements of a given subsystem, it does not allow multiple subsystems to enable lockdep validation at the same time. For example if CXL does: device_set_lock_class(&cxlmd->dev, 1); ...and LIBNVDIMM does: device_s

[PATCH v2 11/12] libnvdimm: Enable lockdep validation

2022-04-12 Thread Dan Williams
Register libnvdimm subsystem devices with a non-zero lock_class to enable the device-core to track lock dependencies. Cc: Vishal Verma Cc: Dave Jiang Cc: Ira Weiny Reviewed-by: Dave Jiang Reviewed-by: Kevin Tian Signed-off-by: Dan Williams --- drivers/nvdimm/bus.c |3 +++ drivers/nv

[PATCH v2 08/12] libnvdimm: Refactor an nvdimm_lock_class() helper

2022-04-12 Thread Dan Williams
In preparation for moving to the device-core device_lock lockdep validation, refactor an nvdimm_lock_class() helper to be used with device_set_lock_class(). Cc: Vishal Verma Cc: Dave Jiang Cc: Ira Weiny Reviewed-by: Dave Jiang Reviewed-by: Kevin Tian Signed-off-by: Dan Williams --- drivers/

[PATCH v2 10/12] libnvdimm: Drop nd_device_lock()

2022-04-12 Thread Dan Williams
In preparation for switching to the core device_lock lockdep validation scheme, convert nd_device_lock() calls back to device_lock(). Note that this temporarily reverts the code back to the typical no validation of device_lock() until a follow-on patch to set dev->lock_class. Cc: Vishal Verma Cc

[PATCH v2 09/12] ACPI: NFIT: Drop nfit_device_lock()

2022-04-12 Thread Dan Williams
In preparation for the libnvdimm subsystem switching to device-core common lockdep validation. Delete nfit_device_lock() which will need to be replaced with an implementation that specifies a non-zero lock class. Note this reverts back to the default state of unvalidated device_lock(), until a loc

[PATCH v2 03/12] cxl/core: Refactor a cxl_lock_class() out of cxl_nested_lock()

2022-04-12 Thread Dan Williams
In preparation for upleveling device_lock() lockdep annotation support into the core, provide a helper to retrieve the lock class. This lock_class will be used with device_set_lock_class() to identify the CXL nested locking rules. Cc: Alison Schofield Cc: Vishal Verma Cc: Ira Weiny Cc: Ben Wida

[PATCH v2 06/12] cxl/core: Use dev->lock_class for device_lock() lockdep validation

2022-04-12 Thread Dan Williams
Update CONFIG_PROVE_CXL_LOCKING to use the common device-core helpers for device_lock validation. When CONFIG_PROVE_LOCKING is enabled, and device_set_lock_class() is passed a non-zero lock class , the core acquires the 'struct device' @lockdep_mutex everywhere it acquires the device_lock. Where l

[PATCH v2 07/12] cxl/acpi: Add a device_lock() lock class for the root platform device

2022-04-12 Thread Dan Williams
Now that the device-core can start validating lockdep usage after the device has been added, use that capability to validate usage of device_lock() against the ACPI0017 device relative to other subsystem locks. The 'enum cxl_lock_class' definition moves outside of the ifdef guard to support device

[PATCH v2 05/12] cxl/core: Clamp max lock_class

2022-04-12 Thread Dan Williams
MAX_LOCKDEP_SUBCLASSES limits the depth of the CXL topology that can be validated by lockdep. Given that the cxl_test topology is already at this limit collapse some of the levels and clamp the max depth. Cc: Alison Schofield Cc: Vishal Verma Cc: Ira Weiny Cc: Ben Widawsky Reviewed-by: Dave Ji

[PATCH v2 01/12] device-core: Move device_lock() lockdep init to a helper

2022-04-12 Thread Dan Williams
In preparation for new infrastructure to support lockdep validation of device_lock() usage across driver subsystems, add a device_lockdep_init() helper to contain those updates. Suggested-by: Pierre-Louis Bossart Reviewed-by: Dave Jiang Reviewed-by: Kevin Tian Signed-off-by: Dan Williams ---

[PATCH v2 04/12] cxl/core: Remove cxl_device_lock()

2022-04-12 Thread Dan Williams
In preparation for moving lockdep_mutex nested lock acquisition into the core, remove the cxl_device_lock() wrapper, but preserve cxl_lock_class() that will be used to inform the core of the subsystem's lock ordering rules. Note that this reverts back to the default state of unvalidated device_loc

[PATCH v2 02/12] device-core: Add dev->lock_class to enable device_lock() lockdep validation

2022-04-12 Thread Dan Williams
The device_lock() is hidden from lockdep by default because, for example, a device subsystem may do something like: --- device_add(dev1); ...in driver core... device_lock(dev1); bus->probe(dev1); /* where bus->probe() calls driver1_probe() */ driver1_probe(struct device *dev) { ...do some

[PATCH v2 00/12] device-core: Enable device_lock() lockdep validation

2022-04-12 Thread Dan Williams
Changes since v1 [1]: - Improve the clarity of the cover letter and changelogs of the major patches (Patch2 and Patch12) (Pierre, Kevin, and Dave) - Fix device_lock_interruptible() false negative deadlock detection (Kevin) - Fix off-by-one error in the device_set_lock_class() enable case (Kevin

Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-12 Thread Dan Williams
On Tue, Apr 12, 2022 at 5:04 PM Dave Chinner wrote: > > On Mon, Apr 11, 2022 at 12:09:03AM +0800, Shiyang Ruan wrote: > > Introduce xfs_notify_failure.c to handle failure related works, such as > > implement ->notify_failure(), register/unregister dax holder in xfs, and > > so on. > > > > If the r

Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-12 Thread Dave Chinner
On Mon, Apr 11, 2022 at 12:09:03AM +0800, Shiyang Ruan wrote: > Introduce xfs_notify_failure.c to handle failure related works, such as > implement ->notify_failure(), register/unregister dax holder in xfs, and > so on. > > If the rmap feature of XFS enabled, we can query it to find files and > me

Re: [PATCH v12 1/7] dax: Introduce holder for dax_device

2022-04-12 Thread Dan Williams
On Sun, Apr 10, 2022 at 9:09 AM Shiyang Ruan wrote: > > To easily track filesystem from a pmem device, we introduce a holder for > dax_device structure, and also its operation. This holder is used to > remember who is using this dax_device: > - When it is the backend of a filesystem, the holder