From: Yongxin Yang <yangyongxin@kylinos.cn>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>,
Ben Cheatham <benjamin.cheatham@amd.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jic23@kernel.org>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <iweiny@kernel.org>, Dan Williams <djbw@kernel.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7] cxl/core: Create EINJ debugfs files regardless of EINJ init order
Date: Wed, 18 Nov 2026 09:23:30 +0800 [thread overview]
Message-ID: <20261118010644.7308635-reply-yangyongxin@kylinos.cn> (raw)
In-Reply-To: <26224876-7946-4284-9f3a-5c90411b37d0@intel.com>
Hi Alison, Dave,
Thanks for catching this. You are right, and v7 trades one wrong state
for another: on a host without an EINJ table the files would be created
and every access would fail with -ENODEV, which is exactly what
4ed7952b9e87 set out to avoid. Since ndctl uses the presence of those
files as the signal, the compile time check is not a fix.
Let me describe what I think the real fix has to look like and check the
direction with you before I post v8.
The root cause is ordering. cxl_core_init() is a subsys_initcall and
einj_init() is a device_initcall (module_init), so with cxl_core built
in, the EINJ state is simply not known yet at the point where the files
are created. Whatever condition is evaluated there is a guess: the
runtime check always answers "not up" (the original bug), and the
compile time check always answers "up" (the regression you found). So
the creation has to move to where the answer exists, not the condition
be rewritten.
Planned for v8:
1. Revert both IS_ENABLED() uses. The files are again created only
when einj_cxl_is_initialized() is true at creation time, so nothing
appears on a host where EINJ never comes up.
2. Move the EINJ debugfs setup out of cxl_core_init() into a callback
that runs once EINJ is actually up: cxl core registers it from
cxl_core_init(), and einj invokes it right after einj_initialized is
set. The callback is idempotent, and cxl_core_init() still creates
the files directly when EINJ is already up, which covers the module
load order (einj.ko is a dependency of cxl_core.ko, so it is always
initialised first).
I did not use a late_initcall() for this because port.c already has
subsys_initcall(cxl_core_init), and for modules every initcall macro
expands to module_init(), so a second one in the same file does not
build. A separate file would not help either, since it would need
access to cxl_debugfs and to the port list.
3. The dport directories have the same window. With the runtime check
restored they are created as before for ports registered after EINJ
comes up, and the callback above walks the ports that were already
registered and creates the directories that were skipped.
4. On your second point, I will put the check in all three helpers so
einj_cxl_inject_error() and einj_cxl_inject_rch_error() no longer
depend on their caller. One small detail: the !CONFIG stubs return
-ENXIO while this series used -ENODEV. Do you want the helpers to
follow the stubs, or the stubs to follow the helpers?
I also see that the patch was dropped from cxl/fixes, and I take the
point about threading: v8 will be posted as a thread of its own, not as
a reply to v7.
This is only a design check, no code yet. Does that direction look
right? If so I will send v8 along those lines.
Thanks!
Yongxin
prev parent reply other threads:[~2026-11-18 1:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 3:24 [PATCH v5] cxl/core: Create einj_types " Yongxin Yang
2026-11-02 21:32 ` Cheatham, Benjamin
2026-11-03 5:36 ` [PATCH v6] cxl/core: Create EINJ debugfs files " Yongxin Yang
2026-11-03 21:31 ` Cheatham, Benjamin
2026-11-04 6:12 ` [PATCH v7] " Yongxin Yang
2026-11-16 2:33 ` Yongxin Yang
2026-11-16 22:27 ` Dave Jiang
2026-11-17 22:04 ` Alison Schofield
2026-11-17 22:38 ` Dave Jiang
2026-11-18 1:23 ` Yongxin Yang [this message]
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=20261118010644.7308635-reply-yangyongxin@kylinos.cn \
--to=yangyongxin@kylinos.cn \
--cc=alison.schofield@intel.com \
--cc=benjamin.cheatham@amd.com \
--cc=bp@alien8.de \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=tony.luck@intel.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®