Re: [PATCH v4 28/28] tools/testing/cxl: Add DC Regions to mock mem data

Ira Weiny
2024-10-24T02:23:25Z

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

[snip]

> >
> > Signed-off-by: Ira Weiny <ira.weiny@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.

Thanks.

>
> > +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

Sure. done.

>
> > + 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.

Fixed.

Ira