public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values
@ 2018-11-04 17:18 fche at redhat dot com
  2019-03-26 17:09 ` [Bug bpf/23858] " me at serhei dot io
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fche at redhat dot com @ 2018-11-04 17:18 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 23858
           Summary: sorted iteration on bpf arrays can't sort values
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: fche at redhat dot com
  Target Milestone: ---

% stap -e 'global a probe oneshot { a[0]=5; a[3]=3; a[5]=0;
  foreach (b in a+) printf("%d %d\n", b, a[b]) }'
5 0
3 3
0 5

% stap --bpf -e 'global a probe oneshot { a[0]=5; a[3]=3; a[5]=0; 
  foreach (b in a+) printf("%d %d\n", b, a[b]) }'
0 5
3 3
5 0

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

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

* [Bug bpf/23858] sorted iteration on bpf arrays can't sort values
  2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
@ 2019-03-26 17:09 ` me at serhei dot io
  2019-03-26 19:33 ` me at serhei dot io
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-03-26 17:09 UTC (permalink / raw)
  To: systemtap

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

Serhei Makarov <me at serhei dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |me at serhei dot io

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
Also need to check correct value sorting for strings after PR23875.

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

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

* [Bug bpf/23858] sorted iteration on bpf arrays can't sort values
  2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
  2019-03-26 17:09 ` [Bug bpf/23858] " me at serhei dot io
@ 2019-03-26 19:33 ` me at serhei dot io
  2019-03-26 19:34 ` me at serhei dot io
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-03-26 19:33 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from Serhei Makarov <me at serhei dot io> ---
More involved example:

global a
global s

probe oneshot {
  printf("BEGIN")
  a[0]=5; a[3]=3; a[5]=0
  s["avocado"]=5; s["blueberry"]=3; s["caramel apple"]=0
  foreach (b in a+) printf("%d",a[b])
  foreach (b in a-) printf("%d",a[b])
  foreach (k in s+) printf("%d",s[k])
  foreach (k in s-) printf("%d",s[k])
  printf("END\n")
}

BPF and LKM SystemTap sort it in opposite order, but I'm not sure which is
right. See
https://sourceware.org/systemtap/langref/6_Statement_types.html#SECTION00076000000000000000

"If you add a single plus (+) or minus (-) operator after the VAR or the ARRAY
identifier, the iteration order will be sorted by the ascending or descending
index or value."

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

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

* [Bug bpf/23858] sorted iteration on bpf arrays can't sort values
  2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
  2019-03-26 17:09 ` [Bug bpf/23858] " me at serhei dot io
  2019-03-26 19:33 ` me at serhei dot io
@ 2019-03-26 19:34 ` me at serhei dot io
  2019-06-27 15:48 ` me at serhei dot io
  2019-07-12 15:49 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-03-26 19:34 UTC (permalink / raw)
  To: systemtap

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

--- Comment #3 from Serhei Makarov <me at serhei dot io> ---
Sorry, was just confused.

To sort by key, use foreach (b+ in a). That works correctly.
To sort by value, use foreach (b in a+). That needs to be fixed.

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

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

* [Bug bpf/23858] sorted iteration on bpf arrays can't sort values
  2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
                   ` (2 preceding siblings ...)
  2019-03-26 19:34 ` me at serhei dot io
@ 2019-06-27 15:48 ` me at serhei dot io
  2019-07-12 15:49 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-06-27 15:48 UTC (permalink / raw)
  To: systemtap

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

--- Comment #4 from Serhei Makarov <me at serhei dot io> ---
Should also fix statistics aggregate sorting to use s->sort_aggr while I'm at
it.

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

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

* [Bug bpf/23858] sorted iteration on bpf arrays can't sort values
  2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
                   ` (3 preceding siblings ...)
  2019-06-27 15:48 ` me at serhei dot io
@ 2019-07-12 15:49 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-07-12 15:49 UTC (permalink / raw)
  To: systemtap

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

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] 6+ messages in thread

end of thread, other threads:[~2019-07-12 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-04 17:18 [Bug bpf/23858] New: sorted iteration on bpf arrays can't sort values fche at redhat dot com
2019-03-26 17:09 ` [Bug bpf/23858] " me at serhei dot io
2019-03-26 19:33 ` me at serhei dot io
2019-03-26 19:34 ` me at serhei dot io
2019-06-27 15:48 ` me at serhei dot io
2019-07-12 15:49 ` 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).