Il mar 13 gen 2026, 10:04 Markus Armbruster <armbru@redhat.com> ha scritto:
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 1/9/26 12:46, Daniel P. Berrangé wrote:
>> IMHO the root problem is that it is pretty dubious for us to be
>> spawning the RCU thread from a constructor. Constructors should
>> be limited to minimal initialization of state.

Yes!  Discussed in review of v3:

    https://lore.kernel.org/qemu-devel/87frck1dds.fsf@pond.sub.org/
    Message-ID: <87frck1dds.fsf@pond.sub.org>

>>                                                Spawning threads
>> is outside the boundary of what I'd consider reasonable for
>> a constructor todo. I didn't want try to tackle refactoring the
>> RCU thread creation though, hence this gross workaround.
>
> I see.  Maybe we could (just as gross but smaller) do the RCU constructor late.  Not something that you need to do now, of course.

Could we use an old-fashioned initialization function instead of a
constructor for RCU?

You have to do it in all main()s, which make it unwieldy for tests etc.

Another possibility is to do it lazily on first call_rcu, and just clear the flag in the atfork callbacks.

Paolo