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)
Sat, Apr 20, 11:15 AM
Unknown Object (File)
Mar 7 2024, 5:48 PM
Unknown Object (File)
Jan 23 2024, 4:05 AM
Unknown Object (File)
Dec 22 2023, 11:50 PM
Unknown Object (File)
Dec 14 2023, 10:28 PM
Unknown Object (File)
Dec 2 2023, 2:38 PM
Unknown Object (File)
Nov 10 2023, 2:23 PM
Unknown Object (File)
Oct 9 2023, 1:16 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