* [Bug translator/23407] New: bpf: backend should support strings as first class values
@ 2018-07-12 20:01 me at serhei dot io
2018-08-01 18:16 ` [Bug bpf/23407] " me at serhei dot io
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: me at serhei dot io @ 2018-07-12 20:01 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23407
Bug ID: 23407
Summary: bpf: backend should support strings as first class
values
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: me at serhei dot io
Target Milestone: ---
PR created based on https://sourceware.org/ml/systemtap/2018-q3/msg00016.html
It should be possible to store string literals of reasonable size
(BPF_MAXSTRINGLEN=64, matching the 'best practice' of other eBPF tracing tools)
within local variables, associative array elements, and associative array keys,
and to pass them as function arguments.
The tentative plan is to add a new value type STR to struct value in
bpf-internal.h. In addition to doing register allocation, bpf-opt.cxx will also
lower any STR value into a set of instructions that loads the string onto the
eBPF stack (based on existing printf() code) or into memory (if writing to a
global data structure), then returns the string address. Because more than one
string can be written to the stack at once, strings may need to be written
somewhere besides the start of the stack.
Suggested testcase:
global var
global tab1
global tab2
probe begin {
printf("BEGIN\n")
var = "str1"
tab1[0] = "str2"
tab2["key"] = "str3"
}
probe end {
printf("%s\n", "str0")
printf("%s\n", var)
printf("%s\n", tab1[0])
printf("%s\n", tab2["key"])
printf("END\n")
}
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug bpf/23407] bpf: backend should support strings as first class values
2018-07-12 20:01 [Bug translator/23407] New: bpf: backend should support strings as first class values me at serhei dot io
@ 2018-08-01 18:16 ` me at serhei dot io
2018-08-17 15:42 ` me at serhei dot io
2018-08-17 16:50 ` me at serhei dot io
2 siblings, 0 replies; 4+ messages in thread
From: me at serhei dot io @ 2018-08-01 18:16 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23407
Serhei Makarov <me at serhei dot io> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|translator |bpf
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug bpf/23407] bpf: backend should support strings as first class values
2018-07-12 20:01 [Bug translator/23407] New: bpf: backend should support strings as first class values me at serhei dot io
2018-08-01 18:16 ` [Bug bpf/23407] " me at serhei dot io
@ 2018-08-17 15:42 ` me at serhei dot io
2018-08-17 16:50 ` me at serhei dot io
2 siblings, 0 replies; 4+ messages in thread
From: me at serhei dot io @ 2018-08-17 15:42 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23407
--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
The essential implementation has been completed. There is room to make the
register allocator much, much more clever in terms of providing temporary space
to store string literals, freeing it up to make room for other string literals,
and so forth. Currently all string literals in a probe are stored on the stack
throughout the lifetime of the probe.
To pass the string literals to a helper function, they must be zero-padded by
an unrolled pseudo-loop. There are a couple of places (the ones writing
map/global values rather than map keys) where this zero-padding code could be
eliminated if we instead zeroed out a sufficient proportion of the stack before
writing any string literals.
Leaving this PR open until I've come up with a more complex usage example, and
it becomes clear whether the smarter storage allocator ideas are necessary.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug bpf/23407] bpf: backend should support strings as first class values
2018-07-12 20:01 [Bug translator/23407] New: bpf: backend should support strings as first class values me at serhei dot io
2018-08-01 18:16 ` [Bug bpf/23407] " me at serhei dot io
2018-08-17 15:42 ` me at serhei dot io
@ 2018-08-17 16:50 ` me at serhei dot io
2 siblings, 0 replies; 4+ messages in thread
From: me at serhei dot io @ 2018-08-17 16:50 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=23407
Serhei Makarov <me at serhei dot io> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|systemtap at sourceware dot org |me at serhei dot io
--
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:[~2018-08-17 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 20:01 [Bug translator/23407] New: bpf: backend should support strings as first class values me at serhei dot io
2018-08-01 18:16 ` [Bug bpf/23407] " me at serhei dot io
2018-08-17 15:42 ` me at serhei dot io
2018-08-17 16:50 ` 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).