All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: alejandro.lucero-palau@amd.com
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v29 4/5] sfc: obtain and map cxl range using devm_cxl_probe_mem
Date: Tue, 23 Jun 2026 12:40:54 +0000	[thread overview]
Message-ID: <20260623124055.291BB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622124010.2192888-5-alejandro.lucero-palau@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Resource Teardown Ordering Violation in efx_pci_remove
- [High] Missing Hardware State Restoration for CXL HDM Decoders After FLR
--

commit cd561fb9993e195accb646b7a8524a13a2dd0b79
Author: Alejandro Lucero <alucerop@amd.com>
Subject: sfc: obtain and map cxl range using devm_cxl_probe_mem

This commit introduces CXL support to the sfc driver by creating a CXL
memory device using devm_cxl_probe_mem() and mapping the CXL range for
CTPIO buffer usage.

> diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
> --- a/drivers/net/ethernet/sfc/efx.c
> +++ b/drivers/net/ethernet/sfc/efx.c
> @@ -984,6 +984,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
>  	efx_fini_io(efx);
>  
>  	probe_data = container_of(efx, struct efx_probe_data, efx);
> +	efx_cxl_exit(probe_data);

[Severity: High]
Does this tear down resources in the correct order?

efx_fini_io() calls pci_disable_device() which disables memory decoding for
the endpoint.

Because the CXL memdev and its sysfs interfaces are managed by devres
(created via devm_cxl_probe_mem() during probe), they remain active until
devres_release_all() runs after efx_pci_remove() returns.

If userspace (e.g., CXL utilities, udev) accesses the CXL sysfs attributes
in this window, the CXL core will attempt to read memory-mapped component
registers on the disabled device.

Could this result in PCIe Unsupported Requests (UR) and a fatal AER fault or
kernel panic?

>  
>  	pci_dbg(efx->pci_dev, "shutdown successful\n");

[ ... ]

> diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
> --- a/drivers/net/ethernet/sfc/efx_cxl.c
> +++ b/drivers/net/ethernet/sfc/efx_cxl.c

[ ... ]

> @@ -73,9 +74,31 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>  		return -ENODEV;
>  	}
>  
> +	cxl->cxlmd = devm_cxl_probe_mem(&cxl->cxlds, &cxl_pio_range);

[Severity: High]
Is there a mechanism to restore the CXL HDM decoders after a Function Level
Reset (FLR)?

When the driver performs a device reset via pci_reset_function() (e.g.,
during efx_mcdi_reset() in drivers/net/ethernet/sfc/mcdi.c to recover from
an MCDI timeout), the PCIe endpoint undergoes an FLR. This wipes the
internal device state, including the CXL Component Registers and HDM
decoders.

While the PCI core automatically saves and restores standard configuration
space, it does not restore the memory-mapped CXL HDM decoders.

Without notifying the CXL core or manually re-initializing the CXL DPA
capacity and reprogramming the HDM decoders, the device silently stops
decoding the physical address range mapped to cxl->ctpio_cxl.

Could subsequent PIO packet transmissions to the ctpio_cxl mapping trigger
PCIe Unsupported Requests (UR) and lead to AER faults or kernel panics?

> +	if (IS_ERR(cxl->cxlmd)) {
> +		pci_err(pci_dev, "CXL accel memdev creation failed\n");
> +		return PTR_ERR(cxl->cxlmd);
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260622124010.2192888-1-alejandro.lucero-palau@amd.com?part=4

  reply	other threads:[~2026-06-23 12:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 12:40 [PATCH v29 0/5] Type2 device basic support alejandro.lucero-palau
2026-06-22 12:40 ` [PATCH v29 1/5] sfc: add cxl support alejandro.lucero-palau
2026-06-22 12:40 ` [PATCH v29 2/5] cxl/sfc: Map cxl regs alejandro.lucero-palau
2026-06-23 12:40   ` sashiko-bot
2026-06-22 12:40 ` [PATCH v29 3/5] cxl/sfc: Initialize dpa without a mailbox alejandro.lucero-palau
2026-06-22 12:40 ` [PATCH v29 4/5] sfc: obtain and map cxl range using devm_cxl_probe_mem alejandro.lucero-palau
2026-06-23 12:40   ` sashiko-bot [this message]
2026-06-22 12:40 ` [PATCH v29 5/5] sfc: support pio mapping based on cxl alejandro.lucero-palau
2026-06-23 12:40   ` 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=20260623124055.291BB1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.