-
-
Save agentzh/905021679609619ec1b62011870cd926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 114add4208129cc08bc47175ad505c8b719fe942 | |
Author: Yichun Zhang (agentzh) <yichun@openresty.com> | |
Date: Fri Sep 16 13:37:38 2022 -0700 | |
Bug: runtime: we might not sync the tracepoint's SRCU state after unregistering the tracepoints | |
It might lead to issues like PR29577. | |
diff --git a/tapsets.cxx b/tapsets.cxx | |
index 50b70aa58..cb4705ffa 100644 | |
--- a/tapsets.cxx | |
+++ b/tapsets.cxx | |
@@ -12570,14 +12570,15 @@ tracepoint_derived_probe_group::emit_module_init (systemtap_session &s) | |
s.op->newline(-1) << "}"; | |
s.op->newline(-1) << "}"; | |
- // This would be technically proper (on those autoconf-detectable | |
- // kernels that include this function in tracepoint.h), however we | |
- // already make several calls to synchronze_sched() during our | |
- // shutdown processes. | |
+ // Modern kernels' tracepoint implementation makes use of SRCU and | |
+ // their tracepoint_synchronize_unregister() function calls | |
+ // synchronize_srcu(&tracepoint_srcu) right before calling synchronize_rcu(). | |
+ // So it's safer to always call tracepoint_synchronize_unregister() to avoid | |
+ // any risks. | |
- // s.op->newline() << "if (rc)"; | |
- // s.op->newline(1) << "tracepoint_synchronize_unregister();"; | |
- // s.op->indent(-1); | |
+ s.op->newline() << "if (rc)"; | |
+ s.op->newline(1) << "tracepoint_synchronize_unregister();"; | |
+ s.op->indent(-1); | |
} | |
@@ -12592,9 +12593,8 @@ tracepoint_derived_probe_group::emit_module_exit (systemtap_session& s) | |
s.op->newline(1) << "stap_tracepoint_probes[i].unreg();"; | |
s.op->indent(-1); | |
- // Not necessary: see above. | |
- | |
- // s.op->newline() << "tracepoint_synchronize_unregister();"; | |
+ // This is necessary: see above. | |
+ s.op->newline() << "tracepoint_synchronize_unregister();"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment