Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wei Hou" <wei.hou@scaleflux.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()
Date: Thu, 18 Jun 2026 17:18:08 +0000	[thread overview]
Message-ID: <20260618171809.2ABDF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618170356.25382-1-wei.hou@scaleflux.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The driver swallows -EPROBE_DEFER (and potentially other errors like -ENOMEM) returned from cxl_pci_setup_regs() when initializing component registers. For Restricted CXL Host (RCH) topologies, cxl_pci_setup_regs() explicitly returns -EPROBE_DEFER if the upstream port isn't initialized yet. However, cxl_pci_probe() only logs a warning and falls through, where the rc variable is subsequently overwritten by cxl_pci_type3_init_mailbox(cxlds). As a result, the probe succeeds and the device binds permanently without its component registers, disabling features like RAS.
--

commit 4e1380c792dda7219b704feca6c3a617dfdf2972
Author: Wei Hou <wei.hou@scaleflux.com>

cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()

This commit removes the mailbox validation check from
cxl_pci_type3_init_mailbox() since mailbox presence is already verified
by the MEMDEV probe. It notes that missing component registers should
not prevent initialization.

> The driver's design intent is that missing or malformed component
> registers should not prevent mailbox initialization. cxl_pci_probe()
> already reflects this: the CXL_REGLOC_RBI_COMPONENT setup path only
> emits a dev_warn() and continues when component registers are absent,
> rather than returning an error.

[Severity: High]
This is a pre-existing issue, but does this design intent inadvertently
swallow -EPROBE_DEFER or other errors like -ENOMEM?

If cxl_pci_setup_regs() returns -EPROBE_DEFER (such as for Restricted CXL
Host topologies when the upstream port isn't initialized yet),
cxl_pci_probe() logs a warning and continues. The rc variable is then
immediately overwritten:

drivers/cxl/pci.c:cxl_pci_probe() {
    ...
	rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT,
				&cxlds->reg_map);
	if (rc)
		dev_warn(&pdev->dev, "No component registers (%d)\n", rc);
	else if (!cxlds->reg_map.component_map.ras.valid)
		dev_dbg(&pdev->dev, "RAS registers not found\n");

	rc = cxl_pci_type3_init_mailbox(cxlds);
    ...
}

Will this cause the probe to succeed without component registers and
bypass probe deferral, permanently disabling features like RAS?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260618170356.25382-1-wei.hou@scaleflux.com?part=1

      reply	other threads:[~2026-06-18 17:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 17:03 [PATCH] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox() Wei Hou
2026-06-18 17:18 ` sashiko-bot [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=20260618171809.2ABDF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wei.hou@scaleflux.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