On Thu, Nov 10, 2022 at 11:59:02PM +1000, David Gwynne wrote:
> On Thu, Nov 10, 2022 at 09:04:22PM +1000, David Gwynne wrote:
> > On Thu, Nov 10, 2022 at 08:10:35AM +1000, David Gwynne wrote:
> > > I know what this is. The barrier at the end of if_idxmap_alloc is
> > > sleeping waiting for cpus to run that aren't running cos we haven't
> > > finished booting yet.
> > >
> > > I'll back it out and fix it up when I'm actually awake.
> >
> > i woke up, so here's a diff.
> >
> > this uses the usedidx as an smr_entry so we can use smr_call instead of
> > smr_barrier during autoconf.
> >
> > this works for me on a box with a lot of hardware interfaces, which
> > forces allocation of a new interface map and therefore destruction of
> > the initial one.
> >
> > there is still an smr_barrier in if_idxmap_remove, but remove only
> > happens when an interface goes away. we could use part of struct ifnet
> > (eg, if_description) as an smr_entry if needed.
> >
>
> this one is even better.
Please add #include <sys/smr.h>.
> + SMR_PTR_SET_LOCKED(&if_idxmap.map, if_map);
> +
> + smr_init(&dtor->smr);
> + dtor->map = oif_map;
I think smr_call could be moved here. The call is non-blocking.
Then the scope of the dtor variable could be reduced too.
dtor->map = oif_map;
smr_init(&dtor->smr);
smr_call(&dtor->smr, if_idxmap_free, dtor);
OK visa@