[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bb1fb0f-cc74-4853-a9fc-2bf96cd66ee4@amd.com>
Date: Fri, 6 Jun 2025 14:44:27 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Dan Williams <dan.j.williams@...el.com>, alejandro.lucero-palau@....com,
linux-cxl@...r.kernel.org, netdev@...r.kernel.org, edward.cree@....com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, dave.jiang@...el.com
Cc: 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
On 5/21/25 22:01, Dan Williams wrote:
> 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?
As I have commented in patch 12, I was not contemplating those modules
to be removed while the SFC driver depends on them.
>
> 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.
For clarification, we assume this detachment being due to cxl_mem or
cxl_acpi being removed therefore contemplating a clean unwind which has
to be implemented. Correct?
>
> 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