From: Yuxiong Wang <yuxiong.wang@linux.alibaba.com>
To: dave@stgolabs.net, jonathan.cameron@huawei.com,
dave.jiang@intel.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com,
dan.j.williams@intel.com
Cc: ming.li@zohomail.com, rrichter@amd.com,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
Yuxiong Wang <yuxiong.wang@linux.alibaba.com>,
Huang Ying <ying.huang@linux.alibaba.com>
Subject: [PATCH] cxl: Fix premature commit_end increment on decoder commit failure
Date: Thu, 29 Jan 2026 14:45:52 +0800 [thread overview]
Message-ID: <20260129064552.31180-1-yuxiong.wang@linux.alibaba.com> (raw)
In cxl_decoder_commit(), commit_end is incremented before verifying whether the
commit succeeded, and the CXL_DECODER_F_ENABLE bit in cxld->flags is only set
after a successful commit. As a result, if the commit fails, commit_end has been
incremented and cxld->reset() has no effect since the flag is not set, so commit_end
remains incorrectly incremented. The inconsistency between commit_end and
CXL_DECODER_F_ENABLE causes failure during subsequent either commit or reset
operations.
Fix this by incrementing commit_end only after confirming the commit succeeded.
Also, remove the ineffective cxld->reset() call. According to CXL 3.2 Spec 8.2.4.20.12
Committing Decoder Programming, since cxld_await_commit() has cleared the decoder
commit bit on failure, no additional reset is required.
Fixes: 176baef ("cxl/hdm: Commit decoder state to hardware")
Signed-off-by: Yuxiong Wang <yuxiong.wang@linux.alibaba.com>
Acked-by: Huang Ying <ying.huang@linux.alibaba.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
---
Change log:
* Added CXL 3.2 Spec 8.2.4.20.12 Committing Decoder Programming statement. Thanks
Alison.
* Collected reviewed-by. Thanks Dave and Alison.
RFC Link: https://lore.kernel.org/linux-cxl/aXqKC-bscufh1ggq@aschofie-mobl2.lan/
---
drivers/cxl/core/hdm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index eb5a3a7640c6..912f648a6b7a 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -844,14 +844,13 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
scoped_guard(rwsem_read, &cxl_rwsem.dpa)
setup_hw_decoder(cxld, hdm);
- port->commit_end++;
rc = cxld_await_commit(hdm, cxld->id);
if (rc) {
dev_dbg(&port->dev, "%s: error %d committing decoder\n",
dev_name(&cxld->dev), rc);
- cxld->reset(cxld);
return rc;
}
+ port->commit_end++;
cxld->flags |= CXL_DECODER_F_ENABLE;
return 0;
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-01-29 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 6:45 Yuxiong Wang [this message]
2026-01-29 17:47 ` [PATCH] cxl: Fix premature commit_end increment on decoder commit failure Alison Schofield
2026-01-30 3:11 ` Yuxiong Wang
2026-01-30 16:16 ` Dave Jiang
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=20260129064552.31180-1-yuxiong.wang@linux.alibaba.com \
--to=yuxiong.wang@linux.alibaba.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=ming.li@zohomail.com \
--cc=rrichter@amd.com \
--cc=vishal.l.verma@intel.com \
--cc=ying.huang@linux.alibaba.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