Re: [PATCH v9 21/27] gunyah: vm_mgr: Add framework to add VM Functions

Srivatsa Vaddagiri
2023-02-03T17:56:46Z

* Srivatsa Vaddagiri <quic_svaddagi@quicinc.com> [2023-02-03 15:07:14]:

> * Elliot Berman <quic_eberman@quicinc.com> [2023-01-20 14:46:20]:
>
> > +static struct gunyah_vm_function_driver *__find_function(const char name[GUNYAH_FUNCTION_NAME_SIZE])
> > + __must_hold(functions_lock)
> > +{
> > + struct gunyah_vm_function_driver *iter, *drv = NULL;
> > +
> > + list_for_each_entry(iter, &functions, list) {
> > + if (!strncmp(iter->name, name, GUNYAH_FUNCTION_NAME_SIZE)) {
> > + drv = iter;
> > + break;
> > + }
> > + }
>
> Not sure how much of a hot path this is going to sit in. I can imagine VM boot
> to be in fast path for some cases (VMs spawned on usecase boundaries - I think
> some VMs like in Amazon firecracker boot in fraction of a second). This
> indirection could cost that a bit (linear search + strcmp for the right
> function). IMHO a direct interface (ex: ADD_IOEVENTFD) will be more efficient.

At the minimum, I think you can make iter->name an enum, which will make the
search faster.

-vatsa