Messages in this thread | | | Date | Mon, 7 Nov 2022 12:20:08 -0400 | From | Jason Gunthorpe <> | Subject | Re: [RFC PATCH v3 0/3] new subsystem for compute accelerator devices |
| |
On Sun, Nov 06, 2022 at 11:02:22PM +0200, Oded Gabbay wrote: > Another important change is that I have reverted back to use IDR for minor > handling instead of xarray. This is because I have found that xarray doesn't > handle well the scenario where you allocate a NULL entry and then exchange it > with a real pointer. It appears xarray still considers that entry a "zero" > entry. This is unfortunate because DRM works that way (first allocates a NULL > entry and then replaces the entry with a real pointer).
This is what XA_ZERO_ENTRY is for.
Some APIs, like xa_alloc automatically promote NULL to XA_ZERO_ENTRY, others require it to be explicit.
If you use the usual pattern of xa_alloc(NULL), xa_store(!NULL) then you should be fine, as far as I know. So long as the xarray was tagged as allocating.
Jason
| |