On Tue, Sep 30, 2025 at 10:19:54AM +0100, Peter Maydell wrote:
> On Mon, 29 Sept 2025 at 20:08, Peter Xu <peterx@redhat.com> wrote:
> >
> > Trap call_rcu1() to make sure it won't be invoked twice for one rcu head.
> >
> > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > util/rcu.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/util/rcu.c b/util/rcu.c
> > index b703c86f15..9272fe5796 100644
> > --- a/util/rcu.c
> > +++ b/util/rcu.c
> > @@ -307,6 +307,8 @@ static void *call_rcu_thread(void *opaque)
> >
> > void call_rcu1(struct rcu_head *node, void (*func)(struct rcu_head *node))
> > {
> > + /* Avoid double rcu frees */
>
> I would maybe have this say "Catch accidental attempts to
> use the same rcu node for two things at once", which
> isn't the same as a "double free" in the usual sense.
Agree. I'll also adjust the subject when repost, thanks.
>
> > + assert(node->func == NULL);
> > node->func = func;
> > enqueue(node);
> > qatomic_inc(&rcu_call_count);
>
> thanks
> -- PMM
>
--
Peter Xu