Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semaphores for ocaml probes #60

Merged
merged 3 commits into from
Aug 5, 2021

Conversation

gretay-js
Copy link
Contributor

Add separate space for a separate semaphore for ocaml-probes. Ocaml probes should not use systemtap semaphores because they control different handlers.

The PR also tidies semaphores symbols that need not be global.

@gretay-js gretay-js force-pushed the probes_fix_semaphores branch from 1073f3a to d7189fb Compare August 5, 2021 09:34
@gretay-js gretay-js changed the base branch from release-4.11 to main August 5, 2021 09:38
@gretay-js
Copy link
Contributor Author

gretay-js commented Aug 5, 2021

I've rebased this PR and tested it using a separate tracer library.
To ensure that the tracer works correctly for executables built with both original and new versions of probes, we can record the version in "provider" field of stapsdt notes. The "provider" value was "ocaml" in the original version. I added a commit to this PR that set "provider" to "ocaml.1" for the new version. I think this internal name is unlikely to be confused with the "official" ocaml version.

(* OCaml has it's own semaphore, in addition to system tap,
to control ocaml probe handlers independently from stap probe handlers.
It is placed immediately after stap semaphore, and is the same
size - hence offset 2. *)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this is offset 2 not 1. Is this value not in units of 8-byte words?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The units are bytes, and the size of the new semaphore is set to be the same as the size of stap semaphores, so the code for reading them remains unchanged.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, and the semaphores are 16-bit quantities. ok.

@@ -1421,7 +1425,7 @@ let emit_probe_notes0 () =
D.qword (const 0)
end;
D.qword (ConstLabel semaphore_label);
D.bytes "ocaml\000";
D.bytes "ocaml.1\000";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a bit mysterious

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, suggestions for a better name are most welcome!
The prefix ".1" is the version number for ocaml probe notes. There is already a proposal for "ocaml.2" in PR #142.
The suffix "ocaml" is useful for distinguishing probes emitted by OCaml compiler from other stap "providers" of probes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users will see these strings if they inspect probe notes using "readelf -n" or gdb's "info probes".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems ok for now.

@@ -1421,7 +1425,7 @@ let emit_probe_notes0 () =
D.qword (const 0)
end;
D.qword (ConstLabel semaphore_label);
D.bytes "ocaml\000";
D.bytes "ocaml.1\000";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems ok for now.

@mshinwell mshinwell merged commit 0237451 into ocaml-flambda:main Aug 5, 2021
mshinwell pushed a commit that referenced this pull request Aug 6, 2021
* Separate semaphore for ocaml probes to correctly support probe_is_enabled

* Emit semaphore symbol as weak and hidden and without compilation unit in its name

* Update version of ocaml probe notes
mshinwell added a commit to mshinwell/flambda-backend that referenced this pull request Dec 13, 2022
1bb6c79 Merge pull request ocaml-flambda#78 from mshinwell/flambda-backend-patches-2022-12-13
9029581 Update otherlibs/dynlink/Makefile
3e4f1b9 Revert toplevel/native/dune to ocaml-jst version
6061e4c Regenerate configure using autoconf 2.71
888d4b1 Back out patch which disables alloc-check in ocaml-jst
a6d5796 Fix dynlink build
3e46daf Update .depend files
a5c547e Bootstrap
a6a9031 Merge flambda-backend changes
0ac7fdd temp fix for linker error (ocaml-flambda#77)
e2d0d9e Enable individual testing with Makefile.jst (ocaml-flambda#76)
2a7e501 Use a more relaxed mode for unification in Ctype.subst (#11771) (ocaml-flambda#73)
cbd791a Allow immediates to cross modes (ocaml-flambda#58)
549d757 Run "misplaced attributes" check when compiling mlis (ocaml-flambda#72)
a6c0e75 Ensure that Ctype.nongen always calls remove_mode_variables (ocaml-flambda#70)
6c50831 array elements are global (ocaml-flambda#67)
8788ff6 Add/move some documentation
9891a36 Propagate location information to `local_` in expressions
988306d Add support for `global_` and `nonlocal_` constructor arguments (ocaml-flambda#50)
e7dd740 Add debug_printers.ml (ocaml-flambda#63)
65f2896 more entries in gitignore (ocaml-flambda#62)
a9a84d0 Move `global_flag` to `Asttypes` (ocaml-flambda#60)
fac5896 Minor attribute fixes from flambda-backend
75f402e Note about make install and Makefile.jst (ocaml-flambda#56)

git-subtree-dir: ocaml
git-subtree-split: 1bb6c79
mshinwell added a commit to mshinwell/flambda-backend that referenced this pull request Dec 13, 2022
985725b Add dynlink_compilerlibs.mli to .gitignore (ocaml-flambda#79)
2b1fa24 Regenerate parser (ocaml-flambda#80)
1bb6c79 Merge pull request ocaml-flambda#78 from mshinwell/flambda-backend-patches-2022-12-13
9029581 Update otherlibs/dynlink/Makefile
3e4f1b9 Revert toplevel/native/dune to ocaml-jst version
6061e4c Regenerate configure using autoconf 2.71
888d4b1 Back out patch which disables alloc-check in ocaml-jst
a6d5796 Fix dynlink build
3e46daf Update .depend files
a5c547e Bootstrap
a6a9031 Merge flambda-backend changes
0ac7fdd temp fix for linker error (ocaml-flambda#77)
e2d0d9e Enable individual testing with Makefile.jst (ocaml-flambda#76)
2a7e501 Use a more relaxed mode for unification in Ctype.subst (#11771) (ocaml-flambda#73)
cbd791a Allow immediates to cross modes (ocaml-flambda#58)
549d757 Run "misplaced attributes" check when compiling mlis (ocaml-flambda#72)
a6c0e75 Ensure that Ctype.nongen always calls remove_mode_variables (ocaml-flambda#70)
6c50831 array elements are global (ocaml-flambda#67)
8788ff6 Add/move some documentation
9891a36 Propagate location information to `local_` in expressions
988306d Add support for `global_` and `nonlocal_` constructor arguments (ocaml-flambda#50)
e7dd740 Add debug_printers.ml (ocaml-flambda#63)
65f2896 more entries in gitignore (ocaml-flambda#62)
a9a84d0 Move `global_flag` to `Asttypes` (ocaml-flambda#60)
fac5896 Minor attribute fixes from flambda-backend
75f402e Note about make install and Makefile.jst (ocaml-flambda#56)

git-subtree-dir: ocaml
git-subtree-split: 985725b
mshinwell added a commit to mshinwell/flambda-backend that referenced this pull request Dec 28, 2022
a09392d Set Menhir version back to 20210419 again (ocaml-flambda#89)
cc63992 Merge pull request ocaml-flambda#88 from mshinwell/flambda-backend-changes-2022-12-27
3e49df3 HACKING.jst.adoc
1866676 Merge flambda-backend changes
e012992 Merge pull request ocaml-flambda#87 from mshinwell/merge-4.14.1
ac5c7c8 Merge tag '4.14.1' into main
3da21bc add a useful debug printer
83b7c72 Document the debug_printers script
98896e0 Remove a tiny code stutter I came across
99cb5d9 release 4.14.1
b49060f last commit before tagging 4.14.1
fae9aef Add documentation
708e5a9 Add tests
c609eee Bootstrap
7f922d0 Polymorphic parameters
51aeb04 Keep generalized structure from patterns when typing let
4b68bb3 Add test of princiaplity from polymorphic type constraints
82c7afe fix wong raise
aca252f x86: Force result of Icomp to be in a register (#11808)
985725b Add dynlink_compilerlibs.mli to .gitignore (ocaml-flambda#79)
2b1fa24 Regenerate parser (ocaml-flambda#80)
1bb6c79 Merge pull request ocaml-flambda#78 from mshinwell/flambda-backend-patches-2022-12-13
9029581 Update otherlibs/dynlink/Makefile
3e4f1b9 Revert toplevel/native/dune to ocaml-jst version
6061e4c Regenerate configure using autoconf 2.71
888d4b1 Back out patch which disables alloc-check in ocaml-jst
a6d5796 Fix dynlink build
3e46daf Update .depend files
a5c547e Bootstrap
a6a9031 Merge flambda-backend changes
0ac7fdd temp fix for linker error (ocaml-flambda#77)
1018602 Remove references to 32-bit Cygwin (#11797)
e2d0d9e Enable individual testing with Makefile.jst (ocaml-flambda#76)
f10cbf6 increment version number after tagging 4.14.1~rc1
11c5ab7 release 4.14.1~rc1
e4c3920 last commit before tagging 4.14.1~rc1
9e598ca Merge pull request #11793 from dra27/then-than
2a7e501 Use a more relaxed mode for unification in Ctype.subst (#11771) (ocaml-flambda#73)
7b35ef7 Statically initialize `caml_global_data` with a valid value (#11788)
cbd791a Allow immediates to cross modes (ocaml-flambda#58)
85a0817 Merge pull request #11534 from gasche/follow-synonyms-in-show-module-type
699f43c Changes
e54e9bc fix the 'stuttering' issue in #show
d9799d3 test comments
fec3b23 follow synonyms when #show-ing module types
06a1ad7 regression tests for #11533 (still failing)
549d757 Run "misplaced attributes" check when compiling mlis (ocaml-flambda#72)
b2b74bf Fix bug in `Mtype.strengthen_lazy` causing spurious typing errors (#11776)
a6c0e75 Ensure that Ctype.nongen always calls remove_mode_variables (ocaml-flambda#70)
6c50831 array elements are global (ocaml-flambda#67)
bc510ed Ensure that types from packed modules are always generalised (#11732)
4d47036 Fix #10768
8788ff6 Add/move some documentation
9891a36 Propagate location information to `local_` in expressions
988306d Add support for `global_` and `nonlocal_` constructor arguments (ocaml-flambda#50)
6729eb8 Missing CAMLparam in win32's Unix.stat (#11737)
e7dd740 Add debug_printers.ml (ocaml-flambda#63)
65f2896 more entries in gitignore (ocaml-flambda#62)
a9a84d0 Move `global_flag` to `Asttypes` (ocaml-flambda#60)
fac5896 Minor attribute fixes from flambda-backend
75f402e Note about make install and Makefile.jst (ocaml-flambda#56)
fb5b1e4 Remove the -force-tmc flag (#11661)
bd87a61 ocamlmklib: use `ar rcs` instead of `ar rc` (#11670)
83762af Merge pull request #11622 from Octachron/fix_recursive_types_in_constructor_mismatch
ca48730 Merge pull request #11609 from Octachron/pr11194_unbound_and_printing_context

git-subtree-dir: ocaml
git-subtree-split: a09392d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants