On Mon, 07 Oct 2024 18:16:34 -0500
Ira Weiny <ira.we...@intel.com> wrote:

> cxl_test provides a good way to ensure quick smoke and regression
> testing.  The complexity of Dynamic Capacity (DC) extent processing as
> well as the complexity of the new sparse DAX regions can mostly be
> tested through cxl_test.  This includes management of sparse regions and
> DAX devices on those regions; the management of extent device lifetimes;
> and the processing of DCD events.
> 
> The only missing functionality from this test is actual interrupt
> processing.
> 
> Mock memory devices can easily mock DC information and manage fake
> extent data.
> 
> Define mock_dc_region information within the mock memory data.  Add
> sysfs entries on the mock device to inject and delete extents.
> 
> The inject format is <start>:<length>:<tag>:<more_flag>
> The delete format is <start>:<length>
> 
> Directly call the event irq callback to simulate irqs to process the
> test extents.
> 
> Add DC mailbox commands to the CEL and implement those commands.
> 
> Signed-off-by: Ira Weiny <ira.we...@intel.com>

Superficial review only.

Looks fine to me but I've been reviewing too long today to be at all sure
I'd spot if it was wrong in a subtle way.  So no tag for now.

> +static void dc_delete_extent(struct device *dev, unsigned long long start,
> +                          unsigned long long length)
> +{
> +     struct cxl_mockmem_data *mdata = dev_get_drvdata(dev);
> +     unsigned long long end = start + length;
> +     struct cxl_extent_data *ext;
> +     unsigned long index;
> +
> +     dev_dbg(dev, "Deleting extent at %#llx len:%#llx\n", start, length);
> +
> +     guard(mutex)(&mdata->ext_lock);
> +     xa_for_each(&mdata->dc_extents, index, ext) {
> +             u64 extent_end = ext->dpa_start + ext->length;
> +
> +             /*
> +              * Any extent which 'touches' the released delete range will be
> +              * removed.
> +              */
> +             if ((start <= ext->dpa_start && ext->dpa_start < end) ||
> +                 (start <= extent_end && extent_end < end)) {
Really trivial but no {} for single line statement

> +                     xa_erase(&mdata->dc_extents, ext->dpa_start);
> +             }
> +     }
> +
> +     /*
> +      * If the extent was accepted let it be for the host to drop
> +      * later.
> +      */
> +}

> @@ -1703,14 +2146,261 @@ static ssize_t sanitize_timeout_store(struct device 
> *dev,
>  
>       return count;
>  }
> -
Noise.

>  static DEVICE_ATTR_RW(sanitize_timeout);
>  


Reply via email to