Re: URCU feature request?

Thobias Knudsen via lttng-dev <[email protected]> Tue, 2 Sep 2025 16:17:19 +0200
Newsgroups org.lttng.lists.lttng-dev
Message-ID <CAKGpcipt=fWJi9Y497C3vq03CXmPY6rXQqs8ZP9nDoTGdRKnAA@mail.gmail.com>
--00000000000013c93f063dd226a3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

> I suspect that what you are trying to achieve is validation that
> calls to functions that require to be within a RCU read-side critical
> section such as cds_lfht_lookup are indeed invoked from within a
> critical section.

Yes exactly, but not only for read sections. It could also be to validate
that rcu_barrier isnt called within a callback function or that
rcu_quiescent_state isnt called when thread is offline

> We've added a "rcu_read_ongoing()" API for that purpose to liburcu
> RCU flavors, but AFAIK it's not used for any kind of validation
> within cds_lfht. This could indeed become a feature request that
> would apply to all liburcu data structure APIs.

I can't find any documentation on rcu_read_ongoing. Btw the documentation
for urcu in general is scattered all around the repo it seems. It should
have been all at one place imo. Should I make a feature request for it? I
don't know how stuff works inside this repo though.



man. 1. sep. 2025 kl. 17:09 skrev Mathieu Desnoyers <
[email protected]>:

> On 2025-08-31 16:48, Thobias Knudsen wrote:
> > BTW i've made a macro library which overrides the
> > urcu and lfht functions. It checks that you call the functions in the
> > correct order. This has been really useful for debugging and I think it
> > would be useful to have it integrated into urcu to make the it more use=
r
> > friendly. you could have it integrated with the macro DEBUG_RCU or make
> > a new one, maybe DEBUG_FUNCTION_CALL_ORDER. The only thing it doesn't
> > catch is if you continue to use data from cds_lfht_lookup() after
> > rcu_read_unlock()
>
> I suspect that what you are trying to achieve is validation that
> calls to functions that require to be within a RCU read-side critical
> section such as cds_lfht_lookup are indeed invoked from within a
> critical section.
>
> We've added a "rcu_read_ongoing()" API for that purpose to liburcu
> RCU flavors, but AFAIK it's not used for any kind of validation
> within cds_lfht. This could indeed become a feature request that
> would apply to all liburcu data structure APIs.
>
> Thanks,
>
> Mathieu
>
> >
> > s=C3=B8n. 31. aug. 2025 kl. 22:42 skrev Thobias Knudsen <thobknu@gmail.=
com
> > <mailto:[email protected]>>:
> >
> >     First question: why isn't Userspace RCU more popular?
> >     Second question: Why isn't it possible to create issues in the urcu
> >     repo? Im asking for a feature here:
> >     Is it possible to make a function which checks if there are more
> >     callbacks queued by call_rcu? I need that because there are some
> >     callbacks which call call_rcu, and then calling rcu_barrier once
> >     isn't enough and I therefore need a way to check if there are still
> >     callbacks to wait on before terminating the program. No worries if
> >     this is too much to ask for or if it isn't possible. This
> >     functionality is only needed in termination because otherwise
> >     isn't needed to call rcu_barrier multiple times (at least so far)
> >
> >     Best regards
> >     Thobias
> >
> >
>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com
>

--00000000000013c93f063dd226a3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">&gt; I suspect that what you are trying to achieve is vali=
dation that<br>&gt; calls to functions that require to be within a RCU read=
-side critical<br>&gt; section such as cds_lfht_lookup are indeed invoked f=
rom within a<br>&gt; critical section.<div><br></div><div>Yes exactly, but =
not only for read sections. It could also be to validate that rcu_barrier i=
snt=C2=A0called within a callback function or that rcu_quiescent_state isnt=
 called when thread is offline</div><div><br>&gt; We&#39;ve added a &quot;r=
cu_read_ongoing()&quot; API for that purpose to liburcu<br>&gt; RCU flavors=
, but AFAIK it&#39;s not used for any kind of validation<br>&gt; within cds=
_lfht. This could indeed become a feature request that<br>&gt; would apply =
to all liburcu data structure APIs.<div><br></div><div>I can&#39;t find any=
 documentation on rcu_read_ongoing. Btw the documentation for urcu in gener=
al is scattered all around the repo it seems. It should have been all at on=
e place imo. Should I make a feature request for it? I don&#39;t know how s=
tuff works inside this repo though.</div><div><br></div><div><br></div></di=
v></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"lt=
r" class=3D"gmail_attr">man. 1. sep. 2025 kl. 17:09 skrev Mathieu Desnoyers=
 &lt;<a href=3D"mailto:[email protected]">mathieu.desnoyers@ef=
ficios.com</a>&gt;:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">On 2025-08-31 16:48, Thobias Knudsen wrote:<br>
&gt; BTW i&#39;ve made a macro library which overrides the <br>
&gt; urcu=C2=A0and=C2=A0lfht=C2=A0functions. It checks that you call the fu=
nctions in the <br>
&gt; correct order. This has been really useful for debugging and I think i=
t <br>
&gt; would be useful to have it integrated into urcu to make the it more us=
er <br>
&gt; friendly. you could have it integrated=C2=A0with the macro DEBUG_RCU o=
r make <br>
&gt; a new one, maybe DEBUG_FUNCTION_CALL_ORDER. The only thing it doesn&#3=
9;t <br>
&gt; catch is if you continue to use data from cds_lfht_lookup() after <br>
&gt; rcu_read_unlock()<br>
<br>
I suspect that what you are trying to achieve is validation that<br>
calls to functions that require to be within a RCU read-side critical<br>
section such as cds_lfht_lookup are indeed invoked from within a<br>
critical section.<br>
<br>
We&#39;ve added a &quot;rcu_read_ongoing()&quot; API for that purpose to li=
burcu<br>
RCU flavors, but AFAIK it&#39;s not used for any kind of validation<br>
within cds_lfht. This could indeed become a feature request that<br>
would apply to all liburcu data structure APIs.<br>
<br>
Thanks,<br>
<br>
Mathieu<br>
<br>
&gt; <br>
&gt; s=C3=B8n. 31. aug. 2025 kl. 22:42 skrev Thobias Knudsen &lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank">[email protected]</a> <br>
&gt; &lt;mailto:<a href=3D"mailto:[email protected]" target=3D"_blank">thob=
[email protected]</a>&gt;&gt;:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0First question: why isn&#39;t Userspace RCU more po=
pular?<br>
&gt;=C2=A0 =C2=A0 =C2=A0Second question: Why isn&#39;t it possible to creat=
e issues in the urcu<br>
&gt;=C2=A0 =C2=A0 =C2=A0repo? Im asking for a feature here:<br>
&gt;=C2=A0 =C2=A0 =C2=A0Is it possible to make a function which checks if t=
here are more<br>
&gt;=C2=A0 =C2=A0 =C2=A0callbacks queued by call_rcu? I need that because t=
here are some<br>
&gt;=C2=A0 =C2=A0 =C2=A0callbacks which call call_rcu, and then calling rcu=
_barrier once<br>
&gt;=C2=A0 =C2=A0 =C2=A0isn&#39;t=C2=A0enough and I therefore need a way to=
 check if there are still<br>
&gt;=C2=A0 =C2=A0 =C2=A0callbacks to wait on before terminating the program=
. No worries if<br>
&gt;=C2=A0 =C2=A0 =C2=A0this is too much to ask for or if it isn&#39;t=C2=
=A0possible. This<br>
&gt;=C2=A0 =C2=A0 =C2=A0functionality is only needed in termination because=
 otherwise<br>
&gt;=C2=A0 =C2=A0 =C2=A0isn&#39;t=C2=A0needed to call rcu_barrier multiple =
times (at least so far)<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Best regards<br>
&gt;=C2=A0 =C2=A0 =C2=A0Thobias<br>
&gt; <br>
&gt; <br>
<br>
<br>
-- <br>
Mathieu Desnoyers<br>
EfficiOS Inc.<br>
<a href=3D"https://www.efficios.com" rel=3D"noreferrer" target=3D"_blank">h=
ttps://www.efficios.com</a><br>
</blockquote></div>

--00000000000013c93f063dd226a3--