RE: [PATCH v5 7/8] cxl/edac: Add CXL memory device memory sparing control feature

Shiju Jose
2025-05-19T21:34:16Z

>-----Original Message-----
>From: Dave Jiang <dave.jiang@intel.com>
>Sent: 19 May 2025 22:16
>To: Alison Schofield <alison.schofield@intel.com>; Shiju Jose
><shiju.jose@huawei.com>
>Cc: linux-cxl@vger.kernel.org; dan.j.williams@intel.com; Jonathan Cameron
><jonathan.cameron@huawei.com>; dave@stgolabs.net;
>vishal.l.verma@intel.com; ira.weiny@intel.com; linux-edac@vger.kernel.org;
>linux-doc@vger.kernel.org; bp@alien8.de; tony.luck@intel.com;
>lenb@kernel.org; Yazen.Ghannam@amd.com; mchehab@kernel.org;
>nifan.cxl@gmail.com; Linuxarm <linuxarm@huawei.com>; tanxiaofei
><tanxiaofei@huawei.com>; Zengtao (B) <prime.zeng@hisilicon.com>; Roberto
>Sassu <roberto.sassu@huawei.com>; kangkang.shen@futurewei.com;
>wanghuiqiang <wanghuiqiang@huawei.com>
>Subject: Re: [PATCH v5 7/8] cxl/edac: Add CXL memory device memory sparing
>control feature
>
>
>
>On 5/19/25 2:01 PM, Alison Schofield wrote:
>> On Thu, May 15, 2025 at 12:59:23PM +0100, shiju.jose@huawei.com wrote:
>>> From: Shiju Jose <shiju.jose@huawei.com>
>>>
>>
>> snip
>>
>>> diff --git a/drivers/cxl/core/edac.c b/drivers/cxl/core/edac.c index
>>> 489c9996bfbc..395d56457931 100644
>>> --- a/drivers/cxl/core/edac.c
>>> +++ b/drivers/cxl/core/edac.c
>>> @@ -21,7 +21,17 @@
>>> #include "core.h"
>>> #include "trace.h"
>>>
>>> -#define CXL_NR_EDAC_DEV_FEATURES 2
>>> +#define CXL_NR_EDAC_DEV_FEATURES 6
>>> +
>>> +static bool cxl_is_memdev_memory_online(const struct cxl_memdev
>>> +*cxlmd) {
>>> + struct cxl_port *port = cxlmd->endpoint;
>>> +
>>> + if (port && cxl_num_decoders_committed(port))
>>> + return true;
>>> +
>>> + return false;
>>> +}
>>>
>>
>> Looks like above fcn needs to be inside the below #ifdef.
>> Smatch is warning this when EDAC_SCRUB is off
This warning is with 'EDAC_MEM_REPAIR' is off.

>>
>> drivers/cxl/core/edac.c:27:13: warning: ‘cxl_is_memdev_memory_online’
>defined but not used [-Wunused-function]
>> 27 | static bool cxl_is_memdev_memory_online(const struct
>> cxl_memdev *cxlmd)
>>
>>
>>> #ifdef CONFIG_CXL_EDAC_SCRUB
>
>I think the function can be moved to above cxl_mem_perform_sparing() as that
>is the only function that calls it. I'll do that when I apply if there's nothing else
>major need to be changed.

Yes. Moving under "#ifdef CONFIG_CXL_EDAC_MEM_REPAIR" which is present
at the start of memory repair features, solved this warning.
Presently 'cxl_is_memdev_memory_online' is used in cxl_mem_perform_sparing() and
cxl_mem_perform_ppr() only though I thought it will be used in other parts of the CXL code.

>
>DJ
>
>
>>
>> snip to end.
>>
>

Thanks,
Shiju