[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <682e3f3343977_1626e100b0@dwillia2-xfh.jf.intel.com.notmuch>
Date: Wed, 21 May 2025 14:01:39 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: <alejandro.lucero-palau@....com>, <linux-cxl@...r.kernel.org>,
<netdev@...r.kernel.org>, <dan.j.williams@...el.com>, <edward.cree@....com>,
<davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
<edumazet@...gle.com>, <dave.jiang@...el.com>
CC: Alejandro Lucero <alucerop@....com>, Martin Habets
<habetsm.xilinx@...il.com>, Edward Cree <ecree.xilinx@...il.com>, "Jonathan
Cameron" <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v16 20/22] sfc: create cxl region
alejandro.lucero-palau@ wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> Use cxl api for creating a region using the endpoint decoder related to
> a DPA range specifying no DAX device should be created.
>
> Signed-off-by: Alejandro Lucero <alucerop@....com>
> Reviewed-by: Martin Habets <habetsm.xilinx@...il.com>
> Acked-by: Edward Cree <ecree.xilinx@...il.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> ---
> drivers/net/ethernet/sfc/efx_cxl.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
> index 20db9aa382ec..960293a04ed3 100644
> --- a/drivers/net/ethernet/sfc/efx_cxl.c
> +++ b/drivers/net/ethernet/sfc/efx_cxl.c
> @@ -110,10 +110,19 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
> goto sfc_put_decoder;
> }
>
> + cxl->efx_region = cxl_create_region(cxl->cxlrd, cxl->cxled, 1, true);
> + if (IS_ERR(cxl->efx_region)) {
> + pci_err(pci_dev, "CXL accel create region failed");
> + rc = PTR_ERR(cxl->efx_region);
> + goto err_region;
> + }
> +
> probe_data->cxl = cxl;
>
> return 0;
>
> +err_region:
> + cxl_dpa_free(cxl->cxled);
> sfc_put_decoder:
> cxl_put_root_decoder(cxl->cxlrd);
> return rc;
> @@ -122,6 +131,7 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
> void efx_cxl_exit(struct efx_probe_data *probe_data)
> {
> if (probe_data->cxl) {
> + cxl_accel_region_detach(probe_data->cxl->cxled);
Here is more late magic hoping that cxl_accel_region_detach() can
actually find something useful to do at this point. I notice that this
series has dropped the cxl_acquire_endpoint() proposal which at least
guaranteed a consistent state of the world throughout this whole
process.
Did I miss the discussion where that approach was abandoned?
The idea would be that at setup time you do:
add_memdev()
acquire_endpoint()
register_hdm_error_handlers()
get_hpa()
get_dpa()
create_region()
release_endpoint()
...where that new register_hdm_error_handlers() is what coordinates
cleaning up everything the type-2 driver cares about upon the memdev
being detached from the CXL topology.
Then your efx_cxl_exit() is automatically handled by:
del_memdev()
...which includes detaching the memdev from the cxl topology.
> cxl_dpa_free(probe_data->cxl->cxled);
> cxl_put_root_decoder(probe_data->cxl->cxlrd);
Otherwise, these long held references are not buying you anything but
the ability to determine "whoops, should have let go of these
resources a long time ago, everything I needed for cleanup is now in a
defunct state".
Powered by blists - more mailing lists