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

From: Srivatsa Vaddagiri
Date: Fri Feb 03 2023 - 12:56:46 EST


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

> * Elliot Berman <quic_eberman@xxxxxxxxxxx> [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