From: "Cheatham, Benjamin" <benjamin.cheatham@amd.com>
To: Yongxin Yang <yangyongxin@kylinos.cn>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v3] cxl/core: Create einj_types when EINJ becomes available
Date: Thu, 29 Oct 2026 12:06:40 -0500 [thread overview]
Message-ID: <7a22cc6a-deba-40e6-8033-97d1234420ba@amd.com> (raw)
In-Reply-To: <20261029065629.333949-1-yangyongxin@kylinos.cn>
Hi Yang, thanks for walking through your reasoning in the last revision. It made looking through
the changes here much easier!
Nit-picky comments in line :)
On 10/29/2026 1:56 AM, Yongxin Yang wrote:
> [You don't often get email from yangyongxin@kylinos.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Yang Yongxin <yangyongxin@kylinos.cn>
>
> The einj_types file under the CXL debugfs directory is never created.
>
I think this should be "The einj_types file under the CXL debugfs directory
is never created when cxl_core is built-in", but I haven't looked in a while.
I remember you saying something about subsys_initcall() being downgraded to a
module_init() when cxl_core is built-in, and it looks like that's the case
after a quick look at the macro definition. So module dependencies should
cause the file creation to happen post EINJ init when both cxl_core and einj_cxl
are modules, in which case the file will be there.
That's probably why I never noticed this either, I (like most people) almost always
set everything CXL related to 'm' when compiling a kernel...
> cxl_core_init() runs at subsys_initcall level, while EINJ registers itself
> from einj_init() at device_initcall level. When cxl_core_init() evaluates
> einj_cxl_is_initialized() the built-in EINJ driver has not been initialized
> yet, so the value is always false and the debugfs_create_file("einj_types")
> call below it is never reached. Users have no way to discover which CXL
> error types the platform supports from debugfs.
>
> Create the file from every point that can tell EINJ is up: cxl_core_init()
> covers cxl_core being a module loaded after EINJ has been initialized;
> cxl_acpi_probe() covers the same case for cxl_acpi and also systems where
> the CEDT is parsed but no dport is ever added; and the dport probe path
I would rather this not mention the case where no dport is ever added and
instead talk about the RCH/RCD case. If there's no dport ever added then
error injection isn't possible and this file is useless, so there's not
really a point in bringing it up.
> covers the built-in case, where the dport added from the memdev probe is
> the only hook reached after einj_init().
>
> The dport probe path can run concurrently for different parent ports, each
> holding only its own device lock, so serialize the check and the create to
> avoid a duplicate debugfs_create_file() attempt that would only fail with
> -EEXIST. Reset the cached dentry in cxl_core_exit() so that reloading
> cxl_core starts from a clean state.
>
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Cc: <stable@vger.kernel.org>
> Link: https://lore.kernel.org/all/de14c4ef-e3d8-432f-9ce8-87c468d6d2ad@amd.com/
> Signed-off-by: Yang Yongxin <yangyongxin@kylinos.cn>
> ---
The contents of the patch look good to me, so with the changes to the description
and comment below:
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
> Changes in v3:
> - Take the review from Ben: the helper is now cxl_debugfs_einj_add_types(),
> non-static, declared in cxl.h and exported to cxl_acpi only, so that the
> cxl_acpi hook can call it.
> - Add the cxl_acpi_probe() hook, before cxl_bus_rescan(), so the file is
> created once the CXL topology exists instead of waiting for a dport.
> - Keep the dport path as a retry point. With EINJ built in, cxl_core_init()
> and cxl_acpi_probe() both run before einj_init(), so dropping it would
> still leave the file uncreated there.
> - Drop the "RCH is out of scope" paragraph. RCH does add a dport, from
> add_host_bridge_dport(); the file is still not created there when EINJ is
> built in, so do not claim the acpi hook fixes RCH.
> - Reset einj_types_dentry and cxl_debugfs in cxl_core_exit(), so that a
> reloaded cxl_core does not keep a stale pointer and lose the file.
> - Use guard(mutex) instead of mutex_lock()/mutex_unlock().
>
> drivers/cxl/acpi.c | 9 +++++++++
> drivers/cxl/core/port.c | 41 +++++++++++++++++++++++++++++++++++------
> drivers/cxl/cxl.h | 2 ++
> 3 files changed, 46 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 3b818adbd38b..0584245b30f2 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -958,6 +958,15 @@ static int cxl_acpi_probe(struct platform_device *pdev)
> if (rc < 0)
> return rc;
>
> + /*
> + * Create einj_types from here as well, so the file also shows up when
> + * cxl_acpi is a module loaded after EINJ, and on systems where the
> + * CEDT is parsed but no dport is ever added (no CHBS for the host
> + * bridge, or a CHBS without a valid component register base), which
Same thing as in the commit description, just mention the RCH/RCD case here instead.
Thanks,
Ben
next prev parent reply other threads:[~2026-10-29 17:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 5:54 [PATCH] " Yongxin Yang
2026-10-28 8:49 ` [PATCH v2] " Yongxin Yang
2026-10-28 20:46 ` Cheatham, Benjamin
2026-10-29 6:56 ` [PATCH v3] " Yongxin Yang
2026-10-29 17:06 ` Cheatham, Benjamin [this message]
2026-10-30 3:20 ` [PATCH v4] " Yongxin Yang
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=7a22cc6a-deba-40e6-8033-97d1234420ba@amd.com \
--to=benjamin.cheatham@amd.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
--cc=yangyongxin@kylinos.cn \
/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®