[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc9adde2-2c07-4249-b788-63f50c8e429e@intel.com>
Date: Mon, 6 Oct 2025 09:13:43 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Neeraj Kumar <s.neeraj@...sung.com>
Cc: linux-cxl@...r.kernel.org, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org, gost.dev@...sung.com,
a.manzanares@...sung.com, vishak.g@...sung.com, neeraj.kernel@...il.com,
cpgs@...sung.com
Subject: Re: [PATCH V3 20/20] cxl/pmem: Add CXL LSA 2.1 support in cxl pmem
On 9/29/25 7:02 AM, Neeraj Kumar wrote:
> On 24/09/25 01:47PM, Dave Jiang wrote:
>>
>>> +++ b/drivers/cxl/core/pmem_region.c
>>> @@ -290,3 +290,56 @@ int devm_cxl_add_pmem_region(struct cxl_region *cxlr)
>>> return rc;
>>> }
>>> EXPORT_SYMBOL_NS_GPL(devm_cxl_add_pmem_region, "CXL");
>>> +
>>> +static int match_free_ep_decoder(struct device *dev, const void *data)
>>> +{
>>> + struct cxl_decoder *cxld = to_cxl_decoder(dev);
>>
>> I think this is needed if the function is match_free_ep_decoder().
>>
>> if (!is_endpoint_decoder(dev))
>> return 0;
>>
>
> Yes this check is required, I will add this.
>
>>> +
>>> + return !cxld->region;
>>> +}
>>
>> May want to borrow some code from match_free_decoder() in core/region.c. I think the decoder commit order matters?
>>
>
> Yes Dave, Looking at [1], seems commit order matters. Sure I will look
> at match_free_decoder() in core/region.c
> [1] https://lore.kernel.org/all/172964783668.81806.14962699553881333486.stgit@dwillia2-xfh.jf.intel.com/
>
>
>>> +
>>> +static struct cxl_decoder *cxl_find_free_ep_decoder(struct cxl_port *port)
>>> +{
>>> + struct device *dev;
>>> +
>>> + dev = device_find_child(&port->dev, NULL, match_free_ep_decoder);
>>> + if (!dev)
>>> + return NULL;
>>> +
>>> + /* Release device ref taken via device_find_child() */
>>> + put_device(dev);
>>
>> Should have the caller put the device.
>
> Its like taking device ref temporarly and releasing it then and there
> after finding proper root decoder. I believe, releasing device ref
> from caller would make it look little out of context.
As mentioned in my response to 15/20, the caller should be releasing the device reference since the caller is using the endpoint decoder. I would also add a comment to the new functions acquiring the decoders that the caller is expected to put_device() on the decoder dev when done.
DJ
>
>
> Regards,
> Neeraj
>
Powered by blists - more mailing lists