@@ -264,3 +264,79 @@ Sysfs files are documented in
264
264
`Documentation/ABI/testing/sysfs-edac-scrub `
265
265
266
266
`Documentation/ABI/testing/sysfs-edac-ecs `
267
+
268
+ Examples
269
+ --------
270
+
271
+ The usage takes the form shown in these examples:
272
+
273
+ 1. CXL memory Patrol Scrub
274
+
275
+ The following are the use cases identified why we might increase the scrub rate.
276
+
277
+ - Scrubbing is needed at device granularity because a device is showing
278
+ unexpectedly high errors.
279
+
280
+ - Scrubbing may apply to memory that isn't online at all yet. Likely this
281
+ is a system wide default setting on boot.
282
+
283
+ - Scrubbing at a higher rate because the monitor software has determined that
284
+ more reliability is necessary for a particular data set. This is called
285
+ Differentiated Reliability.
286
+
287
+ 1.1. Device based scrubbing
288
+
289
+ CXL memory is exposed to memory management subsystem and ultimately userspace
290
+ via CXL devices. Device-based scrubbing is used for the first use case
291
+ described in "Section 1 CXL Memory Patrol Scrub".
292
+
293
+ When combining control via the device interfaces and region interfaces,
294
+ "see Section 1.2 Region based scrubbing".
295
+
296
+ Sysfs files for scrubbing are documented in
297
+ `Documentation/ABI/testing/sysfs-edac-scrub `
298
+
299
+ 1.2. Region based scrubbing
300
+
301
+ CXL memory is exposed to memory management subsystem and ultimately userspace
302
+ via CXL regions. CXL Regions represent mapped memory capacity in system
303
+ physical address space. These can incorporate one or more parts of multiple CXL
304
+ memory devices with traffic interleaved across them. The user may want to control
305
+ the scrub rate via this more abstract region instead of having to figure out the
306
+ constituent devices and program them separately. The scrub rate for each device
307
+ covers the whole device. Thus if multiple regions use parts of that device then
308
+ requests for scrubbing of other regions may result in a higher scrub rate than
309
+ requested for this specific region.
310
+
311
+ Region-based scrubbing is used for the third use case described in
312
+ "Section 1 CXL Memory Patrol Scrub".
313
+
314
+ Userspace must follow below set of rules on how to set the scrub rates for any
315
+ mixture of requirements.
316
+
317
+ 1. Taking each region in turn from lowest desired scrub rate to highest and set
318
+ their scrub rates. Later regions may override the scrub rate on individual
319
+ devices (and hence potentially whole regions).
320
+
321
+ 2. Take each device for which enhanced scrubbing is required (higher rate) and
322
+ set those scrub rates. This will override the scrub rates of individual devices,
323
+ setting them to the maximum rate required for any of the regions they help back,
324
+ unless a specific rate is already defined.
325
+
326
+ Sysfs files for scrubbing are documented in
327
+ `Documentation/ABI/testing/sysfs-edac-scrub `
328
+
329
+ 2. CXL memory Error Check Scrub (ECS)
330
+
331
+ The Error Check Scrub (ECS) feature enables a memory device to perform error
332
+ checking and correction (ECC) and count single-bit errors. The associated
333
+ memory controller sets the ECS mode with a trigger sent to the memory
334
+ device. CXL ECS control allows the host, thus the userspace, to change the
335
+ attributes for error count mode, threshold number of errors per segment
336
+ (indicating how many segments have at least that number of errors) for
337
+ reporting errors, and reset the ECS counter. Thus the responsibility for
338
+ initiating Error Check Scrub on a memory device may lie with the memory
339
+ controller or platform when unexpectedly high error rates are detected.
340
+
341
+ Sysfs files for scrubbing are documented in
342
+ `Documentation/ABI/testing/sysfs-edac-ecs `
0 commit comments