From: Yili Zhang <zhangyili01@baidu.com>
To: <alison.schofield@intel.com>
Cc: <dave.jiang@intel.com>, <dave@stgolabs.net>, <jic23@kernel.org>,
<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<shiju.jose@huawei.com>, <vishal.l.verma@intel.com>,
<zhangyili01@baidu.com>
Subject: Re: [PATCH] cxl/edac: Bounds-check ECS threshold index from device
Date: Wed, 30 Sep 2026 17:09:23 +0800 [thread overview]
Message-ID: <20260930090923.29654-1-zhangyili01@baidu.com> (raw)
In-Reply-To: <arv6_znTtwN4JExY@aschofie-mobl2.lan>
On 2026-09-29 10:53, Alison Schofield wrote:
>
> Hi Yili,
>
> I see the appeal of keeping this as the smallest possible fix, but is the
> existing behavior for 0-2 something we intentionally want to preserve, or
> just how the current implementation works?
>
> Documentation/ABI/testing/sysfs-edac-ecs lists 256, 1024, and 4096 as the
> threshold values. If 0 is meant to represent a reserved encoding, should
> that be part of the documented ABI?
Hi Alison,
You're right on both counts.
The 0-2 behavior is not something we want to preserve; it is just
an artifact of the sparse array's implicit zero-fill. The ABI documentation
only lists 256, 1024 and 4096 as supported values, so rather than documenting
0 as well, make the read fail for all reserved encodings and only ever report
the documented values.
> Does CXL_ECS_GET_ATTR() itself prevent that? It already has an int return
> path and can return errors from cxl_mem_ecs_get_attrbs().
>
> Is the real limitation just the interface used by the cxl_get_ecs_*()
> helpers? Would something like this work:
>
>
> static int cxl_get_ecs_threshold(u8 log_cap, u16 config, u16 *threshold)
> {
> u8 index = FIELD_GET(CXL_ECS_THRESHOLD_COUNT_MASK, config);
>
> if (index >= ARRAY_SIZE(ecs_supp_threshold) ||
> !ecs_supp_threshold[index])
> return -EINVAL;
>
> *threshold = ecs_supp_threshold[index];
> return 0;
> }
And you're correct that CXL_ECS_GET_ATTR() already propagates errors;
the only real limitation was the helper signature, as you sketched.
v2 restructures the cxl_get_ecs_*() helpers to return int with an
output parameter and updates the macro accordingly.
v2 follows shortly.
Thanks,
Yili
next prev parent reply other threads:[~2026-09-30 9:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 7:35 Yili Zhang
2026-09-28 18:21 ` Dave Jiang
2026-09-29 3:17 ` Yili Zhang
2026-09-29 17:53 ` Alison Schofield
2026-09-30 9:09 ` Yili Zhang [this message]
2026-09-30 9:56 ` [PATCH v2] cxl/edac: Fail ECS threshold read for reserved encodings Yili Zhang
2026-10-20 21:27 ` Jonathan Cameron
2026-10-21 13:14 ` Yili Zhang
2026-10-21 15:58 ` Alison Schofield
2026-10-29 12:37 ` Yili Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930090923.29654-1-zhangyili01@baidu.com \
--to=zhangyili01@baidu.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shiju.jose@huawei.com \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®