Re: [PATCH v4 21/28] cxl/extent: Process DCD events and realize region extents

Ira Weiny
2024-10-14T02:06:03Z

Li, Ming4 wrote:
> On 10/10/2024 3:49 AM, Ira Weiny wrote:
> > Li, Ming4 wrote:
> >> On 10/8/2024 7:16 AM, ira.weiny@intel.com wrote:
> >>> From: Navneet Singh <navneet.singh@intel.com>

[snip]

> > This should fix it:
> >
> > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> > index d66beec687a0..99200274dea8 100644
> > --- a/drivers/cxl/core/mbox.c
> > +++ b/drivers/cxl/core/mbox.c
> > @@ -1119,10 +1119,11 @@ static int cxl_send_dc_response(struct cxl_memdev_state *mds, int opcode,
> > if (rc)
> > return rc;
> > pl_index = 0;
> > + cnt -= pl_index;
>
> should update cnt before pl_index is reset to 0.

Of course.

>
> the cnt is a one of parameters of cxl_send_dc_response(), that means the
> caller gives the value of cnt, is that possible if the size of
> extent_array is larger than cnt?

No both callers ensure cnt is equal to the number of elements in the
array. Otherwise cxl_send_dc_response() would need to iterate the array
to determine this size itself. It is just more efficient to pass that
count which was already determined.

> Should skip remain extents in
> extent_array when cnt is equal to 0?
>

No not skip. But this makes me rethink this solution. The spec requires
a response even if 0 extents are accepted. That is what drove me to the
buggy solution before. I'll have to think on this a bit. I'd like to not
have weird gotos but that is the easiest solution I see.

Ira