[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [XEN PATCH for-4.13 v3 6/7] libxl: Introduce libxl__ev_immediate



On Mon, Nov 18, 2019 at 05:28:17PM +0000, Ian Jackson wrote:
> Anthony PERARD writes ("[XEN PATCH for-4.13 v3 6/7] libxl: Introduce 
> libxl__ev_immediate"):
> > This new ev allows to arrange a non-reentrant callback to be called.
> > This happen immediately after the current event is processed and after
> > other ev_immediates that would have already been registered.
> 
> Thanks for doing this work.
> 
> > +    LIBXL_TAILQ_FOREACH_SAFE(ei, &egc->ev_immediates, entry, ei_tmp) {
> > +        LIBXL_TAILQ_REMOVE(&egc->ev_immediates, ei, entry);
> 
> I think LIBXL_TAILQ_FOREACH_SAFE is not safe enough here.
> ei->callback might *add* things to egc->ev_immediates.  The manpage
> just says
> 
>      However, unlike their unsafe counterparts, TAILQ_FOREACH and
>      TAILQ_FOREACH_REVERSE permit to both remove var as well as free
>      it from within the loop safely without interfering with the
>      traversal.
> 
> I can't find an explicit statement about the allowable changes with
> LIBXL_TAILQ_FOREACH but I expect they are "none".  See the loop in
> ao__abort for what I think is the correct pattern (albeit embedded in
> something more complex).

Sound good. I'll also switch to STAILQ instead, single-link tail queue
for a FIFO list.

Thanks,

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.