public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/10822] New: procfs file created too late
@ 2009-10-21 21:10 dsmith at redhat dot com
  2009-10-21 22:23 ` [Bug translator/10822] " jistone at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dsmith at redhat dot com @ 2009-10-21 21:10 UTC (permalink / raw)
  To: systemtap

I've investigated some testsuite/systemtap.base/onoffprobe.exp failures I was
seeing.  After seeing the output from the begin probe, the testcase immediately
tries to write to the procfs file created by the script.  This kept failing.

In looking at the translator-created C file, I see this:

====
   for (i=0; i<2; i++) {                                                       
      struct stap_be_probe* stp = & stap_be_probes [i];                         
      if (stp->type == 1)                                                       
        enter_be_probe (stp);                                                   
    }                                                                           
    for (i=0; i<2; i++) {                                                       
      struct stap_be_probe* stp = & stap_be_probes [i];                         
      if (stp->type == 2)                                                       
        enter_be_probe (stp);                                                   
    }                                                                           
    goto out;                                                                   
  }                                                                             
  for (i = 0; i < 1; i++) {                                                     
    struct stap_procfs_probe *spp = &stap_procfs_probes[i];                     
    if (spp->read_pp)                                                           
      probe_point = spp->read_pp;                                               
    else                                                                        
      probe_point = spp->write_pp;                                              
    rc = _stp_create_procfs(spp->path, i);                                      
====

From the above, it appears that the begin probes are run, then the procfs file
is created.  I don't believe this is correct - begin probes should be run after
all the other probes types module init code has been run.

-- 
           Summary: procfs file created too late
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: dsmith at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/10822] procfs file created too late
  2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
@ 2009-10-21 22:23 ` jistone at redhat dot com
  2009-10-22  0:29 ` fche at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jistone at redhat dot com @ 2009-10-21 22:23 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jistone at redhat dot com  2009-10-21 22:22 -------
While we are in our initialization phase, any probes that fire will quietly skip
their handlers.  We have a guarantee that begin probes will fire before any
others, so we can't run a procfs handler before then.  If you changed the
initialization order, then you might get your procfs file created sooner, but
reads/writes to it might be ignored.

This race between procfs creation and STAP_SESSION_RUNNING actually exists
regardless.  If we can't block users until RUNNING (instead of ignoring them),
then we probably need to wait to create the procfs in the first place.

As for the testcase, it could just use some other trigger than begin for the
first "advance" call.  Maybe a short timer probe would work, or even just run
the first echo as a "-c" command.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/10822] procfs file created too late
  2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
  2009-10-21 22:23 ` [Bug translator/10822] " jistone at redhat dot com
@ 2009-10-22  0:29 ` fche at redhat dot com
  2009-10-22 13:12 ` dsmith at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2009-10-22  0:29 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From fche at redhat dot com  2009-10-22 00:28 -------
One (wacky?) possibility is to keep the begin probes' output from
appearing at staprun/stapio's output until all the probes have been
fully registered/activated.  Maybe a deferred _stp_print_flush();
maybe having staprun listen to the STP_START message before shuffling
out data.  Something that makes it delay the begin probes' output
until everything is really ready.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/10822] procfs file created too late
  2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
  2009-10-21 22:23 ` [Bug translator/10822] " jistone at redhat dot com
  2009-10-22  0:29 ` fche at redhat dot com
@ 2009-10-22 13:12 ` dsmith at redhat dot com
  2009-10-22 13:26 ` dsmith at redhat dot com
  2009-10-22 14:05 ` dsmith at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dsmith at redhat dot com @ 2009-10-22 13:12 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From dsmith at redhat dot com  2009-10-22 13:12 -------
(In reply to comment #1)
> While we are in our initialization phase, any probes that fire will quietly skip
> their handlers.  We have a guarantee that begin probes will fire before any
> others, so we can't run a procfs handler before then.  If you changed the
> initialization order, then you might get your procfs file created sooner, but
> reads/writes to it might be ignored.

I don't want to run any procfs probes, I just want to setup the procfs file.  If
a procfs read/write happened before systemtap got fully initialized, it should
get skipped (just as with any other probe type).

Think of creating the procfs file as no different than registering a kprobe.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/10822] procfs file created too late
  2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
                   ` (2 preceding siblings ...)
  2009-10-22 13:12 ` dsmith at redhat dot com
@ 2009-10-22 13:26 ` dsmith at redhat dot com
  2009-10-22 14:05 ` dsmith at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dsmith at redhat dot com @ 2009-10-22 13:26 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From dsmith at redhat dot com  2009-10-22 13:26 -------
(In reply to comment #3)
> (In reply to comment #1)
> > While we are in our initialization phase, any probes that fire will quietly skip
> > their handlers.  We have a guarantee that begin probes will fire before any
> > others, so we can't run a procfs handler before then.  If you changed the
> > initialization order, then you might get your procfs file created sooner, but
> > reads/writes to it might be ignored.
> 
> I don't want to run any procfs probes, I just want to setup the procfs file.  If
> a procfs read/write happened before systemtap got fully initialized, it should
> get skipped (just as with any other probe type).
> 
> Think of creating the procfs file as no different than registering a kprobe.

After looking at the code a bit more, I think I was looking at this incorrectly.
 kprobes are registered after any begin probes are run.  So, the initialization
order appears correct.

This is really a testcase problem.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/10822] procfs file created too late
  2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
                   ` (3 preceding siblings ...)
  2009-10-22 13:26 ` dsmith at redhat dot com
@ 2009-10-22 14:05 ` dsmith at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: dsmith at redhat dot com @ 2009-10-22 14:05 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From dsmith at redhat dot com  2009-10-22 14:04 -------
Testcase fixed in commit 712d12c by waiting for the procfs file to be created.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=10822

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

end of thread, other threads:[~2009-10-22 14:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-21 21:10 [Bug translator/10822] New: procfs file created too late dsmith at redhat dot com
2009-10-21 22:23 ` [Bug translator/10822] " jistone at redhat dot com
2009-10-22  0:29 ` fche at redhat dot com
2009-10-22 13:12 ` dsmith at redhat dot com
2009-10-22 13:26 ` dsmith at redhat dot com
2009-10-22 14:05 ` dsmith at redhat dot com

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).