Re: git: ddf0ed09bd8f - main - sdt: Implement SDT probes using hot-patching
Date: Mon, 24 Jun 2024 15:36:55 UTC
On Wed, Jun 19, 2024 at 1:58 PM Mark Johnston <markj@freebsd.org> wrote: > > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ddf0ed09bd8f83677407db36828aca2c10f419c9 > > commit ddf0ed09bd8f83677407db36828aca2c10f419c9 > Author: Mark Johnston <markj@FreeBSD.org> > AuthorDate: 2024-06-19 20:57:09 +0000 > Commit: Mark Johnston <markj@FreeBSD.org> > CommitDate: 2024-06-19 20:57:41 +0000 > > sdt: Implement SDT probes using hot-patching > > The idea here is to avoid a memory access and conditional branch per > probe site. Instead, the probe is represented by an "unreachable" > unconditional function call. asm goto is used to store the address of > the probe site (represented by a no-op sled) and the address of the > function call into a tracepoint record. Each SDT probe carries a list > of tracepoints. Questions out of curiosity and maybe ignorance: How does this work with relocations? Something must be adjusting these addresses? > +/* > + * Work around an apparent clang bug or limitation which prevents the use of the > + * "i" (immediate) constraint with the probe structure. > + */ > +#define _SDT_ASM_PROBE_CONSTRAINT "Ws" > +#define _SDT_ASM_PROBE_OPERAND "p" Is it because i386 kmods are built with -fPIC? By the way, it seems gcc13 (latest in ports) doesn't support the "Ws" constraint. It seems to have been added to gcc 14. I know i386 is tier 2 these days, and gcc is a second consideration anyway. Trying to test out a patch for i386 gcc, I found that it doesn't build currently and this is one of a few reasons. Ryan