public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* RE: prompt script exiting
@ 2005-12-12 11:35 Mao, Bibo
  2005-12-12 15:26 ` Frank Ch. Eigler
  0 siblings, 1 reply; 6+ messages in thread
From: Mao, Bibo @ 2005-12-12 11:35 UTC (permalink / raw)
  To: William Cohen, SystemTAP

Hi Cohen,

Currently in the script when exit() is called, the global variant flag _stp_exit_flag will be set as 1. I do know whether judge the value of _stp_exit_flag just before kprobe/kretprobe handler running. And then when it is set as 1, kprobe/kretprobe handler return immediately, and then collect data will be more accurate when it is used for measurement.

Regards
Bibo,mao

>-----Original Message-----
>From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org]
>On Behalf Of William Cohen
>Sent: 2005年12月3日 4:08
>To: SystemTAP
>Subject: prompt script exiting
>
>When running the testsuite with the recent version of systemtap
>(snapshot from this morning, 2005-12-02) I found that syscalls2.exp
>would consistently fail. The the tests uses an exit() in the script when
>a probe fires 100 times. The syscalls2.exp allows a little slop and the
>probe to fire after the exit but before being removed. However, the
>changes in how exit operates makes create a longer wait before scripts
>actually exits. On the test runs I saw the probe fire 232, 200, 267, and
>420 times on various machines, much more than the 150 times allowed in
>the test.
>
>Do we expect the script to exit promptly when the exit() is encountered
>in the script? People taking measurements will want to know about this
>because it could significantly affect the data their scripts collect.
>For the time being we can just document this as how it behaves. It
>should be fairly easy for users to have a predicate in their
>instrumentation, so it is a pretty minor issue.
>
>-Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: prompt script exiting
  2005-12-12 11:35 prompt script exiting Mao, Bibo
@ 2005-12-12 15:26 ` Frank Ch. Eigler
  2005-12-12 15:42   ` William Cohen
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Ch. Eigler @ 2005-12-12 15:26 UTC (permalink / raw)
  To: Mao, Bibo; +Cc: systemtap


"Mao, Bibo" <bibo.mao@intel.com> writes:

> [...]  I do know whether judge the value of _stp_exit flag just
> before kprobe/kretprobe handler running. And then when it is set as
> 1, kprobe/kretprobe handler return immediately [...]

The _stp_exit flag could be associated with the translator's overall
session_state flag, which has an STAP_SESSION_STOPPING value.  This is
used during that phase when the "end" probes are run, and causes other
probes to return early.  The tapset exit() function could set that in
addition to calling the runtime function.

- FChE

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: prompt script exiting
  2005-12-12 15:26 ` Frank Ch. Eigler
@ 2005-12-12 15:42   ` William Cohen
  2005-12-12 15:49     ` Frank Ch. Eigler
  0 siblings, 1 reply; 6+ messages in thread
From: William Cohen @ 2005-12-12 15:42 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: Mao, Bibo, systemtap

Frank Ch. Eigler wrote:
> "Mao, Bibo" <bibo.mao@intel.com> writes:
> 
> 
>>[...]  I do know whether judge the value of _stp_exit flag just
>>before kprobe/kretprobe handler running. And then when it is set as
>>1, kprobe/kretprobe handler return immediately [...]
> 
> 
> The _stp_exit flag could be associated with the translator's overall
> session_state flag, which has an STAP_SESSION_STOPPING value.  This is
> used during that phase when the "end" probes are run, and causes other
> probes to return early.  The tapset exit() function could set that in
> addition to calling the runtime function.
> 
> - FChE

That sounds like it would operate in the manner that people would 
expect. Right now there can be a fairly delay between the exit() 
occuring in the script and the data collection begin shutdown.

What happens if there are two scripts running? Is this flag local to the 
script or a global? If it is global and there are two systemtap 
scription running with one of them is exiting, the other script script 
would also be affected and not collect data.

-Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: prompt script exiting
  2005-12-12 15:42   ` William Cohen
@ 2005-12-12 15:49     ` Frank Ch. Eigler
  2005-12-12 20:22       ` William Cohen
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Ch. Eigler @ 2005-12-12 15:49 UTC (permalink / raw)
  To: William Cohen; +Cc: systemtap

Hi -

wcohen wrote:

> That [systemtap_session change] sounds like it would operate in the
> manner that people would expect. [...]

Yeah.  Would you mind testing it and committing it if it works?

> What happens if there are two scripts running? Is this flag local to
> the script or a global? [...]

"global" in the systemtap sense means shared amongst probe handlers of
the same systemtap session.  There is no "global" data in the sense of
kernel-wide at all, except perhaps in kprobes internals.

- FChE

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: prompt script exiting
  2005-12-12 15:49     ` Frank Ch. Eigler
@ 2005-12-12 20:22       ` William Cohen
  0 siblings, 0 replies; 6+ messages in thread
From: William Cohen @ 2005-12-12 20:22 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: systemtap

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

Frank Ch. Eigler wrote:
> Hi -
> 
> wcohen wrote:
> 
> 
>>That [systemtap_session change] sounds like it would operate in the
>>manner that people would expect. [...]
> 
> 
> Yeah.  Would you mind testing it and committing it if it works?
> 
> 
>>What happens if there are two scripts running? Is this flag local to
>>the script or a global? [...]
> 
> 
> "global" in the systemtap sense means shared amongst probe handlers of
> the same systemtap session.  There is no "global" data in the sense of
> kernel-wide at all, except perhaps in kprobes internals.
> 
> - FChE

Here is a one-liner that appears to fix the problem. 
systemtap.samples/syscalls2.exp works when it is installed.

2005-12-12  Will Cohen  <wcohen@redhat.com>

	* tapset/logging.stp (function_exit): Make sure systemtap
	probes stop collection additional data.



-Will

[-- Attachment #2: quickstop.patch --]
[-- Type: text/x-patch, Size: 477 bytes --]

Index: logging.stp
===================================================================
RCS file: /cvs/systemtap/src/tapset/logging.stp,v
retrieving revision 1.6
diff -u -r1.6 logging.stp
--- logging.stp	18 Nov 2005 21:57:30 -0000	1.6
+++ logging.stp	12 Dec 2005 20:16:34 -0000
@@ -21,6 +21,7 @@
 
 // NB: exit() does *not* cause immediate return from current function/probe
 function exit () %{
+    atomic_set (&session_state, STAP_SESSION_STOPPING);
     _stp_exit ();
 %}
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* prompt script exiting
@ 2005-12-02 20:08 William Cohen
  0 siblings, 0 replies; 6+ messages in thread
From: William Cohen @ 2005-12-02 20:08 UTC (permalink / raw)
  To: SystemTAP

When running the testsuite with the recent version of systemtap 
(snapshot from this morning, 2005-12-02) I found that syscalls2.exp 
would consistently fail. The the tests uses an exit() in the script when 
a probe fires 100 times. The syscalls2.exp allows a little slop and the 
probe to fire after the exit but before being removed. However, the 
changes in how exit operates makes create a longer wait before scripts 
actually exits. On the test runs I saw the probe fire 232, 200, 267, and 
420 times on various machines, much more than the 150 times allowed in 
the test.

Do we expect the script to exit promptly when the exit() is encountered 
in the script? People taking measurements will want to know about this 
because it could significantly affect the data their scripts collect. 
For the time being we can just document this as how it behaves. It 
should be fairly easy for users to have a predicate in their 
instrumentation, so it is a pretty minor issue.

-Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-12-12 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-12 11:35 prompt script exiting Mao, Bibo
2005-12-12 15:26 ` Frank Ch. Eigler
2005-12-12 15:42   ` William Cohen
2005-12-12 15:49     ` Frank Ch. Eigler
2005-12-12 20:22       ` William Cohen
  -- strict thread matches above, loose matches on Subject: below --
2005-12-02 20:08 William Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).