Page MenuHomeFreeBSD

LinuxKPI: Do not wait for a grace period in rcu_barrier()
ClosedPublic

Authored by wulf on Jun 18 2021, 12:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 1 2024, 1:36 PM
Unknown Object (File)
Sep 27 2024, 12:47 PM
Unknown Object (File)
Sep 23 2024, 5:12 PM
Unknown Object (File)
Sep 23 2024, 5:12 PM
Unknown Object (File)
Sep 23 2024, 5:12 PM
Unknown Object (File)
Sep 23 2024, 4:55 PM
Unknown Object (File)
Sep 23 2024, 1:36 PM
Unknown Object (File)
Sep 23 2024, 1:36 PM

Details

Summary

Linux docs explicitly state that this is not required [1]:

"Important note: The rcu_barrier() function is not, repeat, not,
obligated to wait for a grace period. It is instead only required to
wait for RCU callbacks that have already been posted. Therefore, if
there are no RCU callbacks posted anywhere in the system, rcu_barrier()
is within its rights to return immediately. Even if there are
callbacks posted, rcu_barrier() does not necessarily need to wait for
a grace period."

P.S. This makes my current workaround[2] for i915 double-free related
crashes on drm-kmod v5.5 cheaper.

[1] https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html
[2] https://github.com/wulf7/drm-kmod/commit/cf961531da0c6f58f2ba0aaabf4ce423be820fd4

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wulf requested review of this revision.Jun 18 2021, 12:15 AM
sys/compat/linuxkpi/common/src/linux_rcu.c
369–375

What do you think about noting (with a comment) that linux_synchronize_rcu(type) is not necessary and explicitly omitted? It's the sort of thing that one might expect is needed (as evidenced by the existing code) so seems like it might make sense to mention.

This revision is now accepted and ready to land.Jun 18 2021, 6:11 AM
sys/compat/linuxkpi/common/src/linux_rcu.c
369–375

What do you think about noting (with a comment) that linux_synchronize_rcu(type) is not necessary and explicitly omitted? It's the sort of thing that one might expect is needed (as evidenced by the existing code) so seems like it might make sense to mention.

I'll add such a comment