diff options
author | 2023-11-26 16:09:29 -0800 | |
---|---|---|
committer | 2023-11-29 17:03:53 -0800 | |
commit | 5558b92e8d39e18aa19619be2ee37274e9592528 (patch) | |
tree | 0d69fdfb71cde9d1d354fecbcb22c12195ffb6f3 /tools | |
parent | cxl/hdm: Fix a benign lockdep splat (diff) | |
download | linux-5558b92e8d39e18aa19619be2ee37274e9592528.tar.gz linux-5558b92e8d39e18aa19619be2ee37274e9592528.tar.bz2 linux-5558b92e8d39e18aa19619be2ee37274e9592528.zip |
cxl/core: Always hold region_rwsem while reading poison lists
A read of a device poison list is triggered via a sysfs attribute
and the results are logged as kernel trace events of type cxl_poison.
The work is managed by either: a) the region driver when one of more
regions map the device, or by b) the memdev driver when no regions
map the device.
In the case of a) the region driver holds the region_rwsem while
reading the poison by committed endpoint decoder mappings and for
any unmapped resources. This makes sure that the cxl_poison trace
event trace reports valid region info. (Region name, HPA, and UUID).
In the case of b) the memdev driver holds the dpa_rwsem preventing
new DPA resources from being attached to a region. However, it leaves
a gap between region attach and decoder commit actions. If a DPA in
the gap is in the poison list, the cxl_poison trace event will omit
the region info.
Close the gap by holding the region_rwsem and the dpa_rwsem when
reading poison per memdev. Since both methods now hold both locks,
down_read both from the caller. Doing so also addresses the lockdep
assert that found this issue:
Commit 458ba8189cb4 ("cxl: Add cxl_decoders_committed() helper")
Fixes: f0832a586396 ("cxl/region: Provide region info to the cxl_poison trace event")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/08e8e7ec9a3413b91d51de39e385653494b1eed0.1701041440.git.alison.schofield@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions