On Sun, May 18, 2025 at 10:52:24AM +0200, Jan Beulich wrote: > On 16.05.2025 04:04, dm...@proton.me wrote: > > From: Denis Mukhin <dmuk...@ford.com> > > > > Currently, hypervisor code has two different non-system domain ID allocation > > implementations: > > > > (a) Sequential IDs allocation in dom0less Arm code based on > > max_init_domid; > > > > (b) Sequential IDs allocation in XEN_DOMCTL_createdomain; does not use > > max_init_domid (both Arm and x86). > > > > It makes sense to have a common helper code for such task across > > architectures > > (Arm and x86) and between dom0less / toolstack domU allocation. > > > > Wrap the domain ID allocation as an arch-independent function domid_alloc() > > in > > common/domain.c based on rangeset. > > > > Allocation algorithm: > > - If an explicit domain ID is provided, verify its availability and > > use it if ID is not used; > > - Otherwise, perform an exhaustive search starting from the end of the used > > domain ID range. domid_alloc() guarantees that two subsequent calls will > > result in different IDs allocation. > While you properly retain original logic now, the above is not an accurate > description thereof, imo. To search "from the end" usually is understood as > a backwards search. Whereas what you mean is that the search starts off where > the last one finished, wrapping around when hitting the end of the valid > range.
I have updated the description in v7: https://lore.kernel.org/xen-devel/20250519192306.1364471-2-dmuk...@ford.com/ > > Jan >