[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9a37931d-0e40-4b46-bf2d-93b6c98aa2fd@amd.com>
Date: Mon, 12 May 2025 11:38:00 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Alison Schofield <alison.schofield@...el.com>,
alejandro.lucero-palau@....com
Cc: linux-cxl@...r.kernel.org, netdev@...r.kernel.org,
dan.j.williams@...el.com, edward.cree@....com, davem@...emloft.net,
kuba@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
dave.jiang@...el.com, Ben Cheatham <benjamin.cheatham@....com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v14 09/22] cxl: prepare memdev creation for type2
On 5/8/25 02:06, Alison Schofield wrote:
> On Thu, Apr 17, 2025 at 10:29:12PM +0100, alejandro.lucero-palau@....com wrote:
>> From: Alejandro Lucero <alucerop@....com>
>>
>> Current cxl core is relying on a CXL_DEVTYPE_CLASSMEM type device when
>> creating a memdev leading to problems when obtaining cxl_memdev_state
>> references from a CXL_DEVTYPE_DEVMEM type.
>>
>> Modify check for obtaining cxl_memdev_state adding CXL_DEVTYPE_DEVMEM
>> support.
>>
>> Make devm_cxl_add_memdev accessible from a accel driver.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> Reviewed-by: Ben Cheatham <benjamin.cheatham@....com>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
>> Reviewed-by: Dave Jiang <dave.jiang@...el.com>
snip
>>
>> rc = devm_add_action_or_reset(dev, remove_debugfs, dentry);
>> if (rc)
>> @@ -219,6 +225,13 @@ static umode_t cxl_mem_visible(struct kobject *kobj, struct attribute *a, int n)
>> struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
>> struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds);
>>
>> + /*
>> + * Avoid poison sysfs files for Type2 devices as they rely on
>> + * cxl_memdev_state.
>> + */
>> + if (!mds)
>> + return 0;
>> +
> The above 2 'if (!mds)' seem like indirect methods to avoid Type 2
> devices. How about:
>
> /* Type 2, CXL_DEVTYPE_DEVMEM, excluded from poison setup */
> if (cxlds->type == CXL_DEVTYPE_CLASSMEM) {
>
Hi Allison,
I forgot this one.
I think it is better to leave the current check because it makes
explicit the problem of cxl_memdev_state being null for Type2.
Thanks
>
> snip
>
Powered by blists - more mailing lists