public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug bpf/25218] New: stapbpf losing perf_events
@ 2019-11-22 23:13 sapatel at redhat dot com
  2019-11-22 23:16 ` [Bug bpf/25218] " sapatel at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sapatel at redhat dot com @ 2019-11-22 23:13 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=25218

            Bug ID: 25218
           Summary: stapbpf losing perf_events
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: sapatel at redhat dot com
  Target Milestone: ---

When there is frequent output from a script, it appears that stapbpf loses some
perf_events which leads to errors. Consider the script below.

global count

probe kernel.function("vfs_read") {

    count++

    printf("Beginning: %d\n", count)
    printf("Middle: %d\n", count)
    printf("End: %d\n", count)

}

Output:

...
...
Beginning: 13700
Middle: 13700
End: 13700
Beginning: 13701
Middle: 13701
End: 13701
WARNING: lost 359 perf_events on cpu 2
bpfinterp.cxx:421: printf already started
WARNING: /home/sapatel/stap_head/install/bin/stapbpf exited with signal: 6
(Aborted)

However, if the output is redirected to a file instead, the perf_events are not
lost, and the script proceeds as expected.

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

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

* [Bug bpf/25218] stapbpf losing perf_events
  2019-11-22 23:13 [Bug bpf/25218] New: stapbpf losing perf_events sapatel at redhat dot com
@ 2019-11-22 23:16 ` sapatel at redhat dot com
  2019-11-22 23:46 ` [Bug bpf/25218] stapbpf loses perf_events when writing to interactive terminal me at serhei dot io
  2019-11-25 18:22 ` me at serhei dot io
  2 siblings, 0 replies; 4+ messages in thread
From: sapatel at redhat dot com @ 2019-11-22 23:16 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=25218

Sagar Patel <sapatel at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sapatel at redhat dot com

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

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

* [Bug bpf/25218] stapbpf loses perf_events when writing to interactive terminal
  2019-11-22 23:13 [Bug bpf/25218] New: stapbpf losing perf_events sapatel at redhat dot com
  2019-11-22 23:16 ` [Bug bpf/25218] " sapatel at redhat dot com
@ 2019-11-22 23:46 ` me at serhei dot io
  2019-11-25 18:22 ` me at serhei dot io
  2 siblings, 0 replies; 4+ messages in thread
From: me at serhei dot io @ 2019-11-22 23:46 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=25218

Serhei Makarov <me at serhei dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me at serhei dot io
            Summary|stapbpf losing perf_events  |stapbpf loses perf_events
                   |                            |when writing to interactive
                   |                            |terminal

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
My suspicion is that the perf_events buffer used to receive transport messages
fills up while the stapbpf process is delayed writing output. This results in
transport messages being overwritten and the 'lost perf_events' warning being
generated.

When stapbpf output is redirected to a file, there is no I/O delay, and
perf_events are consumed before the buffer overflows.

If my suspicion is true, this could be solved by receiving transport messages
in a separate thread.

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

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

* [Bug bpf/25218] stapbpf loses perf_events when writing to interactive terminal
  2019-11-22 23:13 [Bug bpf/25218] New: stapbpf losing perf_events sapatel at redhat dot com
  2019-11-22 23:16 ` [Bug bpf/25218] " sapatel at redhat dot com
  2019-11-22 23:46 ` [Bug bpf/25218] stapbpf loses perf_events when writing to interactive terminal me at serhei dot io
@ 2019-11-25 18:22 ` me at serhei dot io
  2 siblings, 0 replies; 4+ messages in thread
From: me at serhei dot io @ 2019-11-25 18:22 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=25218

--- Comment #2 from Serhei Makarov <me at serhei dot io> ---
One thing that I should definitely fix, aside from tackling the speed disparity
in console/file output: when perf_events are lost, unpaired PRINTF_{START,END}
messages should not cause a fatal error for stapbpf.

That is, a sequence such as

PRINTF_START PRINTF_END <lost events> PRINTF_END

should cause the PRINTF_END to be dropped along with the lost events.
Currently it causes stapbpf to terminate with an error message.

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

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

end of thread, other threads:[~2019-11-25 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 23:13 [Bug bpf/25218] New: stapbpf losing perf_events sapatel at redhat dot com
2019-11-22 23:16 ` [Bug bpf/25218] " sapatel at redhat dot com
2019-11-22 23:46 ` [Bug bpf/25218] stapbpf loses perf_events when writing to interactive terminal me at serhei dot io
2019-11-25 18:22 ` me at serhei dot io

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