[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250320161847.GA892515@horms.kernel.org>
Date: Thu, 20 Mar 2025 16:18:47 +0000
From: Simon Horman <horms@...nel.org>
To: alejandro.lucero-palau@....com
Cc: 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, Alejandro Lucero <alucerop@....com>
Subject: Re: [PATCH v11 13/23] cxl: define a driver interface for DPA
allocation
On Mon, Mar 10, 2025 at 09:03:30PM +0000, alejandro.lucero-palau@....com wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> Region creation involves finding available DPA (device-physical-address)
> capacity to map into HPA (host-physical-address) space. Define an API,
> cxl_request_dpa(), that tries to allocate the DPA memory the driver
> requires to operate. The memory requested should not be bigger than the
> max available HPA obtained previously with cxl_get_hpa_freespace.
>
> Based on https://lore.kernel.org/linux-cxl/168592158743.1948938.7622563891193802610.stgit@dwillia2-xfh.jf.intel.com/
>
> Signed-off-by: Alejandro Lucero <alucerop@....com>
Hi Alejandro,
As reported by the Kernel Test Robot, in some circumstances this
patch fails to build.
I did not see this with x86_64 or arm64 allmodconfig.
But I did see the problem on ARM and was able to reproduce it (quickly)
like this using the toolchain here [*].
$ PATH=.../gcc-12.3.0-nolibc/arm-linux-gnueabi/bin:$PATH
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make allmodconfig
$ echo CONFIG_GCC_PLUGINS=n >> .config
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make oldconfig
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make drivers/cxl/core/hdm.o
...
CC [M] drivers/cxl/core/hdm.o
In file included from drivers/cxl/core/hdm.c:6:
./include/cxl/cxl.h:150:22: error: field 'dpa_range' has incomplete type
150 | struct range dpa_range;
| ^~~~~~~~~
./include/cxl/cxl.h:221:30: error: field 'range' has incomplete type
221 | struct range range;
|
[*] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/14.2.0/
...
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
...
> +/**
> + * cxl_request_dpa - search and reserve DPA given input constraints
> + * @cxlmd: memdev with an endpoint port with available decoders
> + * @is_ram: DPA operation mode (ram vs pmem)
> + * @min: the minimum amount of capacity the call needs
nit: @alloc should be documented instead of @min
> + *
> + * Given that a region needs to allocate from limited HPA capacity it
> + * may be the case that a device has more mappable DPA capacity than
> + * available HPA. So, the expectation is that @min is a driver known
> + * value for how much capacity is needed, and @max is the limit of
> + * how much HPA space is available for a new region.
> + *
> + * Returns a pinned cxl_decoder with at least @min bytes of capacity
> + * reserved, or an error pointer. The caller is also expected to own the
> + * lifetime of the memdev registration associated with the endpoint to
> + * pin the decoder registered as well.
> + */
> +struct cxl_endpoint_decoder *cxl_request_dpa(struct cxl_memdev *cxlmd,
> + bool is_ram,
> + resource_size_t alloc)
...
Powered by blists - more mailing lists