Alexander Kolbasov
2005-Oct-04 23:47 UTC
[dtrace-discuss] BEGIN probe, system() and agent lwp
Hello, I noticed that the agent lwp doesn''t disappear after the system() call in the BEGIN probe. Should it be gone by the time the system() returned? Here is the script and its output when I run it with a single-threaded process. Notice that there is a thread with tid 2: ------------------------------------------------------------- #!/usr/sbin/dtrace -wqs BEGIN { system("pfiles %d >/dev/null", $1); } sched:::on-cpu / pid == $1 && curlwpsinfo->pr_lwpid != 1/ { @[curlwpsinfo->pr_lwpid, stack(20)] = count(); } ---------------------------------------------------------------- $ ./strange.d `pgrep emacs` ^C 2 1 2 genunix`stop+0x4a9 genunix`issig_forreal+0x361 genunix`issig+0xd genunix`post_syscall+0x6b5 unix`lwp_rtt+0x61 1 2 genunix`stop+0x4a9 genunix`post_syscall+0x75d genunix`syscall_exit+0x59 unix`sys_syscall32+0x1a5 51 2 genunix`stop+0x4a9 genunix`pre_syscall+0x201 genunix`syscall_entry+0xc5 unix`sys_syscall32+0xe1 52 ----------------------------------------------------------------- Why the agent lwp is still present?
On Tue, Oct 04, 2005 at 04:47:39PM -0700, Alexander Kolbasov wrote:> Hello, > > I noticed that the agent lwp doesn''t disappear after the system() call in the > BEGIN probe. Should it be gone by the time the system() returned?...> Why the agent lwp is still present?The system() call is not processed until the recorded data hits userland, long after the BEGIN probe completes. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Alexander Kolbasov
2005-Oct-05 00:06 UTC
[dtrace-discuss] BEGIN probe, system() and agent lwp
> On Tue, Oct 04, 2005 at 04:47:39PM -0700, Alexander Kolbasov wrote: > > Hello, > > > > I noticed that the agent lwp doesn''t disappear after the system() call in the > > BEGIN probe. Should it be gone by the time the system() returned? > ... > > Why the agent lwp is still present? > > The system() call is not processed until the recorded data hits userland, long > after the BEGIN probe completes.> -- >Jonathan Adams, Solaris Kernel DevelopmentSo there is no implied barrier that guarantees that everything specified in the BEGIN probe have completed before other probes start working, right? Is system() the only action with such property or there are others as well?
> So there is no implied barrier that guarantees that everything specified in > the BEGIN probe have completed before other probes start working, right? > > Is system() the only action with such property or there are others as well?There are quite a few others that are deferred for user-land processing, including printa(), clear(), trunc(), normalize(), denormalize(), setopt(), freopen(), and ftruncate(). - Bryan -------------------------------------------------------------------------- Bryan Cantrill, Solaris Kernel Development. http://blogs.sun.com/bmc
On Tue, Oct 04, 2005 at 05:06:16PM -0700, Alexander Kolbasov wrote:> > On Tue, Oct 04, 2005 at 04:47:39PM -0700, Alexander Kolbasov wrote: > > > Hello, > > > > > > I noticed that the agent lwp doesn''t disappear after the system() call in the > > > BEGIN probe. Should it be gone by the time the system() returned? > > ... > > > Why the agent lwp is still present? > > > > The system() call is not processed until the recorded data hits userland, long > > after the BEGIN probe completes. > > > -- > >Jonathan Adams, Solaris Kernel Development > > So there is no implied barrier that guarantees that everything specified in > the BEGIN probe have completed before other probes start working, right?Any action that is specified to take effect in userland is entirely asynchronous to in-kernel dtrace processing. Period. Such items will also not have any effect in anonymous tracing until a dtrace(1M) process claims the anonymous tracing state with the -a flag.> Is system() the only action with such property or there are others as well?Bryan specified a list. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development