Skip to content

Commit 1909e61

Browse files
committed
cxl/extent: Process dynamic partition events and realize region extents
A dynamic capacity device (DCD) sends events to signal the host for changes in the availability of Dynamic Capacity (DC) memory. These events contain extents describing a DPA range and meta data for memory to be added or removed. Events may be sent from the device at any time. Three types of events can be signaled, Add, Release, and Force Release. On add, the host may accept or reject the memory being offered. If no region exists, or the extent is invalid, the extent should be rejected. Add extent events may be grouped by a 'more' bit which indicates those extents should be processed as a group. On remove, the host can delay the response until the host is safely not using the memory. If no region exists the release can be sent immediately. The host may also release extents (or partial extents) at any time. Thus the 'more' bit grouping of release events is of less value and can be ignored in favor of sending multiple release capacity responses for groups of release events. Force removal is intended as a mechanism between the FM and the device and intended only when the host is unresponsive, out of sync, or otherwise broken. Purposely ignore force removal events. Regions are made up of one or more devices which may be surfacing memory to the host. Once all devices in a region have surfaced an extent the region can expose a corresponding extent for the user to consume. Without interleaving a device extent forms a 1:1 relationship with the region extent. Immediately surface a region extent upon getting a device extent. Per the specification the device is allowed to offer or remove extents at any time. However, anticipated use cases can expect extents to be offered, accepted, and removed in well defined chunks. Simplify extent tracking with the following restrictions. 1) Flag for removal any extent which overlaps a requested release range. 2) Refuse the offer of extents which overlap already accepted memory ranges. 3) Accept again a range which has already been accepted by the host. Eating duplicates serves three purposes. 3a) This simplifies the code if the device should get out of sync with the host. And it should be safe to acknowledge the extent again. 3b) This simplifies the code to process existing extents if the extent list should change while the extent list is being read. 3c) Duplicates for a given partition which are seen during a race between the hardware surfacing an extent and the cxl dax driver scanning for existing extents will be ignored. NOTE: Processing existing extents is done in a later patch. Management of the region extent devices must be synchronized with potential uses of the memory within the DAX layer. Create region extent devices as children of the cxl_dax_region device such that the DAX region driver can co-drive them and synchronize with the DAX layer. Synchronization and management is handled in a subsequent patch. Tag support within the DAX layer is not yet supported. To maintain compatibility with legacy DAX/region processing only tags with a value of 0 are allowed. This defines existing DAX devices as having a 0 tag which makes the most logical sense as a default. Process DCD events and create region devices. Based on an original patch by Navneet Singh. Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Li Ming <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Ira Weiny <[email protected]> --- Changes: [iweiny: rebase] [djbw: s/region/partition/] [iweiny: Adapt to new partition arch] [iweiny: s/tag/uuid/ throughout the code]
1 parent 83cea4e commit 1909e61

File tree

9 files changed

+786
-4
lines changed

9 files changed

+786
-4
lines changed

drivers/cxl/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ cxl_core-y += cdat.o
1717
cxl_core-y += ras.o
1818
cxl_core-y += acpi.o
1919
cxl_core-$(CONFIG_TRACING) += trace.o
20-
cxl_core-$(CONFIG_CXL_REGION) += region.o
20+
cxl_core-$(CONFIG_CXL_REGION) += region.o extent.o
2121
cxl_core-$(CONFIG_CXL_MCE) += mce.o
2222
cxl_core-$(CONFIG_CXL_FEATURES) += features.o

drivers/cxl/core/core.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,24 @@ struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa,
4545
u64 cxl_dpa_to_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
4646
u64 dpa);
4747

48+
int cxl_add_extent(struct cxl_memdev_state *mds, struct cxl_extent *extent);
49+
int cxl_rm_extent(struct cxl_memdev_state *mds, struct cxl_extent *extent);
4850
#else
4951
static inline u64 cxl_dpa_to_hpa(struct cxl_region *cxlr,
5052
const struct cxl_memdev *cxlmd, u64 dpa)
5153
{
5254
return ULLONG_MAX;
5355
}
56+
static inline int cxl_add_extent(struct cxl_memdev_state *mds,
57+
struct cxl_extent *extent)
58+
{
59+
return 0;
60+
}
61+
static inline int cxl_rm_extent(struct cxl_memdev_state *mds,
62+
struct cxl_extent *extent)
63+
{
64+
return 0;
65+
}
5466
static inline
5567
struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa,
5668
struct cxl_endpoint_decoder **cxled)
@@ -129,6 +141,7 @@ int cxl_update_hmat_access_coordinates(int nid, struct cxl_region *cxlr,
129141
bool cxl_need_node_perf_attrs_update(int nid);
130142
int cxl_port_get_switch_dport_bandwidth(struct cxl_port *port,
131143
struct access_coordinate *c);
144+
void memdev_release_extent(struct cxl_memdev_state *mds, struct range *range);
132145

133146
int cxl_ras_init(void);
134147
void cxl_ras_exit(void);

0 commit comments

Comments
 (0)