On 19.05.2025 22:12, dm...@proton.me wrote: > From: Denis Mukhin <dmuk...@ford.com> > > The physical console input rotation depends on max_init_domid symbol, which is > managed differently across architectures. > > Instead of trying to manage max_init_domid in the arch-common code the console > input rotation code can be reworked by removing dependency on max_init_domid > entirely.
... at the expense of doing (worst case) 32k iterations just to find nothing (else). Iirc it was to avoid this why max_init_domid was introduced. > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -2460,6 +2460,35 @@ void domid_free(domid_t domid) > spin_unlock(&domid_lock); > } > > +/* > + * Find the ID of the next possible console owner domain. > + * > + * @return Domain ID: DOMID_XEN or non-system domain IDs within > + * the range of [0..CONFIG_MAX_DOMID-1]. > + */ > +domid_t domid_find_with_input_allowed(domid_t hint) > +{ > + struct domain *d; const? > + domid_t domid = DOMID_XEN; > + > + spin_lock(&domlist_update_lock); Why this heavy lock? Other functions iterating the list just use the RCU read lock. Jan