From: Richard Cheng <icheng@nvidia.com>
To: dave@stgolabs.net, jic23@kernel.org, dave.jiang@intel.com,
alison.schofield@intel.com, vishal.l.verma@intel.com,
djbw@kernel.org, danwilliams@nvidia.com
Cc: iweiny@kernel.org, ming.li@zohomail.com, shiju.jose@huawei.com,
alucerop@amd.com, linux-cxl@vger.kernel.org,
linux-kernel@vger.kernel.org, kobak@nvidia.com,
kaihengf@nvidia.com, newtonl@nvidia.com, kristinc@nvidia.com,
mochs@nvidia.com, Richard Cheng <icheng@nvidia.com>
Subject: [PATCH] cxl/mbox: Serialize RAW Get/Set Feature commands
Date: Tue, 14 Jul 2026 11:10:10 +0800 [thread overview]
Message-ID: <20260714031010.14834-1-icheng@nvidia.com> (raw)
Dave Jiang's patch [1] adds feat_mutex to serialize kernel-managed Get
and Set Feature operations. However, the RAW command path calls
mbox_send() directly and bypasses cxl_get_feature() and
cxl_set_feature().
Take feat_mutex around each RAW Get and Set Feature mailbox send. This
prevents individual RAW Feature commands from interleaving with
kernel-managed Feature helper loops. Other RAW commands are unchanged.
[1]:
https://lore.kernel.org/linux-cxl/20260709155841.1895915-1-dave.jiang@intel.com/
Signed-off-by: Richard Cheng <icheng@nvidia.com>
---
drivers/cxl/core/mbox.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 0370ac39ec4a..55b0c3ac1ede 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -599,6 +599,8 @@ static int handle_mailbox_cmd_from_user(struct cxl_mailbox *cxl_mbox,
u32 *retval)
{
struct device *dev = cxl_mbox->host;
+ bool is_feature_cmd = mbox_cmd->opcode == CXL_MBOX_OP_GET_FEATURE ||
+ mbox_cmd->opcode == CXL_MBOX_OP_SET_FEATURE;
int rc;
dev_dbg(dev,
@@ -608,7 +610,11 @@ static int handle_mailbox_cmd_from_user(struct cxl_mailbox *cxl_mbox,
cxl_mem_opcode_to_name(mbox_cmd->opcode),
mbox_cmd->opcode, mbox_cmd->size_in);
+ if (is_feature_cmd)
+ mutex_lock(&cxl_mbox->feat_mutex);
rc = cxl_mbox->mbox_send(cxl_mbox, mbox_cmd);
+ if (is_feature_cmd)
+ mutex_unlock(&cxl_mbox->feat_mutex);
if (rc)
goto out;
--
2.43.0
next reply other threads:[~2026-07-14 3:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 3:10 Richard Cheng [this message]
2026-07-14 3:21 ` [PATCH] cxl/mbox: Serialize RAW Get/Set Feature commands sashiko-bot
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=20260714031010.14834-1-icheng@nvidia.com \
--to=icheng@nvidia.com \
--cc=alison.schofield@intel.com \
--cc=alucerop@amd.com \
--cc=danwilliams@nvidia.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=kaihengf@nvidia.com \
--cc=kobak@nvidia.com \
--cc=kristinc@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=mochs@nvidia.com \
--cc=newtonl@nvidia.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.